Added xmlSchemaValidateFile() to the public API. This will use SAX2-driven
* xmlschemas.c include/libxml/xmlschemas.h: Added
xmlSchemaValidateFile() to the public API. This will use
SAX2-driven validation.
diff --git a/ChangeLog b/ChangeLog
index 6d11291..74b9896 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Wed Jun 15 14:50:48 CEST 2005 Kasimier Buchcik <libxml2-cvs@cazic.net>
+
+ * xmlschemas.c include/libxml/xmlschemas.h: Added
+ xmlSchemaValidateFile() to the public API. This will use
+ SAX2-driven validation.
+
Wed Jun 15 11:11:38 CEST 2005 Kasimier Buchcik <libxml2-cvs@cazic.net>
* result/schemas/bug306806_1_0 result/schemas/bug306806_1_0.err:
diff --git a/include/libxml/xmlschemas.h b/include/libxml/xmlschemas.h
index 0af2be5..364ed9c 100644
--- a/include/libxml/xmlschemas.h
+++ b/include/libxml/xmlschemas.h
@@ -156,12 +156,16 @@
XMLPUBFUN int XMLCALL
xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt,
xmlNodePtr elem);
-XMLPUBFUN int XMLCALL
+XMLPUBFUN int XMLCALL
xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt,
xmlParserInputBufferPtr input,
xmlCharEncoding enc,
xmlSAXHandlerPtr sax,
void *user_data);
+XMLPUBFUN int XMLCALL
+ xmlSchemaValidateFile (xmlSchemaValidCtxtPtr ctxt,
+ const char * filename,
+ int options);
#ifdef __cplusplus
}
#endif
diff --git a/xmlschemas.c b/xmlschemas.c
index beddcab..719262e 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -67,7 +67,7 @@
#define DUMP_CONTENT_MODEL
-/* #define XML_SCHEMA_SAX_ENABLED */
+#define XML_SCHEMA_SAX_ENABLED
#ifdef LIBXML_READER_ENABLED
/* #define XML_SCHEMA_READER_ENABLED */
@@ -19037,7 +19037,12 @@
* Evaluate the state objects.
*/
while (sto != NULL) {
- xmlStreamPop((xmlStreamCtxtPtr) sto->xpathCtxt);
+ res = xmlStreamPop((xmlStreamCtxtPtr) sto->xpathCtxt);
+ if (res == -1) {
+ VERROR_INT("xmlSchemaXPathProcessHistory",
+ "calling xmlStreamPop()");
+ return (-1);
+ }
#if DEBUG_IDC
xmlGenericError(xmlGenericErrorContext, "IDC: stream pop '%s'\n",
sto->sel->xpath);
@@ -23950,7 +23955,7 @@
TODO return (0);
}
-#if 0
+#ifdef XML_SCHEMA_SAX_ENABLED
/**
* xmlSchemaValidateFile:
* @ctxt: a schema validation context
@@ -23961,7 +23966,8 @@
*/
int
xmlSchemaValidateFile(xmlSchemaValidCtxtPtr ctxt,
- const char * filename)
+ const char * filename,
+ int options ATTRIBUTE_UNUSED)
{
int ret;
@@ -23997,6 +24003,7 @@
*/
ctxt->sax->ignorableWhitespace = xmlSchemaSAXHandleText;
ctxt->sax->characters = xmlSchemaSAXHandleText;
+
ctxt->sax->cdataBlock = xmlSchemaSAXHandleCDataSection;
ctxt->sax->reference = xmlSchemaSAXHandleReference;
ctxt->sax->initialized = XML_SAX2_MAGIC;
@@ -24009,7 +24016,7 @@
/* VAL TODO: Set error handlers. */
ctxt->flags |= XML_SCHEMA_VALID_CTXT_FLAG_STREAM;
- ret = xmlSchemaVStart(ctxt, filename);
+ ret = xmlSchemaVStart(ctxt);
/*
* URGENT VAL TODO: What to do with well-formedness errors?
@@ -24021,7 +24028,7 @@
ret = 1;
xmlSchemaErr((xmlSchemaAbstractCtxtPtr) ctxt, ret, NULL,
"The instance document '%s' is not well-formed",
- filename, NULL);
+ BAD_CAST filename, NULL);
}
ctxt->parserCtxt->sax = NULL;
xmlFreeParserCtxt(ctxt->parserCtxt);
@@ -24030,7 +24037,7 @@
return (ret);
}
-#endif
+#endif /* XML_SCHEMA_SAX_ENABLED */
#ifdef XML_SCHEMA_READER_ENABLED
int