1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-21 14:53:44 +03:00

added new APIs for creating reader from sources or reusing a reader with a

* xmlreader.c include/libxml/xmlreader.h: added new APIs
  for creating reader from sources or reusing a reader with
  a new source, like the xmlReadxx and xmlCtxtReadxxx
* win32/libxml2.def.src doc/libxml2-api.xml doc/apibuild.py
  doc/Makefile.am: regenerated the APIs
* doc/xml.html: applied a patch from Stefan Kost for namesapce docs
Daniel
This commit is contained in:
Daniel Veillard
2003-10-18 09:07:46 +00:00
parent 871611bb03
commit fc8dc355da
11 changed files with 655 additions and 75 deletions

View File

@@ -1,3 +1,12 @@
Sat Oct 18 11:04:32 CEST 2003 Daniel Veillard <daniel@veillard.com>
* xmlreader.c include/libxml/xmlreader.h: added new APIs
for creating reader from sources or reusing a reader with
a new source, like the xmlReadxx and xmlCtxtReadxxx
* win32/libxml2.def.src doc/libxml2-api.xml doc/apibuild.py
doc/Makefile.am: regenerated the APIs
* doc/xml.html: applied a patch from Stefan Kost for namesapce docs
Sat Oct 18 12:46:02 HKT 2003 William Brack <wbrack@mmm.com.hk> Sat Oct 18 12:46:02 HKT 2003 William Brack <wbrack@mmm.com.hk>
* genChRanges.py, chvalid.c, include/libxml/chvalid.h, * genChRanges.py, chvalid.c, include/libxml/chvalid.h,

View File

@@ -60,7 +60,7 @@ xmlcatalog.1: xmlcatalog_man.xml
-@(xsltproc --nonet xmlcatalog_man.xml) -@(xsltproc --nonet xmlcatalog_man.xml)
scan: scan:
-gtkdoc-scan --module=libxml --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="acconfig.h config.h win32config.h trio.h triostr.h triop.h config-mac.h XMLTestPrefix2.h XMLTestPrefix.h triodef.h trionan.h xlink.h libxml.h libxml2-py.h libxml_wrap.h" -gtkdoc-scan --module=libxml --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="acconfig.h config.h win32config.h trio.h triostr.h triop.h config-mac.h XMLTestPrefix2.h XMLTestPrefix.h triodef.h trionan.h xlink.h libxml.h libxml2-py.h libxml_wrap.h chvalid.h"
templates: scan templates: scan
-gtkdoc-mktmpl --module=libxml -gtkdoc-mktmpl --module=libxml

View File

@@ -25,6 +25,9 @@ ignored_files = {
"testOOM.c": "out of memory tester", "testOOM.c": "out of memory tester",
"testOOMlib.h": "out of memory tester", "testOOMlib.h": "out of memory tester",
"testOOMlib.c": "out of memory tester", "testOOMlib.c": "out of memory tester",
"chvalid.h": "internal only + parsing problems",
"pattern.c": "not integrated yet",
"pattern.h": "not integrated yet",
} }
ignored_words = { ignored_words = {

View File

@@ -140,15 +140,7 @@
<exports symbol='xmlErrMemory'/> <exports symbol='xmlErrMemory'/>
<exports symbol='xmlFreeInputStream'/> <exports symbol='xmlFreeInputStream'/>
<exports symbol='xmlHandleEntity'/> <exports symbol='xmlHandleEntity'/>
<exports symbol='xmlIsBaseChar'/>
<exports symbol='xmlIsBlank'/>
<exports symbol='xmlIsChar'/>
<exports symbol='xmlIsCombining'/>
<exports symbol='xmlIsDigit'/>
<exports symbol='xmlIsExtender'/>
<exports symbol='xmlIsIdeographic'/>
<exports symbol='xmlIsLetter'/> <exports symbol='xmlIsLetter'/>
<exports symbol='xmlIsPubidChar'/>
<exports symbol='xmlNamespaceParseNCName'/> <exports symbol='xmlNamespaceParseNCName'/>
<exports symbol='xmlNamespaceParseNSDef'/> <exports symbol='xmlNamespaceParseNSDef'/>
<exports symbol='xmlNamespaceParseQName'/> <exports symbol='xmlNamespaceParseQName'/>
@@ -206,6 +198,7 @@
<exports symbol='xmlParserHandlePEReference'/> <exports symbol='xmlParserHandlePEReference'/>
<exports symbol='xmlParserHandleReference'/> <exports symbol='xmlParserHandleReference'/>
<exports symbol='xmlParserInputShrink'/> <exports symbol='xmlParserInputShrink'/>
<exports symbol='xmlParserMaxDepth'/>
<exports symbol='xmlPopInput'/> <exports symbol='xmlPopInput'/>
<exports symbol='xmlPushInput'/> <exports symbol='xmlPushInput'/>
<exports symbol='xmlScanName'/> <exports symbol='xmlScanName'/>
@@ -1385,6 +1378,16 @@
<exports symbol='xmlNewTextReaderFilename'/> <exports symbol='xmlNewTextReaderFilename'/>
<exports symbol='xmlParserProperties'/> <exports symbol='xmlParserProperties'/>
<exports symbol='xmlParserSeverities'/> <exports symbol='xmlParserSeverities'/>
<exports symbol='xmlReaderForDoc'/>
<exports symbol='xmlReaderForFd'/>
<exports symbol='xmlReaderForFile'/>
<exports symbol='xmlReaderForIO'/>
<exports symbol='xmlReaderForMemory'/>
<exports symbol='xmlReaderNewDoc'/>
<exports symbol='xmlReaderNewFd'/>
<exports symbol='xmlReaderNewFile'/>
<exports symbol='xmlReaderNewIO'/>
<exports symbol='xmlReaderNewMemory'/>
<exports symbol='xmlReaderTypes'/> <exports symbol='xmlReaderTypes'/>
<exports symbol='xmlTextReader'/> <exports symbol='xmlTextReader'/>
<exports symbol='xmlTextReaderAttributeCount'/> <exports symbol='xmlTextReaderAttributeCount'/>
@@ -4911,6 +4914,7 @@ actually an xmlCharEncoding'/>
<variable name='xmlMallocAtomic' file='globals' type='xmlMallocFunc'/> <variable name='xmlMallocAtomic' file='globals' type='xmlMallocFunc'/>
<variable name='xmlMemStrdup' file='globals' type='xmlStrdupFunc'/> <variable name='xmlMemStrdup' file='globals' type='xmlStrdupFunc'/>
<variable name='xmlParserDebugEntities' file='globals' type='int'/> <variable name='xmlParserDebugEntities' file='globals' type='int'/>
<variable name='xmlParserMaxDepth' file='parserInternals' type='unsigned int'/>
<variable name='xmlParserVersion' file='globals' type='const char *'/> <variable name='xmlParserVersion' file='globals' type='const char *'/>
<variable name='xmlPedanticParserDefaultValue' file='globals' type='int'/> <variable name='xmlPedanticParserDefaultValue' file='globals' type='int'/>
<variable name='xmlRealloc' file='globals' type='xmlReallocFunc'/> <variable name='xmlRealloc' file='globals' type='xmlReallocFunc'/>
@@ -8053,41 +8057,11 @@ actually an xmlCharEncoding'/>
<arg name='buffer' type='char *' info='the buffer to store data read'/> <arg name='buffer' type='char *' info='the buffer to store data read'/>
<arg name='len' type='int' info='the length of the buffer in bytes'/> <arg name='len' type='int' info='the length of the buffer in bytes'/>
</functype> </functype>
<function name='xmlIsBaseChar' file='parserInternals'>
<info>Check whether the character is allowed by the production [85] BaseChar ::= ... long list see REC ... VI is your friend ! :1,$ s/\[#x\([0-9A-Z]*\)-#x\([0-9A-Z]*\)\]/ (((c) &gt;= 0x\1) \&amp;\&amp; ((c) &lt;= 0x\2)) ||/ and :1,$ s/#x\([0-9A-Z]*\)/ ((c) == 0x\1) ||/</info>
<return type='int' info='0 if not, non-zero otherwise'/>
<arg name='c' type='int' info='an unicode character (int)'/>
</function>
<function name='xmlIsBlank' file='parserInternals'>
<info>Check whether the character is allowed by the production [3] S ::= (#x20 | #x9 | #xD | #xA)+ Also available as a macro IS_BLANK()</info>
<return type='int' info='0 if not, non-zero otherwise'/>
<arg name='c' type='int' info='an unicode character (int)'/>
</function>
<function name='xmlIsBlankNode' file='tree'> <function name='xmlIsBlankNode' file='tree'>
<info>Checks whether this node is an empty or whitespace only (and possibly ignorable) text-node.</info> <info>Checks whether this node is an empty or whitespace only (and possibly ignorable) text-node.</info>
<return type='int' info='1 yes, 0 no'/> <return type='int' info='1 yes, 0 no'/>
<arg name='node' type='xmlNodePtr' info='the node'/> <arg name='node' type='xmlNodePtr' info='the node'/>
</function> </function>
<function name='xmlIsChar' file='parserInternals'>
<info>Check whether the character is allowed by the production [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. Also available as a macro IS_CHAR()</info>
<return type='int' info='0 if not, non-zero otherwise'/>
<arg name='c' type='int' info='an unicode character (int)'/>
</function>
<function name='xmlIsCombining' file='parserInternals'>
<info>Check whether the character is allowed by the production [87] CombiningChar ::= ... long list see REC ...</info>
<return type='int' info='0 if not, non-zero otherwise'/>
<arg name='c' type='int' info='an unicode character (int)'/>
</function>
<function name='xmlIsDigit' file='parserInternals'>
<info>Check whether the character is allowed by the production [88] Digit ::= ... long list see REC ...</info>
<return type='int' info='0 if not, non-zero otherwise'/>
<arg name='c' type='int' info='an unicode character (int)'/>
</function>
<function name='xmlIsExtender' file='parserInternals'>
<info>Check whether the character is allowed by the production [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 | #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] | [#x309D-#x309E] | [#x30FC-#x30FE]</info>
<return type='int' info='0 if not, non-zero otherwise'/>
<arg name='c' type='int' info='an unicode character (int)'/>
</function>
<function name='xmlIsID' file='valid'> <function name='xmlIsID' file='valid'>
<info>Determine whether an attribute is of type ID. In case we have DTD(s) then this is done if DTD loading has been requested. In the case of HTML documents parsed with the HTML parser, then ID detection is done systematically.</info> <info>Determine whether an attribute is of type ID. In case we have DTD(s) then this is done if DTD loading has been requested. In the case of HTML documents parsed with the HTML parser, then ID detection is done systematically.</info>
<return type='int' info='0 or 1 depending on the lookup result'/> <return type='int' info='0 or 1 depending on the lookup result'/>
@@ -8095,11 +8069,6 @@ actually an xmlCharEncoding'/>
<arg name='elem' type='xmlNodePtr' info='the element carrying the attribute'/> <arg name='elem' type='xmlNodePtr' info='the element carrying the attribute'/>
<arg name='attr' type='xmlAttrPtr' info='the attribute'/> <arg name='attr' type='xmlAttrPtr' info='the attribute'/>
</function> </function>
<function name='xmlIsIdeographic' file='parserInternals'>
<info>Check whether the character is allowed by the production [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029]</info>
<return type='int' info='0 if not, non-zero otherwise'/>
<arg name='c' type='int' info='an unicode character (int)'/>
</function>
<function name='xmlIsLetter' file='parserInternals'> <function name='xmlIsLetter' file='parserInternals'>
<info>Check whether the character is allowed by the production [84] Letter ::= BaseChar | Ideographic</info> <info>Check whether the character is allowed by the production [84] Letter ::= BaseChar | Ideographic</info>
<return type='int' info='0 if not, non-zero otherwise'/> <return type='int' info='0 if not, non-zero otherwise'/>
@@ -8115,11 +8084,6 @@ actually an xmlCharEncoding'/>
<arg name='doc' type='xmlDocPtr' info='the document'/> <arg name='doc' type='xmlDocPtr' info='the document'/>
<arg name='name' type='const xmlChar *' info='the element name'/> <arg name='name' type='const xmlChar *' info='the element name'/>
</function> </function>
<function name='xmlIsPubidChar' file='parserInternals'>
<info>Check whether the character is allowed by the production [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-&apos;()+,./:=?;!*#@$_%]</info>
<return type='int' info='0 if not, non-zero otherwise'/>
<arg name='c' type='int' info='an unicode character (int)'/>
</function>
<function name='xmlIsRef' file='valid'> <function name='xmlIsRef' file='valid'>
<info>Determine whether an attribute is of type Ref. In case we have DTD(s) then this is simple, otherwise we use an heuristic: name Ref (upper or lowercase).</info> <info>Determine whether an attribute is of type Ref. In case we have DTD(s) then this is simple, otherwise we use an heuristic: name Ref (upper or lowercase).</info>
<return type='int' info='0 or 1 depending on the lookup result'/> <return type='int' info='0 or 1 depending on the lookup result'/>
@@ -9700,6 +9664,95 @@ 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='xmlReaderForDoc' file='xmlreader'>
<info>Create an xmltextReader for an XML in-memory document.</info>
<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='URL' type='const char *' info='the base URL to use for the document'/>
<arg name='encoding' type='const char *' info='the document encoding, or NULL'/>
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
</function>
<function name='xmlReaderForFd' file='xmlreader'>
<info>Create an xmltextReader for an XML from a file descriptor.</info>
<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='URL' type='const char *' info='the base URL to use for the document'/>
<arg name='encoding' type='const char *' info='the document encoding, or NULL'/>
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
</function>
<function name='xmlReaderForFile' file='xmlreader'>
<info>parse an XML file from the filesystem or the network.</info>
<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='encoding' type='const char *' info='the document encoding, or NULL'/>
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
</function>
<function name='xmlReaderForIO' file='xmlreader'>
<info>Create an xmltextReader for an XML document from I/O functions and source.</info>
<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='ioclose' type='xmlInputCloseCallback' info='an I/O close function'/>
<arg name='ioctx' type='void *' info='an I/O handler'/>
<arg name='URL' type='const char *' info='the base URL to use for the document'/>
<arg name='encoding' type='const char *' info='the document encoding, or NULL'/>
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
</function>
<function name='xmlReaderForMemory' file='xmlreader'>
<info>Create an xmltextReader for an XML in-memory document.</info>
<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='size' type='int' info='the size of the array'/>
<arg name='URL' type='const char *' info='the base URL to use for the document'/>
<arg name='encoding' type='const char *' info='the document encoding, or NULL'/>
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
</function>
<function name='xmlReaderNewDoc' file='xmlreader'>
<info>Setup an xmltextReader to parse an XML in-memory 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='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='encoding' type='const char *' info='the document encoding, or NULL'/>
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
</function>
<function name='xmlReaderNewFd' file='xmlreader'>
<info>Setup an xmltextReader to parse an XML from a file descriptor. 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='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='encoding' type='const char *' info='the document encoding, or NULL'/>
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
</function>
<function name='xmlReaderNewFile' file='xmlreader'>
<info>parse an XML file from the filesystem or the network. 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='filename' type='const char *' info='a file or URL'/>
<arg name='encoding' type='const char *' info='the document encoding, or NULL'/>
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
</function>
<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>
<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='ioread' type='xmlInputReadCallback' info='an I/O read function'/>
<arg name='ioclose' type='xmlInputCloseCallback' info='an I/O close function'/>
<arg name='ioctx' type='void *' info='an I/O handler'/>
<arg name='URL' type='const char *' info='the base URL to use for the document'/>
<arg name='encoding' type='const char *' info='the document encoding, or NULL'/>
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
</function>
<function name='xmlReaderNewMemory' file='xmlreader'>
<info>Setup an xmltextReader to parse an XML in-memory 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='buffer' type='const char *' info='a pointer to a char array'/>
<arg name='size' type='int' info='the size of the array'/>
<arg name='URL' type='const char *' info='the base URL to use for the document'/>
<arg name='encoding' type='const char *' info='the document encoding, or NULL'/>
<arg name='options' type='int' info='a combination of xmlParserOption(s)'/>
</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.'/>

View File

@@ -34,12 +34,21 @@ same as &lt;bar:text&gt; in another document. What really matters is the URI
associated with the element or the attribute, not the prefix string (which is associated with the element or the attribute, not the prefix string (which is
just a shortcut for the full URI). In libxml, element and attributes have an just a shortcut for the full URI). In libxml, element and attributes have an
<code>ns</code> field pointing to an xmlNs structure detailing the namespace <code>ns</code> field pointing to an xmlNs structure detailing the namespace
prefix and its URI.</p><p>@@Interfaces@@</p><p>@@Examples@@</p><p>Usually people object to using namespaces together with validity checking. prefix and its URI.</p><p>@@Interfaces@@</p><pre>
xmlNodePtr node;
if(!strncmp(node-&gt;name,&quot;mytag&quot;,5)
&amp;&amp; node-&gt;ns
&amp;&amp; !strcmp(node-&gt;ns-&gt;href,&quot;http://www.mysite.com/myns/1.0&quot;)) {
...
}
</pre><p>Usually people object to using namespaces together with validity checking.
I will try to make sure that using namespaces won't break validity checking, I will try to make sure that using namespaces won't break validity checking,
so even if you plan to use or currently are using validation I strongly so even if you plan to use or currently are using validation I strongly
suggest adding namespaces to your document. A default namespace scheme suggest adding namespaces to your document. A default namespace scheme
<code>xmlns=&quot;http://....&quot;</code> should not break validity even on less <code>xmlns=&quot;http://....&quot;</code> should not break validity even on less
flexible parsers. Using namespaces to mix and differentiate content coming flexible parsers. Using namespaces to mix and differentiate content coming
from multiple DTDs will certainly break current validation schemes. I will from multiple DTDs will certainly break current validation schemes.
try to provide ways to do this, but this may not be portable or To check such documents one needs to use schema-validation, which is supported
standardized.</p><p><a href="bugs.html">Daniel Veillard</a></p></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></body></html> in libxml2 as well. See <a href="http://www.relaxng.org/">relagx-ng</a> and
<a href="http://www.w3c.org/XML/Schema">w3c-schema</a>.
</p><p><a href="bugs.html">Daniel Veillard</a></p></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></body></html>

View File

@@ -23,7 +23,7 @@ incompatible changes. The main goals were:</p><ul><li>a general cleanup. A numbe
</ul><h3>How to fix libxml-1.x code:</h3><p>So client code of libxml designed to run with version 1.x may have to be </ul><h3>How to fix libxml-1.x code:</h3><p>So client code of libxml designed to run with version 1.x may have to be
changed to compile against version 2.x of libxml. Here is a list of changes changed to compile against version 2.x of libxml. Here is a list of changes
that I have collected, they may not be sufficient, so in case you find other that I have collected, they may not be sufficient, so in case you find other
change which are required, <a href="mailto:Daniel.<EFBFBD>eillardw3.org">drop me a change which are required, <a href="mailto:Daniel.Veillard@w3.org">drop me a
mail</a>:</p><ol><li>The package name have changed from libxml to libxml2, the library name mail</a>:</p><ol><li>The package name have changed from libxml to libxml2, the library name
is now -lxml2 . There is a new xml2-config script which should be used to is now -lxml2 . There is a new xml2-config script which should be used to
select the right parameters libxml2</li> select the right parameters libxml2</li>

View File

@@ -3758,7 +3758,14 @@ prefix and its URI.</p>
<p>@@Interfaces@@</p> <p>@@Interfaces@@</p>
<p>@@Examples@@</p> <pre>
xmlNodePtr node;
if(!strncmp(node-&gt;name,"mytag",5)
&amp;&amp; node-&gt;ns
&amp;&amp; !strcmp(node-&gt;ns-&gt;href,"http://www.mysite.com/myns/1.0")) {
...
}
</pre>
<p>Usually people object to using namespaces together with validity checking. <p>Usually people object to using namespaces together with validity checking.
I will try to make sure that using namespaces won't break validity checking, I will try to make sure that using namespaces won't break validity checking,
@@ -3766,9 +3773,11 @@ so even if you plan to use or currently are using validation I strongly
suggest adding namespaces to your document. A default namespace scheme suggest adding namespaces to your document. A default namespace scheme
<code>xmlns="http://...."</code> should not break validity even on less <code>xmlns="http://...."</code> should not break validity even on less
flexible parsers. Using namespaces to mix and differentiate content coming flexible parsers. Using namespaces to mix and differentiate content coming
from multiple DTDs will certainly break current validation schemes. I will from multiple DTDs will certainly break current validation schemes.
try to provide ways to do this, but this may not be portable or To check such documents one needs to use schema-validation, which is supported
standardized.</p> in libxml2 as well. See <a href="http://www.relaxng.org/">relagx-ng</a> and
<a href="http://www.w3c.org/XML/Schema">w3c-schema</a>.
</p>
<h2><a name="Upgrading">Upgrading 1.x code</a></h2> <h2><a name="Upgrading">Upgrading 1.x code</a></h2>
@@ -3796,7 +3805,7 @@ incompatible changes. The main goals were:</p>
<p>So client code of libxml designed to run with version 1.x may have to be <p>So client code of libxml designed to run with version 1.x may have to be
changed to compile against version 2.x of libxml. Here is a list of changes changed to compile against version 2.x of libxml. Here is a list of changes
that I have collected, they may not be sufficient, so in case you find other that I have collected, they may not be sufficient, so in case you find other
change which are required, <a href="mailto:Daniel.<EFBFBD>eillardw3.org">drop me a change which are required, <a href="mailto:Daniel.Veillard@w3.org">drop me a
mail</a>:</p> mail</a>:</p>
<ol> <ol>
<li>The package name have changed from libxml to libxml2, the library name <li>The package name have changed from libxml to libxml2, the library name

View File

@@ -205,6 +205,69 @@ XMLPUBFUN int XMLCALL
xmlRelaxNGPtr schema); xmlRelaxNGPtr schema);
#endif #endif
/*
* New more complete APIs for simpler creation and reuse of readers
*/
XMLPUBFUN xmlTextReaderPtr XMLCALL
xmlReaderForDoc (const xmlChar * cur,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlTextReaderPtr XMLCALL
xmlReaderForFile (const char *filename,
const char *encoding,
int options);
XMLPUBFUN xmlTextReaderPtr XMLCALL
xmlReaderForMemory (const char *buffer,
int size,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlTextReaderPtr XMLCALL
xmlReaderForFd (int fd,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlTextReaderPtr XMLCALL
xmlReaderForIO (xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void *ioctx,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN int XMLCALL
xmlReaderNewDoc (xmlTextReaderPtr reader,
const xmlChar * cur,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN int XMLCALL
xmlReaderNewFile (xmlTextReaderPtr reader,
const char *filename,
const char *encoding,
int options);
XMLPUBFUN int XMLCALL
xmlReaderNewMemory (xmlTextReaderPtr reader,
const char *buffer,
int size,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN int XMLCALL
xmlReaderNewFd (xmlTextReaderPtr reader,
int fd,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN int XMLCALL
xmlReaderNewIO (xmlTextReaderPtr reader,
xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void *ioctx,
const char *URL,
const char *encoding,
int options);
/* /*
* Error handling extensions * Error handling extensions
*/ */

View File

@@ -133,15 +133,7 @@ createFileParserCtxt()
createMemoryParserCtxt() createMemoryParserCtxt()
htmlCreateFileParserCtxt() htmlCreateFileParserCtxt()
htmlInitAutoClose() htmlInitAutoClose()
isBaseChar()
isBlank()
isChar()
isCombining()
isDigit()
isExtender()
isIdeographic()
isLetter() isLetter()
isPubidChar()
namePop() namePop()
namePush() namePush()
nodePop() nodePop()
@@ -213,6 +205,10 @@ resetLastError()
# functions from module xmlreader # functions from module xmlreader
newTextReaderFilename() newTextReaderFilename()
readerForDoc()
readerForFd()
readerForFile()
readerForMemory()
# functions from module xmlregexp # functions from module xmlregexp
regexpCompile() regexpCompile()
@@ -709,6 +705,10 @@ Class xmlTextReader(xmlTextReaderCore)
SetParserProp() SetParserProp()
Value() Value()
XmlLang() XmlLang()
readerNewDoc()
readerNewFd()
readerNewFile()
readerNewMemory()
Class xmlReg() Class xmlReg()
# functions from module xmlregexp # functions from module xmlregexp

View File

@@ -85,6 +85,7 @@ __xmlKeepBlanksDefaultValue
#else #else
xmlKeepBlanksDefaultValue DATA xmlKeepBlanksDefaultValue DATA
#endif #endif
xmlLastError DATA
#ifdef LIBXML_THREAD_ENABLED #ifdef LIBXML_THREAD_ENABLED
__xmlLineNumbersDefaultValue __xmlLineNumbersDefaultValue
#else #else
@@ -115,6 +116,7 @@ __xmlParserDebugEntities
#else #else
xmlParserDebugEntities DATA xmlParserDebugEntities DATA
#endif #endif
xmlParserMaxDepth DATA
#ifdef LIBXML_THREAD_ENABLED #ifdef LIBXML_THREAD_ENABLED
__xmlParserVersion __xmlParserVersion
#else #else
@@ -143,6 +145,7 @@ xmlSaveNoEmptyTags DATA
xmlStringComment DATA xmlStringComment DATA
xmlStringText DATA xmlStringText DATA
xmlStringTextNoenc DATA xmlStringTextNoenc DATA
xmlStructuredError DATA
#ifdef LIBXML_THREAD_ENABLED #ifdef LIBXML_THREAD_ENABLED
__xmlSubstituteEntitiesDefaultValue __xmlSubstituteEntitiesDefaultValue
#else #else
@@ -644,6 +647,7 @@ xmlCopyElementContent
xmlCopyElementTable xmlCopyElementTable
xmlCopyEntitiesTable xmlCopyEntitiesTable
xmlCopyEnumeration xmlCopyEnumeration
xmlCopyError
xmlCopyNamespace xmlCopyNamespace
xmlCopyNamespaceList xmlCopyNamespaceList
xmlCopyNode xmlCopyNode
@@ -661,12 +665,14 @@ xmlCreateIntSubset
xmlCreateMemoryParserCtxt xmlCreateMemoryParserCtxt
xmlCreatePushParserCtxt xmlCreatePushParserCtxt
xmlCreateURI xmlCreateURI
xmlCtxtGetLastError
xmlCtxtReadDoc xmlCtxtReadDoc
xmlCtxtReadFd xmlCtxtReadFd
xmlCtxtReadFile xmlCtxtReadFile
xmlCtxtReadIO xmlCtxtReadIO
xmlCtxtReadMemory xmlCtxtReadMemory
xmlCtxtReset xmlCtxtReset
xmlCtxtResetLastError
xmlCtxtUseOptions xmlCtxtUseOptions
xmlCurrentChar xmlCurrentChar
#ifdef LIBXML_DEBUG_ENABLED #ifdef LIBXML_DEBUG_ENABLED
@@ -720,6 +726,33 @@ xmlDocDumpMemoryEnc
xmlDocFormatDump xmlDocFormatDump
xmlDocGetRootElement xmlDocGetRootElement
xmlDocSetRootElement xmlDocSetRootElement
xmlDocWalkerAttributeCount
xmlDocWalkerBaseUri
xmlDocWalkerCurrentDoc
xmlDocWalkerCurrentNode
xmlDocWalkerDepth
xmlDocWalkerGetAttribute
xmlDocWalkerGetAttributeNo
xmlDocWalkerGetAttributeNs
xmlDocWalkerHasAttributes
xmlDocWalkerHasValue
xmlDocWalkerIsEmptyElement
xmlDocWalkerLocalName
xmlDocWalkerLookupNamespace
xmlDocWalkerMoveToAttribute
xmlDocWalkerMoveToAttributeNo
xmlDocWalkerMoveToAttributeNs
xmlDocWalkerMoveToElement
xmlDocWalkerMoveToFirstAttribute
xmlDocWalkerMoveToNextAttribute
xmlDocWalkerName
xmlDocWalkerNamespaceUri
xmlDocWalkerNext
xmlDocWalkerNodeType
xmlDocWalkerPrefix
xmlDocWalkerRewind
xmlDocWalkerStep
xmlDocWalkerValue
xmlDumpAttributeDecl xmlDumpAttributeDecl
xmlDumpAttributeTable xmlDumpAttributeTable
xmlDumpElementDecl xmlDumpElementDecl
@@ -732,6 +765,7 @@ xmlElemDump
xmlEncodeEntities xmlEncodeEntities
xmlEncodeEntitiesReentrant xmlEncodeEntitiesReentrant
xmlEncodeSpecialChars xmlEncodeSpecialChars
xmlErrMemory
xmlFileClose xmlFileClose
xmlFileMatch xmlFileMatch
xmlFileOpen xmlFileOpen
@@ -745,6 +779,7 @@ xmlFreeAutomata
xmlFreeCatalog xmlFreeCatalog
#endif #endif
xmlFreeDoc xmlFreeDoc
xmlFreeDocWalker
xmlFreeDtd xmlFreeDtd
xmlFreeElementContent xmlFreeElementContent
xmlFreeElementTable xmlFreeElementTable
@@ -789,6 +824,7 @@ xmlGetGlobalState
xmlGetID xmlGetID
xmlGetIntSubset xmlGetIntSubset
xmlGetLastChild xmlGetLastChild
xmlGetLastError
xmlGetLineNo xmlGetLineNo
xmlGetNoNsProp xmlGetNoNsProp
xmlGetNodePath xmlGetNodePath
@@ -866,19 +902,11 @@ 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
@@ -1080,6 +1108,7 @@ xmlNewDocProp
xmlNewDocRawNode xmlNewDocRawNode
xmlNewDocText xmlNewDocText
xmlNewDocTextLen xmlNewDocTextLen
xmlNewDocWalker
xmlNewDtd xmlNewDtd
xmlNewElementContent xmlNewElementContent
xmlNewEntityInputStream xmlNewEntityInputStream
@@ -1233,6 +1262,16 @@ xmlReadFd
xmlReadFile xmlReadFile
xmlReadIO xmlReadIO
xmlReadMemory xmlReadMemory
xmlReaderForDoc
xmlReaderForFd
xmlReaderForFile
xmlReaderForIO
xmlReaderForMemory
xmlReaderNewDoc
xmlReaderNewFd
xmlReaderNewFile
xmlReaderNewIO
xmlReaderNewMemory
#ifdef DEBUG_MEMORY_LOCATION #ifdef DEBUG_MEMORY_LOCATION
xmlReallocLoc xmlReallocLoc
#endif #endif
@@ -1340,6 +1379,8 @@ xmlRemoveID
xmlRemoveProp xmlRemoveProp
xmlRemoveRef xmlRemoveRef
xmlReplaceNode xmlReplaceNode
xmlResetError
xmlResetLastError
xmlSAX2AttributeDecl xmlSAX2AttributeDecl
xmlSAX2CDataBlock xmlSAX2CDataBlock
xmlSAX2Characters xmlSAX2Characters
@@ -1480,6 +1521,7 @@ xmlSetListDoc
xmlSetNs xmlSetNs
xmlSetNsProp xmlSetNsProp
xmlSetProp xmlSetProp
xmlSetStructuredErrorFunc
xmlSetTreeDoc xmlSetTreeDoc
xmlSetupParserForBuffer xmlSetupParserForBuffer
#ifdef LIBXML_DEBUG_ENABLED #ifdef LIBXML_DEBUG_ENABLED
@@ -1532,6 +1574,7 @@ xmlSplitQName3
xmlSprintfElementContent xmlSprintfElementContent
xmlStopParser xmlStopParser
xmlStrEqual xmlStrEqual
xmlStrPrintf
xmlStrQEqual xmlStrQEqual
xmlStrcasecmp xmlStrcasecmp
xmlStrcasestr xmlStrcasestr
@@ -1629,6 +1672,7 @@ xmlThrDefPedanticParserDefaultValue
xmlThrDefRegisterNodeDefault xmlThrDefRegisterNodeDefault
xmlThrDefSaveNoEmptyTags xmlThrDefSaveNoEmptyTags
xmlThrDefSetGenericErrorFunc xmlThrDefSetGenericErrorFunc
xmlThrDefSetStructuredErrorFunc
xmlThrDefSubstituteEntitiesDefaultValue xmlThrDefSubstituteEntitiesDefaultValue
xmlThrDefTreeIndentString xmlThrDefTreeIndentString
#ifdef LIBXML_REGEXP_ENABLED #ifdef LIBXML_REGEXP_ENABLED
@@ -2193,6 +2237,9 @@ xmlXPathDivValues
xmlXPathEqualValues xmlXPathEqualValues
#endif #endif
#ifdef LIBXML_XPATH_ENABLED #ifdef LIBXML_XPATH_ENABLED
xmlXPathErr
#endif
#ifdef LIBXML_XPATH_ENABLED
xmlXPathEval xmlXPathEval
#endif #endif
#ifdef LIBXML_XPATH_ENABLED #ifdef LIBXML_XPATH_ENABLED

View File

@@ -35,6 +35,7 @@
#include <libxml/xmlmemory.h> #include <libxml/xmlmemory.h>
#include <libxml/xmlIO.h> #include <libxml/xmlIO.h>
#include <libxml/xmlreader.h> #include <libxml/xmlreader.h>
#include <libxml/parserInternals.h>
#include <libxml/relaxng.h> #include <libxml/relaxng.h>
/* #define DEBUG_CALLBACKS */ /* #define DEBUG_CALLBACKS */
@@ -3523,6 +3524,392 @@ xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader,
*arg = reader->errorFuncArg; *arg = reader->errorFuncArg;
} }
/************************************************************************
* *
* New set (2.6.0) of simpler and more flexible APIs *
* *
************************************************************************/
/**
* xmlTextReaderSetup:
* @reader: an XML reader
* @URL: the base URL to use for the document
* @encoding: the document encoding, or NULL
* @options: a combination of xmlParserOption(s)
* @reuse: keep the context for reuse
*
* Setup an XML reader with new options
*
* Returns 0 in case of success and -1 in case of error.
*/
static int
xmlTextReaderSetup(xmlTextReaderPtr reader, const char *URL,
const char *encoding, int options)
{
if ((reader == NULL) || (reader->ctxt == NULL))
return (-1);
xmlCtxtUseOptions(reader->ctxt, options);
if (encoding != NULL) {
xmlCharEncodingHandlerPtr hdlr;
hdlr = xmlFindCharEncodingHandler(encoding);
if (hdlr != NULL)
xmlSwitchToEncoding(reader->ctxt, hdlr);
}
if ((URL != NULL) && (reader->ctxt->input != NULL) &&
(reader->ctxt->input->filename == NULL))
reader->ctxt->input->filename = (char *)
xmlStrdup((const xmlChar *) URL);
return (0);
}
/**
* xmlReaderForDoc:
* @cur: a pointer to a zero terminated string
* @URL: the base URL to use for the document
* @encoding: the document encoding, or NULL
* @options: a combination of xmlParserOption(s)
*
* Create an xmltextReader for an XML in-memory document.
*
* Returns the new reader or NULL in case of error.
*/
xmlTextReaderPtr
xmlReaderForDoc(const xmlChar * cur, const char *URL, const char *encoding,
int options)
{
int len;
if (cur == NULL)
return (NULL);
len = xmlStrlen(cur);
return (xmlReaderForMemory
((const char *) cur, len, URL, encoding, options));
}
/**
* xmlReaderForFile:
* @filename: a file or URL
* @encoding: the document encoding, or NULL
* @options: a combination of xmlParserOption(s)
*
* parse an XML file from the filesystem or the network.
*
* Returns the new reader or NULL in case of error.
*/
xmlTextReaderPtr
xmlReaderForFile(const char *filename, const char *encoding, int options)
{
xmlTextReaderPtr reader;
reader = xmlNewTextReaderFilename(filename);
if (reader == NULL)
return (NULL);
xmlTextReaderSetup(reader, NULL, encoding, options);
return (reader);
}
/**
* xmlReaderForMemory:
* @buffer: a pointer to a char array
* @size: the size of the array
* @URL: the base URL to use for the document
* @encoding: the document encoding, or NULL
* @options: a combination of xmlParserOption(s)
*
* Create an xmltextReader for an XML in-memory document.
*
* Returns the new reader or NULL in case of error.
*/
xmlTextReaderPtr
xmlReaderForMemory(const char *buffer, int size, const char *URL,
const char *encoding, int options)
{
xmlTextReaderPtr reader;
xmlParserInputBufferPtr buf;
buf =
xmlParserInputBufferCreateMem(buffer, size,
XML_CHAR_ENCODING_NONE);
if (buf == NULL) {
return (NULL);
}
reader = xmlNewTextReader(buf, URL);
if (reader == NULL) {
xmlFreeParserInputBuffer(buf);
return (NULL);
}
xmlTextReaderSetup(reader, URL, encoding, options);
return (reader);
}
/**
* xmlReaderForFd:
* @fd: an open file descriptor
* @URL: the base URL to use for the document
* @encoding: the document encoding, or NULL
* @options: a combination of xmlParserOption(s)
*
* Create an xmltextReader for an XML from a file descriptor.
*
* Returns the new reader or NULL in case of error.
*/
xmlTextReaderPtr
xmlReaderForFd(int fd, const char *URL, const char *encoding, int options)
{
xmlTextReaderPtr reader;
xmlParserInputBufferPtr input;
if (fd < 0)
return (NULL);
input = xmlParserInputBufferCreateFd(fd, XML_CHAR_ENCODING_NONE);
if (input == NULL)
return (NULL);
reader = xmlNewTextReader(input, URL);
if (reader == NULL) {
xmlFreeParserInputBuffer(input);
return (NULL);
}
xmlTextReaderSetup(reader, URL, encoding, options);
return (reader);
}
/**
* xmlReaderForIO:
* @ioread: an I/O read function
* @ioclose: an I/O close function
* @ioctx: an I/O handler
* @URL: the base URL to use for the document
* @encoding: the document encoding, or NULL
* @options: a combination of xmlParserOption(s)
*
* Create an xmltextReader for an XML document from I/O functions and source.
*
* Returns the new reader or NULL in case of error.
*/
xmlTextReaderPtr
xmlReaderForIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose,
void *ioctx, const char *URL, const char *encoding,
int options)
{
xmlTextReaderPtr reader;
xmlParserInputBufferPtr input;
if (ioread == NULL)
return (NULL);
input = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx,
XML_CHAR_ENCODING_NONE);
if (input == NULL)
return (NULL);
reader = xmlNewTextReader(input, URL);
if (reader == NULL) {
xmlFreeParserInputBuffer(input);
return (NULL);
}
xmlTextReaderSetup(reader, URL, encoding, options);
return (reader);
}
/**
* xmlReaderNewDoc:
* @reader: an XML reader
* @cur: a pointer to a zero terminated string
* @URL: the base URL to use for the document
* @encoding: the document encoding, or NULL
* @options: a combination of xmlParserOption(s)
*
* Setup an xmltextReader to parse an XML in-memory document.
* This reuses the existing @reader xmlTextReader.
*
* Returns 0 in case of success and -1 in case of error
*/
int
xmlReaderNewDoc(xmlTextReaderPtr reader, const xmlChar * cur,
const char *URL, const char *encoding, int options)
{
xmlParserInputPtr stream;
if (cur == NULL)
return (-1);
if ((reader == NULL) || (reader->ctxt == NULL))
return (-1);
xmlCtxtReset(reader->ctxt);
stream = xmlNewStringInputStream(reader->ctxt, cur);
if (stream == NULL) {
return (-1);
}
inputPush(reader->ctxt, stream);
return (xmlTextReaderSetup(reader, URL, encoding, options));
}
/**
* xmlReaderNewFile:
* @reader: an XML reader
* @filename: a file or URL
* @encoding: the document encoding, or NULL
* @options: a combination of xmlParserOption(s)
*
* parse an XML file from the filesystem or the network.
* This reuses the existing @reader xmlTextReader.
*
* Returns 0 in case of success and -1 in case of error
*/
int
xmlReaderNewFile(xmlTextReaderPtr reader, const char *filename,
const char *encoding, int options)
{
xmlParserInputPtr stream;
if (filename == NULL)
return (-1);
if ((reader == NULL) || (reader->ctxt == NULL))
return (-1);
xmlCtxtReset(reader->ctxt);
stream = xmlNewInputFromFile(reader->ctxt, filename);
if (stream == NULL) {
return (-1);
}
inputPush(reader->ctxt, stream);
return (xmlTextReaderSetup(reader, NULL, encoding, options));
}
/**
* xmlReaderNewMemory:
* @reader: an XML reader
* @buffer: a pointer to a char array
* @size: the size of the array
* @URL: the base URL to use for the document
* @encoding: the document encoding, or NULL
* @options: a combination of xmlParserOption(s)
*
* Setup an xmltextReader to parse an XML in-memory document.
* This reuses the existing @reader xmlTextReader.
*
* Returns 0 in case of success and -1 in case of error
*/
int
xmlReaderNewMemory(xmlTextReaderPtr reader, const char *buffer, int size,
const char *URL, const char *encoding, int options)
{
xmlParserInputBufferPtr input;
xmlParserInputPtr stream;
if ((reader == NULL) || (reader->ctxt == NULL))
return (-1);
if (buffer == NULL)
return (-1);
xmlCtxtReset(reader->ctxt);
input =
xmlParserInputBufferCreateMem(buffer, size,
XML_CHAR_ENCODING_NONE);
if (input == NULL) {
return (-1);
}
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));
}
/**
* xmlReaderNewFd:
* @reader: an XML reader
* @fd: an open file descriptor
* @URL: the base URL to use for the document
* @encoding: the document encoding, or NULL
* @options: a combination of xmlParserOption(s)
*
* Setup an xmltextReader to parse an XML from a file descriptor.
* This reuses the existing @reader xmlTextReader.
*
* Returns 0 in case of success and -1 in case of error
*/
int
xmlReaderNewFd(xmlTextReaderPtr reader, int fd,
const char *URL, const char *encoding, int options)
{
xmlParserInputBufferPtr input;
xmlParserInputPtr stream;
if (fd < 0)
return (-1);
if ((reader == NULL) || (reader->ctxt == NULL))
return (-1);
xmlCtxtReset(reader->ctxt);
input = xmlParserInputBufferCreateFd(fd, XML_CHAR_ENCODING_NONE);
if (input == NULL)
return (-1);
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));
}
/**
* xmlReaderNewIO:
* @reader: an XML reader
* @ioread: an I/O read function
* @ioclose: an I/O close function
* @ioctx: an I/O handler
* @URL: the base URL to use for the document
* @encoding: the document encoding, or NULL
* @options: a combination of xmlParserOption(s)
*
* Setup an xmltextReader to parse an XML document from I/O functions
* and source.
* This reuses the existing @reader xmlTextReader.
*
* Returns 0 in case of success and -1 in case of error
*/
int
xmlReaderNewIO(xmlTextReaderPtr reader, xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose, void *ioctx,
const char *URL, const char *encoding, int options)
{
xmlParserInputBufferPtr input;
xmlParserInputPtr stream;
if (ioread == NULL)
return (-1);
if ((reader == NULL) || (reader->ctxt == NULL))
return (-1);
xmlCtxtReset(reader->ctxt);
input = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx,
XML_CHAR_ENCODING_NONE);
if (input == NULL)
return (-1);
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));
}
/************************************************************************ /************************************************************************
* * * *
* Utilities * * Utilities *