diff --git a/ChangeLog b/ChangeLog index 9752ebdd..9a65bb48 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Thu Jul 14 01:03:03 CEST 2005 Daniel Veillard + + * error.c relaxng.c xmlreader.c xmlschemas.c include/libxml/relaxng.h + include/libxml/xmlschemas.h: applied patch from Marcus Boerger + to route relaxng and schemas error messages when using the reader + through the structured interface if activated. + * elfgcchack.h doc/* testapi.c: rebuilt since this add new APIs + to test. + Wed Jul 13 18:35:47 CEST 2005 Daniel Veillard * HTMLparser.c: applied UTF-8 script parsing bug #310229 fix from diff --git a/doc/APIchunk15.html b/doc/APIchunk15.html index 02fc03ad..c60930d8 100644 --- a/doc/APIchunk15.html +++ b/doc/APIchunk15.html @@ -399,9 +399,11 @@ A:link, A:visited, A:active { text-decoration: underline } xmlRelaxNGGetValidErrors
xmlRelaxNGSetParserErrors
xmlRelaxNGSetValidErrors
+xmlRelaxNGSetValidStructuredErrors
xmlSchemaGetValidErrors
xmlSchemaSetParserErrors
xmlSchemaSetValidErrors
+xmlSchemaSetValidStructuredErrors
xmlShellCmd
xmlSwitchEncoding
xmlSwitchInputEncoding
diff --git a/doc/APIchunk24.html b/doc/APIchunk24.html index 2d52d0d2..39466f3b 100644 --- a/doc/APIchunk24.html +++ b/doc/APIchunk24.html @@ -670,7 +670,9 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSchemaNewNOTATIONValue
xmlSchemaNewQNameValue
xmlSchemaNewStringValue
-
structured
xmlSetStructuredErrorFunc
+
structured
xmlRelaxNGSetValidStructuredErrors
+xmlSchemaSetValidStructuredErrors
+xmlSetStructuredErrorFunc
structures
xmlFreeDoc
xmlFreeNs
xmlFreeNsList
diff --git a/doc/APIchunk6.html b/doc/APIchunk6.html index b2179c00..1433661e 100644 --- a/doc/APIchunk6.html +++ b/doc/APIchunk6.html @@ -165,6 +165,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlRelaxNGParse
xmlRelaxNGSetParserErrors
xmlRelaxNGSetValidErrors
+xmlRelaxNGSetValidStructuredErrors
xmlRelaxNGValidateDoc
RelaxNG
xmlRelaxNGCleanupTypes
xmlRelaxNGDump
diff --git a/doc/APIchunk7.html b/doc/APIchunk7.html index 825348dc..b37c70c2 100644 --- a/doc/APIchunk7.html +++ b/doc/APIchunk7.html @@ -158,36 +158,6 @@ A:link, A:visited, A:active { text-decoration: underline }
Semi
xmlRelaxParserSetFlag
Send
xmlNanoFTPQuit
Serialize
xmlAttrSerializeTxtContent
-
Set
htmlHandleOmittedElem
-initGenericErrorDefaultFunc
-setNamespace
-xlinkSetDefaultDetect
-xlinkSetDefaultHandler
-xmlDocSetRootElement
-xmlInitializePredefinedEntities
-xmlKeepBlanksDefault
-xmlLineNumbersDefault
-xmlNodeSetBase
-xmlNodeSetLang
-xmlNodeSetName
-xmlNodeSetSpacePreserve
-xmlPedanticParserDefault
-xmlRelaxNGSetParserErrors
-xmlRelaxNGSetValidErrors
-xmlSAXDefaultVersion
-xmlSaveSetAttrEscape
-xmlSaveSetEscape
-xmlSchemaSetParserErrors
-xmlSchemaSetValidErrors
-xmlSetBufferAllocationScheme
-xmlSetEntityReferenceFunc
-xmlSetNsProp
-xmlSetProp
-xmlSubstituteEntitiesDefault
-xmlTextWriterSetIndent
-xmlTextWriterSetIndentString
-xmlXIncludeSetFlags
-xmlXPtrEvalRangePredicate
Sets
htmlSetMetaEncoding
xmlBufferSetAllocationScheme
xmlSchemaSetValidOptions
diff --git a/doc/APIfiles.html b/doc/APIfiles.html index 94d55f06..97c24b10 100644 --- a/doc/APIfiles.html +++ b/doc/APIfiles.html @@ -941,6 +941,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlRelaxNGPtr
xmlRelaxNGSetParserErrors
xmlRelaxNGSetValidErrors
+xmlRelaxNGSetValidStructuredErrors
xmlRelaxNGValidCtxt
xmlRelaxNGValidCtxtPtr
xmlRelaxNGValidErr
@@ -2700,6 +2701,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSchemaSetParserErrors
xmlSchemaSetValidErrors
xmlSchemaSetValidOptions
+xmlSchemaSetValidStructuredErrors
xmlSchemaValidCtxt
xmlSchemaValidCtxtGetOptions
xmlSchemaValidCtxtPtr
diff --git a/doc/APIfunctions.html b/doc/APIfunctions.html index ce0d0c5b..787a7068 100644 --- a/doc/APIfunctions.html +++ b/doc/APIfunctions.html @@ -792,6 +792,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlRegNewExecCtxt
xmlRelaxNGSetParserErrors
xmlRelaxNGSetValidErrors
+xmlRelaxNGSetValidStructuredErrors
xmlRelaxNGValidityErrorFunc
xmlRelaxNGValidityWarningFunc
xmlSAX2AttributeDecl
@@ -831,6 +832,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSaveToIO
xmlSchemaSetParserErrors
xmlSchemaSetValidErrors
+xmlSchemaSetValidStructuredErrors
xmlSchemaValidateStream
xmlSchemaValidityErrorFunc
xmlSchemaValidityWarningFunc
@@ -1759,6 +1761,7 @@ A:link, A:visited, A:active { text-decoration: underline }

Type xmlRelaxNGValidCtxtPtr:

xmlRelaxNGFreeValidCtxt
xmlRelaxNGGetValidErrors
xmlRelaxNGSetValidErrors
+xmlRelaxNGSetValidStructuredErrors
xmlRelaxNGValidateDoc
xmlRelaxNGValidateFullElement
xmlRelaxNGValidatePopElement
@@ -1860,6 +1863,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSchemaSAXPlug
xmlSchemaSetValidErrors
xmlSchemaSetValidOptions
+xmlSchemaSetValidStructuredErrors
xmlSchemaValidCtxtGetOptions
xmlSchemaValidateDoc
xmlSchemaValidateFile
@@ -1898,7 +1902,9 @@ A:link, A:visited, A:active { text-decoration: underline } xmlStreamPop
xmlStreamPush
xmlStreamPushAttr
-

Type xmlStructuredErrorFunc:

xmlSetStructuredErrorFunc
+

Type xmlStructuredErrorFunc:

xmlRelaxNGSetValidStructuredErrors
+xmlSchemaSetValidStructuredErrors
+xmlSetStructuredErrorFunc
xmlTextReaderSetStructuredErrorHandler
xmlThrDefSetStructuredErrorFunc

Type xmlTextReaderErrorFunc:

xmlTextReaderSetErrorHandler
diff --git a/doc/APIsymbols.html b/doc/APIsymbols.html index 756863f9..e7c1a3e1 100644 --- a/doc/APIsymbols.html +++ b/doc/APIsymbols.html @@ -2455,6 +2455,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlRelaxNGPtr
xmlRelaxNGSetParserErrors
xmlRelaxNGSetValidErrors
+xmlRelaxNGSetValidStructuredErrors
xmlRelaxNGValidCtxt
xmlRelaxNGValidCtxtPtr
xmlRelaxNGValidErr
@@ -2607,6 +2608,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSchemaSetParserErrors
xmlSchemaSetValidErrors
xmlSchemaSetValidOptions
+xmlSchemaSetValidStructuredErrors
xmlSchemaType
xmlSchemaTypeLink
xmlSchemaTypeLinkPtr
diff --git a/doc/html/libxml-relaxng.html b/doc/html/libxml-relaxng.html index 942aac36..637f27f0 100644 --- a/doc/html/libxml-relaxng.html +++ b/doc/html/libxml-relaxng.html @@ -37,6 +37,7 @@ The content of this structure is not made public by the API.

xmlRelaxNGPtr	xmlRelaxNGParse		(xmlRelaxNGParserCtxtPtr ctxt)
void	xmlRelaxNGSetParserErrors	(xmlRelaxNGParserCtxtPtr ctxt, 
xmlRelaxNGValidityErrorFunc err,
xmlRelaxNGValidityWarningFunc warn,
void * ctx)
void	xmlRelaxNGSetValidErrors	(xmlRelaxNGValidCtxtPtr ctxt, 
xmlRelaxNGValidityErrorFunc err,
xmlRelaxNGValidityWarningFunc warn,
void * ctx)
+
void	xmlRelaxNGSetValidStructuredErrors	(xmlRelaxNGValidCtxtPtr ctxt, 
xmlStructuredErrorFunc serror,
void * ctx)
int	xmlRelaxNGValidateDoc		(xmlRelaxNGValidCtxtPtr ctxt, 
xmlDocPtr doc)
int	xmlRelaxNGValidateFullElement	(xmlRelaxNGValidCtxtPtr ctxt, 
xmlDocPtr doc,
xmlNodePtr elem)
int	xmlRelaxNGValidatePopElement	(xmlRelaxNGValidCtxtPtr ctxt, 
xmlDocPtr doc,
xmlNodePtr elem)
@@ -135,7 +136,9 @@ The content of this structure is not made public by the API.

Set the callback functions used to handle errors for a validation context

ctxt:a Relax-NG validation context
err:the error callback
warn:the warning callback
ctx:contextual data for the callbacks

Function: xmlRelaxNGSetValidErrors

void	xmlRelaxNGSetValidErrors	(xmlRelaxNGValidCtxtPtr ctxt, 
xmlRelaxNGValidityErrorFunc err,
xmlRelaxNGValidityWarningFunc warn,
void * ctx)

Set the error and warning callback informations

-
ctxt:a Relax-NG validation context
err:the error function
warn:the warning function
ctx:the functions context

Function: xmlRelaxNGValidateDoc

int	xmlRelaxNGValidateDoc		(xmlRelaxNGValidCtxtPtr ctxt, 
xmlDocPtr doc)
+
ctxt:a Relax-NG validation context
err:the error function
warn:the warning function
ctx:the functions context

Function: xmlRelaxNGSetValidStructuredErrors

void	xmlRelaxNGSetValidStructuredErrors	(xmlRelaxNGValidCtxtPtr ctxt, 
xmlStructuredErrorFunc serror,
void * ctx)
+

Set the structured error callback

+
ctxt:a Relax-NG validation context
serror:the structured error function
ctx:the functions context

Function: xmlRelaxNGValidateDoc

int	xmlRelaxNGValidateDoc		(xmlRelaxNGValidCtxtPtr ctxt, 
xmlDocPtr doc)

Validate a document tree in memory.

ctxt:a Relax-NG validation context
doc:a parsed document tree
Returns:0 if the document is valid, a positive error code number otherwise and -1 in case of internal or API error.

Function: xmlRelaxNGValidateFullElement

int	xmlRelaxNGValidateFullElement	(xmlRelaxNGValidCtxtPtr ctxt, 
xmlDocPtr doc,
xmlNodePtr elem)

Validate a full subtree when xmlRelaxNGValidatePushElement() returned 0 and the content of the node has been expanded.

diff --git a/doc/html/libxml-xmlschemas.html b/doc/html/libxml-xmlschemas.html index 201b09b1..12771717 100644 --- a/doc/html/libxml-xmlschemas.html +++ b/doc/html/libxml-xmlschemas.html @@ -40,6 +40,7 @@ The content of this structure is not made public by the API.
void	xmlSchemaSetParserErrors	(xmlSchemaParserCtxtPtr ctxt, 
xmlSchemaValidityErrorFunc err,
xmlSchemaValidityWarningFunc warn,
void * ctx)
void	xmlSchemaSetValidErrors		(xmlSchemaValidCtxtPtr ctxt, 
xmlSchemaValidityErrorFunc err,
xmlSchemaValidityWarningFunc warn,
void * ctx)
int	xmlSchemaSetValidOptions	(xmlSchemaValidCtxtPtr ctxt, 
int options)
+
void	xmlSchemaSetValidStructuredErrors	(xmlSchemaValidCtxtPtr ctxt, 
xmlStructuredErrorFunc serror,
void * ctx)
int	xmlSchemaValidCtxtGetOptions	(xmlSchemaValidCtxtPtr ctxt)
int	xmlSchemaValidateDoc		(xmlSchemaValidCtxtPtr ctxt, 
xmlDocPtr doc)
int	xmlSchemaValidateFile		(xmlSchemaValidCtxtPtr ctxt, 
const char * filename,
int options)
@@ -145,7 +146,9 @@ The content of this structure is not made public by the API.

Set the error and warning callback informations

ctxt:a schema validation context
err:the error function
warn:the warning function
ctx:the functions context

Function: xmlSchemaSetValidOptions

int	xmlSchemaSetValidOptions	(xmlSchemaValidCtxtPtr ctxt, 
int options)

Sets the options to be used during the validation.

-
ctxt:a schema validation context
options:a combination of xmlSchemaValidOption
Returns:0 in case of success, -1 in case of an API error.

Function: xmlSchemaValidCtxtGetOptions

int	xmlSchemaValidCtxtGetOptions	(xmlSchemaValidCtxtPtr ctxt)
+
ctxt:a schema validation context
options:a combination of xmlSchemaValidOption
Returns:0 in case of success, -1 in case of an API error.

Function: xmlSchemaSetValidStructuredErrors

void	xmlSchemaSetValidStructuredErrors	(xmlSchemaValidCtxtPtr ctxt, 
xmlStructuredErrorFunc serror,
void * ctx)
+

Set the structured error callback

+
ctxt:a schema validation context
serror:the structured error function
ctx:the functions context

Function: xmlSchemaValidCtxtGetOptions

int	xmlSchemaValidCtxtGetOptions	(xmlSchemaValidCtxtPtr ctxt)

Get the validation context options.

ctxt:a schema validation context
Returns:the option combination or -1 on error.

Function: xmlSchemaValidateDoc

int	xmlSchemaValidateDoc		(xmlSchemaValidCtxtPtr ctxt, 
xmlDocPtr doc)

Validate a document tree in memory.

diff --git a/doc/libxml2-api.xml b/doc/libxml2-api.xml index d1006033..07ba179f 100644 --- a/doc/libxml2-api.xml +++ b/doc/libxml2-api.xml @@ -1033,17 +1033,18 @@ - + - + - - + + + @@ -2883,7 +2884,7 @@ - + @@ -2894,6 +2895,7 @@ + @@ -12233,6 +12235,14 @@ actually an xmlCharEncoding'/> + + defined(LIBXML_SCHEMAS_ENABLED) + Set the structured error callback + + + + + defined(LIBXML_SCHEMAS_ENABLED) Validate a document tree in memory. @@ -13038,6 +13048,14 @@ actually an xmlCharEncoding'/> + + defined(LIBXML_SCHEMAS_ENABLED) + Set the structured error callback + + + + + defined(LIBXML_SCHEMAS_ENABLED) Check that a value conforms to the lexical space of the predefined type. if true a value is computed and returned in @val. diff --git a/doc/libxml2-refs.xml b/doc/libxml2-refs.xml index 52dc7161..6fea832f 100644 --- a/doc/libxml2-refs.xml +++ b/doc/libxml2-refs.xml @@ -2449,6 +2449,7 @@ + @@ -2601,6 +2602,7 @@ + @@ -5848,6 +5850,7 @@ + @@ -6000,6 +6003,7 @@ + @@ -8340,6 +8344,7 @@ + @@ -8379,6 +8384,7 @@ + @@ -9515,6 +9521,7 @@ + @@ -9654,6 +9661,7 @@ + @@ -9716,6 +9724,8 @@ + + @@ -11034,6 +11044,7 @@ + @@ -12827,6 +12838,7 @@ + @@ -16472,6 +16484,7 @@ + @@ -16761,38 +16774,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -21902,9 +21883,11 @@ + + @@ -27409,6 +27392,8 @@ + + diff --git a/elfgcchack.h b/elfgcchack.h index e2584c0e..cc503748 100644 --- a/elfgcchack.h +++ b/elfgcchack.h @@ -8132,6 +8132,18 @@ extern __typeof (xmlRelaxNGSetValidErrors) xmlRelaxNGSetValidErrors__internal_al #endif #endif +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_relaxng +#undef xmlRelaxNGSetValidStructuredErrors +extern __typeof (xmlRelaxNGSetValidStructuredErrors) xmlRelaxNGSetValidStructuredErrors __attribute((alias("xmlRelaxNGSetValidStructuredErrors__internal_alias"))); +#else +#ifndef xmlRelaxNGSetValidStructuredErrors +extern __typeof (xmlRelaxNGSetValidStructuredErrors) xmlRelaxNGSetValidStructuredErrors__internal_alias __attribute((visibility("hidden"))); +#define xmlRelaxNGSetValidStructuredErrors xmlRelaxNGSetValidStructuredErrors__internal_alias +#endif +#endif +#endif + #if defined(LIBXML_SCHEMAS_ENABLED) #ifdef bottom_relaxng #undef xmlRelaxNGValidateDoc @@ -9238,6 +9250,18 @@ extern __typeof (xmlSchemaIsBuiltInTypeFacet) xmlSchemaIsBuiltInTypeFacet__inter #endif #endif +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaIsValid +extern __typeof (xmlSchemaIsValid) xmlSchemaIsValid __attribute((alias("xmlSchemaIsValid__internal_alias"))); +#else +#ifndef xmlSchemaIsValid +extern __typeof (xmlSchemaIsValid) xmlSchemaIsValid__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaIsValid xmlSchemaIsValid__internal_alias +#endif +#endif +#endif + #if defined(LIBXML_SCHEMAS_ENABLED) #ifdef bottom_xmlschemas #undef xmlSchemaNewDocParserCtxt @@ -9346,6 +9370,30 @@ extern __typeof (xmlSchemaParse) xmlSchemaParse__internal_alias __attribute((vis #endif #endif +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaSAXPlug +extern __typeof (xmlSchemaSAXPlug) xmlSchemaSAXPlug __attribute((alias("xmlSchemaSAXPlug__internal_alias"))); +#else +#ifndef xmlSchemaSAXPlug +extern __typeof (xmlSchemaSAXPlug) xmlSchemaSAXPlug__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaSAXPlug xmlSchemaSAXPlug__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaSAXUnplug +extern __typeof (xmlSchemaSAXUnplug) xmlSchemaSAXUnplug __attribute((alias("xmlSchemaSAXUnplug__internal_alias"))); +#else +#ifndef xmlSchemaSAXUnplug +extern __typeof (xmlSchemaSAXUnplug) xmlSchemaSAXUnplug__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaSAXUnplug xmlSchemaSAXUnplug__internal_alias +#endif +#endif +#endif + #if defined(LIBXML_SCHEMAS_ENABLED) #ifdef bottom_xmlschemas #undef xmlSchemaSetParserErrors @@ -9382,6 +9430,18 @@ extern __typeof (xmlSchemaSetValidOptions) xmlSchemaSetValidOptions__internal_al #endif #endif +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaSetValidStructuredErrors +extern __typeof (xmlSchemaSetValidStructuredErrors) xmlSchemaSetValidStructuredErrors __attribute((alias("xmlSchemaSetValidStructuredErrors__internal_alias"))); +#else +#ifndef xmlSchemaSetValidStructuredErrors +extern __typeof (xmlSchemaSetValidStructuredErrors) xmlSchemaSetValidStructuredErrors__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaSetValidStructuredErrors xmlSchemaSetValidStructuredErrors__internal_alias +#endif +#endif +#endif + #if defined(LIBXML_SCHEMAS_ENABLED) #ifdef bottom_xmlschemastypes #undef xmlSchemaValPredefTypeNode @@ -9998,7 +10058,6 @@ extern __typeof (xmlSprintfElementContent) xmlSprintfElementContent__internal_al #endif #endif -#if defined(LIBXML_PUSH_ENABLED) #ifdef bottom_parser #undef xmlStopParser extern __typeof (xmlStopParser) xmlStopParser __attribute((alias("xmlStopParser__internal_alias"))); @@ -10008,7 +10067,6 @@ extern __typeof (xmlStopParser) xmlStopParser__internal_alias __attribute((visib #define xmlStopParser xmlStopParser__internal_alias #endif #endif -#endif #ifdef bottom_xmlstring #undef xmlStrEqual @@ -11056,6 +11114,18 @@ extern __typeof (xmlTextReaderRelaxNGValidate) xmlTextReaderRelaxNGValidate__int #endif #endif +#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderSchemaValidate +extern __typeof (xmlTextReaderSchemaValidate) xmlTextReaderSchemaValidate __attribute((alias("xmlTextReaderSchemaValidate__internal_alias"))); +#else +#ifndef xmlTextReaderSchemaValidate +extern __typeof (xmlTextReaderSchemaValidate) xmlTextReaderSchemaValidate__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderSchemaValidate xmlTextReaderSchemaValidate__internal_alias +#endif +#endif +#endif + #if defined(LIBXML_READER_ENABLED) #ifdef bottom_xmlreader #undef xmlTextReaderSetErrorHandler @@ -11080,6 +11150,18 @@ extern __typeof (xmlTextReaderSetParserProp) xmlTextReaderSetParserProp__interna #endif #endif +#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderSetSchema +extern __typeof (xmlTextReaderSetSchema) xmlTextReaderSetSchema __attribute((alias("xmlTextReaderSetSchema__internal_alias"))); +#else +#ifndef xmlTextReaderSetSchema +extern __typeof (xmlTextReaderSetSchema) xmlTextReaderSetSchema__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderSetSchema xmlTextReaderSetSchema__internal_alias +#endif +#endif +#endif + #if defined(LIBXML_READER_ENABLED) #ifdef bottom_xmlreader #undef xmlTextReaderSetStructuredErrorHandler @@ -14484,7 +14566,7 @@ extern __typeof (xmlValidateElementDecl) xmlValidateElementDecl__internal_alias #endif #endif -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) #ifdef bottom_tree #undef xmlValidateNCName extern __typeof (xmlValidateNCName) xmlValidateNCName __attribute((alias("xmlValidateNCName__internal_alias"))); diff --git a/error.c b/error.c index 17ced922..b0d0f147 100644 --- a/error.c +++ b/error.c @@ -595,8 +595,10 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel, schannel = xmlStructuredError; else channel = xmlGenericError; + if (!data) { data = xmlGenericErrorContext; } + } if (schannel != NULL) { schannel(data, to); return; diff --git a/include/libxml/relaxng.h b/include/libxml/relaxng.h index ca3c13ba..cd753982 100644 --- a/include/libxml/relaxng.h +++ b/include/libxml/relaxng.h @@ -152,6 +152,9 @@ XMLPUBFUN int XMLCALL xmlRelaxNGValidityErrorFunc *err, xmlRelaxNGValidityWarningFunc *warn, void **ctx); +XMLPUBFUN void XMLCALL + xmlRelaxNGSetValidStructuredErrors(xmlRelaxNGValidCtxtPtr ctxt, + xmlStructuredErrorFunc serror, void *ctx); XMLPUBFUN xmlRelaxNGValidCtxtPtr XMLCALL xmlRelaxNGNewValidCtxt (xmlRelaxNGPtr schema); XMLPUBFUN void XMLCALL diff --git a/include/libxml/xmlschemas.h b/include/libxml/xmlschemas.h index 6cecffdc..89fc4b4c 100644 --- a/include/libxml/xmlschemas.h +++ b/include/libxml/xmlschemas.h @@ -138,6 +138,9 @@ XMLPUBFUN void XMLCALL xmlSchemaValidityErrorFunc err, xmlSchemaValidityWarningFunc warn, void *ctx); +XMLPUBFUN void XMLCALL + xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt, + xmlStructuredErrorFunc serror, void *ctx); XMLPUBFUN int XMLCALL xmlSchemaGetValidErrors (xmlSchemaValidCtxtPtr ctxt, xmlSchemaValidityErrorFunc *err, diff --git a/relaxng.c b/relaxng.c index b1d4a771..61daa0d1 100644 --- a/relaxng.c +++ b/relaxng.c @@ -10662,6 +10662,26 @@ xmlRelaxNGSetValidErrors(xmlRelaxNGValidCtxtPtr ctxt, ctxt->userData = ctx; } +/** + * xmlRelaxNGSetValidStructuredErrors: + * @ctxt: a Relax-NG validation context + * @serror: the structured error function + * @ctx: the functions context + * + * Set the structured error callback + */ +void +xmlRelaxNGSetValidStructuredErrors(xmlRelaxNGValidCtxtPtr ctxt, + xmlStructuredErrorFunc serror, void *ctx) +{ + if (ctxt == NULL) + return; + ctxt->serror = serror; + ctxt->error = NULL; + ctxt->warning = NULL; + ctxt->userData = ctx; +} + /** * xmlRelaxNGGetValidErrors: * @ctxt: a Relax-NG validation context diff --git a/testapi.c b/testapi.c index 9e7969bb..e44e9bec 100644 --- a/testapi.c +++ b/testapi.c @@ -17336,6 +17336,16 @@ test_xmlRelaxNGSetValidErrors(void) { } +static int +test_xmlRelaxNGSetValidStructuredErrors(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + static int test_xmlRelaxNGValidateDoc(void) { int test_ret = 0; @@ -17613,7 +17623,7 @@ static int test_relaxng(void) { int test_ret = 0; - if (quiet == 0) printf("Testing relaxng : 14 of 22 functions ...\n"); + if (quiet == 0) printf("Testing relaxng : 14 of 23 functions ...\n"); test_ret += test_xmlRelaxNGDump(); test_ret += test_xmlRelaxNGDumpTree(); test_ret += test_xmlRelaxNGGetParserErrors(); @@ -17626,6 +17636,7 @@ test_relaxng(void) { test_ret += test_xmlRelaxNGParse(); test_ret += test_xmlRelaxNGSetParserErrors(); test_ret += test_xmlRelaxNGSetValidErrors(); + test_ret += test_xmlRelaxNGSetValidStructuredErrors(); test_ret += test_xmlRelaxNGValidateDoc(); test_ret += test_xmlRelaxNGValidateFullElement(); test_ret += test_xmlRelaxNGValidatePopElement(); @@ -32808,6 +32819,16 @@ test_xmlSchemaSetValidOptions(void) { } +static int +test_xmlSchemaSetValidStructuredErrors(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + static int test_xmlSchemaValidCtxtGetOptions(void) { int test_ret = 0; @@ -33037,7 +33058,7 @@ static int test_xmlschemas(void) { int test_ret = 0; - if (quiet == 0) printf("Testing xmlschemas : 14 of 22 functions ...\n"); + if (quiet == 0) printf("Testing xmlschemas : 14 of 23 functions ...\n"); test_ret += test_xmlSchemaDump(); test_ret += test_xmlSchemaGetParserErrors(); test_ret += test_xmlSchemaGetValidErrors(); @@ -33052,6 +33073,7 @@ test_xmlschemas(void) { test_ret += test_xmlSchemaSetParserErrors(); test_ret += test_xmlSchemaSetValidErrors(); test_ret += test_xmlSchemaSetValidOptions(); + test_ret += test_xmlSchemaSetValidStructuredErrors(); test_ret += test_xmlSchemaValidCtxtGetOptions(); test_ret += test_xmlSchemaValidateDoc(); test_ret += test_xmlSchemaValidateFile(); diff --git a/win32/libxml2.def.src b/win32/libxml2.def.src index a0eb5457..e9f79590 100644 --- a/win32/libxml2.def.src +++ b/win32/libxml2.def.src @@ -1430,6 +1430,9 @@ xmlRelaxNGSetParserErrors xmlRelaxNGSetValidErrors #endif #ifdef LIBXML_SCHEMAS_ENABLED +xmlRelaxNGSetValidStructuredErrors +#endif +#ifdef LIBXML_SCHEMAS_ENABLED xmlRelaxNGValidateDoc #endif #ifdef LIBXML_SCHEMAS_ENABLED @@ -1586,6 +1589,9 @@ xmlSchemaInitTypes xmlSchemaIsBuiltInTypeFacet #endif #ifdef LIBXML_SCHEMAS_ENABLED +xmlSchemaIsValid +#endif +#ifdef LIBXML_SCHEMAS_ENABLED xmlSchemaNewDocParserCtxt #endif #ifdef LIBXML_SCHEMAS_ENABLED @@ -1613,6 +1619,12 @@ xmlSchemaNewValidCtxt xmlSchemaParse #endif #ifdef LIBXML_SCHEMAS_ENABLED +xmlSchemaSAXPlug +#endif +#ifdef LIBXML_SCHEMAS_ENABLED +xmlSchemaSAXUnplug +#endif +#ifdef LIBXML_SCHEMAS_ENABLED xmlSchemaSetParserErrors #endif #ifdef LIBXML_SCHEMAS_ENABLED @@ -1622,6 +1634,9 @@ xmlSchemaSetValidErrors xmlSchemaSetValidOptions #endif #ifdef LIBXML_SCHEMAS_ENABLED +xmlSchemaSetValidStructuredErrors +#endif +#ifdef LIBXML_SCHEMAS_ENABLED xmlSchemaValPredefTypeNode #endif #ifdef LIBXML_SCHEMAS_ENABLED @@ -1836,8 +1851,10 @@ xmlTextReaderRelaxNGSetSchema #ifdef LIBXML_SCHEMAS_ENABLED xmlTextReaderRelaxNGValidate #endif +xmlTextReaderSchemaValidate xmlTextReaderSetErrorHandler xmlTextReaderSetParserProp +xmlTextReaderSetSchema xmlTextReaderSetStructuredErrorHandler xmlTextReaderStandalone xmlTextReaderValue diff --git a/xmlreader.c b/xmlreader.c index 14843eb8..e8858a15 100644 --- a/xmlreader.c +++ b/xmlreader.c @@ -3880,6 +3880,66 @@ xmlTextReaderCurrentDoc(xmlTextReaderPtr reader) { } #ifdef LIBXML_SCHEMAS_ENABLED + +static char * +xmlTextReaderBuildMessage(const char *msg, va_list ap); + +static void +xmlTextReaderValidityError(void *ctxt, const char *msg, ...); + +static void +xmlTextReaderValidityWarning(void *ctxt, const char *msg, ...); + +static void xmlTextReaderValidityErrorRelay(void *ctx, const char *msg, ...) +{ + xmlTextReaderPtr reader = (xmlTextReaderPtr) ctx; + char * str; + va_list ap; + + va_start(ap,msg); + str = xmlTextReaderBuildMessage(msg,ap); + if (!reader->errorFunc) { + xmlTextReaderValidityError(ctx, "%s", str); + } else { + reader->errorFunc(reader->errorFuncArg, str, XML_PARSER_SEVERITY_VALIDITY_ERROR, NULL /* locator */); + } + if (str != NULL) + xmlFree(str); + va_end(ap); +} + +static void xmlTextReaderValidityWarningRelay(void *ctx, const char *msg, ...) +{ + xmlTextReaderPtr reader = (xmlTextReaderPtr) ctx; + char * str; + va_list ap; + + va_start(ap,msg); + str = xmlTextReaderBuildMessage(msg,ap); + if (!reader->errorFunc) { + xmlTextReaderValidityWarning(ctx, "%s", str); + } else { + reader->errorFunc(reader->errorFuncArg, str, XML_PARSER_SEVERITY_VALIDITY_WARNING, NULL /* locator */); + } + if (str != NULL) + xmlFree(str); + va_end(ap); +} + +static void +xmlTextReaderStructuredError(void *ctxt, xmlErrorPtr error); + +static void xmlTextReaderValidityStructuredRelay(void * userData, xmlErrorPtr error) +{ + xmlTextReaderPtr reader = (xmlTextReaderPtr) userData; + + if (reader->sErrorFunc) { + reader->sErrorFunc(reader->errorFuncArg, error); + } else { + xmlTextReaderStructuredError(reader, error); + } +} + /** * xmlTextReaderRelaxNGSetSchema: * @reader: the xmlTextReaderPtr used @@ -3924,9 +3984,14 @@ xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader, xmlRelaxNGPtr schema) { return(-1); if (reader->errorFunc != NULL) { xmlRelaxNGSetValidErrors(reader->rngValidCtxt, - (xmlRelaxNGValidityErrorFunc)reader->errorFunc, - (xmlRelaxNGValidityWarningFunc) reader->errorFunc, - reader->errorFuncArg); + xmlTextReaderValidityErrorRelay, + xmlTextReaderValidityWarningRelay, + reader); + } + if (reader->sErrorFunc != NULL) { + xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, + xmlTextReaderValidityStructuredRelay, + reader); } reader->rngValidErrors = 0; reader->rngFullNode = NULL; @@ -3999,9 +4064,14 @@ xmlTextReaderSetSchema(xmlTextReaderPtr reader, xmlSchemaPtr schema) { } if (reader->errorFunc != NULL) { xmlSchemaSetValidErrors(reader->xsdValidCtxt, - (xmlSchemaValidityErrorFunc)reader->errorFunc, - (xmlSchemaValidityWarningFunc) reader->errorFunc, - reader->errorFuncArg); + xmlTextReaderValidityErrorRelay, + xmlTextReaderValidityWarningRelay, + reader); + } + if (reader->sErrorFunc != NULL) { + xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, + xmlTextReaderValidityStructuredRelay, + reader); } reader->xsdValidErrors = 0; reader->validate = XML_TEXTREADER_VALIDATE_XSD; @@ -4051,9 +4121,14 @@ xmlTextReaderRelaxNGValidate(xmlTextReaderPtr reader, const char *rng) { ctxt = xmlRelaxNGNewParserCtxt(rng); if (reader->errorFunc != NULL) { xmlRelaxNGSetParserErrors(ctxt, - (xmlRelaxNGValidityErrorFunc) reader->errorFunc, - (xmlRelaxNGValidityWarningFunc) reader->errorFunc, - reader->errorFuncArg); + xmlTextReaderValidityErrorRelay, + xmlTextReaderValidityWarningRelay, + reader); + } + if (reader->sErrorFunc != NULL) { + xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, + xmlTextReaderValidityStructuredRelay, + reader); } reader->rngSchemas = xmlRelaxNGParse(ctxt); xmlRelaxNGFreeParserCtxt(ctxt); @@ -4067,9 +4142,14 @@ xmlTextReaderRelaxNGValidate(xmlTextReaderPtr reader, const char *rng) { } if (reader->errorFunc != NULL) { xmlRelaxNGSetValidErrors(reader->rngValidCtxt, - (xmlRelaxNGValidityErrorFunc)reader->errorFunc, - (xmlRelaxNGValidityWarningFunc) reader->errorFunc, - reader->errorFuncArg); + xmlTextReaderValidityErrorRelay, + xmlTextReaderValidityWarningRelay, + reader); + } + if (reader->sErrorFunc != NULL) { + xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, + xmlTextReaderValidityStructuredRelay, + reader); } reader->rngValidErrors = 0; reader->rngFullNode = NULL; @@ -4129,9 +4209,9 @@ xmlTextReaderSchemaValidate(xmlTextReaderPtr reader, const char *xsd) { ctxt = xmlSchemaNewParserCtxt(xsd); if (reader->errorFunc != NULL) { xmlSchemaSetParserErrors(ctxt, - (xmlSchemaValidityErrorFunc) reader->errorFunc, - (xmlSchemaValidityWarningFunc) reader->errorFunc, - reader->errorFuncArg); + xmlTextReaderValidityErrorRelay, + xmlTextReaderValidityWarningRelay, + reader); } reader->xsdSchemas = xmlSchemaParse(ctxt); xmlSchemaFreeParserCtxt(ctxt); @@ -4155,9 +4235,14 @@ xmlTextReaderSchemaValidate(xmlTextReaderPtr reader, const char *xsd) { } if (reader->errorFunc != NULL) { xmlSchemaSetValidErrors(reader->xsdValidCtxt, - (xmlSchemaValidityErrorFunc)reader->errorFunc, - (xmlSchemaValidityWarningFunc) reader->errorFunc, - reader->errorFuncArg); + xmlTextReaderValidityErrorRelay, + xmlTextReaderValidityWarningRelay, + reader); + } + if (reader->sErrorFunc != NULL) { + xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, + xmlTextReaderValidityStructuredRelay, + reader); } reader->xsdValidErrors = 0; reader->validate = XML_TEXTREADER_VALIDATE_XSD; @@ -4467,6 +4552,22 @@ xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader, reader->errorFunc = f; reader->sErrorFunc = NULL; reader->errorFuncArg = arg; +#ifdef LIBXML_SCHEMAS_ENABLED + if (reader->rngValidCtxt) { + xmlRelaxNGSetValidErrors(reader->rngValidCtxt, + xmlTextReaderValidityErrorRelay, + xmlTextReaderValidityWarningRelay, + reader); + xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, NULL, reader); + } + if (reader->xsdValidCtxt) { + xmlSchemaSetValidErrors(reader->xsdValidCtxt, + xmlTextReaderValidityErrorRelay, + xmlTextReaderValidityWarningRelay, + reader); + xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, NULL, reader); + } +#endif } else { /* restore defaults */ @@ -4477,6 +4578,16 @@ xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader, reader->errorFunc = NULL; reader->sErrorFunc = NULL; reader->errorFuncArg = NULL; +#ifdef LIBXML_SCHEMAS_ENABLED + if (reader->rngValidCtxt) { + xmlRelaxNGSetValidErrors(reader->rngValidCtxt, NULL, NULL, reader); + xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, NULL, reader); + } + if (reader->xsdValidCtxt) { + xmlSchemaSetValidErrors(reader->xsdValidCtxt, NULL, NULL, reader); + xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, NULL, reader); + } +#endif } } @@ -4503,6 +4614,20 @@ xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader, reader->sErrorFunc = f; reader->errorFunc = NULL; reader->errorFuncArg = arg; +#ifdef LIBXML_SCHEMAS_ENABLED + if (reader->rngValidCtxt) { + xmlRelaxNGSetValidErrors(reader->rngValidCtxt, NULL, NULL, reader); + xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, + xmlTextReaderValidityStructuredRelay, + reader); + } + if (reader->xsdValidCtxt) { + xmlSchemaSetValidErrors(reader->xsdValidCtxt, NULL, NULL, reader); + xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, + xmlTextReaderValidityStructuredRelay, + reader); + } +#endif } else { /* restore defaults */ @@ -4514,6 +4639,16 @@ xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader, reader->errorFunc = NULL; reader->sErrorFunc = NULL; reader->errorFuncArg = NULL; +#ifdef LIBXML_SCHEMAS_ENABLED + if (reader->rngValidCtxt) { + xmlRelaxNGSetValidErrors(reader->rngValidCtxt, NULL, NULL, reader); + xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, NULL, reader); + } + if (reader->xsdValidCtxt) { + xmlSchemaSetValidErrors(reader->xsdValidCtxt, NULL, NULL, reader); + xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, NULL, reader); + } +#endif } } diff --git a/xmlschemas.c b/xmlschemas.c index afa70105..4411f39f 100644 --- a/xmlschemas.c +++ b/xmlschemas.c @@ -23647,6 +23647,26 @@ xmlSchemaSetValidErrors(xmlSchemaValidCtxtPtr ctxt, xmlSchemaSetParserErrors(ctxt->pctxt, err, warn, ctx); } +/** + * xmlSchemaSetValidStructuredErrors: + * @ctxt: a schema validation context + * @serror: the structured error function + * @ctx: the functions context + * + * Set the structured error callback + */ +void +xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt, + xmlStructuredErrorFunc serror, void *ctx) +{ + if (ctxt == NULL) + return; + ctxt->serror = serror; + ctxt->error = NULL; + ctxt->warning = NULL; + ctxt->userData = ctx; +} + /** * xmlSchemaGetValidErrors: * @ctxt: a XML-Schema validation context