Class LibXML::XML::Schema
In: ext/libxml/libxml.c
Parent: Object
   TODO what is this patch doing here?

        xmlSchemaParserCtxtPtr  parser;
        xmlSchemaPtr            sptr;
        xmlSchemaValidCtxtPtr   vptr;

+ int is_invalid;

        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &source) == FAILURE) {
                return;

@@ -598,26 +598,24 @@

                        convert_to_string_ex(&source);
                        parser = xmlSchemaNewParserCtxt(Z_STRVAL_P(source));
                        sptr = xmlSchemaParse(parser);
                        break;
                case SCHEMA_BLOB:
                        convert_to_string_ex(&source);
                        parser = xmlSchemaNewMemParserCtxt(Z_STRVAL_P(source), Z_STRLEN_P(source));
                        sptr = xmlSchemaParse(parser);
                        break;
        }

        vptr = xmlSchemaNewValidCtxt(sptr);

+ is_invalid = xmlSchemaValidateDoc(vptr, (xmlDocPtr) sxe->document->ptr);

        xmlSchemaFree(sptr);
        xmlSchemaFreeValidCtxt(vptr);
        xmlSchemaFreeParserCtxt(parser);
  • if (is_valid) {
  • RETURN_TRUE;
  • } else {

+ if (is_invalid) {

                RETURN_FALSE;

+ } else { + RETURN_TRUE;

        }
 }
  }}}

@@ -695,7 +693,7 @@

 {
        if (!strcmp(method, "xsearch")) {
                simplexml_ce_xpath_search(INTERNAL_FUNCTION_PARAM_PASSTHRU);

-ifdef xmlSchemaParserCtxtPtr +ifdef LIBXML_SCHEMAS_ENABLED

        } else if (!strcmp(method, "validate_schema_file")) {
                simplexml_ce_schema_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, SCHEMA_FILE);
        } else if (!strcmp(method, "validate_schema_buffer")) {

Methods

document   from_string   new  

Public Class methods

Create a new schema from the specified document.

[Source]

/*
 * call-seq:
 *    XML::Schema.document(document) -> schema
 * 
 * Create a new schema from the specified document.
 */
VALUE
ruby_xml_schema_init_from_document(VALUE class, VALUE document) {

Create a new schema using the specified string.

[Source]

/*
 * call-seq:
 *    XML::Schema.string("schema_data") -> "value"
 * 
 * Create a new schema using the specified string.
 */
VALUE
ruby_xml_schema_init_from_string(VALUE self, VALUE schema_str) {

Create a new schema from the specified URI.

[Source]

/*
 * call-seq:
 *    XML::Schema.new(schema_uri) -> schema
 * 
 * Create a new schema from the specified URI.
 */
VALUE
ruby_xml_schema_init_from_uri(VALUE class, VALUE uri) {

[Validate]