1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-24 13:33:01 +03:00

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.
This commit is contained in:
Kasimier T. Buchcik
2005-06-15 12:54:05 +00:00
parent ef1b6676f6
commit c63fbbff72
3 changed files with 25 additions and 8 deletions

View File

@@ -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> 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: * result/schemas/bug306806_1_0 result/schemas/bug306806_1_0.err:

View File

@@ -156,12 +156,16 @@ XMLPUBFUN int XMLCALL
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt, xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt,
xmlNodePtr elem); xmlNodePtr elem);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt, xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt,
xmlParserInputBufferPtr input, xmlParserInputBufferPtr input,
xmlCharEncoding enc, xmlCharEncoding enc,
xmlSAXHandlerPtr sax, xmlSAXHandlerPtr sax,
void *user_data); void *user_data);
XMLPUBFUN int XMLCALL
xmlSchemaValidateFile (xmlSchemaValidCtxtPtr ctxt,
const char * filename,
int options);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@@ -67,7 +67,7 @@
#define DUMP_CONTENT_MODEL #define DUMP_CONTENT_MODEL
/* #define XML_SCHEMA_SAX_ENABLED */ #define XML_SCHEMA_SAX_ENABLED
#ifdef LIBXML_READER_ENABLED #ifdef LIBXML_READER_ENABLED
/* #define XML_SCHEMA_READER_ENABLED */ /* #define XML_SCHEMA_READER_ENABLED */
@@ -19037,7 +19037,12 @@ xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt,
* Evaluate the state objects. * Evaluate the state objects.
*/ */
while (sto != NULL) { 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 #if DEBUG_IDC
xmlGenericError(xmlGenericErrorContext, "IDC: stream pop '%s'\n", xmlGenericError(xmlGenericErrorContext, "IDC: stream pop '%s'\n",
sto->sel->xpath); sto->sel->xpath);
@@ -23950,7 +23955,7 @@ xmlSchemaValidateStream(xmlSchemaValidCtxtPtr ctxt,
TODO return (0); TODO return (0);
} }
#if 0 #ifdef XML_SCHEMA_SAX_ENABLED
/** /**
* xmlSchemaValidateFile: * xmlSchemaValidateFile:
* @ctxt: a schema validation context * @ctxt: a schema validation context
@@ -23961,7 +23966,8 @@ xmlSchemaValidateStream(xmlSchemaValidCtxtPtr ctxt,
*/ */
int int
xmlSchemaValidateFile(xmlSchemaValidCtxtPtr ctxt, xmlSchemaValidateFile(xmlSchemaValidCtxtPtr ctxt,
const char * filename) const char * filename,
int options ATTRIBUTE_UNUSED)
{ {
int ret; int ret;
@@ -23997,6 +24003,7 @@ xmlSchemaValidateFile(xmlSchemaValidCtxtPtr ctxt,
*/ */
ctxt->sax->ignorableWhitespace = xmlSchemaSAXHandleText; ctxt->sax->ignorableWhitespace = xmlSchemaSAXHandleText;
ctxt->sax->characters = xmlSchemaSAXHandleText; ctxt->sax->characters = xmlSchemaSAXHandleText;
ctxt->sax->cdataBlock = xmlSchemaSAXHandleCDataSection; ctxt->sax->cdataBlock = xmlSchemaSAXHandleCDataSection;
ctxt->sax->reference = xmlSchemaSAXHandleReference; ctxt->sax->reference = xmlSchemaSAXHandleReference;
ctxt->sax->initialized = XML_SAX2_MAGIC; ctxt->sax->initialized = XML_SAX2_MAGIC;
@@ -24009,7 +24016,7 @@ xmlSchemaValidateFile(xmlSchemaValidCtxtPtr ctxt,
/* VAL TODO: Set error handlers. */ /* VAL TODO: Set error handlers. */
ctxt->flags |= XML_SCHEMA_VALID_CTXT_FLAG_STREAM; 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? * URGENT VAL TODO: What to do with well-formedness errors?
@@ -24021,7 +24028,7 @@ xmlSchemaValidateFile(xmlSchemaValidCtxtPtr ctxt,
ret = 1; ret = 1;
xmlSchemaErr((xmlSchemaAbstractCtxtPtr) ctxt, ret, NULL, xmlSchemaErr((xmlSchemaAbstractCtxtPtr) ctxt, ret, NULL,
"The instance document '%s' is not well-formed", "The instance document '%s' is not well-formed",
filename, NULL); BAD_CAST filename, NULL);
} }
ctxt->parserCtxt->sax = NULL; ctxt->parserCtxt->sax = NULL;
xmlFreeParserCtxt(ctxt->parserCtxt); xmlFreeParserCtxt(ctxt->parserCtxt);
@@ -24030,7 +24037,7 @@ xmlSchemaValidateFile(xmlSchemaValidCtxtPtr ctxt,
return (ret); return (ret);
} }
#endif #endif /* XML_SCHEMA_SAX_ENABLED */
#ifdef XML_SCHEMA_READER_ENABLED #ifdef XML_SCHEMA_READER_ENABLED
int int