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
diff --git a/ChangeLog b/ChangeLog
index d22e1ef..05874b3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
 	* genChRanges.py, chvalid.c, include/libxml/chvalid.h,
diff --git a/doc/Makefile.am b/doc/Makefile.am
index d018f39..7aef77d 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -60,7 +60,7 @@
 	-@(xsltproc --nonet xmlcatalog_man.xml)
 
 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
 	-gtkdoc-mktmpl --module=libxml
diff --git a/doc/apibuild.py b/doc/apibuild.py
index 59cc0cf..ce2f738 100755
--- a/doc/apibuild.py
+++ b/doc/apibuild.py
@@ -25,6 +25,9 @@
   "testOOM.c": "out of memory tester",
   "testOOMlib.h": "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 = {
diff --git a/doc/libxml2-api.xml b/doc/libxml2-api.xml
index 4cfee68..1effbc0 100644
--- a/doc/libxml2-api.xml
+++ b/doc/libxml2-api.xml
@@ -140,15 +140,7 @@
      <exports symbol='xmlErrMemory'/>
      <exports symbol='xmlFreeInputStream'/>
      <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='xmlIsPubidChar'/>
      <exports symbol='xmlNamespaceParseNCName'/>
      <exports symbol='xmlNamespaceParseNSDef'/>
      <exports symbol='xmlNamespaceParseQName'/>
@@ -206,6 +198,7 @@
      <exports symbol='xmlParserHandlePEReference'/>
      <exports symbol='xmlParserHandleReference'/>
      <exports symbol='xmlParserInputShrink'/>
+     <exports symbol='xmlParserMaxDepth'/>
      <exports symbol='xmlPopInput'/>
      <exports symbol='xmlPushInput'/>
      <exports symbol='xmlScanName'/>
@@ -1385,6 +1378,16 @@
      <exports symbol='xmlNewTextReaderFilename'/>
      <exports symbol='xmlParserProperties'/>
      <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='xmlTextReader'/>
      <exports symbol='xmlTextReaderAttributeCount'/>
@@ -4911,6 +4914,7 @@
     <variable name='xmlMallocAtomic' file='globals' type='xmlMallocFunc'/>
     <variable name='xmlMemStrdup' file='globals' type='xmlStrdupFunc'/>
     <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='xmlPedanticParserDefaultValue' file='globals' type='int'/>
     <variable name='xmlRealloc' file='globals' type='xmlReallocFunc'/>
@@ -8053,41 +8057,11 @@
       <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'/>
     </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'>
       <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'/>
       <arg name='node' type='xmlNodePtr' info='the node'/>
     </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'>
       <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'/>
@@ -8095,11 +8069,6 @@
       <arg name='elem' type='xmlNodePtr' info='the element carrying the attribute'/>
       <arg name='attr' type='xmlAttrPtr' info='the attribute'/>
     </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'>
       <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'/>
@@ -8115,11 +8084,6 @@
       <arg name='doc' type='xmlDocPtr' info='the document'/>
       <arg name='name' type='const xmlChar *' info='the element name'/>
     </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'>
       <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'/>
@@ -9700,6 +9664,95 @@
       <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='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'>
       <info>Signature for a realloc() implementation.</info>
       <return type='void *' info='a pointer to the newly reallocated block or NULL in case of error.'/>
diff --git a/doc/namespaces.html b/doc/namespaces.html
index d50f10b..6f15c5f 100644
--- a/doc/namespaces.html
+++ b/doc/namespaces.html
@@ -34,12 +34,21 @@
 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
 <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,
 so even if you plan to use or currently are using validation I strongly
 suggest adding namespaces to your document. A default namespace scheme
 <code>xmlns=&quot;http://....&quot;</code> should not break validity even on less
 flexible parsers. Using namespaces to mix and differentiate content coming
-from multiple DTDs will certainly break current validation schemes. I will
-try to provide ways to do this, but this may not be portable or
-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>
+from multiple DTDs will certainly break current validation schemes.
+To check such documents one needs to use schema-validation, which is supported
+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>
diff --git a/doc/upgrade.html b/doc/upgrade.html
index 335e9bc..8196a48 100644
--- a/doc/upgrade.html
+++ b/doc/upgrade.html
@@ -23,7 +23,7 @@
 </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
 that I have collected, they may not be sufficient, so in case you find other
-change which are required, <a href="mailto:Daniel.Ï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
     is now -lxml2 . There is a new xml2-config script which should be used to
     select the right parameters libxml2</li>
diff --git a/doc/xml.html b/doc/xml.html
index d72d4b9..f7fcdaa 100644
--- a/doc/xml.html
+++ b/doc/xml.html
@@ -3758,7 +3758,14 @@
 
 <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.
 I will try to make sure that using namespaces won't break validity checking,
@@ -3766,9 +3773,11 @@
 suggest adding namespaces to your document. A default namespace scheme
 <code>xmlns="http://...."</code> should not break validity even on less
 flexible parsers. Using namespaces to mix and differentiate content coming
-from multiple DTDs will certainly break current validation schemes. I will
-try to provide ways to do this, but this may not be portable or
-standardized.</p>
+from multiple DTDs will certainly break current validation schemes.
+To check such documents one needs to use schema-validation, which is supported
+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>
 
@@ -3796,7 +3805,7 @@
 <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
 that I have collected, they may not be sufficient, so in case you find other
-change which are required, <a href="mailto:Daniel.Ï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
diff --git a/include/libxml/xmlreader.h b/include/libxml/xmlreader.h
index 67c625e..bbff65d 100644
--- a/include/libxml/xmlreader.h
+++ b/include/libxml/xmlreader.h
@@ -206,6 +206,69 @@
 #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
  */
 typedef void *  xmlTextReaderLocatorPtr;
diff --git a/python/libxml2class.txt b/python/libxml2class.txt
index 2f37fb3..f5cbc7e 100644
--- a/python/libxml2class.txt
+++ b/python/libxml2class.txt
@@ -133,15 +133,7 @@
 createMemoryParserCtxt()
 htmlCreateFileParserCtxt()
 htmlInitAutoClose()
-isBaseChar()
-isBlank()
-isChar()
-isCombining()
-isDigit()
-isExtender()
-isIdeographic()
 isLetter()
-isPubidChar()
 namePop()
 namePush()
 nodePop()
@@ -213,6 +205,10 @@
 
 # functions from module xmlreader
 newTextReaderFilename()
+readerForDoc()
+readerForFd()
+readerForFile()
+readerForMemory()
 
 # functions from module xmlregexp
 regexpCompile()
@@ -709,6 +705,10 @@
     SetParserProp()
     Value()
     XmlLang()
+    readerNewDoc()
+    readerNewFd()
+    readerNewFile()
+    readerNewMemory()
 Class xmlReg()
 
     # functions from module xmlregexp
diff --git a/win32/libxml2.def.src b/win32/libxml2.def.src
index 3864d9a..2aea070 100644
--- a/win32/libxml2.def.src
+++ b/win32/libxml2.def.src
@@ -85,6 +85,7 @@
 #else
 xmlKeepBlanksDefaultValue DATA
 #endif
+xmlLastError DATA
 #ifdef LIBXML_THREAD_ENABLED
 __xmlLineNumbersDefaultValue
 #else
@@ -115,6 +116,7 @@
 #else
 xmlParserDebugEntities DATA
 #endif
+xmlParserMaxDepth DATA
 #ifdef LIBXML_THREAD_ENABLED
 __xmlParserVersion
 #else
@@ -143,6 +145,7 @@
 xmlStringComment DATA
 xmlStringText DATA
 xmlStringTextNoenc DATA
+xmlStructuredError DATA
 #ifdef LIBXML_THREAD_ENABLED
 __xmlSubstituteEntitiesDefaultValue
 #else
@@ -644,6 +647,7 @@
 xmlCopyElementTable
 xmlCopyEntitiesTable
 xmlCopyEnumeration
+xmlCopyError
 xmlCopyNamespace
 xmlCopyNamespaceList
 xmlCopyNode
@@ -661,12 +665,14 @@
 xmlCreateMemoryParserCtxt
 xmlCreatePushParserCtxt
 xmlCreateURI
+xmlCtxtGetLastError
 xmlCtxtReadDoc
 xmlCtxtReadFd
 xmlCtxtReadFile
 xmlCtxtReadIO
 xmlCtxtReadMemory
 xmlCtxtReset
+xmlCtxtResetLastError
 xmlCtxtUseOptions
 xmlCurrentChar
 #ifdef LIBXML_DEBUG_ENABLED
@@ -720,6 +726,33 @@
 xmlDocFormatDump
 xmlDocGetRootElement
 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
 xmlDumpAttributeTable
 xmlDumpElementDecl
@@ -732,6 +765,7 @@
 xmlEncodeEntities
 xmlEncodeEntitiesReentrant
 xmlEncodeSpecialChars
+xmlErrMemory
 xmlFileClose
 xmlFileMatch
 xmlFileOpen
@@ -745,6 +779,7 @@
 xmlFreeCatalog
 #endif
 xmlFreeDoc
+xmlFreeDocWalker
 xmlFreeDtd
 xmlFreeElementContent
 xmlFreeElementTable
@@ -789,6 +824,7 @@
 xmlGetID
 xmlGetIntSubset
 xmlGetLastChild
+xmlGetLastError
 xmlGetLineNo
 xmlGetNoNsProp
 xmlGetNodePath
@@ -866,19 +902,11 @@
 #endif
 xmlInitializeGlobalState
 xmlInitializePredefinedEntities
-xmlIsBaseChar
-xmlIsBlank
 xmlIsBlankNode
-xmlIsChar
-xmlIsCombining
-xmlIsDigit
-xmlIsExtender
 xmlIsID
-xmlIsIdeographic
 xmlIsLetter
 xmlIsMainThread
 xmlIsMixedElement
-xmlIsPubidChar
 xmlIsRef
 #ifdef LIBXML_HTML_ENABLED
 xmlIsXHTML
@@ -1080,6 +1108,7 @@
 xmlNewDocRawNode
 xmlNewDocText
 xmlNewDocTextLen
+xmlNewDocWalker
 xmlNewDtd
 xmlNewElementContent
 xmlNewEntityInputStream
@@ -1233,6 +1262,16 @@
 xmlReadFile
 xmlReadIO
 xmlReadMemory
+xmlReaderForDoc
+xmlReaderForFd
+xmlReaderForFile
+xmlReaderForIO
+xmlReaderForMemory
+xmlReaderNewDoc
+xmlReaderNewFd
+xmlReaderNewFile
+xmlReaderNewIO
+xmlReaderNewMemory
 #ifdef DEBUG_MEMORY_LOCATION
 xmlReallocLoc
 #endif
@@ -1340,6 +1379,8 @@
 xmlRemoveProp
 xmlRemoveRef
 xmlReplaceNode
+xmlResetError
+xmlResetLastError
 xmlSAX2AttributeDecl
 xmlSAX2CDataBlock
 xmlSAX2Characters
@@ -1480,6 +1521,7 @@
 xmlSetNs
 xmlSetNsProp
 xmlSetProp
+xmlSetStructuredErrorFunc
 xmlSetTreeDoc
 xmlSetupParserForBuffer
 #ifdef LIBXML_DEBUG_ENABLED
@@ -1532,6 +1574,7 @@
 xmlSprintfElementContent
 xmlStopParser
 xmlStrEqual
+xmlStrPrintf
 xmlStrQEqual
 xmlStrcasecmp
 xmlStrcasestr
@@ -1629,6 +1672,7 @@
 xmlThrDefRegisterNodeDefault
 xmlThrDefSaveNoEmptyTags
 xmlThrDefSetGenericErrorFunc
+xmlThrDefSetStructuredErrorFunc
 xmlThrDefSubstituteEntitiesDefaultValue
 xmlThrDefTreeIndentString
 #ifdef LIBXML_REGEXP_ENABLED
@@ -2193,6 +2237,9 @@
 xmlXPathEqualValues
 #endif
 #ifdef LIBXML_XPATH_ENABLED
+xmlXPathErr
+#endif
+#ifdef LIBXML_XPATH_ENABLED
 xmlXPathEval
 #endif
 #ifdef LIBXML_XPATH_ENABLED
diff --git a/xmlreader.c b/xmlreader.c
index b4c9d70..1f1176b 100644
--- a/xmlreader.c
+++ b/xmlreader.c
@@ -35,6 +35,7 @@
 #include <libxml/xmlmemory.h>
 #include <libxml/xmlIO.h>
 #include <libxml/xmlreader.h>
+#include <libxml/parserInternals.h>
 #include <libxml/relaxng.h>
 
 /* #define DEBUG_CALLBACKS */
@@ -3523,6 +3524,392 @@
     *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					*