Commit c63fbbff authored by Kasimier T. Buchcik's avatar Kasimier T. Buchcik

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.
parent ef1b6676
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:
......
......@@ -156,12 +156,16 @@ XMLPUBFUN int XMLCALL
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
......
......@@ -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 @@ xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt,
* 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 @@ xmlSchemaValidateStream(xmlSchemaValidCtxtPtr ctxt,
TODO return (0);
}
#if 0
#ifdef XML_SCHEMA_SAX_ENABLED
/**
* xmlSchemaValidateFile:
* @ctxt: a schema validation context
......@@ -23961,7 +23966,8 @@ xmlSchemaValidateStream(xmlSchemaValidCtxtPtr ctxt,
*/
int
xmlSchemaValidateFile(xmlSchemaValidCtxtPtr ctxt,
const char * filename)
const char * filename,
int options ATTRIBUTE_UNUSED)
{
int ret;
......@@ -23997,6 +24003,7 @@ xmlSchemaValidateFile(xmlSchemaValidCtxtPtr ctxt,
*/
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 @@ xmlSchemaValidateFile(xmlSchemaValidCtxtPtr ctxt,
/* 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 @@ xmlSchemaValidateFile(xmlSchemaValidCtxtPtr ctxt,
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 @@ xmlSchemaValidateFile(xmlSchemaValidCtxtPtr ctxt,
return (ret);
}
#endif
#endif /* XML_SCHEMA_SAX_ENABLED */
#ifdef XML_SCHEMA_READER_ENABLED
int
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment