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_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")) {