mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-19 14:50:07 +03:00
build: Add separate configuration option for RELAX NG
Support for RELAX NG used to be enabled together with XML Schema support (--with-schemas). Now there's a separate option and a new feature macro LIBXML_RELAXNG_ENABLED.
This commit is contained in:
parent
ce1b704e33
commit
e50d314a27
@ -61,7 +61,10 @@ cmake_dependent_option(
|
||||
LIBXML2_WITH_READER "Add the xmlReader parsing interface" ON
|
||||
"LIBXML2_WITH_PUSH" OFF)
|
||||
cmake_dependent_option(
|
||||
LIBXML2_WITH_SCHEMAS "Add Relax-NG and Schemas support" ON
|
||||
LIBXML2_WITH_RELAXNG "Add Relax-NG support" ON
|
||||
"LIBXML2_WITH_REGEXPS;LIBXML2_WITH_SCHEMAS" OFF)
|
||||
cmake_dependent_option(
|
||||
LIBXML2_WITH_SCHEMAS "Add XML Schemas 1.0 support" ON
|
||||
"LIBXML2_WITH_PATTERN;LIBXML2_WITH_REGEXPS" OFF)
|
||||
cmake_dependent_option(
|
||||
LIBXML2_WITH_SCHEMATRON "Add Schematron support" ON
|
||||
@ -83,7 +86,7 @@ if(LIBXML2_WITH_PYTHON)
|
||||
CACHE PATH "Python bindings install directory")
|
||||
endif()
|
||||
|
||||
foreach(VARIABLE IN ITEMS WITH_C14N WITH_CATALOG WITH_DEBUG WITH_HTML WITH_HTTP WITH_ICONV WITH_ICU WITH_ISO8859X WITH_LEGACY WITH_LZMA WITH_MODULES WITH_OUTPUT WITH_PATTERN WITH_PUSH WITH_READER WITH_REGEXPS WITH_SAX1 WITH_SCHEMAS WITH_SCHEMATRON WITH_THREADS WITH_THREAD_ALLOC WITH_VALID WITH_WRITER WITH_XINCLUDE WITH_XPATH WITH_XPTR WITH_ZLIB)
|
||||
foreach(VARIABLE IN ITEMS WITH_C14N WITH_CATALOG WITH_DEBUG WITH_HTML WITH_HTTP WITH_ICONV WITH_ICU WITH_ISO8859X WITH_LEGACY WITH_LZMA WITH_MODULES WITH_OUTPUT WITH_PATTERN WITH_PUSH WITH_READER WITH_REGEXPS WITH_RELAXNG WITH_SAX1 WITH_SCHEMAS WITH_SCHEMATRON WITH_THREADS WITH_THREAD_ALLOC WITH_VALID WITH_WRITER WITH_XINCLUDE WITH_XPATH WITH_XPTR WITH_ZLIB)
|
||||
if(LIBXML2_${VARIABLE})
|
||||
set(${VARIABLE} 1)
|
||||
else()
|
||||
@ -277,8 +280,11 @@ endif()
|
||||
if(LIBXML2_WITH_REGEXPS)
|
||||
list(APPEND LIBXML2_SRCS xmlregexp.c xmlunicode.c)
|
||||
endif()
|
||||
if(LIBXML2_WITH_RELAXNG)
|
||||
list(APPEND LIBXML2_SRCS relaxng.c)
|
||||
endif()
|
||||
if(LIBXML2_WITH_SCHEMAS)
|
||||
list(APPEND LIBXML2_SRCS relaxng.c xmlschemas.c xmlschemastypes.c)
|
||||
list(APPEND LIBXML2_SRCS xmlschemas.c xmlschemastypes.c)
|
||||
endif()
|
||||
if(LIBXML2_WITH_SCHEMATRON)
|
||||
list(APPEND LIBXML2_SRCS schematron.c)
|
||||
|
@ -89,8 +89,11 @@ endif
|
||||
if WITH_REGEXPS_SOURCES
|
||||
libxml2_la_SOURCES += xmlregexp.c xmlunicode.c
|
||||
endif
|
||||
if WITH_RELAXNG_SOURCES
|
||||
libxml2_la_SOURCES += relaxng.c
|
||||
endif
|
||||
if WITH_SCHEMAS_SOURCES
|
||||
libxml2_la_SOURCES += relaxng.c xmlschemas.c xmlschemastypes.c
|
||||
libxml2_la_SOURCES += xmlschemas.c xmlschemastypes.c
|
||||
endif
|
||||
if WITH_SCHEMATRON_SOURCES
|
||||
libxml2_la_SOURCES += schematron.c
|
||||
|
@ -63,8 +63,9 @@ The following options disable or enable code modules and relevant symbols:
|
||||
--with-python Python bindings (on)
|
||||
--with-reader xmlReader parsing interface (on)
|
||||
--with-regexps regular expressions support (on)
|
||||
--with-relaxng RELAX NG support (on)
|
||||
--with-sax1 older SAX1 interface (on)
|
||||
--with-schemas XML Schemas 1.0 and RELAX NG support (on)
|
||||
--with-schemas XML Schemas 1.0 support (on)
|
||||
--with-schematron Schematron support (on)
|
||||
--with-threads multithreading support (on)
|
||||
--with-thread-alloc per-thread malloc hooks (off)
|
||||
|
30
configure.ac
30
configure.ac
@ -100,10 +100,12 @@ AC_ARG_WITH(reader,
|
||||
[ --with-reader xmlReader parsing interface (on)])
|
||||
AC_ARG_WITH(regexps,
|
||||
[ --with-regexps regular expressions support (on)])
|
||||
AC_ARG_WITH(relaxng,
|
||||
[ --with-relaxng RELAX NG support (on)])
|
||||
AC_ARG_WITH(sax1,
|
||||
[ --with-sax1 older SAX1 interface (on)])
|
||||
AC_ARG_WITH(schemas,
|
||||
[ --with-schemas XML Schemas 1.0 and RELAX NG support (on)])
|
||||
[ --with-schemas XML Schemas 1.0 support (on)])
|
||||
AC_ARG_WITH(schematron,
|
||||
[ --with-schematron Schematron support (on)])
|
||||
AC_ARG_WITH(threads,
|
||||
@ -159,6 +161,16 @@ if test "$with_c14n" = "yes"; then
|
||||
fi
|
||||
with_xpath=yes
|
||||
fi
|
||||
if test "$with_relaxng" = "yes"; then
|
||||
if test "$with_regexps" = "no"; then
|
||||
echo WARNING: --with-relaxng overrides --without-regexps
|
||||
fi
|
||||
with_regexps=yes
|
||||
if test "$with_schemas" = "no"; then
|
||||
echo WARNING: --with-relaxng overrides --without-schemas
|
||||
fi
|
||||
with_schemas=yes
|
||||
fi
|
||||
if test "$with_schemas" = "yes"; then
|
||||
if test "$with_pattern" = "no"; then
|
||||
echo WARNING: --with-schemas overrides --without-pattern
|
||||
@ -232,6 +244,7 @@ if test "$with_minimum" = "yes"; then
|
||||
test "$with_reader" = "" && with_reader=no
|
||||
test "$with_readline" = "" && with_readline=no
|
||||
test "$with_regexps" = "" && with_regexps=no
|
||||
test "$with_relaxng" = "" && with_relaxng=no
|
||||
test "$with_sax1" = "" && with_sax1=no
|
||||
test "$with_schemas" = "" && with_schemas=no
|
||||
test "$with_schematron" = "" && with_schematron=no
|
||||
@ -261,8 +274,12 @@ else
|
||||
with_writer=no
|
||||
fi
|
||||
if test "$with_regexps" = "no"; then
|
||||
with_relaxng=no
|
||||
with_schemas=no
|
||||
fi
|
||||
if test "$with_schemas" = "no"; then
|
||||
with_relaxng=no
|
||||
fi
|
||||
if test "$with_xpath" = "no"; then
|
||||
with_c14n=no
|
||||
with_schematron=no
|
||||
@ -577,8 +594,17 @@ else
|
||||
fi
|
||||
AC_SUBST(WITH_ISO8859X)
|
||||
|
||||
if test "$with_relaxng" = "no" ; then
|
||||
echo "Disabling Relax-NG support"
|
||||
WITH_RELAXNG=0
|
||||
else
|
||||
WITH_RELAXNG=1
|
||||
fi
|
||||
AC_SUBST(WITH_RELAXNG)
|
||||
AM_CONDITIONAL(WITH_RELAXNG_SOURCES, test "$WITH_RELAXNG" = "1")
|
||||
|
||||
if test "$with_schemas" = "no" ; then
|
||||
echo "Disabling Schemas/Relax-NG support"
|
||||
echo "Disabling Schemas support"
|
||||
WITH_SCHEMAS=0
|
||||
else
|
||||
WITH_SCHEMAS=1
|
||||
|
@ -615,6 +615,7 @@
|
||||
<exports symbol='XML_WITH_PUSH' type='enum'/>
|
||||
<exports symbol='XML_WITH_READER' type='enum'/>
|
||||
<exports symbol='XML_WITH_REGEXP' type='enum'/>
|
||||
<exports symbol='XML_WITH_RELAXNG' type='enum'/>
|
||||
<exports symbol='XML_WITH_SAX1' type='enum'/>
|
||||
<exports symbol='XML_WITH_SCHEMAS' type='enum'/>
|
||||
<exports symbol='XML_WITH_SCHEMATRON' type='enum'/>
|
||||
@ -5659,6 +5660,7 @@ crash if you try to modify the tree)'/>
|
||||
<enum name='XML_WITH_PUSH' file='parser' value='4' type='xmlFeature'/>
|
||||
<enum name='XML_WITH_READER' file='parser' value='5' type='xmlFeature'/>
|
||||
<enum name='XML_WITH_REGEXP' file='parser' value='22' type='xmlFeature'/>
|
||||
<enum name='XML_WITH_RELAXNG' file='parser' value='34' type='xmlFeature' info='since 2.14.0'/>
|
||||
<enum name='XML_WITH_SAX1' file='parser' value='8' type='xmlFeature'/>
|
||||
<enum name='XML_WITH_SCHEMAS' file='parser' value='25' type='xmlFeature'/>
|
||||
<enum name='XML_WITH_SCHEMATRON' file='parser' value='26' type='xmlFeature'/>
|
||||
@ -12270,44 +12272,44 @@ crash if you try to modify the tree)'/>
|
||||
<arg name='closeFunc' type='xmlOutputCloseCallback' info='the xmlOutputCloseCallback'/>
|
||||
</function>
|
||||
<function name='xmlRelaxNGCleanupTypes' file='relaxng' module='relaxng'>
|
||||
<cond>defined(LIBXML_SCHEMAS_ENABLED)</cond>
|
||||
<cond>defined(LIBXML_RELAXNG_ENABLED)</cond>
|
||||
<info>DEPRECATED: This function will be made private. Call xmlCleanupParser to free global state but see the warnings there. xmlCleanupParser should be only called once at program exit. In most cases, you don't have call cleanup functions at all. Cleanup the default Schemas type library associated to RelaxNG</info>
|
||||
<return type='void'/>
|
||||
</function>
|
||||
<function name='xmlRelaxNGDump' file='relaxng' module='relaxng'>
|
||||
<cond>defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)</cond>
|
||||
<cond>defined(LIBXML_RELAXNG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)</cond>
|
||||
<info>Dump a RelaxNG structure back</info>
|
||||
<return type='void'/>
|
||||
<arg name='output' type='FILE *' info='the file output'/>
|
||||
<arg name='schema' type='xmlRelaxNGPtr' info='a schema structure'/>
|
||||
</function>
|
||||
<function name='xmlRelaxNGDumpTree' file='relaxng' module='relaxng'>
|
||||
<cond>defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)</cond>
|
||||
<cond>defined(LIBXML_RELAXNG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)</cond>
|
||||
<info>Dump the transformed RelaxNG tree.</info>
|
||||
<return type='void'/>
|
||||
<arg name='output' type='FILE *' info='the file output'/>
|
||||
<arg name='schema' type='xmlRelaxNGPtr' info='a schema structure'/>
|
||||
</function>
|
||||
<function name='xmlRelaxNGFree' file='relaxng' module='relaxng'>
|
||||
<cond>defined(LIBXML_SCHEMAS_ENABLED)</cond>
|
||||
<cond>defined(LIBXML_RELAXNG_ENABLED)</cond>
|
||||
<info>Deallocate a RelaxNG structure.</info>
|
||||
<return type='void'/>
|
||||
<arg name='schema' type='xmlRelaxNGPtr' info='a schema structure'/>
|
||||
</function>
|
||||
<function name='xmlRelaxNGFreeParserCtxt' file='relaxng' module='relaxng'>
|
||||
<cond>defined(LIBXML_SCHEMAS_ENABLED)</cond>
|
||||
<cond>defined(LIBXML_RELAXNG_ENABLED)</cond>
|
||||
<info>Free the resources associated to the schema parser context</info>
|
||||
<return type='void'/>
|
||||
<arg name='ctxt' type='xmlRelaxNGParserCtxtPtr' info='the schema parser context'/>
|
||||
</function>
|
||||
<function name='xmlRelaxNGFreeValidCtxt' file='relaxng' module='relaxng'>
|
||||
<cond>defined(LIBXML_SCHEMAS_ENABLED)</cond>
|
||||
<cond>defined(LIBXML_RELAXNG_ENABLED)</cond>
|
||||
<info>Free the resources associated to the schema validation context</info>
|
||||
<return type='void'/>
|
||||
<arg name='ctxt' type='xmlRelaxNGValidCtxtPtr' info='the schema validation context'/>
|
||||
</function>
|
||||
<function name='xmlRelaxNGGetParserErrors' file='relaxng' module='relaxng'>
|
||||
<cond>defined(LIBXML_SCHEMAS_ENABLED)</cond>
|
||||
<cond>defined(LIBXML_RELAXNG_ENABLED)</cond>
|
||||
<info>Get the callback information used to handle errors for a validation context</info>
|
||||
<return type='int' info='-1 in case of failure, 0 otherwise.'/>
|
||||
<arg name='ctxt' type='xmlRelaxNGParserCtxtPtr' info='a Relax-NG validation context'/>
|
||||
@ -12316,7 +12318,7 @@ crash if you try to modify the tree)'/>
|
||||
<arg name='ctx' type='void **' info='contextual data for the callbacks result'/>
|
||||
</function>
|
||||
<function name='xmlRelaxNGGetValidErrors' file='relaxng' module='relaxng'>
|
||||
<cond>defined(LIBXML_SCHEMAS_ENABLED)</cond>
|
||||
<cond>defined(LIBXML_RELAXNG_ENABLED)</cond>
|
||||
<info>Get the error and warning callback information</info>
|
||||
<return type='int' info='-1 in case of error and 0 otherwise'/>
|
||||
<arg name='ctxt' type='xmlRelaxNGValidCtxtPtr' info='a Relax-NG validation context'/>
|
||||
@ -12325,43 +12327,43 @@ crash if you try to modify the tree)'/>
|
||||
<arg name='ctx' type='void **' info='the functions context result'/>
|
||||
</function>
|
||||
<function name='xmlRelaxNGInitTypes' file='relaxng' module='relaxng'>
|
||||
<cond>defined(LIBXML_SCHEMAS_ENABLED)</cond>
|
||||
<cond>defined(LIBXML_RELAXNG_ENABLED)</cond>
|
||||
<info>Initialize the default type libraries.</info>
|
||||
<return type='int' info='0 in case of success and -1 in case of error.'/>
|
||||
</function>
|
||||
<function name='xmlRelaxNGNewDocParserCtxt' file='relaxng' module='relaxng'>
|
||||
<cond>defined(LIBXML_SCHEMAS_ENABLED)</cond>
|
||||
<cond>defined(LIBXML_RELAXNG_ENABLED)</cond>
|
||||
<info>Create an XML RelaxNGs parser context for that document. Note: since the process of compiling a RelaxNG schemas modifies the document, the @doc parameter is duplicated internally.</info>
|
||||
<return type='xmlRelaxNGParserCtxtPtr' info='the parser context or NULL in case of error'/>
|
||||
<arg name='doc' type='xmlDocPtr' info='a preparsed document tree'/>
|
||||
</function>
|
||||
<function name='xmlRelaxNGNewMemParserCtxt' file='relaxng' module='relaxng'>
|
||||
<cond>defined(LIBXML_SCHEMAS_ENABLED)</cond>
|
||||
<cond>defined(LIBXML_RELAXNG_ENABLED)</cond>
|
||||
<info>Create an XML RelaxNGs parse context for that memory buffer expected to contain an XML RelaxNGs file.</info>
|
||||
<return type='xmlRelaxNGParserCtxtPtr' info='the parser context or NULL in case of error'/>
|
||||
<arg name='buffer' type='const char *' info='a pointer to a char array containing the schemas'/>
|
||||
<arg name='size' type='int' info='the size of the array'/>
|
||||
</function>
|
||||
<function name='xmlRelaxNGNewParserCtxt' file='relaxng' module='relaxng'>
|
||||
<cond>defined(LIBXML_SCHEMAS_ENABLED)</cond>
|
||||
<cond>defined(LIBXML_RELAXNG_ENABLED)</cond>
|
||||
<info>Create an XML RelaxNGs parse context for that file/resource expected to contain an XML RelaxNGs file.</info>
|
||||
<return type='xmlRelaxNGParserCtxtPtr' info='the parser context or NULL in case of error'/>
|
||||
<arg name='URL' type='const char *' info='the location of the schema'/>
|
||||
</function>
|
||||
<function name='xmlRelaxNGNewValidCtxt' file='relaxng' module='relaxng'>
|
||||
<cond>defined(LIBXML_SCHEMAS_ENABLED)</cond>
|
||||
<cond>defined(LIBXML_RELAXNG_ENABLED)</cond>
|
||||
<info>Create an XML RelaxNGs validation context based on the given schema</info>
|
||||
<return type='xmlRelaxNGValidCtxtPtr' info='the validation context or NULL in case of error'/>
|
||||
<arg name='schema' type='xmlRelaxNGPtr' info='a precompiled XML RelaxNGs'/>
|
||||
</function>
|
||||
<function name='xmlRelaxNGParse' file='relaxng' module='relaxng'>
|
||||
<cond>defined(LIBXML_SCHEMAS_ENABLED)</cond>
|
||||
<cond>defined(LIBXML_RELAXNG_ENABLED)</cond>
|
||||
<info>parse a schema definition resource and build an internal XML Schema structure which can be used to validate instances.</info>
|
||||
<return type='xmlRelaxNGPtr' info='the internal XML RelaxNG structure built from the resource or NULL in case of error'/>
|
||||
<arg name='ctxt' type='xmlRelaxNGParserCtxtPtr' info='a Relax-NG parser context'/>
|
||||
</function>
|
||||
<function name='xmlRelaxNGSetParserErrors' file='relaxng' module='relaxng'>
|
||||
<cond>defined(LIBXML_SCHEMAS_ENABLED)</cond>
|
||||
<cond>defined(LIBXML_RELAXNG_ENABLED)</cond>
|
||||
<info>DEPRECATED: Use xmlRelaxNGSetParserStructuredErrors. Set the callback functions used to handle errors for a validation context</info>
|
||||
<return type='void'/>
|
||||
<arg name='ctxt' type='xmlRelaxNGParserCtxtPtr' info='a Relax-NG validation context'/>
|
||||
@ -12370,7 +12372,7 @@ crash if you try to modify the tree)'/>
|
||||
<arg name='ctx' type='void *' info='contextual data for the callbacks'/>
|
||||
</function>
|
||||
<function name='xmlRelaxNGSetParserStructuredErrors' file='relaxng' module='relaxng'>
|
||||
<cond>defined(LIBXML_SCHEMAS_ENABLED)</cond>
|
||||
<cond>defined(LIBXML_RELAXNG_ENABLED)</cond>
|
||||
<info>Set the callback functions used to handle errors for a parsing context</info>
|
||||
<return type='void'/>
|
||||
<arg name='ctxt' type='xmlRelaxNGParserCtxtPtr' info='a Relax-NG parser context'/>
|
||||
@ -12378,7 +12380,7 @@ crash if you try to modify the tree)'/>
|
||||
<arg name='ctx' type='void *' info='contextual data for the callbacks'/>
|
||||
</function>
|
||||
<function name='xmlRelaxNGSetResourceLoader' file='relaxng' module='relaxng'>
|
||||
<cond>defined(LIBXML_SCHEMAS_ENABLED)</cond>
|
||||
<cond>defined(LIBXML_RELAXNG_ENABLED)</cond>
|
||||
<info>Set the callback function used to load external resources.</info>
|
||||
<return type='void'/>
|
||||
<arg name='ctxt' type='xmlRelaxNGParserCtxtPtr' info='a Relax-NG parser context'/>
|
||||
@ -12386,7 +12388,7 @@ crash if you try to modify the tree)'/>
|
||||
<arg name='vctxt' type='void *' info='contextual data for the callbacks'/>
|
||||
</function>
|
||||
<function name='xmlRelaxNGSetValidErrors' file='relaxng' module='relaxng'>
|
||||
<cond>defined(LIBXML_SCHEMAS_ENABLED)</cond>
|
||||
<cond>defined(LIBXML_RELAXNG_ENABLED)</cond>
|
||||
<info>DEPRECATED: Use xmlRelaxNGSetValidStructuredErrors. Set the error and warning callback information</info>
|
||||
<return type='void'/>
|
||||
<arg name='ctxt' type='xmlRelaxNGValidCtxtPtr' info='a Relax-NG validation context'/>
|
||||
@ -12395,7 +12397,7 @@ crash if you try to modify the tree)'/>
|
||||
<arg name='ctx' type='void *' info='the functions context'/>
|
||||
</function>
|
||||
<function name='xmlRelaxNGSetValidStructuredErrors' file='relaxng' module='relaxng'>
|
||||
<cond>defined(LIBXML_SCHEMAS_ENABLED)</cond>
|
||||
<cond>defined(LIBXML_RELAXNG_ENABLED)</cond>
|
||||
<info>Set the structured error callback</info>
|
||||
<return type='void'/>
|
||||
<arg name='ctxt' type='xmlRelaxNGValidCtxtPtr' info='a Relax-NG validation context'/>
|
||||
@ -12403,14 +12405,14 @@ crash if you try to modify the tree)'/>
|
||||
<arg name='ctx' type='void *' info='the functions context'/>
|
||||
</function>
|
||||
<function name='xmlRelaxNGValidateDoc' file='relaxng' module='relaxng'>
|
||||
<cond>defined(LIBXML_SCHEMAS_ENABLED)</cond>
|
||||
<cond>defined(LIBXML_RELAXNG_ENABLED)</cond>
|
||||
<info>Validate a document tree in memory.</info>
|
||||
<return type='int' info='0 if the document is valid, a positive error code number otherwise and -1 in case of internal or API error.'/>
|
||||
<arg name='ctxt' type='xmlRelaxNGValidCtxtPtr' info='a Relax-NG validation context'/>
|
||||
<arg name='doc' type='xmlDocPtr' info='a parsed document tree'/>
|
||||
</function>
|
||||
<function name='xmlRelaxNGValidateFullElement' file='relaxng' module='relaxng'>
|
||||
<cond>defined(LIBXML_SCHEMAS_ENABLED)</cond>
|
||||
<cond>defined(LIBXML_RELAXNG_ENABLED)</cond>
|
||||
<info>Validate a full subtree when xmlRelaxNGValidatePushElement() returned 0 and the content of the node has been expanded.</info>
|
||||
<return type='int' info='1 if no validation problem was found or -1 in case of error.'/>
|
||||
<arg name='ctxt' type='xmlRelaxNGValidCtxtPtr' info='the validation context'/>
|
||||
@ -12418,7 +12420,7 @@ crash if you try to modify the tree)'/>
|
||||
<arg name='elem' type='xmlNodePtr' info='an element instance'/>
|
||||
</function>
|
||||
<function name='xmlRelaxNGValidatePopElement' file='relaxng' module='relaxng'>
|
||||
<cond>defined(LIBXML_SCHEMAS_ENABLED)</cond>
|
||||
<cond>defined(LIBXML_RELAXNG_ENABLED)</cond>
|
||||
<info>Pop the element end from the RelaxNG validation stack.</info>
|
||||
<return type='int' info='1 if no validation problem was found or 0 otherwise'/>
|
||||
<arg name='ctxt' type='xmlRelaxNGValidCtxtPtr' info='the RelaxNG validation context'/>
|
||||
@ -12426,7 +12428,7 @@ crash if you try to modify the tree)'/>
|
||||
<arg name='elem' type='xmlNodePtr' info='an element instance'/>
|
||||
</function>
|
||||
<function name='xmlRelaxNGValidatePushCData' file='relaxng' module='relaxng'>
|
||||
<cond>defined(LIBXML_SCHEMAS_ENABLED)</cond>
|
||||
<cond>defined(LIBXML_RELAXNG_ENABLED)</cond>
|
||||
<info>check the CData parsed for validation in the current stack</info>
|
||||
<return type='int' info='1 if no validation problem was found or -1 otherwise'/>
|
||||
<arg name='ctxt' type='xmlRelaxNGValidCtxtPtr' info='the RelaxNG validation context'/>
|
||||
@ -12434,7 +12436,7 @@ crash if you try to modify the tree)'/>
|
||||
<arg name='len' type='int' info='the length of the data'/>
|
||||
</function>
|
||||
<function name='xmlRelaxNGValidatePushElement' file='relaxng' module='relaxng'>
|
||||
<cond>defined(LIBXML_SCHEMAS_ENABLED)</cond>
|
||||
<cond>defined(LIBXML_RELAXNG_ENABLED)</cond>
|
||||
<info>Push a new element start on the RelaxNG validation stack.</info>
|
||||
<return type='int' info='1 if no validation problem was found or 0 if validating the element requires a full node, and -1 in case of error.'/>
|
||||
<arg name='ctxt' type='xmlRelaxNGValidCtxtPtr' info='the validation context'/>
|
||||
@ -12442,7 +12444,7 @@ crash if you try to modify the tree)'/>
|
||||
<arg name='elem' type='xmlNodePtr' info='an element instance'/>
|
||||
</function>
|
||||
<functype name='xmlRelaxNGValidityErrorFunc' file='relaxng' module='relaxng'>
|
||||
<cond>defined(LIBXML_SCHEMAS_ENABLED)</cond>
|
||||
<cond>defined(LIBXML_RELAXNG_ENABLED)</cond>
|
||||
<info>Signature of an error callback from a Relax-NG validation</info>
|
||||
<return type='void'/>
|
||||
<arg name='ctx' type='void *' info='the validation context'/>
|
||||
@ -12450,7 +12452,7 @@ crash if you try to modify the tree)'/>
|
||||
<arg name='...' type='...' info='extra arguments'/>
|
||||
</functype>
|
||||
<functype name='xmlRelaxNGValidityWarningFunc' file='relaxng' module='relaxng'>
|
||||
<cond>defined(LIBXML_SCHEMAS_ENABLED)</cond>
|
||||
<cond>defined(LIBXML_RELAXNG_ENABLED)</cond>
|
||||
<info>Signature of a warning callback from a Relax-NG validation</info>
|
||||
<return type='void'/>
|
||||
<arg name='ctx' type='void *' info='the validation context'/>
|
||||
@ -12458,7 +12460,7 @@ crash if you try to modify the tree)'/>
|
||||
<arg name='...' type='...' info='extra arguments'/>
|
||||
</functype>
|
||||
<function name='xmlRelaxParserSetFlag' file='relaxng' module='relaxng'>
|
||||
<cond>defined(LIBXML_SCHEMAS_ENABLED)</cond>
|
||||
<cond>defined(LIBXML_RELAXNG_ENABLED)</cond>
|
||||
<info>Semi private function used to pass information to a parser context which are a combination of xmlRelaxNGParserFlag .</info>
|
||||
<return type='int' info='0 if success and -1 in case of error'/>
|
||||
<arg name='ctxt' type='xmlRelaxNGParserCtxtPtr' info='a RelaxNG parser context'/>
|
||||
@ -14277,21 +14279,21 @@ crash if you try to modify the tree)'/>
|
||||
<arg name='reader' type='xmlTextReaderPtr' info='the xmlTextReaderPtr used'/>
|
||||
</function>
|
||||
<function name='xmlTextReaderRelaxNGSetSchema' file='xmlreader' module='xmlreader'>
|
||||
<cond>defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)</cond>
|
||||
<cond>defined(LIBXML_READER_ENABLED) && defined(LIBXML_RELAXNG_ENABLED)</cond>
|
||||
<info>Use RelaxNG to validate the document as it is processed. Activation is only possible before the first Read(). if @schema is NULL, then RelaxNG validation is deactivated. @ The @schema should not be freed until the reader is deallocated or its use has been deactivated.</info>
|
||||
<return type='int' info='0 in case the RelaxNG validation could be (de)activated and -1 in case of error.'/>
|
||||
<arg name='reader' type='xmlTextReaderPtr' info='the xmlTextReaderPtr used'/>
|
||||
<arg name='schema' type='xmlRelaxNGPtr' info='a precompiled RelaxNG schema'/>
|
||||
</function>
|
||||
<function name='xmlTextReaderRelaxNGValidate' file='xmlreader' module='xmlreader'>
|
||||
<cond>defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)</cond>
|
||||
<cond>defined(LIBXML_READER_ENABLED) && defined(LIBXML_RELAXNG_ENABLED)</cond>
|
||||
<info>Use RelaxNG schema to validate the document as it is processed. Activation is only possible before the first Read(). If @rng is NULL, then RelaxNG schema validation is deactivated.</info>
|
||||
<return type='int' info='0 in case the schemas validation could be (de)activated and -1 in case of error.'/>
|
||||
<arg name='reader' type='xmlTextReaderPtr' info='the xmlTextReaderPtr used'/>
|
||||
<arg name='rng' type='const char *' info='the path to a RelaxNG schema or NULL'/>
|
||||
</function>
|
||||
<function name='xmlTextReaderRelaxNGValidateCtxt' file='xmlreader' module='xmlreader'>
|
||||
<cond>defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)</cond>
|
||||
<cond>defined(LIBXML_READER_ENABLED) && defined(LIBXML_RELAXNG_ENABLED)</cond>
|
||||
<info>Use RelaxNG schema context to validate the document as it is processed. Activation is only possible before the first Read(). If @ctxt is NULL, then RelaxNG schema validation is deactivated.</info>
|
||||
<return type='int' info='0 in case the schemas validation could be (de)activated and -1 in case of error.'/>
|
||||
<arg name='reader' type='xmlTextReaderPtr' info='the xmlTextReaderPtr used'/>
|
||||
|
@ -21,6 +21,7 @@ xmlversion_h.set10('WITH_PATTERN', want_pattern)
|
||||
xmlversion_h.set10('WITH_PUSH', want_push)
|
||||
xmlversion_h.set10('WITH_READER', want_reader)
|
||||
xmlversion_h.set10('WITH_REGEXPS', want_regexps)
|
||||
xmlversion_h.set10('WITH_RELAXNG', want_relaxng)
|
||||
xmlversion_h.set10('WITH_SAX1', want_sax1)
|
||||
xmlversion_h.set10('WITH_SCHEMAS', want_schemas)
|
||||
xmlversion_h.set10('WITH_SCHEMATRON', want_schematron)
|
||||
|
@ -1613,6 +1613,7 @@ typedef enum {
|
||||
XML_WITH_ZLIB = 31,
|
||||
XML_WITH_ICU = 32,
|
||||
XML_WITH_LZMA = 33,
|
||||
XML_WITH_RELAXNG = 34, /* since 2.14.0 */
|
||||
XML_WITH_NONE = 99999 /* just to be sure of allocation size */
|
||||
} xmlFeature;
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/parser.h>
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -219,6 +219,6 @@ XMLPUBFUN int
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_SCHEMAS_ENABLED */
|
||||
#endif /* LIBXML_RELAXNG_ENABLED */
|
||||
|
||||
#endif /* __XML_RELAX_NG__ */
|
||||
|
@ -14,8 +14,10 @@
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/xmlerror.h>
|
||||
#include <libxml/xmlIO.h>
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
#include <libxml/relaxng.h>
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#include <libxml/xmlschemas.h>
|
||||
#endif
|
||||
#include <libxml/parser.h>
|
||||
@ -287,7 +289,7 @@ XMLPUBFUN int
|
||||
xmlTextReaderNextSibling (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderIsValid (xmlTextReaderPtr reader);
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderRelaxNGValidate(xmlTextReaderPtr reader,
|
||||
const char *rng);
|
||||
@ -299,6 +301,8 @@ XMLPUBFUN int
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader,
|
||||
xmlRelaxNGPtr schema);
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
XMLPUBFUN int
|
||||
xmlTextReaderSchemaValidate (xmlTextReaderPtr reader,
|
||||
const char *xsd);
|
||||
|
@ -269,6 +269,15 @@
|
||||
#define LIBXML_AUTOMATA_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_RELAXNG_ENABLED:
|
||||
*
|
||||
* Whether the RelaxNG validation interfaces are compiled in
|
||||
*/
|
||||
#if @WITH_RELAXNG@
|
||||
#define LIBXML_RELAXNG_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_SCHEMAS_ENABLED:
|
||||
*
|
||||
|
14
meson.build
14
meson.build
@ -151,6 +151,7 @@ want_pattern = not want_minimum \
|
||||
|
||||
feature = get_option('regexps')
|
||||
want_regexps = not want_minimum \
|
||||
or get_option('relaxng').enabled() \
|
||||
or get_option('schemas').enabled() ? \
|
||||
feature.allowed() : feature.enabled()
|
||||
|
||||
@ -187,7 +188,14 @@ want_reader = want_minimum ? feature.enabled() : feature.allowed()
|
||||
feature = get_option('schemas') \
|
||||
.require(want_pattern, error_message: 'schemas requires pattern') \
|
||||
.require(want_regexps, error_message: 'schemas requires regexps')
|
||||
want_schemas = want_minimum ? feature.enabled() : feature.allowed()
|
||||
want_schemas = not want_minimum \
|
||||
or get_option('relaxng') ? \
|
||||
feature.allowed() : feature.enabled()
|
||||
|
||||
feature = get_option('relaxng') \
|
||||
.require(want_regexps, error_message: 'relaxng requires regexps') \
|
||||
.require(want_schemas, error_message: 'relaxng requires schemas')
|
||||
want_relaxng = want_minimum ? feature.enabled() : feature.allowed()
|
||||
|
||||
feature = get_option('schematron') \
|
||||
.require(want_pattern, error_message: 'schematron requires pattern') \
|
||||
@ -451,7 +459,8 @@ xml_opt_src = [
|
||||
[want_pattern, ['pattern.c']],
|
||||
[want_reader, ['xmlreader.c']],
|
||||
[want_regexps, ['xmlregexp.c', 'xmlunicode.c']],
|
||||
[want_schemas, ['relaxng.c', 'xmlschemas.c', 'xmlschemastypes.c']],
|
||||
[want_relaxng, ['relaxng.c']],
|
||||
[want_schemas, ['xmlschemas.c', 'xmlschemastypes.c']],
|
||||
[want_schematron, ['schematron.c']],
|
||||
[want_writer, ['xmlwriter.c']],
|
||||
[want_xinclude, ['xinclude.c']],
|
||||
@ -616,6 +625,7 @@ summary(
|
||||
'reader': want_reader,
|
||||
'readline': want_readline,
|
||||
'regexps': want_regexps,
|
||||
'relaxng': want_relaxng,
|
||||
'sax1': want_sax1,
|
||||
'schemas': want_schemas,
|
||||
'schematron': want_schematron,
|
||||
|
@ -132,6 +132,11 @@ option('regexps',
|
||||
description: 'Regular expressions support'
|
||||
)
|
||||
|
||||
option('relaxng',
|
||||
type: 'feature',
|
||||
description: 'RELAX NG support'
|
||||
)
|
||||
|
||||
option('sax1',
|
||||
type: 'feature',
|
||||
description: 'Older SAX1 interface'
|
||||
@ -139,7 +144,7 @@ option('sax1',
|
||||
|
||||
option('schemas',
|
||||
type: 'feature',
|
||||
description: 'XML Schemas 1.0 and RELAX NG support'
|
||||
description: 'XML Schemas 1.0 support'
|
||||
)
|
||||
|
||||
option('schematron',
|
||||
|
6
parser.c
6
parser.c
@ -657,6 +657,12 @@ xmlHasFeature(xmlFeature feature)
|
||||
return(1);
|
||||
#else
|
||||
return(0);
|
||||
#endif
|
||||
case XML_WITH_RELAXNG:
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
return(1);
|
||||
#else
|
||||
return(0);
|
||||
#endif
|
||||
case XML_WITH_SCHEMAS:
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
|
@ -2876,14 +2876,13 @@ libxml_addLocalCatalog(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
|
||||
}
|
||||
#endif /* LIBXML_CATALOG_ENABLED */
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* RelaxNG error handler registration *
|
||||
* *
|
||||
************************************************************************/
|
||||
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
typedef struct
|
||||
{
|
||||
PyObject *warn;
|
||||
@ -3035,7 +3034,9 @@ libxml_xmlRelaxNGFreeValidCtxt(ATTRIBUTE_UNUSED PyObject *self, PyObject *args)
|
||||
Py_INCREF(Py_None);
|
||||
return(Py_None);
|
||||
}
|
||||
#endif /* LIBXML_RELAXNG_ENABLED */
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
typedef struct
|
||||
{
|
||||
PyObject *warn;
|
||||
@ -3188,8 +3189,7 @@ libxml_xmlSchemaFreeValidCtxt(ATTRIBUTE_UNUSED PyObject * self, PyObject * args)
|
||||
Py_INCREF(Py_None);
|
||||
return(Py_None);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* LIBXML_SCHEMAS_ENABLED */
|
||||
|
||||
#ifdef LIBXML_C14N_ENABLED
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
@ -3594,9 +3594,11 @@ static PyMethodDef libxmlMethods[] = {
|
||||
#ifdef LIBXML_CATALOG_ENABLED
|
||||
{(char *)"addLocalCatalog", libxml_addLocalCatalog, METH_VARARGS, NULL },
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
{(char *)"xmlRelaxNGSetValidErrors", libxml_xmlRelaxNGSetValidErrors, METH_VARARGS, NULL},
|
||||
{(char *)"xmlRelaxNGFreeValidCtxt", libxml_xmlRelaxNGFreeValidCtxt, METH_VARARGS, NULL},
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
{(char *)"xmlSchemaSetValidErrors", libxml_xmlSchemaSetValidErrors, METH_VARARGS, NULL},
|
||||
{(char *)"xmlSchemaFreeValidCtxt", libxml_xmlSchemaFreeValidCtxt, METH_VARARGS, NULL},
|
||||
#endif
|
||||
|
@ -19,8 +19,10 @@
|
||||
#include <libxml/xmlreader.h>
|
||||
#include <libxml/globals.h>
|
||||
#include <libxml/xmlsave.h>
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
#include <libxml/relaxng.h>
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#include <libxml/xmlschemas.h>
|
||||
#endif
|
||||
|
||||
@ -204,7 +206,7 @@ void libxml_PyFileRelease(FILE *f);
|
||||
#define PyFile_Release(f)
|
||||
#endif
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
xmlRelaxNGPtr obj;
|
||||
@ -229,6 +231,9 @@ typedef struct {
|
||||
#define PyrelaxNgValidCtxt_Get(v) (((v) == Py_None) ? NULL : \
|
||||
(((PyrelaxNgValidCtxt_Object *)(v))->obj))
|
||||
|
||||
#endif /* LIBXML_RELAXNG_ENABLED */
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
xmlSchemaPtr obj;
|
||||
@ -292,10 +297,12 @@ PyObject * libxml_xmlTextReaderPtrWrap(xmlTextReaderPtr reader);
|
||||
PyObject * libxml_xmlTextReaderLocatorPtrWrap(xmlTextReaderLocatorPtr locator);
|
||||
#endif
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
PyObject * libxml_xmlRelaxNGPtrWrap(xmlRelaxNGPtr ctxt);
|
||||
PyObject * libxml_xmlRelaxNGParserCtxtPtrWrap(xmlRelaxNGParserCtxtPtr ctxt);
|
||||
PyObject * libxml_xmlRelaxNGValidCtxtPtrWrap(xmlRelaxNGValidCtxtPtr valid);
|
||||
#endif /* LIBXML_RELAXNG_ENABLED */
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
PyObject * libxml_xmlSchemaPtrWrap(xmlSchemaPtr ctxt);
|
||||
PyObject * libxml_xmlSchemaParserCtxtPtrWrap(xmlSchemaParserCtxtPtr ctxt);
|
||||
PyObject * libxml_xmlSchemaValidCtxtPtrWrap(xmlSchemaValidCtxtPtr valid);
|
||||
|
@ -771,7 +771,7 @@ libxml_xmlTextReaderLocatorPtrWrap(xmlTextReaderLocatorPtr locator)
|
||||
}
|
||||
#endif /* LIBXML_READER_ENABLED */
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
PyObject *
|
||||
libxml_xmlRelaxNGPtrWrap(xmlRelaxNGPtr ctxt)
|
||||
{
|
||||
@ -815,7 +815,9 @@ libxml_xmlRelaxNGValidCtxtPtrWrap(xmlRelaxNGValidCtxtPtr valid)
|
||||
(char *) "xmlRelaxNGValidCtxtPtr", NULL);
|
||||
return (ret);
|
||||
}
|
||||
#endif /* LIBXML_RELAXNG_ENABLED */
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
PyObject *
|
||||
libxml_xmlSchemaPtrWrap(xmlSchemaPtr ctxt)
|
||||
{
|
||||
|
@ -16,7 +16,7 @@
|
||||
#define IN_LIBXML
|
||||
#include "libxml.h"
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
@ -29,7 +29,6 @@
|
||||
|
||||
#include <libxml/relaxng.h>
|
||||
|
||||
#include <libxml/xmlschemastypes.h>
|
||||
#include <libxml/xmlautomata.h>
|
||||
#include <libxml/xmlregexp.h>
|
||||
#include <libxml/xmlschemastypes.h>
|
||||
@ -10867,4 +10866,4 @@ xmlRelaxNGValidateDoc(xmlRelaxNGValidCtxtPtr ctxt, xmlDocPtr doc)
|
||||
return (ret);
|
||||
}
|
||||
|
||||
#endif /* LIBXML_SCHEMAS_ENABLED */
|
||||
#endif /* LIBXML_RELAXNG_ENABLED */
|
||||
|
150
runsuite.c
150
runsuite.c
@ -17,7 +17,8 @@
|
||||
#include <libxml/parserInternals.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/uri.h>
|
||||
#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_XPATH_ENABLED)
|
||||
#if (defined(LIBXML_RELAXNG_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)) && \
|
||||
defined(LIBXML_XPATH_ENABLED)
|
||||
#include <libxml/xmlreader.h>
|
||||
|
||||
#include <libxml/xpath.h>
|
||||
@ -55,16 +56,6 @@ static int checkTestFile(const char *filename) {
|
||||
return(1);
|
||||
}
|
||||
|
||||
static xmlChar *composeDir(const xmlChar *dir, const xmlChar *path) {
|
||||
char buf[500];
|
||||
|
||||
if (dir == NULL) return(xmlStrdup(path));
|
||||
if (path == NULL) return(NULL);
|
||||
|
||||
snprintf(buf, 500, "%s/%s", (const char *) dir, (const char *) path);
|
||||
return(xmlStrdup((const xmlChar *) buf));
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* Libxml2 specific routines *
|
||||
@ -78,60 +69,6 @@ static int nb_schematas = 0;
|
||||
static int nb_unimplemented = 0;
|
||||
static int nb_leaks = 0;
|
||||
|
||||
static int
|
||||
fatalError(void) {
|
||||
fprintf(stderr, "Exitting tests on fatal error\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* that's needed to implement <resource>
|
||||
*/
|
||||
#define MAX_ENTITIES 20
|
||||
static char *testEntitiesName[MAX_ENTITIES];
|
||||
static char *testEntitiesValue[MAX_ENTITIES];
|
||||
static int nb_entities = 0;
|
||||
static void resetEntities(void) {
|
||||
int i;
|
||||
|
||||
for (i = 0;i < nb_entities;i++) {
|
||||
if (testEntitiesName[i] != NULL)
|
||||
xmlFree(testEntitiesName[i]);
|
||||
if (testEntitiesValue[i] != NULL)
|
||||
xmlFree(testEntitiesValue[i]);
|
||||
}
|
||||
nb_entities = 0;
|
||||
}
|
||||
static int addEntity(char *name, char *content) {
|
||||
if (nb_entities >= MAX_ENTITIES) {
|
||||
fprintf(stderr, "Too many entities defined\n");
|
||||
return(-1);
|
||||
}
|
||||
testEntitiesName[nb_entities] = name;
|
||||
testEntitiesValue[nb_entities] = content;
|
||||
nb_entities++;
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int
|
||||
testResourceLoader(void *vctxt ATTRIBUTE_UNUSED, const char *URL,
|
||||
const char *ID ATTRIBUTE_UNUSED,
|
||||
xmlResourceType type ATTRIBUTE_UNUSED,
|
||||
int flags ATTRIBUTE_UNUSED, xmlParserInputPtr *out) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nb_entities; i++) {
|
||||
if (!strcmp(testEntitiesName[i], URL)) {
|
||||
*out = xmlNewInputFromString(testEntitiesName[i],
|
||||
testEntitiesValue[i],
|
||||
XML_INPUT_BUF_STATIC);
|
||||
return(XML_ERR_OK);
|
||||
}
|
||||
}
|
||||
|
||||
return(xmlNewInputFromUrl(URL, 0, out));
|
||||
}
|
||||
|
||||
/*
|
||||
* Trapping the error messages at the generic level to grab the equivalent of
|
||||
* stderr messages on CLI tools.
|
||||
@ -206,6 +143,8 @@ initializeLibxml2(void) {
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
xmlSchemaInitTypes();
|
||||
#endif
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
xmlRelaxNGInitTypes();
|
||||
#endif
|
||||
}
|
||||
@ -271,6 +210,62 @@ getString(xmlNodePtr cur, const char *xpath) {
|
||||
* *
|
||||
************************************************************************/
|
||||
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
|
||||
/*
|
||||
* that's needed to implement <resource>
|
||||
*/
|
||||
#define MAX_ENTITIES 20
|
||||
static char *testEntitiesName[MAX_ENTITIES];
|
||||
static char *testEntitiesValue[MAX_ENTITIES];
|
||||
static int nb_entities = 0;
|
||||
static void resetEntities(void) {
|
||||
int i;
|
||||
|
||||
for (i = 0;i < nb_entities;i++) {
|
||||
if (testEntitiesName[i] != NULL)
|
||||
xmlFree(testEntitiesName[i]);
|
||||
if (testEntitiesValue[i] != NULL)
|
||||
xmlFree(testEntitiesValue[i]);
|
||||
}
|
||||
nb_entities = 0;
|
||||
}
|
||||
static int addEntity(char *name, char *content) {
|
||||
if (nb_entities >= MAX_ENTITIES) {
|
||||
fprintf(stderr, "Too many entities defined\n");
|
||||
return(-1);
|
||||
}
|
||||
testEntitiesName[nb_entities] = name;
|
||||
testEntitiesValue[nb_entities] = content;
|
||||
nb_entities++;
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int
|
||||
testResourceLoader(void *vctxt ATTRIBUTE_UNUSED, const char *URL,
|
||||
const char *ID ATTRIBUTE_UNUSED,
|
||||
xmlResourceType type ATTRIBUTE_UNUSED,
|
||||
int flags ATTRIBUTE_UNUSED, xmlParserInputPtr *out) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nb_entities; i++) {
|
||||
if (!strcmp(testEntitiesName[i], URL)) {
|
||||
*out = xmlNewInputFromString(testEntitiesName[i],
|
||||
testEntitiesValue[i],
|
||||
XML_INPUT_BUF_STATIC);
|
||||
return(XML_ERR_OK);
|
||||
}
|
||||
}
|
||||
|
||||
return(xmlNewInputFromUrl(URL, 0, out));
|
||||
}
|
||||
|
||||
static int
|
||||
fatalError(void) {
|
||||
fprintf(stderr, "Exitting tests on fatal error\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static int
|
||||
xsdIncorrectTestCase(xmlNodePtr cur) {
|
||||
xmlNodePtr test;
|
||||
@ -330,6 +325,16 @@ done:
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static xmlChar *composeDir(const xmlChar *dir, const xmlChar *path) {
|
||||
char buf[500];
|
||||
|
||||
if (dir == NULL) return(xmlStrdup(path));
|
||||
if (path == NULL) return(NULL);
|
||||
|
||||
snprintf(buf, 500, "%s/%s", (const char *) dir, (const char *) path);
|
||||
return(xmlStrdup((const xmlChar *) buf));
|
||||
}
|
||||
|
||||
static void
|
||||
installResources(xmlNodePtr tst, const xmlChar *base) {
|
||||
xmlNodePtr test;
|
||||
@ -732,6 +737,7 @@ done:
|
||||
xmlFreeDoc(doc);
|
||||
return(ret);
|
||||
}
|
||||
#endif /* LIBXML_RELAXNG_ENABLED */
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
@ -739,6 +745,7 @@ done:
|
||||
* *
|
||||
************************************************************************/
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
static int
|
||||
xstcTestInstance(xmlNodePtr cur, xmlSchemaPtr schemas,
|
||||
const xmlChar *spath, const char *base) {
|
||||
@ -998,6 +1005,7 @@ done:
|
||||
xmlFreeDoc(doc);
|
||||
return(ret);
|
||||
}
|
||||
#endif /* LIBXML_SCHEMAS_ENABLED */
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
@ -1008,7 +1016,10 @@ done:
|
||||
int
|
||||
main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
|
||||
int ret = 0;
|
||||
int old_errors, old_tests, old_leaks, expected_errors;
|
||||
int old_errors, old_tests, old_leaks;
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
int expected_errors;
|
||||
#endif
|
||||
|
||||
logfile = fopen(LOGFILE, "wb");
|
||||
if (logfile == NULL) {
|
||||
@ -1021,7 +1032,7 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
|
||||
if ((argc >= 2) && (!strcmp(argv[1], "-v")))
|
||||
verbose = 1;
|
||||
|
||||
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
old_errors = nb_errors;
|
||||
old_tests = nb_tests;
|
||||
old_leaks = nb_leaks;
|
||||
@ -1063,7 +1074,9 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
|
||||
nb_tests - old_tests,
|
||||
nb_errors - old_errors,
|
||||
nb_leaks - old_leaks);
|
||||
#endif /* LIBXML_RELAXNG_ENABLED */
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
old_errors = nb_errors;
|
||||
old_tests = nb_tests;
|
||||
old_leaks = nb_leaks;
|
||||
@ -1123,6 +1136,7 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
|
||||
printf("Some errors were expected.\n");
|
||||
nb_errors = old_errors;
|
||||
}
|
||||
#endif /* LIBXML_SCHEMAS_ENABLED */
|
||||
|
||||
if ((nb_errors == 0) && (nb_leaks == 0)) {
|
||||
ret = 0;
|
||||
@ -1140,7 +1154,7 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
|
||||
fclose(logfile);
|
||||
return(ret);
|
||||
}
|
||||
#else /* !SCHEMAS */
|
||||
#else /* !RELAXNG && !SCHEMAS */
|
||||
int
|
||||
main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
|
||||
fprintf(stderr, "runsuite requires support for schemas and xpath in libxml2\n");
|
||||
|
23
runtest.c
23
runtest.c
@ -52,8 +52,11 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
#include <libxml/relaxng.h>
|
||||
#endif
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#include <libxml/xmlschemas.h>
|
||||
#include <libxml/xmlschemastypes.h>
|
||||
#endif
|
||||
@ -313,9 +316,11 @@ initializeLibxml2(void) {
|
||||
#endif
|
||||
xmlInitializeCatalog();
|
||||
#endif
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
xmlRelaxNGInitTypes();
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
xmlSchemaInitTypes();
|
||||
xmlRelaxNGInitTypes();
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -2732,7 +2737,7 @@ streamProcessTest(const char *filename, const char *result, const char *err,
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
if (rng != NULL) {
|
||||
ret = xmlTextReaderRelaxNGValidate(reader, rng);
|
||||
if (ret < 0) {
|
||||
@ -3527,12 +3532,13 @@ uriPathTest(const char *filename ATTRIBUTE_UNUSED,
|
||||
return(failures);
|
||||
}
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
/************************************************************************
|
||||
* *
|
||||
* Schemas tests *
|
||||
* *
|
||||
************************************************************************/
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
static int
|
||||
schemasOneTest(const char *sch,
|
||||
const char *filename,
|
||||
@ -3687,12 +3693,15 @@ schemasTest(const char *filename,
|
||||
|
||||
return(res);
|
||||
}
|
||||
#endif /* LIBXML_SCHEMAS_ENABLED */
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* Schemas tests *
|
||||
* RELAX NG tests *
|
||||
* *
|
||||
************************************************************************/
|
||||
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
static int
|
||||
rngOneTest(const char *sch,
|
||||
const char *filename,
|
||||
@ -3915,7 +3924,7 @@ rngStreamTest(const char *filename,
|
||||
}
|
||||
#endif /* READER */
|
||||
|
||||
#endif
|
||||
#endif /* LIBXML_RELAX_ENABLED */
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
@ -5272,6 +5281,8 @@ testDesc testDescriptions[] = {
|
||||
{ "Schemas regression tests" ,
|
||||
schemasTest, "./test/schemas/*_*.xsd", NULL, NULL, NULL,
|
||||
0 },
|
||||
#endif
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
{ "Relax-NG regression tests" ,
|
||||
rngTest, "./test/relaxng/*.rng", NULL, NULL, NULL,
|
||||
XML_PARSE_DTDATTR | XML_PARSE_NOENT },
|
||||
|
12
shell.c
12
shell.c
@ -31,7 +31,7 @@
|
||||
#include <libxml/uri.h>
|
||||
#include <libxml/xpath.h>
|
||||
#include <libxml/xpathInternals.h>
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
#include <libxml/relaxng.h>
|
||||
#endif
|
||||
|
||||
@ -599,7 +599,7 @@ xmllintShellSetContent(xmllintShellCtxtPtr ctxt ATTRIBUTE_UNUSED,
|
||||
return (0);
|
||||
}
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_RELAXNG_ENABLED)
|
||||
static void
|
||||
xmllintShellPrintf(void *ctx, const char *msg, ...) {
|
||||
xmllintShellCtxtPtr sctxt = ctx;
|
||||
@ -609,9 +609,9 @@ xmllintShellPrintf(void *ctx, const char *msg, ...) {
|
||||
vfprintf(sctxt->output, msg, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
#endif /* defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */
|
||||
#endif /* defined(LIBXML_VALID_ENABLED) || defined(LIBXML_RELAXNG_ENABLED) */
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
/**
|
||||
* xmllintShellRNGValidate:
|
||||
* @ctxt: the shell context
|
||||
@ -1227,7 +1227,7 @@ xmllintShell(xmlDocPtr doc, const char *filename, FILE * output)
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
fprintf(ctxt->output, "\tvalidate check the document for errors\n");
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
fprintf(ctxt->output, "\trelaxng rng validate the document against the Relax-NG schemas\n");
|
||||
#endif
|
||||
fprintf(ctxt->output, "\tgrep string search for a string in the subtree\n");
|
||||
@ -1237,7 +1237,7 @@ xmllintShell(xmlDocPtr doc, const char *filename, FILE * output)
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
} else if (!strcmp(command, "load")) {
|
||||
xmllintShellLoad(ctxt, arg, NULL, NULL);
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
} else if (!strcmp(command, "relaxng")) {
|
||||
xmllintShellRNGValidate(ctxt, arg, NULL, NULL);
|
||||
#endif
|
||||
|
@ -81,4 +81,4 @@ int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
|
||||
printf("%s : Module support not compiled in\n", argv[0]);
|
||||
return(0);
|
||||
}
|
||||
#endif /* LIBXML_SCHEMAS_ENABLED */
|
||||
#endif /* LIBXML_MODULES_ENABLED */
|
||||
|
46
testapi.c
46
testapi.c
@ -142,7 +142,7 @@ int main(int argc, char **argv) {
|
||||
#ifdef LIBXML_CATALOG_ENABLED
|
||||
xmlInitializeCatalog();
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
xmlRelaxNGInitTypes();
|
||||
#endif
|
||||
|
||||
@ -852,6 +852,8 @@ static void desret_xmlSchemaParserCtxtPtr(xmlSchemaParserCtxtPtr val) {
|
||||
}
|
||||
static void desret_xmlSchemaTypePtr(xmlSchemaTypePtr val ATTRIBUTE_UNUSED) {
|
||||
}
|
||||
#endif
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
static void desret_xmlRelaxNGParserCtxtPtr(xmlRelaxNGParserCtxtPtr val) {
|
||||
xmlRelaxNGFreeParserCtxt(val);
|
||||
}
|
||||
@ -17535,7 +17537,7 @@ static int
|
||||
test_xmlRelaxNGDump(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
|
||||
#if defined(LIBXML_RELAXNG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
|
||||
int mem_base;
|
||||
FILE * output; /* the file output */
|
||||
int n_output;
|
||||
@ -17574,7 +17576,7 @@ static int
|
||||
test_xmlRelaxNGDumpTree(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
|
||||
#if defined(LIBXML_RELAXNG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
|
||||
int mem_base;
|
||||
FILE * output; /* the file output */
|
||||
int n_output;
|
||||
@ -17608,21 +17610,21 @@ test_xmlRelaxNGDumpTree(void) {
|
||||
return(test_ret);
|
||||
}
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
|
||||
#define gen_nb_xmlRelaxNGParserCtxtPtr 1
|
||||
#define gen_xmlRelaxNGParserCtxtPtr(no, nr) NULL
|
||||
#define des_xmlRelaxNGParserCtxtPtr(no, val, nr)
|
||||
#endif
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
|
||||
#define gen_nb_xmlRelaxNGValidityErrorFunc_ptr 1
|
||||
#define gen_xmlRelaxNGValidityErrorFunc_ptr(no, nr) NULL
|
||||
#define des_xmlRelaxNGValidityErrorFunc_ptr(no, val, nr)
|
||||
#endif
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
|
||||
#define gen_nb_xmlRelaxNGValidityWarningFunc_ptr 1
|
||||
#define gen_xmlRelaxNGValidityWarningFunc_ptr(no, nr) NULL
|
||||
@ -17634,7 +17636,7 @@ static int
|
||||
test_xmlRelaxNGGetParserErrors(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
#if defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_RELAXNG_ENABLED)
|
||||
int mem_base;
|
||||
int ret_val;
|
||||
xmlRelaxNGParserCtxtPtr ctxt; /* a Relax-NG validation context */
|
||||
@ -17684,7 +17686,7 @@ test_xmlRelaxNGGetParserErrors(void) {
|
||||
return(test_ret);
|
||||
}
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
|
||||
#define gen_nb_xmlRelaxNGValidCtxtPtr 1
|
||||
#define gen_xmlRelaxNGValidCtxtPtr(no, nr) NULL
|
||||
@ -17696,7 +17698,7 @@ static int
|
||||
test_xmlRelaxNGGetValidErrors(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
#if defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_RELAXNG_ENABLED)
|
||||
int mem_base;
|
||||
int ret_val;
|
||||
xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
|
||||
@ -17751,7 +17753,7 @@ static int
|
||||
test_xmlRelaxNGInitTypes(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
#if defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_RELAXNG_ENABLED)
|
||||
int mem_base;
|
||||
int ret_val;
|
||||
|
||||
@ -17778,7 +17780,7 @@ static int
|
||||
test_xmlRelaxNGNewDocParserCtxt(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
#if defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_RELAXNG_ENABLED)
|
||||
int mem_base;
|
||||
xmlRelaxNGParserCtxtPtr ret_val;
|
||||
xmlDocPtr doc; /* a preparsed document tree */
|
||||
@ -17812,7 +17814,7 @@ static int
|
||||
test_xmlRelaxNGNewMemParserCtxt(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
#if defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_RELAXNG_ENABLED)
|
||||
int mem_base;
|
||||
xmlRelaxNGParserCtxtPtr ret_val;
|
||||
const char * buffer; /* a pointer to a char array containing the schemas */
|
||||
@ -17856,7 +17858,7 @@ static int
|
||||
test_xmlRelaxNGNewParserCtxt(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
#if defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_RELAXNG_ENABLED)
|
||||
int mem_base;
|
||||
xmlRelaxNGParserCtxtPtr ret_val;
|
||||
const char * URL; /* the location of the schema */
|
||||
@ -17960,7 +17962,7 @@ static int
|
||||
test_xmlRelaxNGValidateDoc(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
#if defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_RELAXNG_ENABLED)
|
||||
int mem_base;
|
||||
int ret_val;
|
||||
xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
|
||||
@ -18001,7 +18003,7 @@ static int
|
||||
test_xmlRelaxNGValidateFullElement(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
#if defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_RELAXNG_ENABLED)
|
||||
int mem_base;
|
||||
int ret_val;
|
||||
xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
|
||||
@ -18049,7 +18051,7 @@ static int
|
||||
test_xmlRelaxNGValidatePopElement(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
#if defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_RELAXNG_ENABLED)
|
||||
int mem_base;
|
||||
int ret_val;
|
||||
xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
|
||||
@ -18097,7 +18099,7 @@ static int
|
||||
test_xmlRelaxNGValidatePushCData(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
#if defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_RELAXNG_ENABLED)
|
||||
int mem_base;
|
||||
int ret_val;
|
||||
xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
|
||||
@ -18148,7 +18150,7 @@ static int
|
||||
test_xmlRelaxNGValidatePushElement(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
#if defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_RELAXNG_ENABLED)
|
||||
int mem_base;
|
||||
int ret_val;
|
||||
xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
|
||||
@ -18196,7 +18198,7 @@ static int
|
||||
test_xmlRelaxParserSetFlag(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
#if defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_RELAXNG_ENABLED)
|
||||
int mem_base;
|
||||
int ret_val;
|
||||
xmlRelaxNGParserCtxtPtr ctxt; /* a RelaxNG parser context */
|
||||
@ -33080,7 +33082,7 @@ static int
|
||||
test_xmlTextReaderRelaxNGSetSchema(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_RELAXNG_ENABLED)
|
||||
int mem_base;
|
||||
int ret_val;
|
||||
xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
|
||||
@ -33121,7 +33123,7 @@ static int
|
||||
test_xmlTextReaderRelaxNGValidate(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_RELAXNG_ENABLED)
|
||||
int mem_base;
|
||||
int ret_val;
|
||||
xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
|
||||
@ -33162,7 +33164,7 @@ static int
|
||||
test_xmlTextReaderRelaxNGValidateCtxt(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_RELAXNG_ENABLED)
|
||||
int mem_base;
|
||||
int ret_val;
|
||||
xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
|
||||
|
@ -19,9 +19,11 @@
|
||||
#ifdef LIBXML_CATALOG_ENABLED
|
||||
#include <libxml/catalog.h>
|
||||
#endif
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
#include <libxml/relaxng.h>
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#include <libxml/xmlschemastypes.h>
|
||||
#include <libxml/relaxng.h>
|
||||
#endif
|
||||
|
||||
#if defined(SOLARIS)
|
||||
@ -494,6 +496,8 @@ xmlCleanupParser(void) {
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
xmlSchemaCleanupTypes();
|
||||
#endif
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
xmlRelaxNGCleanupTypes();
|
||||
#endif
|
||||
|
||||
|
@ -30,7 +30,7 @@ modules_defines = {
|
||||
"HTMLparser": "LIBXML_HTML_ENABLED",
|
||||
"catalog": "LIBXML_CATALOG_ENABLED",
|
||||
"xmlreader": "LIBXML_READER_ENABLED",
|
||||
"relaxng": "LIBXML_SCHEMAS_ENABLED",
|
||||
"relaxng": "LIBXML_RELAXNG_ENABLED",
|
||||
"schemasInternals": "LIBXML_SCHEMAS_ENABLED",
|
||||
"xmlschemas": "LIBXML_SCHEMAS_ENABLED",
|
||||
"xmlschemastypes": "LIBXML_SCHEMAS_ENABLED",
|
||||
|
78
xmllint.c
78
xmllint.c
@ -53,8 +53,10 @@
|
||||
#ifdef LIBXML_SCHEMATRON_ENABLED
|
||||
#include <libxml/schematron.h>
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
#include <libxml/relaxng.h>
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#include <libxml/xmlschemas.h>
|
||||
#endif
|
||||
#ifdef LIBXML_PATTERN_ENABLED
|
||||
@ -144,9 +146,11 @@ typedef struct {
|
||||
const char *dtdvalidfpi;
|
||||
int insert;
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
const char *relaxng;
|
||||
xmlRelaxNGPtr relaxngschemas;
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
const char *schema;
|
||||
xmlSchemaPtr wxschemas;
|
||||
#endif
|
||||
@ -1773,7 +1777,7 @@ static void streamFile(xmllintState *lint, const char *filename) {
|
||||
if (lint->maxAmpl > 0)
|
||||
xmlTextReaderSetMaxAmplification(reader, lint->maxAmpl);
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
if (lint->relaxng != NULL) {
|
||||
if ((lint->timing) && (lint->repeat == 1)) {
|
||||
startTimer(lint);
|
||||
@ -1789,6 +1793,8 @@ static void streamFile(xmllintState *lint, const char *filename) {
|
||||
endTimer(lint, "Compiling the schemas");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
if (lint->schema != NULL) {
|
||||
if ((lint->timing) && (lint->repeat == 1)) {
|
||||
startTimer(lint);
|
||||
@ -1823,7 +1829,7 @@ static void streamFile(xmllintState *lint, const char *filename) {
|
||||
ret = xmlTextReaderRead(reader);
|
||||
}
|
||||
if ((lint->timing) && (lint->repeat == 1)) {
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
if (lint->relaxng != NULL)
|
||||
endTimer(lint, "Parsing and validating");
|
||||
else
|
||||
@ -1845,14 +1851,26 @@ static void streamFile(xmllintState *lint, const char *filename) {
|
||||
}
|
||||
}
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
#if defined(LIBXML_RELAXNG_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
||||
{
|
||||
int hasSchema = 0;
|
||||
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
if (lint->relaxng != NULL)
|
||||
hasSchema = 1;
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
if ((lint->relaxng != NULL) || (lint->schema != NULL)) {
|
||||
if (xmlTextReaderIsValid(reader) != 1) {
|
||||
fprintf(errStream, "%s fails to validate\n", filename);
|
||||
lint->progresult = XMLLINT_ERR_VALID;
|
||||
} else {
|
||||
if (!lint->quiet) {
|
||||
fprintf(errStream, "%s validates\n", filename);
|
||||
if (lint->schema != NULL)
|
||||
hasSchema = 1;
|
||||
#endif
|
||||
if (hasSchema) {
|
||||
if (xmlTextReaderIsValid(reader) != 1) {
|
||||
fprintf(errStream, "%s fails to validate\n", filename);
|
||||
lint->progresult = XMLLINT_ERR_VALID;
|
||||
} else {
|
||||
if (!lint->quiet) {
|
||||
fprintf(errStream, "%s validates\n", filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2588,7 +2606,8 @@ parseAndPrintFile(xmllintState *lint, const char *filename) {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
if (lint->relaxngschemas != NULL) {
|
||||
xmlRelaxNGValidCtxtPtr ctxt;
|
||||
int ret;
|
||||
@ -2620,7 +2639,11 @@ parseAndPrintFile(xmllintState *lint, const char *filename) {
|
||||
if ((lint->timing) && (lint->repeat == 1)) {
|
||||
endTimer(lint, "Validating");
|
||||
}
|
||||
} else if (lint->wxschemas != NULL) {
|
||||
}
|
||||
#endif /* LIBXML_RELAXNG_ENABLED */
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
if (lint->wxschemas != NULL) {
|
||||
xmlSchemaValidCtxtPtr ctxt;
|
||||
int ret;
|
||||
|
||||
@ -2652,7 +2675,7 @@ parseAndPrintFile(xmllintState *lint, const char *filename) {
|
||||
endTimer(lint, "Validating");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* LIBXML_SCHEMAS_ENABLED */
|
||||
|
||||
#ifdef LIBXML_DEBUG_ENABLED
|
||||
if ((lint->debugent)
|
||||
@ -2712,6 +2735,7 @@ static void showVersion(FILE *errStream, const char *name) {
|
||||
if (xmlHasFeature(XML_WITH_REGEXP)) fprintf(errStream, "Regexps ");
|
||||
if (xmlHasFeature(XML_WITH_AUTOMATA)) fprintf(errStream, "Automata ");
|
||||
if (xmlHasFeature(XML_WITH_EXPR)) fprintf(errStream, "Expr ");
|
||||
if (xmlHasFeature(XML_WITH_RELAXNG)) fprintf(errStream, "RelaxNG ");
|
||||
if (xmlHasFeature(XML_WITH_SCHEMAS)) fprintf(errStream, "Schemas ");
|
||||
if (xmlHasFeature(XML_WITH_SCHEMATRON)) fprintf(errStream, "Schematron ");
|
||||
if (xmlHasFeature(XML_WITH_MODULES)) fprintf(errStream, "Modules ");
|
||||
@ -2819,8 +2843,10 @@ static void usage(FILE *f, const char *name) {
|
||||
fprintf(f, "\t--pattern pattern_value : test the pattern support\n");
|
||||
#endif
|
||||
#endif /* LIBXML_READER_ENABLED */
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
fprintf(f, "\t--relaxng schema : do RelaxNG validation against the schema\n");
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
fprintf(f, "\t--schema schema : do validation against the WXS schema\n");
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMATRON_ENABLED
|
||||
@ -2880,9 +2906,11 @@ skipArgs(const char *arg) {
|
||||
(!strcmp(arg, "-dtdvalidfpi")) ||
|
||||
(!strcmp(arg, "--dtdvalidfpi")) ||
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
(!strcmp(arg, "-relaxng")) ||
|
||||
(!strcmp(arg, "--relaxng")) ||
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
(!strcmp(arg, "-schema")) ||
|
||||
(!strcmp(arg, "--schema")) ||
|
||||
#endif
|
||||
@ -3159,12 +3187,14 @@ xmllintParseOptions(xmllintState *lint, int argc, const char **argv) {
|
||||
} else if ((!strcmp(argv[i], "-sax")) ||
|
||||
(!strcmp(argv[i], "--sax"))) {
|
||||
lint->sax = 1;
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
} else if ((!strcmp(argv[i], "-relaxng")) ||
|
||||
(!strcmp(argv[i], "--relaxng"))) {
|
||||
i++;
|
||||
lint->relaxng = argv[i];
|
||||
lint->options |= XML_PARSE_NOENT;
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
} else if ((!strcmp(argv[i], "-schema")) ||
|
||||
(!strcmp(argv[i], "--schema"))) {
|
||||
i++;
|
||||
@ -3333,7 +3363,7 @@ xmllintMain(int argc, const char **argv, FILE *errStream,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
if ((lint->relaxng != NULL) && (lint->sax == 0)
|
||||
#ifdef LIBXML_READER_ENABLED
|
||||
&& (lint->stream == 0)
|
||||
@ -3363,9 +3393,13 @@ xmllintMain(int argc, const char **argv, FILE *errStream,
|
||||
if (lint->timing) {
|
||||
endTimer(lint, "Compiling the schemas");
|
||||
}
|
||||
} else if ((lint->schema != NULL)
|
||||
}
|
||||
#endif /* LIBXML_RELAXNG_ENABLED */
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
if ((lint->schema != NULL)
|
||||
#ifdef LIBXML_READER_ENABLED
|
||||
&& (lint->stream == 0)
|
||||
&& (lint->stream == 0)
|
||||
#endif
|
||||
) {
|
||||
xmlSchemaParserCtxtPtr ctxt;
|
||||
@ -3570,9 +3604,11 @@ error:
|
||||
if (lint->wxschematron != NULL)
|
||||
xmlSchematronFree(lint->wxschematron);
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
if (lint->relaxngschemas != NULL)
|
||||
xmlRelaxNGFree(lint->relaxngschemas);
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
if (lint->wxschemas != NULL)
|
||||
xmlSchemaFree(lint->wxschemas);
|
||||
#endif
|
||||
|
51
xmlreader.c
51
xmlreader.c
@ -27,8 +27,10 @@
|
||||
#include <libxml/xmlIO.h>
|
||||
#include <libxml/xmlreader.h>
|
||||
#include <libxml/parserInternals.h>
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
#include <libxml/relaxng.h>
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#include <libxml/xmlschemas.h>
|
||||
#endif
|
||||
#include <libxml/uri.h>
|
||||
@ -127,13 +129,15 @@ struct _xmlTextReader {
|
||||
xmlTextReaderErrorFunc errorFunc; /* callback function */
|
||||
void *errorFuncArg; /* callback function user argument */
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
/* Handling of RelaxNG validation */
|
||||
xmlRelaxNGPtr rngSchemas; /* The Relax NG schemas */
|
||||
xmlRelaxNGValidCtxtPtr rngValidCtxt;/* The Relax NG validation context */
|
||||
int rngPreserveCtxt; /* 1 if the context was provided by the user */
|
||||
int rngValidErrors;/* The number of errors detected */
|
||||
xmlNodePtr rngFullNode; /* the node if RNG not progressive */
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
/* Handling of Schemas validation */
|
||||
xmlSchemaPtr xsdSchemas; /* The Schemas schemas */
|
||||
xmlSchemaValidCtxtPtr xsdValidCtxt;/* The Schemas validation context */
|
||||
@ -916,7 +920,7 @@ xmlTextReaderValidatePush(xmlTextReaderPtr reader) {
|
||||
}*/
|
||||
}
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
if ((reader->validate == XML_TEXTREADER_VALIDATE_RNG) &&
|
||||
(reader->rngValidCtxt != NULL)) {
|
||||
int ret;
|
||||
@ -965,7 +969,7 @@ xmlTextReaderValidateCData(xmlTextReaderPtr reader,
|
||||
data, len);
|
||||
}
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
if ((reader->validate == XML_TEXTREADER_VALIDATE_RNG) &&
|
||||
(reader->rngValidCtxt != NULL)) {
|
||||
int ret;
|
||||
@ -1015,7 +1019,7 @@ xmlTextReaderValidatePop(xmlTextReaderPtr reader) {
|
||||
}*/
|
||||
}
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
if ((reader->validate == XML_TEXTREADER_VALIDATE_RNG) &&
|
||||
(reader->rngValidCtxt != NULL)) {
|
||||
int ret;
|
||||
@ -2132,7 +2136,7 @@ void
|
||||
xmlFreeTextReader(xmlTextReaderPtr reader) {
|
||||
if (reader == NULL)
|
||||
return;
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
if (reader->rngSchemas != NULL) {
|
||||
xmlRelaxNGFree(reader->rngSchemas);
|
||||
reader->rngSchemas = NULL;
|
||||
@ -2142,6 +2146,8 @@ xmlFreeTextReader(xmlTextReaderPtr reader) {
|
||||
xmlRelaxNGFreeValidCtxt(reader->rngValidCtxt);
|
||||
reader->rngValidCtxt = NULL;
|
||||
}
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
if (reader->xsdPlug != NULL) {
|
||||
xmlSchemaSAXUnplug(reader->xsdPlug);
|
||||
reader->xsdPlug = NULL;
|
||||
@ -4003,7 +4009,7 @@ xmlTextReaderCurrentDoc(xmlTextReaderPtr reader) {
|
||||
return(reader->ctxt->myDoc);
|
||||
}
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
/**
|
||||
* xmlTextReaderRelaxNGSetSchema:
|
||||
* @reader: the xmlTextReaderPtr used
|
||||
@ -4058,7 +4064,9 @@ xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader, xmlRelaxNGPtr schema) {
|
||||
reader->validate = XML_TEXTREADER_VALIDATE_RNG;
|
||||
return(0);
|
||||
}
|
||||
#endif /* LIBXML_RELAXNG_ENABLED */
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
/**
|
||||
* xmlTextReaderLocator:
|
||||
* @ctx: the xmlTextReaderPtr used
|
||||
@ -4191,7 +4199,9 @@ xmlTextReaderSetSchema(xmlTextReaderPtr reader, xmlSchemaPtr schema) {
|
||||
reader->validate = XML_TEXTREADER_VALIDATE_XSD;
|
||||
return(0);
|
||||
}
|
||||
#endif /* LIBXML_SCHEMAS_ENABLED */
|
||||
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
/**
|
||||
* xmlTextReaderRelaxNGValidateInternal:
|
||||
* @reader: the xmlTextReaderPtr used
|
||||
@ -4279,7 +4289,9 @@ xmlTextReaderRelaxNGValidateInternal(xmlTextReaderPtr reader,
|
||||
reader->validate = XML_TEXTREADER_VALIDATE_RNG;
|
||||
return(0);
|
||||
}
|
||||
#endif /* LIBXML_RELAXNG_ENABLED */
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
/**
|
||||
* xmlTextReaderSchemaValidateInternal:
|
||||
* @reader: the xmlTextReaderPtr used
|
||||
@ -4427,7 +4439,9 @@ xmlTextReaderSchemaValidate(xmlTextReaderPtr reader, const char *xsd)
|
||||
{
|
||||
return(xmlTextReaderSchemaValidateInternal(reader, xsd, NULL, 0));
|
||||
}
|
||||
#endif /* LIBXML_SCHEMAS_ENABLED */
|
||||
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
/**
|
||||
* xmlTextReaderRelaxNGValidateCtxt:
|
||||
* @reader: the xmlTextReaderPtr used
|
||||
@ -4466,8 +4480,7 @@ xmlTextReaderRelaxNGValidate(xmlTextReaderPtr reader, const char *rng)
|
||||
{
|
||||
return(xmlTextReaderRelaxNGValidateInternal(reader, rng, NULL, 0));
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* LIBXML_RELAXNG_ENABLED */
|
||||
|
||||
/**
|
||||
* xmlTextReaderIsNamespaceDecl:
|
||||
@ -4651,11 +4664,13 @@ xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader,
|
||||
reader->errorFuncArg = arg;
|
||||
xmlCtxtSetErrorHandler(reader->ctxt,
|
||||
xmlTextReaderStructuredRelay, reader);
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
if (reader->rngValidCtxt) {
|
||||
xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt,
|
||||
xmlTextReaderStructuredRelay, reader);
|
||||
}
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
if (reader->xsdValidCtxt) {
|
||||
xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt,
|
||||
xmlTextReaderStructuredRelay, reader);
|
||||
@ -4667,11 +4682,13 @@ xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader,
|
||||
reader->sErrorFunc = NULL;
|
||||
reader->errorFuncArg = NULL;
|
||||
xmlCtxtSetErrorHandler(reader->ctxt, NULL, NULL);
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
if (reader->rngValidCtxt) {
|
||||
xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, NULL,
|
||||
NULL);
|
||||
}
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
if (reader->xsdValidCtxt) {
|
||||
xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, NULL,
|
||||
NULL);
|
||||
@ -4700,11 +4717,13 @@ xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader,
|
||||
reader->errorFuncArg = arg;
|
||||
xmlCtxtSetErrorHandler(reader->ctxt,
|
||||
xmlTextReaderStructuredRelay, reader);
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
if (reader->rngValidCtxt) {
|
||||
xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt,
|
||||
xmlTextReaderStructuredRelay, reader);
|
||||
}
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
if (reader->xsdValidCtxt) {
|
||||
xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt,
|
||||
xmlTextReaderStructuredRelay, reader);
|
||||
@ -4716,11 +4735,13 @@ xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader,
|
||||
reader->sErrorFunc = NULL;
|
||||
reader->errorFuncArg = NULL;
|
||||
xmlCtxtSetErrorHandler(reader->ctxt, NULL, NULL);
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
if (reader->rngValidCtxt) {
|
||||
xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, NULL,
|
||||
NULL);
|
||||
}
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
if (reader->xsdValidCtxt) {
|
||||
xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, NULL,
|
||||
NULL);
|
||||
@ -4783,9 +4804,11 @@ xmlTextReaderIsValid(xmlTextReaderPtr reader)
|
||||
{
|
||||
if (reader == NULL)
|
||||
return (-1);
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
if (reader->validate == XML_TEXTREADER_VALIDATE_RNG)
|
||||
return (reader->rngValidErrors == 0);
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
if (reader->validate == XML_TEXTREADER_VALIDATE_XSD)
|
||||
return (reader->xsdValidErrors == 0);
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user