mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-18 16:08:59 +03:00
removing xmldwalk module since it got merged with the xmlreader. cleanup
* Makefile.am configure.in xmldwalk.c xmlreader.c include/libxml/Makefile.am include/libxml/xmldwalk.h include/libxml/xmlversion.h.in: removing xmldwalk module since it got merged with the xmlreader. * parser.c: cleanup * win32/libxml2.def.src python/libxml2class.txt doc/libxml2-api.xml: rebuilt the API * python/tests/Makefile.am python/tests/reader7.py python/tests/walker.py: adding regression testing for the new xmlreader APIs, new APIs for reader creation, including makeing reader "walker" operating on preparsed document trees. Daniel
This commit is contained in:
14
ChangeLog
14
ChangeLog
@@ -1,3 +1,17 @@
|
|||||||
|
Mon Oct 20 19:02:53 CEST 2003 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* Makefile.am configure.in xmldwalk.c xmlreader.c
|
||||||
|
include/libxml/Makefile.am include/libxml/xmldwalk.h
|
||||||
|
include/libxml/xmlversion.h.in: removing xmldwalk module
|
||||||
|
since it got merged with the xmlreader.
|
||||||
|
* parser.c: cleanup
|
||||||
|
* win32/libxml2.def.src python/libxml2class.txt doc/libxml2-api.xml:
|
||||||
|
rebuilt the API
|
||||||
|
* python/tests/Makefile.am python/tests/reader7.py
|
||||||
|
python/tests/walker.py: adding regression testing for the
|
||||||
|
new xmlreader APIs, new APIs for reader creation, including
|
||||||
|
makeing reader "walker" operating on preparsed document trees.
|
||||||
|
|
||||||
Sun Oct 20 22:37:03 HKT 2003 William Brack <wbrack@mmm.com.hk>
|
Sun Oct 20 22:37:03 HKT 2003 William Brack <wbrack@mmm.com.hk>
|
||||||
|
|
||||||
* entities.c, valid.c: fixed problem reported on the mailing
|
* entities.c, valid.c: fixed problem reported on the mailing
|
||||||
|
@@ -27,7 +27,7 @@ libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c \
|
|||||||
catalog.c globals.c threads.c c14n.c \
|
catalog.c globals.c threads.c c14n.c \
|
||||||
xmlregexp.c xmlschemas.c xmlschemastypes.c xmlunicode.c \
|
xmlregexp.c xmlschemas.c xmlschemastypes.c xmlunicode.c \
|
||||||
triostr.c trio.c xmlreader.c relaxng.c dict.c SAX2.c \
|
triostr.c trio.c xmlreader.c relaxng.c dict.c SAX2.c \
|
||||||
legacy.c xmldwalk.c chvalid.c
|
legacy.c chvalid.c
|
||||||
else
|
else
|
||||||
libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c \
|
libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c \
|
||||||
parser.c tree.c hash.c list.c xmlIO.c xmlmemory.c uri.c \
|
parser.c tree.c hash.c list.c xmlIO.c xmlmemory.c uri.c \
|
||||||
@@ -36,7 +36,7 @@ libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c \
|
|||||||
catalog.c globals.c threads.c c14n.c \
|
catalog.c globals.c threads.c c14n.c \
|
||||||
xmlregexp.c xmlschemas.c xmlschemastypes.c xmlunicode.c \
|
xmlregexp.c xmlschemas.c xmlschemastypes.c xmlunicode.c \
|
||||||
xmlreader.c relaxng.c dict.c SAX2.c \
|
xmlreader.c relaxng.c dict.c SAX2.c \
|
||||||
legacy.c xmldwalk.c chvalid.c
|
legacy.c chvalid.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
DEPS = $(top_builddir)/libxml2.la
|
DEPS = $(top_builddir)/libxml2.la
|
||||||
|
17
configure.in
17
configure.in
@@ -639,23 +639,6 @@ fi
|
|||||||
AC_SUBST(WITH_SAX1)
|
AC_SUBST(WITH_SAX1)
|
||||||
AC_SUBST(TEST_SAX)
|
AC_SUBST(TEST_SAX)
|
||||||
|
|
||||||
AC_ARG_WITH(walker,
|
|
||||||
[ --with-walker add the xmlDocWalker interface (on)])
|
|
||||||
if test "$with_minimum" = "yes" -a "$with_walker" = ""
|
|
||||||
then
|
|
||||||
with_walker=no
|
|
||||||
fi
|
|
||||||
if test "$with_walker" = "no" ; then
|
|
||||||
echo Disabling the xmlDocWalker interface
|
|
||||||
WITH_WALKER=0
|
|
||||||
TEST_WALKER=
|
|
||||||
else
|
|
||||||
WITH_WALKER=1
|
|
||||||
TEST_WALKER=WALKERtests
|
|
||||||
fi
|
|
||||||
AC_SUBST(WITH_WALKER)
|
|
||||||
AC_SUBST(TEST_WALKER)
|
|
||||||
|
|
||||||
AC_ARG_WITH(push,
|
AC_ARG_WITH(push,
|
||||||
[ --with-push add the PUSH parser interfaces (on)])
|
[ --with-push add the PUSH parser interfaces (on)])
|
||||||
if test "$with_minimum" = "yes" -a "$with_push" = ""
|
if test "$with_minimum" = "yes" -a "$with_push" = ""
|
||||||
|
@@ -1438,7 +1438,9 @@
|
|||||||
<exports symbol='xmlReaderNewFile'/>
|
<exports symbol='xmlReaderNewFile'/>
|
||||||
<exports symbol='xmlReaderNewIO'/>
|
<exports symbol='xmlReaderNewIO'/>
|
||||||
<exports symbol='xmlReaderNewMemory'/>
|
<exports symbol='xmlReaderNewMemory'/>
|
||||||
|
<exports symbol='xmlReaderNewWalker'/>
|
||||||
<exports symbol='xmlReaderTypes'/>
|
<exports symbol='xmlReaderTypes'/>
|
||||||
|
<exports symbol='xmlReaderWalker'/>
|
||||||
<exports symbol='xmlTextReader'/>
|
<exports symbol='xmlTextReader'/>
|
||||||
<exports symbol='xmlTextReaderAttributeCount'/>
|
<exports symbol='xmlTextReaderAttributeCount'/>
|
||||||
<exports symbol='xmlTextReaderBaseUri'/>
|
<exports symbol='xmlTextReaderBaseUri'/>
|
||||||
@@ -1449,6 +1451,7 @@
|
|||||||
<exports symbol='xmlTextReaderConstNamespaceUri'/>
|
<exports symbol='xmlTextReaderConstNamespaceUri'/>
|
||||||
<exports symbol='xmlTextReaderConstPrefix'/>
|
<exports symbol='xmlTextReaderConstPrefix'/>
|
||||||
<exports symbol='xmlTextReaderConstString'/>
|
<exports symbol='xmlTextReaderConstString'/>
|
||||||
|
<exports symbol='xmlTextReaderConstValue'/>
|
||||||
<exports symbol='xmlTextReaderConstXmlLang'/>
|
<exports symbol='xmlTextReaderConstXmlLang'/>
|
||||||
<exports symbol='xmlTextReaderCurrentDoc'/>
|
<exports symbol='xmlTextReaderCurrentDoc'/>
|
||||||
<exports symbol='xmlTextReaderCurrentNode'/>
|
<exports symbol='xmlTextReaderCurrentNode'/>
|
||||||
@@ -1480,6 +1483,7 @@
|
|||||||
<exports symbol='xmlTextReaderName'/>
|
<exports symbol='xmlTextReaderName'/>
|
||||||
<exports symbol='xmlTextReaderNamespaceUri'/>
|
<exports symbol='xmlTextReaderNamespaceUri'/>
|
||||||
<exports symbol='xmlTextReaderNext'/>
|
<exports symbol='xmlTextReaderNext'/>
|
||||||
|
<exports symbol='xmlTextReaderNextSibling'/>
|
||||||
<exports symbol='xmlTextReaderNodeType'/>
|
<exports symbol='xmlTextReaderNodeType'/>
|
||||||
<exports symbol='xmlTextReaderNormalization'/>
|
<exports symbol='xmlTextReaderNormalization'/>
|
||||||
<exports symbol='xmlTextReaderPrefix'/>
|
<exports symbol='xmlTextReaderPrefix'/>
|
||||||
@@ -7283,9 +7287,9 @@ actually an xmlCharEncoding'/>
|
|||||||
<arg name='iter' type='xmlDocWalkerPtr' info='the xmlDocWalkerPtr'/>
|
<arg name='iter' type='xmlDocWalkerPtr' info='the xmlDocWalkerPtr'/>
|
||||||
</function>
|
</function>
|
||||||
<function name='xmlDocWalkerBaseUri' file='xmldwalk'>
|
<function name='xmlDocWalkerBaseUri' file='xmldwalk'>
|
||||||
<info></info>
|
<info>The base URI of the node.</info>
|
||||||
<return type='xmlChar *' info=''/>
|
<return type='xmlChar *' info='the base URI or NULL if not available'/>
|
||||||
<arg name='iter' type='xmlDocWalkerPtr' info=''/>
|
<arg name='iter' type='xmlDocWalkerPtr' info='the xmlDocWalkerPtr'/>
|
||||||
</function>
|
</function>
|
||||||
<function name='xmlDocWalkerCurrentDoc' file='xmldwalk'>
|
<function name='xmlDocWalkerCurrentDoc' file='xmldwalk'>
|
||||||
<info>Hacking interface allowing to get the xmlDocPtr correponding to the current document being accessed by the xmlDocWalker.</info>
|
<info>Hacking interface allowing to get the xmlDocPtr correponding to the current document being accessed by the xmlDocWalker.</info>
|
||||||
@@ -9900,7 +9904,7 @@ actually an xmlCharEncoding'/>
|
|||||||
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
|
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
|
||||||
</function>
|
</function>
|
||||||
<function name='xmlReaderForDoc' file='xmlreader'>
|
<function name='xmlReaderForDoc' file='xmlreader'>
|
||||||
<info>Create an xmltextReader for an XML in-memory document.</info>
|
<info>Create an xmltextReader for an XML in-memory document. The parsing flags @options are a combination of xmlParserOption(s).</info>
|
||||||
<return type='xmlTextReaderPtr' info='the new reader or NULL in case of error.'/>
|
<return type='xmlTextReaderPtr' info='the new reader or NULL in case of error.'/>
|
||||||
<arg name='cur' type='const xmlChar *' info='a pointer to a zero terminated string'/>
|
<arg name='cur' type='const xmlChar *' info='a pointer to a zero terminated string'/>
|
||||||
<arg name='URL' type='const char *' info='the base URL to use for the document'/>
|
<arg name='URL' type='const char *' info='the base URL to use for the document'/>
|
||||||
@@ -9908,7 +9912,7 @@ actually an xmlCharEncoding'/>
|
|||||||
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
|
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
|
||||||
</function>
|
</function>
|
||||||
<function name='xmlReaderForFd' file='xmlreader'>
|
<function name='xmlReaderForFd' file='xmlreader'>
|
||||||
<info>Create an xmltextReader for an XML from a file descriptor.</info>
|
<info>Create an xmltextReader for an XML from a file descriptor. The parsing flags @options are a combination of xmlParserOption(s).</info>
|
||||||
<return type='xmlTextReaderPtr' info='the new reader or NULL in case of error.'/>
|
<return type='xmlTextReaderPtr' info='the new reader or NULL in case of error.'/>
|
||||||
<arg name='fd' type='int' info='an open file descriptor'/>
|
<arg name='fd' type='int' info='an open file descriptor'/>
|
||||||
<arg name='URL' type='const char *' info='the base URL to use for the document'/>
|
<arg name='URL' type='const char *' info='the base URL to use for the document'/>
|
||||||
@@ -9916,14 +9920,14 @@ actually an xmlCharEncoding'/>
|
|||||||
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
|
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
|
||||||
</function>
|
</function>
|
||||||
<function name='xmlReaderForFile' file='xmlreader'>
|
<function name='xmlReaderForFile' file='xmlreader'>
|
||||||
<info>parse an XML file from the filesystem or the network.</info>
|
<info>parse an XML file from the filesystem or the network. The parsing flags @options are a combination of xmlParserOption(s).</info>
|
||||||
<return type='xmlTextReaderPtr' info='the new reader or NULL in case of error.'/>
|
<return type='xmlTextReaderPtr' info='the new reader or NULL in case of error.'/>
|
||||||
<arg name='filename' type='const char *' info='a file or URL'/>
|
<arg name='filename' type='const char *' info='a file or URL'/>
|
||||||
<arg name='encoding' type='const char *' info='the document encoding, or NULL'/>
|
<arg name='encoding' type='const char *' info='the document encoding, or NULL'/>
|
||||||
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
|
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
|
||||||
</function>
|
</function>
|
||||||
<function name='xmlReaderForIO' file='xmlreader'>
|
<function name='xmlReaderForIO' file='xmlreader'>
|
||||||
<info>Create an xmltextReader for an XML document from I/O functions and source.</info>
|
<info>Create an xmltextReader for an XML document from I/O functions and source. The parsing flags @options are a combination of xmlParserOption(s).</info>
|
||||||
<return type='xmlTextReaderPtr' info='the new reader or NULL in case of error.'/>
|
<return type='xmlTextReaderPtr' info='the new reader or NULL in case of error.'/>
|
||||||
<arg name='ioread' type='xmlInputReadCallback' info='an I/O read function'/>
|
<arg name='ioread' type='xmlInputReadCallback' info='an I/O read function'/>
|
||||||
<arg name='ioclose' type='xmlInputCloseCallback' info='an I/O close function'/>
|
<arg name='ioclose' type='xmlInputCloseCallback' info='an I/O close function'/>
|
||||||
@@ -9933,7 +9937,7 @@ actually an xmlCharEncoding'/>
|
|||||||
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
|
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
|
||||||
</function>
|
</function>
|
||||||
<function name='xmlReaderForMemory' file='xmlreader'>
|
<function name='xmlReaderForMemory' file='xmlreader'>
|
||||||
<info>Create an xmltextReader for an XML in-memory document.</info>
|
<info>Create an xmltextReader for an XML in-memory document. The parsing flags @options are a combination of xmlParserOption(s).</info>
|
||||||
<return type='xmlTextReaderPtr' info='the new reader or NULL in case of error.'/>
|
<return type='xmlTextReaderPtr' info='the new reader or NULL in case of error.'/>
|
||||||
<arg name='buffer' type='const char *' info='a pointer to a char array'/>
|
<arg name='buffer' type='const char *' info='a pointer to a char array'/>
|
||||||
<arg name='size' type='int' info='the size of the array'/>
|
<arg name='size' type='int' info='the size of the array'/>
|
||||||
@@ -9942,7 +9946,7 @@ actually an xmlCharEncoding'/>
|
|||||||
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
|
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
|
||||||
</function>
|
</function>
|
||||||
<function name='xmlReaderNewDoc' file='xmlreader'>
|
<function name='xmlReaderNewDoc' file='xmlreader'>
|
||||||
<info>Setup an xmltextReader to parse an XML in-memory document. This reuses the existing @reader xmlTextReader.</info>
|
<info>Setup an xmltextReader to parse an XML in-memory document. The parsing flags @options are a combination of xmlParserOption(s). This reuses the existing @reader xmlTextReader.</info>
|
||||||
<return type='int' info='0 in case of success and -1 in case of error'/>
|
<return type='int' info='0 in case of success and -1 in case of error'/>
|
||||||
<arg name='reader' type='xmlTextReaderPtr' info='an XML reader'/>
|
<arg name='reader' type='xmlTextReaderPtr' info='an XML reader'/>
|
||||||
<arg name='cur' type='const xmlChar *' info='a pointer to a zero terminated string'/>
|
<arg name='cur' type='const xmlChar *' info='a pointer to a zero terminated string'/>
|
||||||
@@ -9951,7 +9955,7 @@ actually an xmlCharEncoding'/>
|
|||||||
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
|
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
|
||||||
</function>
|
</function>
|
||||||
<function name='xmlReaderNewFd' file='xmlreader'>
|
<function name='xmlReaderNewFd' file='xmlreader'>
|
||||||
<info>Setup an xmltextReader to parse an XML from a file descriptor. This reuses the existing @reader xmlTextReader.</info>
|
<info>Setup an xmltextReader to parse an XML from a file descriptor. The parsing flags @options are a combination of xmlParserOption(s). This reuses the existing @reader xmlTextReader.</info>
|
||||||
<return type='int' info='0 in case of success and -1 in case of error'/>
|
<return type='int' info='0 in case of success and -1 in case of error'/>
|
||||||
<arg name='reader' type='xmlTextReaderPtr' info='an XML reader'/>
|
<arg name='reader' type='xmlTextReaderPtr' info='an XML reader'/>
|
||||||
<arg name='fd' type='int' info='an open file descriptor'/>
|
<arg name='fd' type='int' info='an open file descriptor'/>
|
||||||
@@ -9960,7 +9964,7 @@ actually an xmlCharEncoding'/>
|
|||||||
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
|
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
|
||||||
</function>
|
</function>
|
||||||
<function name='xmlReaderNewFile' file='xmlreader'>
|
<function name='xmlReaderNewFile' file='xmlreader'>
|
||||||
<info>parse an XML file from the filesystem or the network. This reuses the existing @reader xmlTextReader.</info>
|
<info>parse an XML file from the filesystem or the network. The parsing flags @options are a combination of xmlParserOption(s). This reuses the existing @reader xmlTextReader.</info>
|
||||||
<return type='int' info='0 in case of success and -1 in case of error'/>
|
<return type='int' info='0 in case of success and -1 in case of error'/>
|
||||||
<arg name='reader' type='xmlTextReaderPtr' info='an XML reader'/>
|
<arg name='reader' type='xmlTextReaderPtr' info='an XML reader'/>
|
||||||
<arg name='filename' type='const char *' info='a file or URL'/>
|
<arg name='filename' type='const char *' info='a file or URL'/>
|
||||||
@@ -9968,7 +9972,7 @@ actually an xmlCharEncoding'/>
|
|||||||
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
|
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
|
||||||
</function>
|
</function>
|
||||||
<function name='xmlReaderNewIO' file='xmlreader'>
|
<function name='xmlReaderNewIO' file='xmlreader'>
|
||||||
<info>Setup an xmltextReader to parse an XML document from I/O functions and source. This reuses the existing @reader xmlTextReader.</info>
|
<info>Setup an xmltextReader to parse an XML document from I/O functions and source. The parsing flags @options are a combination of xmlParserOption(s). This reuses the existing @reader xmlTextReader.</info>
|
||||||
<return type='int' info='0 in case of success and -1 in case of error'/>
|
<return type='int' info='0 in case of success and -1 in case of error'/>
|
||||||
<arg name='reader' type='xmlTextReaderPtr' info='an XML reader'/>
|
<arg name='reader' type='xmlTextReaderPtr' info='an XML reader'/>
|
||||||
<arg name='ioread' type='xmlInputReadCallback' info='an I/O read function'/>
|
<arg name='ioread' type='xmlInputReadCallback' info='an I/O read function'/>
|
||||||
@@ -9979,7 +9983,7 @@ actually an xmlCharEncoding'/>
|
|||||||
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
|
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
|
||||||
</function>
|
</function>
|
||||||
<function name='xmlReaderNewMemory' file='xmlreader'>
|
<function name='xmlReaderNewMemory' file='xmlreader'>
|
||||||
<info>Setup an xmltextReader to parse an XML in-memory document. This reuses the existing @reader xmlTextReader.</info>
|
<info>Setup an xmltextReader to parse an XML in-memory document. The parsing flags @options are a combination of xmlParserOption(s). This reuses the existing @reader xmlTextReader.</info>
|
||||||
<return type='int' info='0 in case of success and -1 in case of error'/>
|
<return type='int' info='0 in case of success and -1 in case of error'/>
|
||||||
<arg name='reader' type='xmlTextReaderPtr' info='an XML reader'/>
|
<arg name='reader' type='xmlTextReaderPtr' info='an XML reader'/>
|
||||||
<arg name='buffer' type='const char *' info='a pointer to a char array'/>
|
<arg name='buffer' type='const char *' info='a pointer to a char array'/>
|
||||||
@@ -9988,6 +9992,17 @@ actually an xmlCharEncoding'/>
|
|||||||
<arg name='encoding' type='const char *' info='the document encoding, or NULL'/>
|
<arg name='encoding' type='const char *' info='the document encoding, or NULL'/>
|
||||||
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
|
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
|
||||||
</function>
|
</function>
|
||||||
|
<function name='xmlReaderNewWalker' file='xmlreader'>
|
||||||
|
<info>Setup an xmltextReader to parse a preparsed XML document. This reuses the existing @reader xmlTextReader.</info>
|
||||||
|
<return type='int' info='0 in case of success and -1 in case of error'/>
|
||||||
|
<arg name='reader' type='xmlTextReaderPtr' info='an XML reader'/>
|
||||||
|
<arg name='doc' type='xmlDocPtr' info='a preparsed document'/>
|
||||||
|
</function>
|
||||||
|
<function name='xmlReaderWalker' file='xmlreader'>
|
||||||
|
<info>Create an xmltextReader for a preparsed document.</info>
|
||||||
|
<return type='xmlTextReaderPtr' info='the new reader or NULL in case of error.'/>
|
||||||
|
<arg name='doc' type='xmlDocPtr' info='a preparsed document'/>
|
||||||
|
</function>
|
||||||
<functype name='xmlReallocFunc' file='xmlmemory'>
|
<functype name='xmlReallocFunc' file='xmlmemory'>
|
||||||
<info>Signature for a realloc() implementation.</info>
|
<info>Signature for a realloc() implementation.</info>
|
||||||
<return type='void *' info='a pointer to the newly reallocated block or NULL in case of error.'/>
|
<return type='void *' info='a pointer to the newly reallocated block or NULL in case of error.'/>
|
||||||
@@ -11335,6 +11350,11 @@ actually an xmlCharEncoding'/>
|
|||||||
<arg name='reader' type='xmlTextReaderPtr' info='the xmlTextReaderPtr used'/>
|
<arg name='reader' type='xmlTextReaderPtr' info='the xmlTextReaderPtr used'/>
|
||||||
<arg name='str' type='const xmlChar *' info='the string to intern.'/>
|
<arg name='str' type='const xmlChar *' info='the string to intern.'/>
|
||||||
</function>
|
</function>
|
||||||
|
<function name='xmlTextReaderConstValue' file='xmlreader'>
|
||||||
|
<info>Provides the text value of the node if present</info>
|
||||||
|
<return type='const xmlChar *' info='the string or NULL if not available. The result will be deallocated on the next Read() operation.'/>
|
||||||
|
<arg name='reader' type='xmlTextReaderPtr' info='the xmlTextReaderPtr used'/>
|
||||||
|
</function>
|
||||||
<function name='xmlTextReaderConstXmlLang' file='xmlreader'>
|
<function name='xmlTextReaderConstXmlLang' file='xmlreader'>
|
||||||
<info>The xml:lang scope within which the node resides.</info>
|
<info>The xml:lang scope within which the node resides.</info>
|
||||||
<return type='const xmlChar *' info='the xml:lang value or NULL if none exists.'/>
|
<return type='const xmlChar *' info='the xml:lang value or NULL if none exists.'/>
|
||||||
@@ -11500,6 +11520,11 @@ actually an xmlCharEncoding'/>
|
|||||||
<return type='int' info='1 if the node was read successfully, 0 if there is no more nodes to read, or -1 in case of error'/>
|
<return type='int' info='1 if the node was read successfully, 0 if there is no more nodes to read, or -1 in case of error'/>
|
||||||
<arg name='reader' type='xmlTextReaderPtr' info='the xmlTextReaderPtr used'/>
|
<arg name='reader' type='xmlTextReaderPtr' info='the xmlTextReaderPtr used'/>
|
||||||
</function>
|
</function>
|
||||||
|
<function name='xmlTextReaderNextSibling' file='xmlreader'>
|
||||||
|
<info></info>
|
||||||
|
<return type='int' info=''/>
|
||||||
|
<arg name='reader' type='xmlTextReaderPtr' info=''/>
|
||||||
|
</function>
|
||||||
<function name='xmlTextReaderNodeType' file='xmlreader'>
|
<function name='xmlTextReaderNodeType' file='xmlreader'>
|
||||||
<info>Get the node type of the current node Reference: http://dotgnu.org/pnetlib-doc/System/Xml/XmlNodeType.html</info>
|
<info>Get the node type of the current node Reference: http://dotgnu.org/pnetlib-doc/System/Xml/XmlNodeType.html</info>
|
||||||
<return type='int' info='the xmlNodeType of the current node or -1 in case of error'/>
|
<return type='int' info='the xmlNodeType of the current node or -1 in case of error'/>
|
||||||
@@ -11583,7 +11608,7 @@ actually an xmlCharEncoding'/>
|
|||||||
</function>
|
</function>
|
||||||
<function name='xmlTextReaderValue' file='xmlreader'>
|
<function name='xmlTextReaderValue' file='xmlreader'>
|
||||||
<info>Provides the text value of the node if present</info>
|
<info>Provides the text value of the node if present</info>
|
||||||
<return type='xmlChar *' info='the string or NULL if not available. The retsult must be deallocated with xmlFree()'/>
|
<return type='xmlChar *' info='the string or NULL if not available. The result must be deallocated with xmlFree()'/>
|
||||||
<arg name='reader' type='xmlTextReaderPtr' info='the xmlTextReaderPtr used'/>
|
<arg name='reader' type='xmlTextReaderPtr' info='the xmlTextReaderPtr used'/>
|
||||||
</function>
|
</function>
|
||||||
<function name='xmlTextReaderXmlLang' file='xmlreader'>
|
<function name='xmlTextReaderXmlLang' file='xmlreader'>
|
||||||
|
@@ -43,7 +43,6 @@ xmlinc_HEADERS = \
|
|||||||
dict.h \
|
dict.h \
|
||||||
SAX2.h \
|
SAX2.h \
|
||||||
xmlexports.h \
|
xmlexports.h \
|
||||||
xmldwalk.h \
|
|
||||||
chvalid.h
|
chvalid.h
|
||||||
|
|
||||||
install-exec-hook:
|
install-exec-hook:
|
||||||
|
@@ -1,116 +0,0 @@
|
|||||||
/*
|
|
||||||
* xmldwalk.h : Interfaces, constants and types of the document traversing API.for XML
|
|
||||||
*
|
|
||||||
* this is heavily based upon the xmlTextReader streaming node API
|
|
||||||
* of libxml2 by Daniel Veillard (daniel@veillard.com). In fact I
|
|
||||||
* just copied and modified xmlreader.h
|
|
||||||
*
|
|
||||||
* So for license and disclaimer see the license and disclaimer of
|
|
||||||
* libxml2.
|
|
||||||
*
|
|
||||||
* alfred@mickautsch.de
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __XML_XMLDWALK_H__
|
|
||||||
#define __XML_XMLDWALK_H__
|
|
||||||
|
|
||||||
#include <libxml/xmlversion.h>
|
|
||||||
#include <libxml/tree.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
XML_DWALK_NONE = 0,
|
|
||||||
XML_DWALK_START,
|
|
||||||
XML_DWALK_BACKTRACK,
|
|
||||||
XML_DWALK_END
|
|
||||||
} xmlDocWalkerState;
|
|
||||||
|
|
||||||
typedef struct _xmlDocWalker xmlDocWalker;
|
|
||||||
typedef xmlDocWalker *xmlDocWalkerPtr;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Constructor & Destructor
|
|
||||||
*/
|
|
||||||
XMLPUBFUN xmlDocWalkerPtr XMLCALL
|
|
||||||
xmlNewDocWalker (xmlDocPtr doc);
|
|
||||||
XMLPUBFUN void XMLCALL
|
|
||||||
xmlFreeDocWalker (xmlDocWalkerPtr iter);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Iterator Functions
|
|
||||||
*/
|
|
||||||
XMLPUBFUN int XMLCALL
|
|
||||||
xmlDocWalkerRewind (xmlDocWalkerPtr iter);
|
|
||||||
XMLPUBFUN int XMLCALL
|
|
||||||
xmlDocWalkerStep (xmlDocWalkerPtr iter);
|
|
||||||
|
|
||||||
XMLPUBFUN int XMLCALL
|
|
||||||
xmlDocWalkerAttributeCount (xmlDocWalkerPtr iter);
|
|
||||||
XMLPUBFUN int XMLCALL
|
|
||||||
xmlDocWalkerDepth (xmlDocWalkerPtr iter);
|
|
||||||
XMLPUBFUN int XMLCALL
|
|
||||||
xmlDocWalkerHasAttributes (xmlDocWalkerPtr iter);
|
|
||||||
XMLPUBFUN int XMLCALL
|
|
||||||
xmlDocWalkerHasValue (xmlDocWalkerPtr iter);
|
|
||||||
XMLPUBFUN int XMLCALL
|
|
||||||
xmlDocWalkerIsEmptyElement (xmlDocWalkerPtr iter);
|
|
||||||
XMLPUBFUN xmlChar * XMLCALL
|
|
||||||
xmlDocWalkerLocalName (xmlDocWalkerPtr iter);
|
|
||||||
XMLPUBFUN xmlChar * XMLCALL
|
|
||||||
xmlDocWalkerName (xmlDocWalkerPtr iter);
|
|
||||||
XMLPUBFUN int XMLCALL
|
|
||||||
xmlDocWalkerNodeType (xmlDocWalkerPtr iter);
|
|
||||||
XMLPUBFUN xmlChar * XMLCALL
|
|
||||||
xmlDocWalkerPrefix (xmlDocWalkerPtr iter);
|
|
||||||
XMLPUBFUN xmlChar * XMLCALL
|
|
||||||
xmlDocWalkerNamespaceUri (xmlDocWalkerPtr iter);
|
|
||||||
XMLPUBFUN xmlChar * XMLCALL
|
|
||||||
xmlDocWalkerBaseUri (xmlDocWalkerPtr iter);
|
|
||||||
XMLPUBFUN xmlChar * XMLCALL
|
|
||||||
xmlDocWalkerValue (xmlDocWalkerPtr iter);
|
|
||||||
|
|
||||||
XMLPUBFUN xmlChar * XMLCALL
|
|
||||||
xmlDocWalkerGetAttributeNo (xmlDocWalkerPtr iter,
|
|
||||||
int no);
|
|
||||||
XMLPUBFUN xmlChar * XMLCALL
|
|
||||||
xmlDocWalkerGetAttribute (xmlDocWalkerPtr iter,
|
|
||||||
const xmlChar *name);
|
|
||||||
XMLPUBFUN xmlChar * XMLCALL
|
|
||||||
xmlDocWalkerGetAttributeNs (xmlDocWalkerPtr iter,
|
|
||||||
const xmlChar *localName,
|
|
||||||
const xmlChar *namespaceURI);
|
|
||||||
XMLPUBFUN xmlChar * XMLCALL
|
|
||||||
xmlDocWalkerLookupNamespace (xmlDocWalkerPtr iter,
|
|
||||||
const xmlChar *prefix);
|
|
||||||
XMLPUBFUN int XMLCALL
|
|
||||||
xmlDocWalkerMoveToAttributeNo (xmlDocWalkerPtr iter,
|
|
||||||
int no);
|
|
||||||
XMLPUBFUN int XMLCALL
|
|
||||||
xmlDocWalkerMoveToAttribute (xmlDocWalkerPtr iter,
|
|
||||||
const xmlChar *name);
|
|
||||||
XMLPUBFUN int XMLCALL
|
|
||||||
xmlDocWalkerMoveToAttributeNs (xmlDocWalkerPtr iter,
|
|
||||||
const xmlChar *localName,
|
|
||||||
const xmlChar *namespaceURI);
|
|
||||||
XMLPUBFUN int XMLCALL
|
|
||||||
xmlDocWalkerMoveToFirstAttribute(xmlDocWalkerPtr iter);
|
|
||||||
XMLPUBFUN int XMLCALL
|
|
||||||
xmlDocWalkerMoveToNextAttribute (xmlDocWalkerPtr iter);
|
|
||||||
XMLPUBFUN int XMLCALL
|
|
||||||
xmlDocWalkerMoveToElement (xmlDocWalkerPtr iter);
|
|
||||||
|
|
||||||
xmlNodePtr
|
|
||||||
xmlDocWalkerCurrentNode (xmlDocWalkerPtr iter);
|
|
||||||
xmlDocPtr
|
|
||||||
xmlDocWalkerCurrentDoc (xmlDocWalkerPtr iter);
|
|
||||||
XMLPUBFUN int XMLCALL
|
|
||||||
xmlDocWalkerNext (xmlDocWalkerPtr iter);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __XML_XMLDWALK_H__ */
|
|
@@ -104,20 +104,6 @@ XMLPUBFUN int XMLCALL
|
|||||||
xmlTextReaderQuoteChar (xmlTextReaderPtr reader);
|
xmlTextReaderQuoteChar (xmlTextReaderPtr reader);
|
||||||
XMLPUBFUN int XMLCALL
|
XMLPUBFUN int XMLCALL
|
||||||
xmlTextReaderReadState (xmlTextReaderPtr reader);
|
xmlTextReaderReadState (xmlTextReaderPtr reader);
|
||||||
XMLPUBFUN xmlChar * XMLCALL
|
|
||||||
xmlTextReaderBaseUri (xmlTextReaderPtr reader);
|
|
||||||
XMLPUBFUN xmlChar * XMLCALL
|
|
||||||
xmlTextReaderLocalName (xmlTextReaderPtr reader);
|
|
||||||
XMLPUBFUN xmlChar * XMLCALL
|
|
||||||
xmlTextReaderName (xmlTextReaderPtr reader);
|
|
||||||
XMLPUBFUN xmlChar * XMLCALL
|
|
||||||
xmlTextReaderNamespaceUri(xmlTextReaderPtr reader);
|
|
||||||
XMLPUBFUN xmlChar * XMLCALL
|
|
||||||
xmlTextReaderPrefix (xmlTextReaderPtr reader);
|
|
||||||
XMLPUBFUN xmlChar * XMLCALL
|
|
||||||
xmlTextReaderXmlLang (xmlTextReaderPtr reader);
|
|
||||||
XMLPUBFUN xmlChar * XMLCALL
|
|
||||||
xmlTextReaderValue (xmlTextReaderPtr reader);
|
|
||||||
|
|
||||||
XMLPUBFUN const xmlChar * XMLCALL
|
XMLPUBFUN const xmlChar * XMLCALL
|
||||||
xmlTextReaderConstBaseUri (xmlTextReaderPtr reader);
|
xmlTextReaderConstBaseUri (xmlTextReaderPtr reader);
|
||||||
@@ -134,6 +120,27 @@ XMLPUBFUN const xmlChar * XMLCALL
|
|||||||
XMLPUBFUN const xmlChar * XMLCALL
|
XMLPUBFUN const xmlChar * XMLCALL
|
||||||
xmlTextReaderConstString (xmlTextReaderPtr reader,
|
xmlTextReaderConstString (xmlTextReaderPtr reader,
|
||||||
const xmlChar *str);
|
const xmlChar *str);
|
||||||
|
XMLPUBFUN const xmlChar * XMLCALL
|
||||||
|
xmlTextReaderConstValue (xmlTextReaderPtr reader);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* use the Const version of the routine for
|
||||||
|
* better performance and simpler code
|
||||||
|
*/
|
||||||
|
XMLPUBFUN xmlChar * XMLCALL
|
||||||
|
xmlTextReaderBaseUri (xmlTextReaderPtr reader);
|
||||||
|
XMLPUBFUN xmlChar * XMLCALL
|
||||||
|
xmlTextReaderLocalName (xmlTextReaderPtr reader);
|
||||||
|
XMLPUBFUN xmlChar * XMLCALL
|
||||||
|
xmlTextReaderName (xmlTextReaderPtr reader);
|
||||||
|
XMLPUBFUN xmlChar * XMLCALL
|
||||||
|
xmlTextReaderNamespaceUri(xmlTextReaderPtr reader);
|
||||||
|
XMLPUBFUN xmlChar * XMLCALL
|
||||||
|
xmlTextReaderPrefix (xmlTextReaderPtr reader);
|
||||||
|
XMLPUBFUN xmlChar * XMLCALL
|
||||||
|
xmlTextReaderXmlLang (xmlTextReaderPtr reader);
|
||||||
|
XMLPUBFUN xmlChar * XMLCALL
|
||||||
|
xmlTextReaderValue (xmlTextReaderPtr reader);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Methods of the XmlTextReader
|
* Methods of the XmlTextReader
|
||||||
@@ -194,6 +201,8 @@ XMLPUBFUN xmlNodePtr XMLCALL
|
|||||||
xmlTextReaderExpand (xmlTextReaderPtr reader);
|
xmlTextReaderExpand (xmlTextReaderPtr reader);
|
||||||
XMLPUBFUN int XMLCALL
|
XMLPUBFUN int XMLCALL
|
||||||
xmlTextReaderNext (xmlTextReaderPtr reader);
|
xmlTextReaderNext (xmlTextReaderPtr reader);
|
||||||
|
XMLPUBFUN int XMLCALL
|
||||||
|
xmlTextReaderNextSibling (xmlTextReaderPtr reader);
|
||||||
XMLPUBFUN int XMLCALL
|
XMLPUBFUN int XMLCALL
|
||||||
xmlTextReaderIsValid (xmlTextReaderPtr reader);
|
xmlTextReaderIsValid (xmlTextReaderPtr reader);
|
||||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||||
@@ -208,6 +217,8 @@ XMLPUBFUN int XMLCALL
|
|||||||
/*
|
/*
|
||||||
* New more complete APIs for simpler creation and reuse of readers
|
* New more complete APIs for simpler creation and reuse of readers
|
||||||
*/
|
*/
|
||||||
|
XMLPUBFUN xmlTextReaderPtr XMLCALL
|
||||||
|
xmlReaderWalker (xmlDocPtr doc);
|
||||||
XMLPUBFUN xmlTextReaderPtr XMLCALL
|
XMLPUBFUN xmlTextReaderPtr XMLCALL
|
||||||
xmlReaderForDoc (const xmlChar * cur,
|
xmlReaderForDoc (const xmlChar * cur,
|
||||||
const char *URL,
|
const char *URL,
|
||||||
@@ -236,6 +247,9 @@ XMLPUBFUN xmlTextReaderPtr XMLCALL
|
|||||||
const char *encoding,
|
const char *encoding,
|
||||||
int options);
|
int options);
|
||||||
|
|
||||||
|
XMLPUBFUN int XMLCALL
|
||||||
|
xmlReaderNewWalker (xmlTextReaderPtr reader,
|
||||||
|
xmlDocPtr doc);
|
||||||
XMLPUBFUN int XMLCALL
|
XMLPUBFUN int XMLCALL
|
||||||
xmlReaderNewDoc (xmlTextReaderPtr reader,
|
xmlReaderNewDoc (xmlTextReaderPtr reader,
|
||||||
const xmlChar * cur,
|
const xmlChar * cur,
|
||||||
|
@@ -128,15 +128,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
|||||||
#define LIBXML_SAX1_ENABLED
|
#define LIBXML_SAX1_ENABLED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* LIBXML_WALKER_ENABLED:
|
|
||||||
*
|
|
||||||
* Whether the xmlDocWalker interface is configured in
|
|
||||||
*/
|
|
||||||
#if @WITH_WALKER@
|
|
||||||
#define LIBXML_WALKER_ENABLED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LIBXML_FTP_ENABLED:
|
* LIBXML_FTP_ENABLED:
|
||||||
*
|
*
|
||||||
|
3
parser.c
3
parser.c
@@ -9241,7 +9241,8 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ctxt->input->cur - ctxt->input->base > 4096) {
|
if ((ctxt->input != NULL) &&
|
||||||
|
(ctxt->input->cur - ctxt->input->base > 4096)) {
|
||||||
xmlSHRINK(ctxt);
|
xmlSHRINK(ctxt);
|
||||||
ctxt->checkIndex = 0;
|
ctxt->checkIndex = 0;
|
||||||
}
|
}
|
||||||
|
@@ -303,6 +303,24 @@ def skip_function(name):
|
|||||||
# the next function is defined in libxml.c
|
# the next function is defined in libxml.c
|
||||||
if name == "xmlRelaxNGFreeValidCtxt":
|
if name == "xmlRelaxNGFreeValidCtxt":
|
||||||
return 1
|
return 1
|
||||||
|
#
|
||||||
|
# Those are skipped because the Const version is used of the bindings
|
||||||
|
# instead.
|
||||||
|
#
|
||||||
|
if name == "xmlTextReaderBaseUri":
|
||||||
|
return 1
|
||||||
|
if name == "xmlTextReaderLocalName":
|
||||||
|
return 1
|
||||||
|
if name == "xmlTextReaderName":
|
||||||
|
return 1
|
||||||
|
if name == "xmlTextReaderNamespaceUri":
|
||||||
|
return 1
|
||||||
|
if name == "xmlTextReaderPrefix":
|
||||||
|
return 1
|
||||||
|
if name == "xmlTextReaderXmlLang":
|
||||||
|
return 1
|
||||||
|
if name == "xmlTextReaderValue":
|
||||||
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def print_function_wrapper(name, output, export, include):
|
def print_function_wrapper(name, output, export, include):
|
||||||
@@ -718,8 +736,12 @@ def nameFixup(name, classe, type, file):
|
|||||||
func = "regexp" + name[6:]
|
func = "regexp" + name[6:]
|
||||||
elif name[0:20] == "xmlTextReaderLocator" and file == "xmlreader":
|
elif name[0:20] == "xmlTextReaderLocator" and file == "xmlreader":
|
||||||
func = name[20:]
|
func = name[20:]
|
||||||
|
elif name[0:18] == "xmlTextReaderConst" and file == "xmlreader":
|
||||||
|
func = name[18:]
|
||||||
elif name[0:13] == "xmlTextReader" and file == "xmlreader":
|
elif name[0:13] == "xmlTextReader" and file == "xmlreader":
|
||||||
func = name[13:]
|
func = name[13:]
|
||||||
|
elif name[0:12] == "xmlReaderNew" and file == "xmlreader":
|
||||||
|
func = name[9:]
|
||||||
elif name[0:11] == "xmlACatalog":
|
elif name[0:11] == "xmlACatalog":
|
||||||
func = name[11:]
|
func = name[11:]
|
||||||
func = string.lower(func[0:1]) + func[1:]
|
func = string.lower(func[0:1]) + func[1:]
|
||||||
|
@@ -584,6 +584,10 @@ Class xmlDoc(xmlNode)
|
|||||||
# functions from module xinclude
|
# functions from module xinclude
|
||||||
xincludeProcess()
|
xincludeProcess()
|
||||||
|
|
||||||
|
# functions from module xmlreader
|
||||||
|
NewWalker()
|
||||||
|
readerWalker()
|
||||||
|
|
||||||
# functions from module xpath
|
# functions from module xpath
|
||||||
xpathNewContext()
|
xpathNewContext()
|
||||||
xpathOrderDocElems()
|
xpathOrderDocElems()
|
||||||
@@ -667,13 +671,6 @@ Class xmlTextReader(xmlTextReaderCore)
|
|||||||
AttributeCount()
|
AttributeCount()
|
||||||
BaseUri()
|
BaseUri()
|
||||||
Close()
|
Close()
|
||||||
ConstBaseUri()
|
|
||||||
ConstLocalName()
|
|
||||||
ConstName()
|
|
||||||
ConstNamespaceUri()
|
|
||||||
ConstPrefix()
|
|
||||||
ConstString()
|
|
||||||
ConstXmlLang()
|
|
||||||
CurrentDoc()
|
CurrentDoc()
|
||||||
CurrentNode()
|
CurrentNode()
|
||||||
Depth()
|
Depth()
|
||||||
@@ -698,7 +695,13 @@ Class xmlTextReader(xmlTextReaderCore)
|
|||||||
MoveToNextAttribute()
|
MoveToNextAttribute()
|
||||||
Name()
|
Name()
|
||||||
NamespaceUri()
|
NamespaceUri()
|
||||||
|
NewDoc()
|
||||||
|
NewFd()
|
||||||
|
NewFile()
|
||||||
|
NewMemory()
|
||||||
|
NewWalker()
|
||||||
Next()
|
Next()
|
||||||
|
NextSibling()
|
||||||
NodeType()
|
NodeType()
|
||||||
Normalization()
|
Normalization()
|
||||||
Prefix()
|
Prefix()
|
||||||
@@ -713,12 +716,9 @@ Class xmlTextReader(xmlTextReaderCore)
|
|||||||
RelaxNGSetSchema()
|
RelaxNGSetSchema()
|
||||||
RelaxNGValidate()
|
RelaxNGValidate()
|
||||||
SetParserProp()
|
SetParserProp()
|
||||||
|
String()
|
||||||
Value()
|
Value()
|
||||||
XmlLang()
|
XmlLang()
|
||||||
readerNewDoc()
|
|
||||||
readerNewFd()
|
|
||||||
readerNewFile()
|
|
||||||
readerNewMemory()
|
|
||||||
Class xmlReg()
|
Class xmlReg()
|
||||||
|
|
||||||
# functions from module xmlregexp
|
# functions from module xmlregexp
|
||||||
|
@@ -26,6 +26,8 @@ PYTESTS= \
|
|||||||
reader4.py \
|
reader4.py \
|
||||||
reader5.py \
|
reader5.py \
|
||||||
reader6.py \
|
reader6.py \
|
||||||
|
reader7.py \
|
||||||
|
walker.py \
|
||||||
ctxterror.py\
|
ctxterror.py\
|
||||||
readererr.py\
|
readererr.py\
|
||||||
relaxng.py \
|
relaxng.py \
|
||||||
|
102
python/tests/reader7.py
Executable file
102
python/tests/reader7.py
Executable file
@@ -0,0 +1,102 @@
|
|||||||
|
#!/usr/bin/python -u
|
||||||
|
#
|
||||||
|
# this tests the entities substitutions with the XmlTextReader interface
|
||||||
|
#
|
||||||
|
import sys
|
||||||
|
import StringIO
|
||||||
|
import libxml2
|
||||||
|
|
||||||
|
# Memory debug specific
|
||||||
|
libxml2.debugMemory(1)
|
||||||
|
|
||||||
|
result = ""
|
||||||
|
def processNode(reader):
|
||||||
|
global result
|
||||||
|
|
||||||
|
result = result + "%d %d %s %d\n" % (reader.Depth(), reader.NodeType(),
|
||||||
|
reader.Name(), reader.IsEmptyElement())
|
||||||
|
|
||||||
|
#
|
||||||
|
# Parse a document testing the readerForxxx API
|
||||||
|
#
|
||||||
|
docstr="""<foo>
|
||||||
|
<label>some text</label>
|
||||||
|
<item>100</item>
|
||||||
|
</foo>"""
|
||||||
|
expect="""0 1 foo 0
|
||||||
|
1 14 #text 0
|
||||||
|
1 1 label 0
|
||||||
|
2 3 #text 0
|
||||||
|
1 15 label 0
|
||||||
|
1 14 #text 0
|
||||||
|
1 1 item 0
|
||||||
|
2 3 #text 0
|
||||||
|
1 15 item 0
|
||||||
|
1 14 #text 0
|
||||||
|
0 15 foo 0
|
||||||
|
"""
|
||||||
|
result = ""
|
||||||
|
|
||||||
|
reader = libxml2.readerForDoc(docstr, "test1", None, 0)
|
||||||
|
ret = reader.Read()
|
||||||
|
while ret == 1:
|
||||||
|
processNode(reader)
|
||||||
|
ret = reader.Read()
|
||||||
|
|
||||||
|
if ret != 0:
|
||||||
|
print "Error parsing the document test1"
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if result != expect:
|
||||||
|
print "Unexpected result for test1"
|
||||||
|
print result
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Reuse the reader for another document testing the ReaderNewxxx API
|
||||||
|
#
|
||||||
|
docstr="""<foo>
|
||||||
|
<label>some text</label>
|
||||||
|
<item>1000</item>
|
||||||
|
</foo>"""
|
||||||
|
expect="""0 1 foo 0
|
||||||
|
1 14 #text 0
|
||||||
|
1 1 label 0
|
||||||
|
2 3 #text 0
|
||||||
|
1 15 label 0
|
||||||
|
1 14 #text 0
|
||||||
|
1 1 item 0
|
||||||
|
2 3 #text 0
|
||||||
|
1 15 item 0
|
||||||
|
1 14 #text 0
|
||||||
|
0 15 foo 0
|
||||||
|
"""
|
||||||
|
result = ""
|
||||||
|
|
||||||
|
reader.NewDoc(docstr, "test2", None, 0)
|
||||||
|
ret = reader.Read()
|
||||||
|
while ret == 1:
|
||||||
|
processNode(reader)
|
||||||
|
ret = reader.Read()
|
||||||
|
|
||||||
|
if ret != 0:
|
||||||
|
print "Error parsing the document test2"
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if result != expect:
|
||||||
|
print "Unexpected result for test2"
|
||||||
|
print result
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
#
|
||||||
|
# cleanup
|
||||||
|
#
|
||||||
|
del reader
|
||||||
|
|
||||||
|
# Memory debug specific
|
||||||
|
libxml2.cleanupParser()
|
||||||
|
if libxml2.debugMemory(1) == 0:
|
||||||
|
print "OK"
|
||||||
|
else:
|
||||||
|
print "Memory leak %d bytes" % (libxml2.debugMemory(1))
|
||||||
|
libxml2.dumpMemory()
|
145
python/tests/walker.py
Executable file
145
python/tests/walker.py
Executable file
@@ -0,0 +1,145 @@
|
|||||||
|
#!/usr/bin/python -u
|
||||||
|
#
|
||||||
|
# this tests the entities substitutions with the XmlTextReader interface
|
||||||
|
#
|
||||||
|
import sys
|
||||||
|
import StringIO
|
||||||
|
import libxml2
|
||||||
|
|
||||||
|
# Memory debug specific
|
||||||
|
libxml2.debugMemory(1)
|
||||||
|
|
||||||
|
result = ""
|
||||||
|
def processNode(reader):
|
||||||
|
global result
|
||||||
|
|
||||||
|
result = result + "%d %d %s %d\n" % (reader.Depth(), reader.NodeType(),
|
||||||
|
reader.Name(), reader.IsEmptyElement())
|
||||||
|
|
||||||
|
#
|
||||||
|
# Parse a document testing the readerForxxx API
|
||||||
|
#
|
||||||
|
docstr="""<foo>
|
||||||
|
<label>some text</label>
|
||||||
|
<item>100</item>
|
||||||
|
</foo>"""
|
||||||
|
expect="""0 1 foo 0
|
||||||
|
1 14 #text 0
|
||||||
|
1 1 label 0
|
||||||
|
2 3 #text 0
|
||||||
|
1 15 label 0
|
||||||
|
1 14 #text 0
|
||||||
|
1 1 item 0
|
||||||
|
2 3 #text 0
|
||||||
|
1 15 item 0
|
||||||
|
1 14 #text 0
|
||||||
|
0 15 foo 0
|
||||||
|
"""
|
||||||
|
result = ""
|
||||||
|
|
||||||
|
doc = libxml2.parseDoc(docstr)
|
||||||
|
reader = doc.readerWalker();
|
||||||
|
ret = reader.Read()
|
||||||
|
while ret == 1:
|
||||||
|
processNode(reader)
|
||||||
|
ret = reader.Read()
|
||||||
|
|
||||||
|
if ret != 0:
|
||||||
|
print "Error parsing the document test1"
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if result != expect:
|
||||||
|
print "Unexpected result for test1"
|
||||||
|
print result
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
doc.freeDoc()
|
||||||
|
|
||||||
|
#
|
||||||
|
# Reuse the reader for another document testing the ReaderNewWalker API
|
||||||
|
#
|
||||||
|
docstr="""<foo>
|
||||||
|
<label>some text</label>
|
||||||
|
<item>1000</item>
|
||||||
|
</foo>"""
|
||||||
|
expect="""0 1 foo 0
|
||||||
|
1 14 #text 0
|
||||||
|
1 1 label 0
|
||||||
|
2 3 #text 0
|
||||||
|
1 15 label 0
|
||||||
|
1 14 #text 0
|
||||||
|
1 1 item 0
|
||||||
|
2 3 #text 0
|
||||||
|
1 15 item 0
|
||||||
|
1 14 #text 0
|
||||||
|
0 15 foo 0
|
||||||
|
"""
|
||||||
|
result = ""
|
||||||
|
|
||||||
|
doc = libxml2.parseDoc(docstr)
|
||||||
|
reader.NewWalker(doc)
|
||||||
|
|
||||||
|
ret = reader.Read()
|
||||||
|
while ret == 1:
|
||||||
|
processNode(reader)
|
||||||
|
ret = reader.Read()
|
||||||
|
|
||||||
|
if ret != 0:
|
||||||
|
print "Error parsing the document test2"
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if result != expect:
|
||||||
|
print "Unexpected result for test2"
|
||||||
|
print result
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
doc.freeDoc()
|
||||||
|
|
||||||
|
#
|
||||||
|
# Reuse the reader for another document testing the ReaderNewxxx API
|
||||||
|
#
|
||||||
|
docstr="""<foo>
|
||||||
|
<label>some text</label>
|
||||||
|
<item>1000</item>
|
||||||
|
</foo>"""
|
||||||
|
expect="""0 1 foo 0
|
||||||
|
1 14 #text 0
|
||||||
|
1 1 label 0
|
||||||
|
2 3 #text 0
|
||||||
|
1 15 label 0
|
||||||
|
1 14 #text 0
|
||||||
|
1 1 item 0
|
||||||
|
2 3 #text 0
|
||||||
|
1 15 item 0
|
||||||
|
1 14 #text 0
|
||||||
|
0 15 foo 0
|
||||||
|
"""
|
||||||
|
result = ""
|
||||||
|
|
||||||
|
reader.NewDoc(docstr, "test3", None, 0)
|
||||||
|
ret = reader.Read()
|
||||||
|
while ret == 1:
|
||||||
|
processNode(reader)
|
||||||
|
ret = reader.Read()
|
||||||
|
|
||||||
|
if ret != 0:
|
||||||
|
print "Error parsing the document test3"
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if result != expect:
|
||||||
|
print "Unexpected result for test3"
|
||||||
|
print result
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
#
|
||||||
|
# cleanup
|
||||||
|
#
|
||||||
|
del reader
|
||||||
|
|
||||||
|
# Memory debug specific
|
||||||
|
libxml2.cleanupParser()
|
||||||
|
if libxml2.debugMemory(1) == 0:
|
||||||
|
print "OK"
|
||||||
|
else:
|
||||||
|
print "Memory leak %d bytes" % (libxml2.debugMemory(1))
|
||||||
|
libxml2.dumpMemory()
|
@@ -80,6 +80,13 @@ __xmlIndentTreeOutput
|
|||||||
#else
|
#else
|
||||||
xmlIndentTreeOutput DATA
|
xmlIndentTreeOutput DATA
|
||||||
#endif
|
#endif
|
||||||
|
xmlIsBaseCharGroup DATA
|
||||||
|
xmlIsCharGroup DATA
|
||||||
|
xmlIsCombiningGroup DATA
|
||||||
|
xmlIsDigitGroup DATA
|
||||||
|
xmlIsExtenderGroup DATA
|
||||||
|
xmlIsIdeographicGroup DATA
|
||||||
|
xmlIsPubidChar_tab DATA
|
||||||
#ifdef LIBXML_THREAD_ENABLED
|
#ifdef LIBXML_THREAD_ENABLED
|
||||||
__xmlKeepBlanksDefaultValue
|
__xmlKeepBlanksDefaultValue
|
||||||
#else
|
#else
|
||||||
@@ -619,9 +626,11 @@ xmlCharEncCloseFunc
|
|||||||
xmlCharEncFirstLine
|
xmlCharEncFirstLine
|
||||||
xmlCharEncInFunc
|
xmlCharEncInFunc
|
||||||
xmlCharEncOutFunc
|
xmlCharEncOutFunc
|
||||||
|
xmlCharInRange
|
||||||
xmlCharStrdup
|
xmlCharStrdup
|
||||||
xmlCharStrndup
|
xmlCharStrndup
|
||||||
xmlCheckFilename
|
xmlCheckFilename
|
||||||
|
xmlCheckHTTPInput
|
||||||
xmlCheckLanguageID
|
xmlCheckLanguageID
|
||||||
xmlCheckUTF8
|
xmlCheckUTF8
|
||||||
xmlCheckVersion
|
xmlCheckVersion
|
||||||
@@ -902,11 +911,19 @@ xmlInitializeCatalog
|
|||||||
#endif
|
#endif
|
||||||
xmlInitializeGlobalState
|
xmlInitializeGlobalState
|
||||||
xmlInitializePredefinedEntities
|
xmlInitializePredefinedEntities
|
||||||
|
xmlIsBaseChar
|
||||||
|
xmlIsBlank
|
||||||
xmlIsBlankNode
|
xmlIsBlankNode
|
||||||
|
xmlIsChar
|
||||||
|
xmlIsCombining
|
||||||
|
xmlIsDigit
|
||||||
|
xmlIsExtender
|
||||||
xmlIsID
|
xmlIsID
|
||||||
|
xmlIsIdeographic
|
||||||
xmlIsLetter
|
xmlIsLetter
|
||||||
xmlIsMainThread
|
xmlIsMainThread
|
||||||
xmlIsMixedElement
|
xmlIsMixedElement
|
||||||
|
xmlIsPubidChar
|
||||||
xmlIsRef
|
xmlIsRef
|
||||||
#ifdef LIBXML_HTML_ENABLED
|
#ifdef LIBXML_HTML_ENABLED
|
||||||
xmlIsXHTML
|
xmlIsXHTML
|
||||||
@@ -1059,6 +1076,9 @@ xmlNanoHTTPCleanup
|
|||||||
xmlNanoHTTPClose
|
xmlNanoHTTPClose
|
||||||
#endif
|
#endif
|
||||||
#ifdef LIBXML_HTTP_ENABLED
|
#ifdef LIBXML_HTTP_ENABLED
|
||||||
|
xmlNanoHTTPEncoding
|
||||||
|
#endif
|
||||||
|
#ifdef LIBXML_HTTP_ENABLED
|
||||||
xmlNanoHTTPFetch
|
xmlNanoHTTPFetch
|
||||||
#endif
|
#endif
|
||||||
#ifdef LIBXML_HTTP_ENABLED
|
#ifdef LIBXML_HTTP_ENABLED
|
||||||
@@ -1071,6 +1091,9 @@ xmlNanoHTTPMethod
|
|||||||
xmlNanoHTTPMethodRedir
|
xmlNanoHTTPMethodRedir
|
||||||
#endif
|
#endif
|
||||||
#ifdef LIBXML_HTTP_ENABLED
|
#ifdef LIBXML_HTTP_ENABLED
|
||||||
|
xmlNanoHTTPMimeType
|
||||||
|
#endif
|
||||||
|
#ifdef LIBXML_HTTP_ENABLED
|
||||||
xmlNanoHTTPOpen
|
xmlNanoHTTPOpen
|
||||||
#endif
|
#endif
|
||||||
#ifdef LIBXML_HTTP_ENABLED
|
#ifdef LIBXML_HTTP_ENABLED
|
||||||
@@ -1080,6 +1103,9 @@ xmlNanoHTTPOpenRedir
|
|||||||
xmlNanoHTTPRead
|
xmlNanoHTTPRead
|
||||||
#endif
|
#endif
|
||||||
#ifdef LIBXML_HTTP_ENABLED
|
#ifdef LIBXML_HTTP_ENABLED
|
||||||
|
xmlNanoHTTPRedir
|
||||||
|
#endif
|
||||||
|
#ifdef LIBXML_HTTP_ENABLED
|
||||||
xmlNanoHTTPReturnCode
|
xmlNanoHTTPReturnCode
|
||||||
#endif
|
#endif
|
||||||
#ifdef LIBXML_HTTP_ENABLED
|
#ifdef LIBXML_HTTP_ENABLED
|
||||||
@@ -1138,6 +1164,7 @@ xmlNextChar
|
|||||||
xmlNoNetExternalEntityLoader
|
xmlNoNetExternalEntityLoader
|
||||||
xmlNodeAddContent
|
xmlNodeAddContent
|
||||||
xmlNodeAddContentLen
|
xmlNodeAddContentLen
|
||||||
|
xmlNodeBufGetContent
|
||||||
xmlNodeDump
|
xmlNodeDump
|
||||||
xmlNodeDumpOutput
|
xmlNodeDumpOutput
|
||||||
xmlNodeGetBase
|
xmlNodeGetBase
|
||||||
@@ -1272,6 +1299,8 @@ xmlReaderNewFd
|
|||||||
xmlReaderNewFile
|
xmlReaderNewFile
|
||||||
xmlReaderNewIO
|
xmlReaderNewIO
|
||||||
xmlReaderNewMemory
|
xmlReaderNewMemory
|
||||||
|
xmlReaderNewWalker
|
||||||
|
xmlReaderWalker
|
||||||
#ifdef DEBUG_MEMORY_LOCATION
|
#ifdef DEBUG_MEMORY_LOCATION
|
||||||
xmlReallocLoc
|
xmlReallocLoc
|
||||||
#endif
|
#endif
|
||||||
@@ -1596,6 +1625,7 @@ xmlStrstr
|
|||||||
xmlStrsub
|
xmlStrsub
|
||||||
xmlSubstituteEntitiesDefault
|
xmlSubstituteEntitiesDefault
|
||||||
xmlSwitchEncoding
|
xmlSwitchEncoding
|
||||||
|
xmlSwitchInputEncoding
|
||||||
xmlSwitchToEncoding
|
xmlSwitchToEncoding
|
||||||
xmlTextConcat
|
xmlTextConcat
|
||||||
xmlTextMerge
|
xmlTextMerge
|
||||||
@@ -1608,6 +1638,7 @@ xmlTextReaderConstName
|
|||||||
xmlTextReaderConstNamespaceUri
|
xmlTextReaderConstNamespaceUri
|
||||||
xmlTextReaderConstPrefix
|
xmlTextReaderConstPrefix
|
||||||
xmlTextReaderConstString
|
xmlTextReaderConstString
|
||||||
|
xmlTextReaderConstValue
|
||||||
xmlTextReaderConstXmlLang
|
xmlTextReaderConstXmlLang
|
||||||
xmlTextReaderCurrentDoc
|
xmlTextReaderCurrentDoc
|
||||||
xmlTextReaderCurrentNode
|
xmlTextReaderCurrentNode
|
||||||
@@ -1637,6 +1668,7 @@ xmlTextReaderMoveToNextAttribute
|
|||||||
xmlTextReaderName
|
xmlTextReaderName
|
||||||
xmlTextReaderNamespaceUri
|
xmlTextReaderNamespaceUri
|
||||||
xmlTextReaderNext
|
xmlTextReaderNext
|
||||||
|
xmlTextReaderNextSibling
|
||||||
xmlTextReaderNodeType
|
xmlTextReaderNodeType
|
||||||
xmlTextReaderNormalization
|
xmlTextReaderNormalization
|
||||||
xmlTextReaderPrefix
|
xmlTextReaderPrefix
|
||||||
|
1197
xmldwalk.c
1197
xmldwalk.c
File diff suppressed because it is too large
Load Diff
15
xmllint.c
15
xmllint.c
@@ -599,13 +599,13 @@ static void myClose(FILE *f) {
|
|||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static void processNode(xmlTextReaderPtr reader) {
|
static void processNode(xmlTextReaderPtr reader) {
|
||||||
xmlChar *name, *value;
|
const xmlChar *name, *value;
|
||||||
|
|
||||||
name = xmlTextReaderName(reader);
|
name = xmlTextReaderConstName(reader);
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
name = xmlStrdup(BAD_CAST "--");
|
name = xmlStrdup(BAD_CAST "--");
|
||||||
|
|
||||||
value = xmlTextReaderValue(reader);
|
value = xmlTextReaderConstValue(reader);
|
||||||
|
|
||||||
printf("%d %d %s %d %d",
|
printf("%d %d %s %d %d",
|
||||||
xmlTextReaderDepth(reader),
|
xmlTextReaderDepth(reader),
|
||||||
@@ -613,12 +613,10 @@ static void processNode(xmlTextReaderPtr reader) {
|
|||||||
name,
|
name,
|
||||||
xmlTextReaderIsEmptyElement(reader),
|
xmlTextReaderIsEmptyElement(reader),
|
||||||
xmlTextReaderHasValue(reader));
|
xmlTextReaderHasValue(reader));
|
||||||
xmlFree(name);
|
|
||||||
if (value == NULL)
|
if (value == NULL)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
else {
|
else {
|
||||||
printf(" %s\n", value);
|
printf(" %s\n", value);
|
||||||
xmlFree(value);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1803,12 +1801,15 @@ main(int argc, char **argv) {
|
|||||||
if ((argv[i][0] != '-') || (strcmp(argv[i], "-") == 0)) {
|
if ((argv[i][0] != '-') || (strcmp(argv[i], "-") == 0)) {
|
||||||
if (repeat) {
|
if (repeat) {
|
||||||
xmlParserCtxtPtr ctxt = NULL;
|
xmlParserCtxtPtr ctxt = NULL;
|
||||||
|
#ifdef LIBXML_READER_ENABLED
|
||||||
|
xmlTextReaderPtr reader = NULL;
|
||||||
|
#endif /* LIBXML_READER_ENABLED */
|
||||||
|
|
||||||
for (acount = 0;acount < repeat;acount++) {
|
for (acount = 0;acount < repeat;acount++) {
|
||||||
#ifdef LIBXML_READER_ENABLED
|
#ifdef LIBXML_READER_ENABLED
|
||||||
if (stream != 0)
|
if (stream != 0) {
|
||||||
streamFile(argv[i]);
|
streamFile(argv[i]);
|
||||||
else {
|
} else {
|
||||||
#endif /* LIBXML_READER_ENABLED */
|
#endif /* LIBXML_READER_ENABLED */
|
||||||
if (ctxt == NULL)
|
if (ctxt == NULL)
|
||||||
ctxt = xmlNewParserCtxt();
|
ctxt = xmlNewParserCtxt();
|
||||||
|
564
xmlreader.c
564
xmlreader.c
@@ -37,6 +37,7 @@
|
|||||||
#include <libxml/xmlreader.h>
|
#include <libxml/xmlreader.h>
|
||||||
#include <libxml/parserInternals.h>
|
#include <libxml/parserInternals.h>
|
||||||
#include <libxml/relaxng.h>
|
#include <libxml/relaxng.h>
|
||||||
|
#include <libxml/uri.h>
|
||||||
|
|
||||||
/* #define DEBUG_CALLBACKS */
|
/* #define DEBUG_CALLBACKS */
|
||||||
/* #define DEBUG_READER */
|
/* #define DEBUG_READER */
|
||||||
@@ -96,6 +97,7 @@ typedef enum {
|
|||||||
|
|
||||||
struct _xmlTextReader {
|
struct _xmlTextReader {
|
||||||
int mode; /* the parsing mode */
|
int mode; /* the parsing mode */
|
||||||
|
xmlDocPtr doc; /* when walking an existing doc */
|
||||||
xmlTextReaderValidate validate;/* is there any validation */
|
xmlTextReaderValidate validate;/* is there any validation */
|
||||||
int allocs; /* what structure were deallocated */
|
int allocs; /* what structure were deallocated */
|
||||||
xmlTextReaderState state;
|
xmlTextReaderState state;
|
||||||
@@ -115,6 +117,8 @@ struct _xmlTextReader {
|
|||||||
int depth; /* depth of the current node */
|
int depth; /* depth of the current node */
|
||||||
xmlNodePtr faketext;/* fake xmlNs chld */
|
xmlNodePtr faketext;/* fake xmlNs chld */
|
||||||
int preserve;/* preserve the resulting document */
|
int preserve;/* preserve the resulting document */
|
||||||
|
xmlBufferPtr buffer; /* used to return const xmlChar * */
|
||||||
|
xmlDictPtr dict; /* the context dictionnary */
|
||||||
|
|
||||||
/* entity stack when traversing entities content */
|
/* entity stack when traversing entities content */
|
||||||
xmlNodePtr ent; /* Current Entity Ref Node */
|
xmlNodePtr ent; /* Current Entity Ref Node */
|
||||||
@@ -144,8 +148,11 @@ static const char *xmlTextReaderIsPreserved = "Preserve this element";
|
|||||||
*
|
*
|
||||||
* Macro used to return an interned string
|
* Macro used to return an interned string
|
||||||
*/
|
*/
|
||||||
#define CONSTSTR(str) xmlDictLookup(reader->ctxt->dict, (str), -1)
|
#define CONSTSTR(str) xmlDictLookup(reader->dict, (str), -1)
|
||||||
#define CONSTQSTR(p, str) xmlDictQLookup(reader->ctxt->dict, (p), (str))
|
#define CONSTQSTR(p, str) xmlDictQLookup(reader->dict, (p), (str))
|
||||||
|
|
||||||
|
static int xmlTextReaderReadTree(xmlTextReaderPtr reader);
|
||||||
|
static int xmlTextReaderNextTree(xmlTextReaderPtr reader);
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
@@ -572,7 +579,7 @@ xmlTextReaderStartElementNs(void *ctx,
|
|||||||
xmlTextReaderPtr reader = ctxt->_private;
|
xmlTextReaderPtr reader = ctxt->_private;
|
||||||
|
|
||||||
#ifdef DEBUG_CALLBACKS
|
#ifdef DEBUG_CALLBACKS
|
||||||
printf("xmlTextReaderStartElementNs(%s)\n", fullname);
|
printf("xmlTextReaderStartElementNs(%s)\n", localname);
|
||||||
#endif
|
#endif
|
||||||
if ((reader != NULL) && (reader->startElementNs != NULL)) {
|
if ((reader != NULL) && (reader->startElementNs != NULL)) {
|
||||||
reader->startElementNs(ctx, localname, prefix, URI, nb_namespaces,
|
reader->startElementNs(ctx, localname, prefix, URI, nb_namespaces,
|
||||||
@@ -606,7 +613,7 @@ xmlTextReaderEndElementNs(void *ctx,
|
|||||||
xmlTextReaderPtr reader = ctxt->_private;
|
xmlTextReaderPtr reader = ctxt->_private;
|
||||||
|
|
||||||
#ifdef DEBUG_CALLBACKS
|
#ifdef DEBUG_CALLBACKS
|
||||||
printf("xmlTextReaderEndElementNs(%s)\n", fullname);
|
printf("xmlTextReaderEndElementNs(%s)\n", localname);
|
||||||
#endif
|
#endif
|
||||||
if ((reader != NULL) && (reader->endElementNs != NULL)) {
|
if ((reader != NULL) && (reader->endElementNs != NULL)) {
|
||||||
reader->endElementNs(ctx, localname, prefix, URI);
|
reader->endElementNs(ctx, localname, prefix, URI);
|
||||||
@@ -1063,7 +1070,12 @@ xmlTextReaderRead(xmlTextReaderPtr reader) {
|
|||||||
xmlTextReaderState oldstate = XML_TEXTREADER_START;
|
xmlTextReaderState oldstate = XML_TEXTREADER_START;
|
||||||
xmlNodePtr oldnode = NULL;
|
xmlNodePtr oldnode = NULL;
|
||||||
|
|
||||||
if ((reader == NULL) || (reader->ctxt == NULL))
|
|
||||||
|
if (reader == NULL)
|
||||||
|
return(-1);
|
||||||
|
if (reader->doc != NULL)
|
||||||
|
return(xmlTextReaderReadTree(reader));
|
||||||
|
if (reader->ctxt == NULL)
|
||||||
return(-1);
|
return(-1);
|
||||||
if (reader->ctxt->wellFormed != 1)
|
if (reader->ctxt->wellFormed != 1)
|
||||||
return(-1);
|
return(-1);
|
||||||
@@ -1317,6 +1329,8 @@ xmlNodePtr
|
|||||||
xmlTextReaderExpand(xmlTextReaderPtr reader) {
|
xmlTextReaderExpand(xmlTextReaderPtr reader) {
|
||||||
if ((reader == NULL) || (reader->node == NULL) || (reader->ctxt == NULL))
|
if ((reader == NULL) || (reader->node == NULL) || (reader->ctxt == NULL))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
if (reader->doc != NULL)
|
||||||
|
return(reader->node);
|
||||||
if (xmlTextReaderDoExpand(reader) < 0)
|
if (xmlTextReaderDoExpand(reader) < 0)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
return(reader->node);
|
return(reader->node);
|
||||||
@@ -1339,6 +1353,8 @@ xmlTextReaderNext(xmlTextReaderPtr reader) {
|
|||||||
|
|
||||||
if (reader == NULL)
|
if (reader == NULL)
|
||||||
return(-1);
|
return(-1);
|
||||||
|
if (reader->doc != NULL)
|
||||||
|
return(xmlTextReaderNextTree(reader));
|
||||||
cur = reader->node;
|
cur = reader->node;
|
||||||
if ((cur == NULL) || (cur->type != XML_ELEMENT_NODE))
|
if ((cur == NULL) || (cur->type != XML_ELEMENT_NODE))
|
||||||
return(xmlTextReaderRead(reader));
|
return(xmlTextReaderRead(reader));
|
||||||
@@ -1466,6 +1482,169 @@ xmlTextReaderReadBinHex(xmlTextReaderPtr reader,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* *
|
||||||
|
* Operating on a preparsed tree *
|
||||||
|
* *
|
||||||
|
************************************************************************/
|
||||||
|
static int
|
||||||
|
xmlTextReaderNextTree(xmlTextReaderPtr reader)
|
||||||
|
{
|
||||||
|
if (reader == 0)
|
||||||
|
return(-1);
|
||||||
|
|
||||||
|
if (reader->state == XML_TEXTREADER_END)
|
||||||
|
return(0);
|
||||||
|
|
||||||
|
if (reader->node == 0) {
|
||||||
|
if (reader->doc->children == 0) {
|
||||||
|
reader->state = XML_TEXTREADER_END;
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
reader->node = reader->doc->children;
|
||||||
|
reader->state = XML_TEXTREADER_START;
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reader->state != XML_TEXTREADER_BACKTRACK) {
|
||||||
|
if (reader->node->children != 0) {
|
||||||
|
reader->node = reader->node->children;
|
||||||
|
reader->depth++;
|
||||||
|
reader->state = XML_TEXTREADER_START;
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((reader->node->type == XML_ELEMENT_NODE) ||
|
||||||
|
(reader->node->type == XML_ATTRIBUTE_NODE)) {
|
||||||
|
reader->state = XML_TEXTREADER_BACKTRACK;
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reader->node->next != 0) {
|
||||||
|
reader->node = reader->node->next;
|
||||||
|
reader->state = XML_TEXTREADER_START;
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reader->node->parent != 0) {
|
||||||
|
if (reader->node->parent->type == XML_DOCUMENT_NODE) {
|
||||||
|
reader->state = XML_TEXTREADER_END;
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
reader->node = reader->node->parent;
|
||||||
|
reader->depth--;
|
||||||
|
reader->state = XML_TEXTREADER_BACKTRACK;
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
reader->state = XML_TEXTREADER_END;
|
||||||
|
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlTextReaderReadTree:
|
||||||
|
* @reader: the xmlTextReaderPtr used
|
||||||
|
*
|
||||||
|
* Moves the position of the current instance to the next node in
|
||||||
|
* the stream, exposing its properties.
|
||||||
|
*
|
||||||
|
* Returns 1 if the node was read successfully, 0 if there is no more
|
||||||
|
* nodes to read, or -1 in case of error
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
xmlTextReaderReadTree(xmlTextReaderPtr reader) {
|
||||||
|
if (reader->state == XML_TEXTREADER_END)
|
||||||
|
return(0);
|
||||||
|
|
||||||
|
if (reader->node == NULL) {
|
||||||
|
if (reader->doc->children == NULL) {
|
||||||
|
reader->state = XML_TEXTREADER_END;
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
reader->node = reader->doc->children;
|
||||||
|
reader->state = XML_TEXTREADER_START;
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reader->state != XML_TEXTREADER_BACKTRACK) {
|
||||||
|
if (reader->node->children != 0) {
|
||||||
|
reader->node = reader->node->children;
|
||||||
|
reader->depth++;
|
||||||
|
reader->state = XML_TEXTREADER_START;
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((reader->node->type == XML_ELEMENT_NODE) ||
|
||||||
|
(reader->node->type == XML_ATTRIBUTE_NODE)) {
|
||||||
|
reader->state = XML_TEXTREADER_BACKTRACK;
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reader->node->next != 0) {
|
||||||
|
reader->node = reader->node->next;
|
||||||
|
reader->state = XML_TEXTREADER_START;
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reader->node->parent != 0) {
|
||||||
|
if ((reader->node->parent->type == XML_DOCUMENT_NODE) ||
|
||||||
|
(reader->node->parent->type == XML_HTML_DOCUMENT_NODE)) {
|
||||||
|
reader->state = XML_TEXTREADER_END;
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
reader->node = reader->node->parent;
|
||||||
|
reader->depth--;
|
||||||
|
reader->state = XML_TEXTREADER_BACKTRACK;
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
reader->state = XML_TEXTREADER_END;
|
||||||
|
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlTextReaderNextTree:
|
||||||
|
* @reader: the xmlTextReaderPtr used
|
||||||
|
*
|
||||||
|
* Skip to the node following the current one in document order while
|
||||||
|
* avoiding the subtree if any.
|
||||||
|
* Currently implemented only for Readers built on a document
|
||||||
|
*
|
||||||
|
* Returns 1 if the node was read successfully, 0 if there is no more
|
||||||
|
* nodes to read, or -1 in case of error
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
xmlTextReaderNextSibling(xmlTextReaderPtr reader) {
|
||||||
|
if (reader == NULL)
|
||||||
|
return(-1);
|
||||||
|
if (reader->doc == NULL) {
|
||||||
|
TODO
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reader->state == XML_TEXTREADER_END)
|
||||||
|
return(0);
|
||||||
|
|
||||||
|
if (reader->node == 0)
|
||||||
|
return(xmlTextReaderNextTree(reader));
|
||||||
|
|
||||||
|
if (reader->node->next != 0) {
|
||||||
|
reader->node = reader->node->next;
|
||||||
|
reader->state = XML_TEXTREADER_START;
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Constructor and destructors *
|
* Constructor and destructors *
|
||||||
@@ -1493,10 +1672,12 @@ xmlNewTextReader(xmlParserInputBufferPtr input, const char *URI) {
|
|||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
memset(ret, 0, sizeof(xmlTextReader));
|
memset(ret, 0, sizeof(xmlTextReader));
|
||||||
|
ret->doc = NULL;
|
||||||
ret->entTab = NULL;
|
ret->entTab = NULL;
|
||||||
ret->entMax = 0;
|
ret->entMax = 0;
|
||||||
ret->entNr = 0;
|
ret->entNr = 0;
|
||||||
ret->input = input;
|
ret->input = input;
|
||||||
|
ret->buffer = xmlBufferCreateSize(100);
|
||||||
ret->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler));
|
ret->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler));
|
||||||
if (ret->sax == NULL) {
|
if (ret->sax == NULL) {
|
||||||
xmlFree(ret);
|
xmlFree(ret);
|
||||||
@@ -1559,6 +1740,7 @@ xmlNewTextReader(xmlParserInputBufferPtr input, const char *URI) {
|
|||||||
* use the parser dictionnary to allocate all elements and attributes names
|
* use the parser dictionnary to allocate all elements and attributes names
|
||||||
*/
|
*/
|
||||||
ret->ctxt->docdict = 1;
|
ret->ctxt->docdict = 1;
|
||||||
|
ret->dict = ret->ctxt->dict;
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1615,6 +1797,8 @@ xmlFreeTextReader(xmlTextReaderPtr reader) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (reader->ctxt != NULL) {
|
if (reader->ctxt != NULL) {
|
||||||
|
if (reader->dict == reader->ctxt->dict)
|
||||||
|
reader->dict = NULL;
|
||||||
if (reader->ctxt->myDoc != NULL) {
|
if (reader->ctxt->myDoc != NULL) {
|
||||||
if (reader->preserve == 0)
|
if (reader->preserve == 0)
|
||||||
xmlTextReaderFreeDoc(reader, reader->ctxt->myDoc);
|
xmlTextReaderFreeDoc(reader, reader->ctxt->myDoc);
|
||||||
@@ -1636,8 +1820,12 @@ xmlFreeTextReader(xmlTextReaderPtr reader) {
|
|||||||
if (reader->faketext != NULL) {
|
if (reader->faketext != NULL) {
|
||||||
xmlFreeNode(reader->faketext);
|
xmlFreeNode(reader->faketext);
|
||||||
}
|
}
|
||||||
|
if (reader->buffer != NULL)
|
||||||
|
xmlBufferFree(reader->buffer);
|
||||||
if (reader->entTab != NULL)
|
if (reader->entTab != NULL)
|
||||||
xmlFree(reader->entTab);
|
xmlFree(reader->entTab);
|
||||||
|
if (reader->dict != NULL)
|
||||||
|
xmlDictFree(reader->dict);
|
||||||
xmlFree(reader);
|
xmlFree(reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2819,7 +3007,7 @@ xmlTextReaderHasValue(xmlTextReaderPtr reader) {
|
|||||||
*
|
*
|
||||||
* Provides the text value of the node if present
|
* Provides the text value of the node if present
|
||||||
*
|
*
|
||||||
* Returns the string or NULL if not available. The retsult must be deallocated
|
* Returns the string or NULL if not available. The result must be deallocated
|
||||||
* with xmlFree()
|
* with xmlFree()
|
||||||
*/
|
*/
|
||||||
xmlChar *
|
xmlChar *
|
||||||
@@ -2859,6 +3047,55 @@ xmlTextReaderValue(xmlTextReaderPtr reader) {
|
|||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlTextReaderConstValue:
|
||||||
|
* @reader: the xmlTextReaderPtr used
|
||||||
|
*
|
||||||
|
* Provides the text value of the node if present
|
||||||
|
*
|
||||||
|
* Returns the string or NULL if not available. The result will be
|
||||||
|
* deallocated on the next Read() operation.
|
||||||
|
*/
|
||||||
|
const xmlChar *
|
||||||
|
xmlTextReaderConstValue(xmlTextReaderPtr reader) {
|
||||||
|
xmlNodePtr node;
|
||||||
|
if (reader == NULL)
|
||||||
|
return(NULL);
|
||||||
|
if (reader->node == NULL)
|
||||||
|
return(NULL);
|
||||||
|
if (reader->curnode != NULL)
|
||||||
|
node = reader->curnode;
|
||||||
|
else
|
||||||
|
node = reader->node;
|
||||||
|
|
||||||
|
switch (node->type) {
|
||||||
|
case XML_NAMESPACE_DECL:
|
||||||
|
return(((xmlNsPtr) node)->href);
|
||||||
|
case XML_ATTRIBUTE_NODE:{
|
||||||
|
xmlAttrPtr attr = (xmlAttrPtr) node;
|
||||||
|
|
||||||
|
if ((attr->children != NULL) &&
|
||||||
|
(attr->children->type == XML_TEXT_NODE) &&
|
||||||
|
(attr->children->next == NULL))
|
||||||
|
return(attr->children->content);
|
||||||
|
else {
|
||||||
|
reader->buffer->use = 0;
|
||||||
|
xmlNodeBufGetContent(reader->buffer, node);
|
||||||
|
return(reader->buffer->content);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case XML_TEXT_NODE:
|
||||||
|
case XML_CDATA_SECTION_NODE:
|
||||||
|
case XML_PI_NODE:
|
||||||
|
case XML_COMMENT_NODE:
|
||||||
|
return(node->content);
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xmlTextReaderIsDefault:
|
* xmlTextReaderIsDefault:
|
||||||
* @reader: the xmlTextReaderPtr used
|
* @reader: the xmlTextReaderPtr used
|
||||||
@@ -3141,6 +3378,10 @@ xmlTextReaderPreserve(xmlTextReaderPtr reader) {
|
|||||||
*/
|
*/
|
||||||
xmlDocPtr
|
xmlDocPtr
|
||||||
xmlTextReaderCurrentDoc(xmlTextReaderPtr reader) {
|
xmlTextReaderCurrentDoc(xmlTextReaderPtr reader) {
|
||||||
|
if (reader == NULL)
|
||||||
|
return(NULL);
|
||||||
|
if (reader->doc != NULL)
|
||||||
|
return(reader->doc);
|
||||||
if ((reader == NULL) || (reader->ctxt == NULL) ||
|
if ((reader == NULL) || (reader->ctxt == NULL) ||
|
||||||
(reader->ctxt->myDoc == NULL))
|
(reader->ctxt->myDoc == NULL))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
@@ -3544,12 +3785,140 @@ xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader,
|
|||||||
* Returns 0 in case of success and -1 in case of error.
|
* Returns 0 in case of success and -1 in case of error.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xmlTextReaderSetup(xmlTextReaderPtr reader, const char *URL,
|
xmlTextReaderSetup(xmlTextReaderPtr reader,
|
||||||
|
xmlParserInputBufferPtr input, const char *URL,
|
||||||
const char *encoding, int options)
|
const char *encoding, int options)
|
||||||
{
|
{
|
||||||
if ((reader == NULL) || (reader->ctxt == NULL))
|
if (reader == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
|
reader->doc = NULL;
|
||||||
|
reader->entNr = 0;
|
||||||
|
if ((input != NULL) && (reader->input != NULL) &&
|
||||||
|
(reader->allocs & XML_TEXTREADER_INPUT)) {
|
||||||
|
xmlFreeParserInputBuffer(reader->input);
|
||||||
|
reader->input = NULL;
|
||||||
|
reader->allocs -= XML_TEXTREADER_INPUT;
|
||||||
|
}
|
||||||
|
if (input != NULL) {
|
||||||
|
reader->input = input;
|
||||||
|
reader->allocs |= XML_TEXTREADER_INPUT;
|
||||||
|
}
|
||||||
|
if (reader->buffer == NULL)
|
||||||
|
reader->buffer = xmlBufferCreateSize(100);
|
||||||
|
if (reader->buffer == NULL) {
|
||||||
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"xmlTextReaderSetup : malloc failed\n");
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
if (reader->sax == NULL)
|
||||||
|
reader->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler));
|
||||||
|
if (reader->sax == NULL) {
|
||||||
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"xmlTextReaderSetup : malloc failed\n");
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
xmlSAXVersion(reader->sax, 2);
|
||||||
|
reader->startElement = reader->sax->startElement;
|
||||||
|
reader->sax->startElement = xmlTextReaderStartElement;
|
||||||
|
reader->endElement = reader->sax->endElement;
|
||||||
|
reader->sax->endElement = xmlTextReaderEndElement;
|
||||||
|
#ifdef LIBXML_SAX1_ENABLED
|
||||||
|
if (reader->sax->initialized == XML_SAX2_MAGIC) {
|
||||||
|
#endif /* LIBXML_SAX1_ENABLED */
|
||||||
|
reader->startElementNs = reader->sax->startElementNs;
|
||||||
|
reader->sax->startElementNs = xmlTextReaderStartElementNs;
|
||||||
|
reader->endElementNs = reader->sax->endElementNs;
|
||||||
|
reader->sax->endElementNs = xmlTextReaderEndElementNs;
|
||||||
|
#ifdef LIBXML_SAX1_ENABLED
|
||||||
|
} else {
|
||||||
|
reader->startElementNs = NULL;
|
||||||
|
reader->endElementNs = NULL;
|
||||||
|
}
|
||||||
|
#endif /* LIBXML_SAX1_ENABLED */
|
||||||
|
reader->characters = reader->sax->characters;
|
||||||
|
reader->sax->characters = xmlTextReaderCharacters;
|
||||||
|
reader->sax->ignorableWhitespace = xmlTextReaderCharacters;
|
||||||
|
reader->cdataBlock = reader->sax->cdataBlock;
|
||||||
|
reader->sax->cdataBlock = xmlTextReaderCDataBlock;
|
||||||
|
|
||||||
|
reader->mode = XML_TEXTREADER_MODE_INITIAL;
|
||||||
|
reader->node = NULL;
|
||||||
|
reader->curnode = NULL;
|
||||||
|
if (input != NULL) {
|
||||||
|
if (reader->input->buffer->use < 4) {
|
||||||
|
xmlParserInputBufferRead(input, 4);
|
||||||
|
}
|
||||||
|
if (reader->ctxt == NULL) {
|
||||||
|
if (reader->input->buffer->use >= 4) {
|
||||||
|
reader->ctxt = xmlCreatePushParserCtxt(reader->sax, NULL,
|
||||||
|
(const char *) reader->input->buffer->content, 4, URL);
|
||||||
|
reader->base = 0;
|
||||||
|
reader->cur = 4;
|
||||||
|
} else {
|
||||||
|
reader->ctxt =
|
||||||
|
xmlCreatePushParserCtxt(reader->sax, NULL, NULL, 0, URL);
|
||||||
|
reader->base = 0;
|
||||||
|
reader->cur = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
xmlParserInputPtr inputStream;
|
||||||
|
xmlParserInputBufferPtr buf;
|
||||||
|
xmlCharEncoding enc = XML_CHAR_ENCODING_NONE;
|
||||||
|
|
||||||
|
if (reader->ctxt->myDoc != NULL)
|
||||||
|
xmlDictReference(reader->ctxt->myDoc->dict);
|
||||||
|
xmlCtxtReset(reader->ctxt);
|
||||||
|
buf = xmlAllocParserInputBuffer(enc);
|
||||||
|
if (buf == NULL) return(-1);
|
||||||
|
inputStream = xmlNewInputStream(reader->ctxt);
|
||||||
|
if (inputStream == NULL) {
|
||||||
|
xmlFreeParserInputBuffer(buf);
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (URL == NULL)
|
||||||
|
inputStream->filename = NULL;
|
||||||
|
else
|
||||||
|
inputStream->filename = (char *)
|
||||||
|
xmlCanonicPath((const xmlChar *) URL);
|
||||||
|
inputStream->buf = buf;
|
||||||
|
inputStream->base = inputStream->buf->buffer->content;
|
||||||
|
inputStream->cur = inputStream->buf->buffer->content;
|
||||||
|
inputStream->end =
|
||||||
|
&inputStream->buf->buffer->content[inputStream->buf->buffer->use];
|
||||||
|
|
||||||
|
inputPush(reader->ctxt, inputStream);
|
||||||
|
reader->cur = 0;
|
||||||
|
}
|
||||||
|
if (reader->ctxt == NULL) {
|
||||||
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"xmlTextReaderSetup : malloc failed\n");
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (reader->dict != NULL) {
|
||||||
|
if (reader->ctxt->dict != NULL) {
|
||||||
|
if (reader->dict != reader->ctxt->dict) {
|
||||||
|
xmlDictFree(reader->dict);
|
||||||
|
reader->dict = reader->ctxt->dict;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
reader->ctxt->dict = reader->dict;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (reader->ctxt->dict == NULL)
|
||||||
|
reader->ctxt->dict = xmlDictCreate();
|
||||||
|
reader->dict = reader->ctxt->dict;
|
||||||
|
}
|
||||||
|
reader->ctxt->_private = reader;
|
||||||
|
reader->ctxt->linenumbers = 1;
|
||||||
|
reader->ctxt->dictNames = 1;
|
||||||
|
/*
|
||||||
|
* use the parser dictionnary to allocate all elements and attributes names
|
||||||
|
*/
|
||||||
|
reader->ctxt->docdict = 1;
|
||||||
|
|
||||||
xmlCtxtUseOptions(reader->ctxt, options);
|
xmlCtxtUseOptions(reader->ctxt, options);
|
||||||
if (encoding != NULL) {
|
if (encoding != NULL) {
|
||||||
xmlCharEncodingHandlerPtr hdlr;
|
xmlCharEncodingHandlerPtr hdlr;
|
||||||
@@ -3562,9 +3931,49 @@ xmlTextReaderSetup(xmlTextReaderPtr reader, const char *URL,
|
|||||||
(reader->ctxt->input->filename == NULL))
|
(reader->ctxt->input->filename == NULL))
|
||||||
reader->ctxt->input->filename = (char *)
|
reader->ctxt->input->filename = (char *)
|
||||||
xmlStrdup((const xmlChar *) URL);
|
xmlStrdup((const xmlChar *) URL);
|
||||||
|
|
||||||
|
reader->doc = NULL;
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlReaderWalker:
|
||||||
|
* @doc: a preparsed document
|
||||||
|
*
|
||||||
|
* Create an xmltextReader for a preparsed document.
|
||||||
|
*
|
||||||
|
* Returns the new reader or NULL in case of error.
|
||||||
|
*/
|
||||||
|
xmlTextReaderPtr
|
||||||
|
xmlReaderWalker(xmlDocPtr doc)
|
||||||
|
{
|
||||||
|
xmlTextReaderPtr ret;
|
||||||
|
|
||||||
|
if (doc == NULL)
|
||||||
|
return(NULL);
|
||||||
|
|
||||||
|
ret = xmlMalloc(sizeof(xmlTextReader));
|
||||||
|
if (ret == NULL) {
|
||||||
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
|
"xmlNewTextReader : malloc failed\n");
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
memset(ret, 0, sizeof(xmlTextReader));
|
||||||
|
ret->entNr = 0;
|
||||||
|
ret->input = NULL;
|
||||||
|
ret->mode = XML_TEXTREADER_MODE_INITIAL;
|
||||||
|
ret->node = NULL;
|
||||||
|
ret->curnode = NULL;
|
||||||
|
ret->base = 0;
|
||||||
|
ret->cur = 0;
|
||||||
|
ret->allocs = XML_TEXTREADER_CTXT;
|
||||||
|
ret->doc = doc;
|
||||||
|
ret->state = XML_TEXTREADER_START;
|
||||||
|
ret->dict = xmlDictCreate();
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xmlReaderForDoc:
|
* xmlReaderForDoc:
|
||||||
* @cur: a pointer to a zero terminated string
|
* @cur: a pointer to a zero terminated string
|
||||||
@@ -3573,6 +3982,7 @@ xmlTextReaderSetup(xmlTextReaderPtr reader, const char *URL,
|
|||||||
* @options: a combination of xmlParserOption(s)
|
* @options: a combination of xmlParserOption(s)
|
||||||
*
|
*
|
||||||
* Create an xmltextReader for an XML in-memory document.
|
* Create an xmltextReader for an XML in-memory document.
|
||||||
|
* The parsing flags @options are a combination of xmlParserOption(s).
|
||||||
*
|
*
|
||||||
* Returns the new reader or NULL in case of error.
|
* Returns the new reader or NULL in case of error.
|
||||||
*/
|
*/
|
||||||
@@ -3597,6 +4007,7 @@ xmlReaderForDoc(const xmlChar * cur, const char *URL, const char *encoding,
|
|||||||
* @options: a combination of xmlParserOption(s)
|
* @options: a combination of xmlParserOption(s)
|
||||||
*
|
*
|
||||||
* parse an XML file from the filesystem or the network.
|
* parse an XML file from the filesystem or the network.
|
||||||
|
* The parsing flags @options are a combination of xmlParserOption(s).
|
||||||
*
|
*
|
||||||
* Returns the new reader or NULL in case of error.
|
* Returns the new reader or NULL in case of error.
|
||||||
*/
|
*/
|
||||||
@@ -3608,7 +4019,7 @@ xmlReaderForFile(const char *filename, const char *encoding, int options)
|
|||||||
reader = xmlNewTextReaderFilename(filename);
|
reader = xmlNewTextReaderFilename(filename);
|
||||||
if (reader == NULL)
|
if (reader == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
xmlTextReaderSetup(reader, NULL, encoding, options);
|
xmlTextReaderSetup(reader, NULL, NULL, encoding, options);
|
||||||
return (reader);
|
return (reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3621,6 +4032,7 @@ xmlReaderForFile(const char *filename, const char *encoding, int options)
|
|||||||
* @options: a combination of xmlParserOption(s)
|
* @options: a combination of xmlParserOption(s)
|
||||||
*
|
*
|
||||||
* Create an xmltextReader for an XML in-memory document.
|
* Create an xmltextReader for an XML in-memory document.
|
||||||
|
* The parsing flags @options are a combination of xmlParserOption(s).
|
||||||
*
|
*
|
||||||
* Returns the new reader or NULL in case of error.
|
* Returns the new reader or NULL in case of error.
|
||||||
*/
|
*/
|
||||||
@@ -3642,7 +4054,8 @@ xmlReaderForMemory(const char *buffer, int size, const char *URL,
|
|||||||
xmlFreeParserInputBuffer(buf);
|
xmlFreeParserInputBuffer(buf);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
xmlTextReaderSetup(reader, URL, encoding, options);
|
reader->allocs |= XML_TEXTREADER_INPUT;
|
||||||
|
xmlTextReaderSetup(reader, NULL, URL, encoding, options);
|
||||||
return (reader);
|
return (reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3654,6 +4067,7 @@ xmlReaderForMemory(const char *buffer, int size, const char *URL,
|
|||||||
* @options: a combination of xmlParserOption(s)
|
* @options: a combination of xmlParserOption(s)
|
||||||
*
|
*
|
||||||
* Create an xmltextReader for an XML from a file descriptor.
|
* Create an xmltextReader for an XML from a file descriptor.
|
||||||
|
* The parsing flags @options are a combination of xmlParserOption(s).
|
||||||
*
|
*
|
||||||
* Returns the new reader or NULL in case of error.
|
* Returns the new reader or NULL in case of error.
|
||||||
*/
|
*/
|
||||||
@@ -3674,7 +4088,8 @@ xmlReaderForFd(int fd, const char *URL, const char *encoding, int options)
|
|||||||
xmlFreeParserInputBuffer(input);
|
xmlFreeParserInputBuffer(input);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
xmlTextReaderSetup(reader, URL, encoding, options);
|
reader->allocs |= XML_TEXTREADER_INPUT;
|
||||||
|
xmlTextReaderSetup(reader, NULL, URL, encoding, options);
|
||||||
return (reader);
|
return (reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3688,6 +4103,7 @@ xmlReaderForFd(int fd, const char *URL, const char *encoding, int options)
|
|||||||
* @options: a combination of xmlParserOption(s)
|
* @options: a combination of xmlParserOption(s)
|
||||||
*
|
*
|
||||||
* Create an xmltextReader for an XML document from I/O functions and source.
|
* Create an xmltextReader for an XML document from I/O functions and source.
|
||||||
|
* The parsing flags @options are a combination of xmlParserOption(s).
|
||||||
*
|
*
|
||||||
* Returns the new reader or NULL in case of error.
|
* Returns the new reader or NULL in case of error.
|
||||||
*/
|
*/
|
||||||
@@ -3711,10 +4127,52 @@ xmlReaderForIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose,
|
|||||||
xmlFreeParserInputBuffer(input);
|
xmlFreeParserInputBuffer(input);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
xmlTextReaderSetup(reader, URL, encoding, options);
|
reader->allocs |= XML_TEXTREADER_INPUT;
|
||||||
|
xmlTextReaderSetup(reader, NULL, URL, encoding, options);
|
||||||
return (reader);
|
return (reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xmlReaderNewWalker:
|
||||||
|
* @reader: an XML reader
|
||||||
|
* @doc: a preparsed document
|
||||||
|
*
|
||||||
|
* Setup an xmltextReader to parse a preparsed XML document.
|
||||||
|
* This reuses the existing @reader xmlTextReader.
|
||||||
|
*
|
||||||
|
* Returns 0 in case of success and -1 in case of error
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
xmlReaderNewWalker(xmlTextReaderPtr reader, xmlDocPtr doc)
|
||||||
|
{
|
||||||
|
if (doc == NULL)
|
||||||
|
return (-1);
|
||||||
|
if (reader == NULL)
|
||||||
|
return (-1);
|
||||||
|
|
||||||
|
if (reader->ctxt != NULL) {
|
||||||
|
xmlCtxtReset(reader->ctxt);
|
||||||
|
}
|
||||||
|
|
||||||
|
reader->entNr = 0;
|
||||||
|
reader->input = NULL;
|
||||||
|
reader->mode = XML_TEXTREADER_MODE_INITIAL;
|
||||||
|
reader->node = NULL;
|
||||||
|
reader->curnode = NULL;
|
||||||
|
reader->base = 0;
|
||||||
|
reader->cur = 0;
|
||||||
|
reader->allocs = XML_TEXTREADER_CTXT;
|
||||||
|
reader->doc = doc;
|
||||||
|
reader->state = XML_TEXTREADER_START;
|
||||||
|
if (reader->dict == NULL) {
|
||||||
|
if ((reader->ctxt != NULL) && (reader->ctxt->dict != NULL))
|
||||||
|
reader->dict = reader->ctxt->dict;
|
||||||
|
else
|
||||||
|
reader->dict = xmlDictCreate();
|
||||||
|
}
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xmlReaderNewDoc:
|
* xmlReaderNewDoc:
|
||||||
* @reader: an XML reader
|
* @reader: an XML reader
|
||||||
@@ -3724,6 +4182,7 @@ xmlReaderForIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose,
|
|||||||
* @options: a combination of xmlParserOption(s)
|
* @options: a combination of xmlParserOption(s)
|
||||||
*
|
*
|
||||||
* Setup an xmltextReader to parse an XML in-memory document.
|
* Setup an xmltextReader to parse an XML in-memory document.
|
||||||
|
* The parsing flags @options are a combination of xmlParserOption(s).
|
||||||
* This reuses the existing @reader xmlTextReader.
|
* This reuses the existing @reader xmlTextReader.
|
||||||
*
|
*
|
||||||
* Returns 0 in case of success and -1 in case of error
|
* Returns 0 in case of success and -1 in case of error
|
||||||
@@ -3732,21 +4191,17 @@ int
|
|||||||
xmlReaderNewDoc(xmlTextReaderPtr reader, const xmlChar * cur,
|
xmlReaderNewDoc(xmlTextReaderPtr reader, const xmlChar * cur,
|
||||||
const char *URL, const char *encoding, int options)
|
const char *URL, const char *encoding, int options)
|
||||||
{
|
{
|
||||||
xmlParserInputPtr stream;
|
|
||||||
|
int len;
|
||||||
|
|
||||||
if (cur == NULL)
|
if (cur == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
if ((reader == NULL) || (reader->ctxt == NULL))
|
if (reader == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
xmlCtxtReset(reader->ctxt);
|
len = xmlStrlen(cur);
|
||||||
|
return (xmlReaderNewMemory(reader, (const char *)cur, len,
|
||||||
stream = xmlNewStringInputStream(reader->ctxt, cur);
|
URL, encoding, options));
|
||||||
if (stream == NULL) {
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
inputPush(reader->ctxt, stream);
|
|
||||||
return (xmlTextReaderSetup(reader, URL, encoding, options));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3757,6 +4212,7 @@ xmlReaderNewDoc(xmlTextReaderPtr reader, const xmlChar * cur,
|
|||||||
* @options: a combination of xmlParserOption(s)
|
* @options: a combination of xmlParserOption(s)
|
||||||
*
|
*
|
||||||
* parse an XML file from the filesystem or the network.
|
* parse an XML file from the filesystem or the network.
|
||||||
|
* The parsing flags @options are a combination of xmlParserOption(s).
|
||||||
* This reuses the existing @reader xmlTextReader.
|
* This reuses the existing @reader xmlTextReader.
|
||||||
*
|
*
|
||||||
* Returns 0 in case of success and -1 in case of error
|
* Returns 0 in case of success and -1 in case of error
|
||||||
@@ -3765,21 +4221,19 @@ int
|
|||||||
xmlReaderNewFile(xmlTextReaderPtr reader, const char *filename,
|
xmlReaderNewFile(xmlTextReaderPtr reader, const char *filename,
|
||||||
const char *encoding, int options)
|
const char *encoding, int options)
|
||||||
{
|
{
|
||||||
xmlParserInputPtr stream;
|
xmlParserInputBufferPtr input;
|
||||||
|
|
||||||
if (filename == NULL)
|
if (filename == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
if ((reader == NULL) || (reader->ctxt == NULL))
|
if (reader == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
xmlCtxtReset(reader->ctxt);
|
input =
|
||||||
|
xmlParserInputBufferCreateFilename(filename,
|
||||||
stream = xmlNewInputFromFile(reader->ctxt, filename);
|
XML_CHAR_ENCODING_NONE);
|
||||||
if (stream == NULL) {
|
if (input == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
return (xmlTextReaderSetup(reader, input, filename, encoding, options));
|
||||||
inputPush(reader->ctxt, stream);
|
|
||||||
return (xmlTextReaderSetup(reader, NULL, encoding, options));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3792,6 +4246,7 @@ xmlReaderNewFile(xmlTextReaderPtr reader, const char *filename,
|
|||||||
* @options: a combination of xmlParserOption(s)
|
* @options: a combination of xmlParserOption(s)
|
||||||
*
|
*
|
||||||
* Setup an xmltextReader to parse an XML in-memory document.
|
* Setup an xmltextReader to parse an XML in-memory document.
|
||||||
|
* The parsing flags @options are a combination of xmlParserOption(s).
|
||||||
* This reuses the existing @reader xmlTextReader.
|
* This reuses the existing @reader xmlTextReader.
|
||||||
*
|
*
|
||||||
* Returns 0 in case of success and -1 in case of error
|
* Returns 0 in case of success and -1 in case of error
|
||||||
@@ -3801,30 +4256,18 @@ xmlReaderNewMemory(xmlTextReaderPtr reader, const char *buffer, int size,
|
|||||||
const char *URL, const char *encoding, int options)
|
const char *URL, const char *encoding, int options)
|
||||||
{
|
{
|
||||||
xmlParserInputBufferPtr input;
|
xmlParserInputBufferPtr input;
|
||||||
xmlParserInputPtr stream;
|
|
||||||
|
|
||||||
if ((reader == NULL) || (reader->ctxt == NULL))
|
if (reader == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
if (buffer == NULL)
|
if (buffer == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
xmlCtxtReset(reader->ctxt);
|
input = xmlParserInputBufferCreateMem(buffer, size,
|
||||||
|
|
||||||
input =
|
|
||||||
xmlParserInputBufferCreateMem(buffer, size,
|
|
||||||
XML_CHAR_ENCODING_NONE);
|
XML_CHAR_ENCODING_NONE);
|
||||||
if (input == NULL) {
|
if (input == NULL) {
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
return (xmlTextReaderSetup(reader, input, URL, encoding, options));
|
||||||
stream = xmlNewIOInputStream(reader->ctxt, input, XML_CHAR_ENCODING_NONE);
|
|
||||||
if (stream == NULL) {
|
|
||||||
xmlFreeParserInputBuffer(input);
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
inputPush(reader->ctxt, stream);
|
|
||||||
return (xmlTextReaderSetup(reader, URL, encoding, options));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3836,6 +4279,7 @@ xmlReaderNewMemory(xmlTextReaderPtr reader, const char *buffer, int size,
|
|||||||
* @options: a combination of xmlParserOption(s)
|
* @options: a combination of xmlParserOption(s)
|
||||||
*
|
*
|
||||||
* Setup an xmltextReader to parse an XML from a file descriptor.
|
* Setup an xmltextReader to parse an XML from a file descriptor.
|
||||||
|
* The parsing flags @options are a combination of xmlParserOption(s).
|
||||||
* This reuses the existing @reader xmlTextReader.
|
* This reuses the existing @reader xmlTextReader.
|
||||||
*
|
*
|
||||||
* Returns 0 in case of success and -1 in case of error
|
* Returns 0 in case of success and -1 in case of error
|
||||||
@@ -3845,26 +4289,16 @@ xmlReaderNewFd(xmlTextReaderPtr reader, int fd,
|
|||||||
const char *URL, const char *encoding, int options)
|
const char *URL, const char *encoding, int options)
|
||||||
{
|
{
|
||||||
xmlParserInputBufferPtr input;
|
xmlParserInputBufferPtr input;
|
||||||
xmlParserInputPtr stream;
|
|
||||||
|
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return (-1);
|
return (-1);
|
||||||
if ((reader == NULL) || (reader->ctxt == NULL))
|
if (reader == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
xmlCtxtReset(reader->ctxt);
|
|
||||||
|
|
||||||
|
|
||||||
input = xmlParserInputBufferCreateFd(fd, XML_CHAR_ENCODING_NONE);
|
input = xmlParserInputBufferCreateFd(fd, XML_CHAR_ENCODING_NONE);
|
||||||
if (input == NULL)
|
if (input == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
stream = xmlNewIOInputStream(reader->ctxt, input, XML_CHAR_ENCODING_NONE);
|
return (xmlTextReaderSetup(reader, input, URL, encoding, options));
|
||||||
if (stream == NULL) {
|
|
||||||
xmlFreeParserInputBuffer(input);
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
inputPush(reader->ctxt, stream);
|
|
||||||
return (xmlTextReaderSetup(reader, URL, encoding, options));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3879,6 +4313,7 @@ xmlReaderNewFd(xmlTextReaderPtr reader, int fd,
|
|||||||
*
|
*
|
||||||
* Setup an xmltextReader to parse an XML document from I/O functions
|
* Setup an xmltextReader to parse an XML document from I/O functions
|
||||||
* and source.
|
* and source.
|
||||||
|
* The parsing flags @options are a combination of xmlParserOption(s).
|
||||||
* This reuses the existing @reader xmlTextReader.
|
* This reuses the existing @reader xmlTextReader.
|
||||||
*
|
*
|
||||||
* Returns 0 in case of success and -1 in case of error
|
* Returns 0 in case of success and -1 in case of error
|
||||||
@@ -3889,26 +4324,17 @@ xmlReaderNewIO(xmlTextReaderPtr reader, xmlInputReadCallback ioread,
|
|||||||
const char *URL, const char *encoding, int options)
|
const char *URL, const char *encoding, int options)
|
||||||
{
|
{
|
||||||
xmlParserInputBufferPtr input;
|
xmlParserInputBufferPtr input;
|
||||||
xmlParserInputPtr stream;
|
|
||||||
|
|
||||||
if (ioread == NULL)
|
if (ioread == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
if ((reader == NULL) || (reader->ctxt == NULL))
|
if (reader == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
xmlCtxtReset(reader->ctxt);
|
|
||||||
|
|
||||||
input = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx,
|
input = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx,
|
||||||
XML_CHAR_ENCODING_NONE);
|
XML_CHAR_ENCODING_NONE);
|
||||||
if (input == NULL)
|
if (input == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
stream = xmlNewIOInputStream(reader->ctxt, input, XML_CHAR_ENCODING_NONE);
|
return (xmlTextReaderSetup(reader, input, URL, encoding, options));
|
||||||
if (stream == NULL) {
|
|
||||||
xmlFreeParserInputBuffer(input);
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
inputPush(reader->ctxt, stream);
|
|
||||||
return (xmlTextReaderSetup(reader, URL, encoding, options));
|
|
||||||
}
|
}
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
|
Reference in New Issue
Block a user