trying to clarify even more the xmlCleanupParser() use and the memory

* parser.c docs/*: trying to clarify even more the xmlCleanupParser()
  use and the memory documentation
Daniel

svn path=/trunk/; revision=3719
diff --git a/ChangeLog b/ChangeLog
index 63b59b4..1d1416a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Mar 31 10:25:37 CEST 2008 Daniel Veillard <daniel@veillard.com>
+
+	* parser.c docs/*: trying to clarify even more the xmlCleanupParser()
+	  use and the memory documentation
+
 Wed Mar 26 18:39:58 CET 2008 Daniel Veillard <daniel@veillard.com>
 
 	* parser.c: changes based on  Alex Khesin patch where xmlParseCharRef
diff --git a/doc/APIchunk1.html b/doc/APIchunk1.html
index 881aedf..bedf943 100644
--- a/doc/APIchunk1.html
+++ b/doc/APIchunk1.html
@@ -119,8 +119,7 @@
 <a href="html/libxml-parser.html#referenceSAXFunc">referenceSAXFunc</a><br />
 <a href="html/libxml-parser.html#startDocumentSAXFunc">startDocumentSAXFunc</a><br />
 <a href="html/libxml-parser.html#startElementSAXFunc">startElementSAXFunc</a><br />
-</dd><dt>Calling</dt><dd><a href="html/libxml-parser.html#xmlCleanupParser">xmlCleanupParser</a><br />
-<a href="html/libxml-xmlIO.html#xmlRegisterHTTPPostCallbacks">xmlRegisterHTTPPostCallbacks</a><br />
+</dd><dt>Calling</dt><dd><a href="html/libxml-xmlIO.html#xmlRegisterHTTPPostCallbacks">xmlRegisterHTTPPostCallbacks</a><br />
 </dd><dt>Canonical</dt><dd><a href="html/libxml-c14n.html#xmlC14NDocDumpMemory">xmlC14NDocDumpMemory</a><br />
 <a href="html/libxml-c14n.html#xmlC14NDocSave">xmlC14NDocSave</a><br />
 <a href="html/libxml-c14n.html#xmlC14NDocSaveTo">xmlC14NDocSaveTo</a><br />
@@ -200,7 +199,6 @@
 <a href="html/libxml-parser.html#xmlParseChunk">xmlParseChunk</a><br />
 <a href="html/libxml-parser.html#xmlParseInNodeContext">xmlParseInNodeContext</a><br />
 </dd><dt>Cleanup</dt><dd><a href="html/libxml-encoding.html#xmlCleanupCharEncodingHandlers">xmlCleanupCharEncodingHandlers</a><br />
-<a href="html/libxml-parser.html#xmlCleanupParser">xmlCleanupParser</a><br />
 <a href="html/libxml-entities.html#xmlCleanupPredefinedEntities">xmlCleanupPredefinedEntities</a><br />
 <a href="html/libxml-xmlerror.html#xmlCtxtResetLastError">xmlCtxtResetLastError</a><br />
 <a href="html/libxml-nanoftp.html#xmlNanoFTPCleanup">xmlNanoFTPCleanup</a><br />
diff --git a/doc/APIchunk10.html b/doc/APIchunk10.html
index 49042c0..fe1eab7 100644
--- a/doc/APIchunk10.html
+++ b/doc/APIchunk10.html
@@ -374,6 +374,7 @@
 <a href="html/libxml-xpointer.html#xmlXPtrLocationSetAdd">xmlXPtrLocationSetAdd</a><br />
 </dd><dt>also</dt><dd><a href="html/libxml-encoding.html#xmlCharEncodingOutputFunc">xmlCharEncodingOutputFunc</a><br />
 <a href="html/libxml-xmlIO.html#xmlCheckHTTPInput">xmlCheckHTTPInput</a><br />
+<a href="html/libxml-parser.html#xmlCleanupParser">xmlCleanupParser</a><br />
 <a href="html/libxml-tree.html#xmlHasProp">xmlHasProp</a><br />
 <a href="html/libxml-parser.html#xmlKeepBlanksDefault">xmlKeepBlanksDefault</a><br />
 <a href="html/libxml-nanoftp.html#xmlNanoFTPProxy">xmlNanoFTPProxy</a><br />
diff --git a/doc/APIchunk12.html b/doc/APIchunk12.html
index d65e701..769619b 100644
--- a/doc/APIchunk12.html
+++ b/doc/APIchunk12.html
@@ -259,10 +259,13 @@
 </dd><dt>circular</dt><dd><a href="html/libxml-schemasInternals.html#XML_SCHEMAS_ATTRGROUP_MARKED">XML_SCHEMAS_ATTRGROUP_MARKED</a><br />
 <a href="html/libxml-schemasInternals.html#XML_SCHEMAS_ELEM_CIRCULAR">XML_SCHEMAS_ELEM_CIRCULAR</a><br />
 <a href="html/libxml-schemasInternals.html#XML_SCHEMAS_TYPE_MARKED">XML_SCHEMAS_TYPE_MARKED</a><br />
+</dd><dt>clean</dt><dd><a href="html/libxml-parser.html#xmlCleanupParser">xmlCleanupParser</a><br />
 </dd><dt>cleanly</dt><dd><a href="html/libxml-xmlIO.html#xmlCheckHTTPInput">xmlCheckHTTPInput</a><br />
-</dd><dt>cleans</dt><dd><a href="html/libxml-nanoftp.html#xmlNanoFTPScanProxy">xmlNanoFTPScanProxy</a><br />
+</dd><dt>cleans</dt><dd><a href="html/libxml-parser.html#xmlCleanupParser">xmlCleanupParser</a><br />
+<a href="html/libxml-nanoftp.html#xmlNanoFTPScanProxy">xmlNanoFTPScanProxy</a><br />
 <a href="html/libxml-nanohttp.html#xmlNanoHTTPScanProxy">xmlNanoHTTPScanProxy</a><br />
 </dd><dt>cleanup</dt><dd><a href="html/libxml-globals.html#xmlCleanupGlobals">xmlCleanupGlobals</a><br />
+<a href="html/libxml-parser.html#xmlCleanupParser">xmlCleanupParser</a><br />
 <a href="html/libxml-threads.html#xmlCleanupThreads">xmlCleanupThreads</a><br />
 <a href="html/libxml-nanoftp.html#xmlNanoFTPCleanup">xmlNanoFTPCleanup</a><br />
 </dd><dt>clear</dt><dd><a href="html/libxml-list.html#xmlListMerge">xmlListMerge</a><br />
diff --git a/doc/APIchunk13.html b/doc/APIchunk13.html
index 00da28b..c86ff16 100644
--- a/doc/APIchunk13.html
+++ b/doc/APIchunk13.html
@@ -495,7 +495,8 @@
 </dd><dt>docs</dt><dd><a href="html/libxml-uri.html#xmlBuildRelativeURI">xmlBuildRelativeURI</a><br />
 </dd><dt>doctypedecl</dt><dd><a href="html/libxml-parserInternals.html#xmlParseDocTypeDecl">xmlParseDocTypeDecl</a><br />
 <a href="html/libxml-parser.html#xmlParseDocument">xmlParseDocument</a><br />
-</dd><dt>documents</dt><dd><a href="html/libxml-valid.html#xmlIsID">xmlIsID</a><br />
+</dd><dt>documents</dt><dd><a href="html/libxml-parser.html#xmlCleanupParser">xmlCleanupParser</a><br />
+<a href="html/libxml-valid.html#xmlIsID">xmlIsID</a><br />
 <a href="html/libxml-parserInternals.html#xmlParseEntityRef">xmlParseEntityRef</a><br />
 <a href="html/libxml-parserInternals.html#xmlParserHandleReference">xmlParserHandleReference</a><br />
 <a href="html/libxml-parser.html#xmlSAXParseDoc">xmlSAXParseDoc</a><br />
diff --git a/doc/APIchunk15.html b/doc/APIchunk15.html
index 2d04f0d..03616a5 100644
--- a/doc/APIchunk15.html
+++ b/doc/APIchunk15.html
@@ -394,6 +394,7 @@
 <a href="html/libxml-relaxng.html#xmlRelaxNGSetValidStructuredErrors">xmlRelaxNGSetValidStructuredErrors</a><br />
 <a href="html/libxml-xmlschemas.html#xmlSchemaSetParserErrors">xmlSchemaSetParserErrors</a><br />
 <a href="html/libxml-xmlschemas.html#xmlSchemaSetParserStructuredErrors">xmlSchemaSetParserStructuredErrors</a><br />
+<a href="html/libxml-schematron.html#xmlSchematronSetValidStructuredErrors">xmlSchematronSetValidStructuredErrors</a><br />
 <a href="html/libxml-debugXML.html#xmlShellCmd">xmlShellCmd</a><br />
 <a href="html/libxml-parserInternals.html#xmlSwitchEncoding">xmlSwitchEncoding</a><br />
 <a href="html/libxml-parserInternals.html#xmlSwitchInputEncoding">xmlSwitchInputEncoding</a><br />
diff --git a/doc/APIchunk17.html b/doc/APIchunk17.html
index f09d9bf..548d945 100644
--- a/doc/APIchunk17.html
+++ b/doc/APIchunk17.html
@@ -516,6 +516,7 @@
 </dd><dt>itself</dt><dd><a href="html/libxml-tree.html#_xmlDoc">_xmlDoc</a><br />
 <a href="html/libxml-xlink.html#xlinkIsLink">xlinkIsLink</a><br />
 <a href="html/libxml-encoding.html#xmlCharEncFirstLine">xmlCharEncFirstLine</a><br />
+<a href="html/libxml-parser.html#xmlCleanupParser">xmlCleanupParser</a><br />
 <a href="html/libxml-parserInternals.html#xmlParsePEReference">xmlParsePEReference</a><br />
 <a href="html/libxml-parserInternals.html#xmlParserHandlePEReference">xmlParserHandlePEReference</a><br />
 <a href="html/libxml-xpathInternals.html#xmlXPathNextSelf">xmlXPathNextSelf</a><br />
diff --git a/doc/APIchunk19.html b/doc/APIchunk19.html
index 7264dff..a5db809 100644
--- a/doc/APIchunk19.html
+++ b/doc/APIchunk19.html
@@ -242,7 +242,8 @@
 </dd><dt>minus</dt><dd><a href="html/libxml-xpathInternals.html#xmlXPathStringFunction">xmlXPathStringFunction</a><br />
 </dd><dt>minute</dt><dd><a href="html/libxml-nanoftp.html#ftpListCallback">ftpListCallback</a><br />
 </dd><dt>misc</dt><dd><a href="html/libxml-xpath.html#xmlXPathContextSetCache">xmlXPathContextSetCache</a><br />
-</dd><dt>misleading</dt><dd><a href="html/libxml-parserInternals.html#xmlParsePEReference">xmlParsePEReference</a><br />
+</dd><dt>misleading</dt><dd><a href="html/libxml-parser.html#xmlCleanupParser">xmlCleanupParser</a><br />
+<a href="html/libxml-parserInternals.html#xmlParsePEReference">xmlParsePEReference</a><br />
 <a href="html/libxml-parserInternals.html#xmlParserHandlePEReference">xmlParserHandlePEReference</a><br />
 </dd><dt>missing</dt><dd><a href="html/libxml-parserInternals.html#xmlParseSDDecl">xmlParseSDDecl</a><br />
 </dd><dt>mixed</dt><dd><a href="html/libxml-schemasInternals.html#XML_SCHEMAS_TYPE_MIXED">XML_SCHEMAS_TYPE_MIXED</a><br />
diff --git a/doc/APIchunk21.html b/doc/APIchunk21.html
index 16d268c..05eab1d 100644
--- a/doc/APIchunk21.html
+++ b/doc/APIchunk21.html
@@ -214,6 +214,7 @@
 <a href="html/libxml-xpathInternals.html#xmlXPathSubValues">xmlXPathSubValues</a><br />
 <a href="html/libxml-xpathInternals.html#xmlXPathValueFlipSign">xmlXPathValueFlipSign</a><br />
 </dd><dt>operations</dt><dd><a href="html/libxml-tree.html#_xmlDOMWrapCtxt">_xmlDOMWrapCtxt</a><br />
+<a href="html/libxml-parser.html#xmlCleanupParser">xmlCleanupParser</a><br />
 <a href="html/libxml-xmlmodule.html#xmlModuleClose">xmlModuleClose</a><br />
 <a href="html/libxml-xmlmodule.html#xmlModuleFree">xmlModuleFree</a><br />
 <a href="html/libxml-tree.html#xmlReconciliateNs">xmlReconciliateNs</a><br />
@@ -226,6 +227,7 @@
 <a href="html/libxml-xpathInternals.html#xmlXPathMultValues">xmlXPathMultValues</a><br />
 <a href="html/libxml-xpathInternals.html#xmlXPathSubValues">xmlXPathSubValues</a><br />
 <a href="html/libxml-xpathInternals.html#xmlXPathValueFlipSign">xmlXPathValueFlipSign</a><br />
+</dd><dt>opposite</dt><dd><a href="html/libxml-parser.html#xmlCleanupParser">xmlCleanupParser</a><br />
 </dd><dt>optimized</dt><dd><a href="html/libxml-xpathInternals.html#xmlXPathNodeSetAddUnique">xmlXPathNodeSetAddUnique</a><br />
 </dd><dt>option</dt><dd><a href="html/libxml-tree.html#xmlDOMWrapAdoptNode">xmlDOMWrapAdoptNode</a><br />
 <a href="html/libxml-tree.html#xmlDOMWrapCloneNode">xmlDOMWrapCloneNode</a><br />
diff --git a/doc/APIchunk22.html b/doc/APIchunk22.html
index 4d1c296..1fcc6c9 100644
--- a/doc/APIchunk22.html
+++ b/doc/APIchunk22.html
@@ -320,6 +320,7 @@
 <a href="html/libxml-tree.html#xmlDOMWrapAdoptNode">xmlDOMWrapAdoptNode</a><br />
 <a href="html/libxml-tree.html#xmlDOMWrapCloneNode">xmlDOMWrapCloneNode</a><br />
 <a href="html/libxml-tree.html#xmlDOMWrapReconcileNamespaces">xmlDOMWrapReconcileNamespaces</a><br />
+</dd><dt>preparing</dt><dd><a href="html/libxml-parser.html#xmlCleanupParser">xmlCleanupParser</a><br />
 </dd><dt>preparsed</dt><dd><a href="html/libxml-xmlreader.html#xmlReaderNewWalker">xmlReaderNewWalker</a><br />
 <a href="html/libxml-xmlreader.html#xmlReaderWalker">xmlReaderWalker</a><br />
 <a href="html/libxml-relaxng.html#xmlRelaxNGNewDocParserCtxt">xmlRelaxNGNewDocParserCtxt</a><br />
@@ -352,7 +353,6 @@
 <a href="html/libxml-tree.html#xmlNodeSetSpacePreserve">xmlNodeSetSpacePreserve</a><br />
 </dd><dt>prev</dt><dd><a href="html/libxml-valid.html#xmlValidGetValidElements">xmlValidGetValidElements</a><br />
 </dd><dt>prevent</dt><dd><a href="html/libxml-parser.html#_xmlParserCtxt">_xmlParserCtxt</a><br />
-<a href="html/libxml-parser.html#xmlCleanupParser">xmlCleanupParser</a><br />
 </dd><dt>previous</dt><dd><a href="html/libxml-tree.html#_xmlAttr">_xmlAttr</a><br />
 <a href="html/libxml-tree.html#_xmlAttribute">_xmlAttribute</a><br />
 <a href="html/libxml-tree.html#_xmlDoc">_xmlDoc</a><br />
diff --git a/doc/APIchunk23.html b/doc/APIchunk23.html
index bbf1165..4d76cc6 100644
--- a/doc/APIchunk23.html
+++ b/doc/APIchunk23.html
@@ -573,8 +573,7 @@
 <a href="html/libxml-xmlreader.html#xmlReaderNewIO">xmlReaderNewIO</a><br />
 <a href="html/libxml-xmlreader.html#xmlReaderNewMemory">xmlReaderNewMemory</a><br />
 <a href="html/libxml-xmlreader.html#xmlReaderNewWalker">xmlReaderNewWalker</a><br />
-</dd><dt>reusing</dt><dd><a href="html/libxml-parser.html#xmlCleanupParser">xmlCleanupParser</a><br />
-<a href="html/libxml-xinclude.html#xmlXIncludeProcessNode">xmlXIncludeProcessNode</a><br />
+</dd><dt>reusing</dt><dd><a href="html/libxml-xinclude.html#xmlXIncludeProcessNode">xmlXIncludeProcessNode</a><br />
 </dd><dt>reverse</dt><dd><a href="html/libxml-list.html#xmlListReverseSearch">xmlListReverseSearch</a><br />
 <a href="html/libxml-list.html#xmlListReverseWalk">xmlListReverseWalk</a><br />
 <a href="html/libxml-xpathInternals.html#xmlXPathNextAncestor">xmlXPathNextAncestor</a><br />
diff --git a/doc/APIchunk24.html b/doc/APIchunk24.html
index 5f563c6..9601ab4 100644
--- a/doc/APIchunk24.html
+++ b/doc/APIchunk24.html
@@ -424,6 +424,7 @@
 <a href="html/libxml-xinclude.html#xmlXIncludeProcessTreeFlags">xmlXIncludeProcessTreeFlags</a><br />
 </dd><dt>sometimes</dt><dd><a href="html/libxml-xmlregexp.html#xmlExpExpDerive">xmlExpExpDerive</a><br />
 </dd><dt>somewhat</dt><dd><a href="html/libxml-parserInternals.html#xmlCheckLanguageID">xmlCheckLanguageID</a><br />
+<a href="html/libxml-parser.html#xmlCleanupParser">xmlCleanupParser</a><br />
 </dd><dt>sorted</dt><dd><a href="html/libxml-parser.html#xmlParserAddNodeInfo">xmlParserAddNodeInfo</a><br />
 <a href="html/libxml-parser.html#xmlParserFindNodeInfoIndex">xmlParserFindNodeInfoIndex</a><br />
 <a href="html/libxml-xpathInternals.html#xmlXPathDistinct">xmlXPathDistinct</a><br />
@@ -718,6 +719,7 @@
 <a href="html/libxml-xmlschemastypes.html#xmlSchemaNewStringValue">xmlSchemaNewStringValue</a><br />
 </dd><dt>structured</dt><dd><a href="html/libxml-relaxng.html#xmlRelaxNGSetValidStructuredErrors">xmlRelaxNGSetValidStructuredErrors</a><br />
 <a href="html/libxml-xmlschemas.html#xmlSchemaSetParserStructuredErrors">xmlSchemaSetParserStructuredErrors</a><br />
+<a href="html/libxml-schematron.html#xmlSchematronSetValidStructuredErrors">xmlSchematronSetValidStructuredErrors</a><br />
 <a href="html/libxml-xmlerror.html#xmlSetStructuredErrorFunc">xmlSetStructuredErrorFunc</a><br />
 </dd><dt>structures</dt><dd><a href="html/libxml-tree.html#xmlFreeDoc">xmlFreeDoc</a><br />
 <a href="html/libxml-tree.html#xmlFreeNs">xmlFreeNs</a><br />
diff --git a/doc/APIchunk28.html b/doc/APIchunk28.html
index 5ab3207..bc198ee 100644
--- a/doc/APIchunk28.html
+++ b/doc/APIchunk28.html
@@ -222,6 +222,7 @@
 <a href="html/libxml-tree.html#xmlSaveFormatFile">xmlSaveFormatFile</a><br />
 <a href="html/libxml-tree.html#xmlSaveFormatFileEnc">xmlSaveFormatFileEnc</a><br />
 </dd><dt>xmlInitParser</dt><dd><a href="html/libxml-parserInternals.html#htmlInitAutoClose">htmlInitAutoClose</a><br />
+<a href="html/libxml-parser.html#xmlCleanupParser">xmlCleanupParser</a><br />
 </dd><dt>xmlInitThreads</dt><dd><a href="html/libxml-threads.html#xmlInitThreads">xmlInitThreads</a><br />
 </dd><dt>xmlInitializeCatalog</dt><dd><a href="html/libxml-catalog.html#xmlCatalogAdd">xmlCatalogAdd</a><br />
 </dd><dt>xmlInitializeGlobalState</dt><dd><a href="html/libxml-globals.html#xmlInitializeGlobalState">xmlInitializeGlobalState</a><br />
diff --git a/doc/APIchunk5.html b/doc/APIchunk5.html
index f315b91..72067ed 100644
--- a/doc/APIchunk5.html
+++ b/doc/APIchunk5.html
@@ -61,6 +61,7 @@
 </dd><dt>Ogham</dt><dd><a href="html/libxml-xmlunicode.html#xmlUCSIsOgham">xmlUCSIsOgham</a><br />
 </dd><dt>OldItalic</dt><dd><a href="html/libxml-xmlunicode.html#xmlUCSIsOldItalic">xmlUCSIsOldItalic</a><br />
 </dd><dt>One</dt><dd><a href="html/libxml-parserInternals.html#INPUT_CHUNK">INPUT_CHUNK</a><br />
+<a href="html/libxml-parser.html#xmlCleanupParser">xmlCleanupParser</a><br />
 <a href="html/libxml-parserInternals.html#xmlParseAttributeType">xmlParseAttributeType</a><br />
 <a href="html/libxml-xmlerror.html#xmlSetGenericErrorFunc">xmlSetGenericErrorFunc</a><br />
 <a href="html/libxml-valid.html#xmlValidateElementDecl">xmlValidateElementDecl</a><br />
diff --git a/doc/APIchunk7.html b/doc/APIchunk7.html
index ae29cb4..df878bf 100644
--- a/doc/APIchunk7.html
+++ b/doc/APIchunk7.html
@@ -122,6 +122,7 @@
 </dd><dt>Schematron</dt><dd><a href="html/libxml-xmlversion.html#LIBXML_SCHEMATRON_ENABLED">LIBXML_SCHEMATRON_ENABLED</a><br />
 <a href="html/libxml-schematron.html#xmlSchematronFree">xmlSchematronFree</a><br />
 <a href="html/libxml-schematron.html#xmlSchematronParse">xmlSchematronParse</a><br />
+<a href="html/libxml-schematron.html#xmlSchematronSetValidStructuredErrors">xmlSchematronSetValidStructuredErrors</a><br />
 </dd><dt>Schematrons</dt><dd><a href="html/libxml-schematron.html#xmlSchematronNewDocParserCtxt">xmlSchematronNewDocParserCtxt</a><br />
 <a href="html/libxml-schematron.html#xmlSchematronNewMemParserCtxt">xmlSchematronNewMemParserCtxt</a><br />
 <a href="html/libxml-schematron.html#xmlSchematronNewParserCtxt">xmlSchematronNewParserCtxt</a><br />
@@ -158,7 +159,8 @@
 </dd><dt>Second</dt><dd><a href="html/libxml-parserInternals.html#xmlCheckLanguageID">xmlCheckLanguageID</a><br />
 </dd><dt>Section</dt><dd><a href="html/libxml-encoding.html#xmlGetCharEncodingName">xmlGetCharEncodingName</a><br />
 <a href="html/libxml-uri.html#xmlNormalizeURIPath">xmlNormalizeURIPath</a><br />
-</dd><dt>See</dt><dd><a href="html/libxml-list.html#xmlLinkGetData">xmlLinkGetData</a><br />
+</dd><dt>See</dt><dd><a href="html/libxml-parser.html#xmlCleanupParser">xmlCleanupParser</a><br />
+<a href="html/libxml-list.html#xmlLinkGetData">xmlLinkGetData</a><br />
 <a href="html/libxml-parserInternals.html#xmlParseNotationDecl">xmlParseNotationDecl</a><br />
 <a href="html/libxml-xmlreader.html#xmlTextReaderByteConsumed">xmlTextReaderByteConsumed</a><br />
 </dd><dt>Seems</dt><dd><a href="html/libxml-parserInternals.html#xmlParseTextDecl">xmlParseTextDecl</a><br />
diff --git a/doc/APIfiles.html b/doc/APIfiles.html
index b1773eb..30d650a 100644
--- a/doc/APIfiles.html
+++ b/doc/APIfiles.html
@@ -1218,6 +1218,7 @@
 <a href="html/libxml-schemasInternals.html#xmlSchemaWildcardNsPtr">xmlSchemaWildcardNsPtr</a><br />
 <a href="html/libxml-schemasInternals.html#xmlSchemaWildcardPtr">xmlSchemaWildcardPtr</a><br />
 </p><h2><a name="schematron" id="schematron">Module schematron</a>:</h2><p><a href="html/libxml-schematron.html#XML_SCHEMATRON_OUT_BUFFER">XML_SCHEMATRON_OUT_BUFFER</a><br />
+<a href="html/libxml-schematron.html#XML_SCHEMATRON_OUT_ERROR">XML_SCHEMATRON_OUT_ERROR</a><br />
 <a href="html/libxml-schematron.html#XML_SCHEMATRON_OUT_FILE">XML_SCHEMATRON_OUT_FILE</a><br />
 <a href="html/libxml-schematron.html#XML_SCHEMATRON_OUT_IO">XML_SCHEMATRON_OUT_IO</a><br />
 <a href="html/libxml-schematron.html#XML_SCHEMATRON_OUT_QUIET">XML_SCHEMATRON_OUT_QUIET</a><br />
@@ -1235,6 +1236,7 @@
 <a href="html/libxml-schematron.html#xmlSchematronParserCtxt">xmlSchematronParserCtxt</a><br />
 <a href="html/libxml-schematron.html#xmlSchematronParserCtxtPtr">xmlSchematronParserCtxtPtr</a><br />
 <a href="html/libxml-schematron.html#xmlSchematronPtr">xmlSchematronPtr</a><br />
+<a href="html/libxml-schematron.html#xmlSchematronSetValidStructuredErrors">xmlSchematronSetValidStructuredErrors</a><br />
 <a href="html/libxml-schematron.html#xmlSchematronValidCtxt">xmlSchematronValidCtxt</a><br />
 <a href="html/libxml-schematron.html#xmlSchematronValidCtxtPtr">xmlSchematronValidCtxtPtr</a><br />
 <a href="html/libxml-schematron.html#xmlSchematronValidOptions">xmlSchematronValidOptions</a><br />
@@ -1991,6 +1993,7 @@
 <a href="html/libxml-xmlerror.html#XML_FROM_RELAXNGV">XML_FROM_RELAXNGV</a><br />
 <a href="html/libxml-xmlerror.html#XML_FROM_SCHEMASP">XML_FROM_SCHEMASP</a><br />
 <a href="html/libxml-xmlerror.html#XML_FROM_SCHEMASV">XML_FROM_SCHEMASV</a><br />
+<a href="html/libxml-xmlerror.html#XML_FROM_SCHEMATRONV">XML_FROM_SCHEMATRONV</a><br />
 <a href="html/libxml-xmlerror.html#XML_FROM_TREE">XML_FROM_TREE</a><br />
 <a href="html/libxml-xmlerror.html#XML_FROM_VALID">XML_FROM_VALID</a><br />
 <a href="html/libxml-xmlerror.html#XML_FROM_WRITER">XML_FROM_WRITER</a><br />
@@ -2397,6 +2400,8 @@
 <a href="html/libxml-xmlerror.html#XML_SCHEMAP_WARN_SKIP_SCHEMA">XML_SCHEMAP_WARN_SKIP_SCHEMA</a><br />
 <a href="html/libxml-xmlerror.html#XML_SCHEMAP_WARN_UNLOCATED_SCHEMA">XML_SCHEMAP_WARN_UNLOCATED_SCHEMA</a><br />
 <a href="html/libxml-xmlerror.html#XML_SCHEMAP_WILDCARD_INVALID_NS_MEMBER">XML_SCHEMAP_WILDCARD_INVALID_NS_MEMBER</a><br />
+<a href="html/libxml-xmlerror.html#XML_SCHEMATRONV_ASSERT">XML_SCHEMATRONV_ASSERT</a><br />
+<a href="html/libxml-xmlerror.html#XML_SCHEMATRONV_REPORT">XML_SCHEMATRONV_REPORT</a><br />
 <a href="html/libxml-xmlerror.html#XML_SCHEMAV_ATTRINVALID">XML_SCHEMAV_ATTRINVALID</a><br />
 <a href="html/libxml-xmlerror.html#XML_SCHEMAV_ATTRUNKNOWN">XML_SCHEMAV_ATTRUNKNOWN</a><br />
 <a href="html/libxml-xmlerror.html#XML_SCHEMAV_CONSTRUCT">XML_SCHEMAV_CONSTRUCT</a><br />
diff --git a/doc/APIfunctions.html b/doc/APIfunctions.html
index 80b0a88..9e83889 100644
--- a/doc/APIfunctions.html
+++ b/doc/APIfunctions.html
@@ -852,6 +852,7 @@
 <a href="html/libxml-xmlschemas.html#xmlSchemaValidateStream">xmlSchemaValidateStream</a><br />
 <a href="html/libxml-xmlschemas.html#xmlSchemaValidityErrorFunc">xmlSchemaValidityErrorFunc</a><br />
 <a href="html/libxml-xmlschemas.html#xmlSchemaValidityWarningFunc">xmlSchemaValidityWarningFunc</a><br />
+<a href="html/libxml-schematron.html#xmlSchematronSetValidStructuredErrors">xmlSchematronSetValidStructuredErrors</a><br />
 <a href="html/libxml-schematron.html#xmlSchematronValidityErrorFunc">xmlSchematronValidityErrorFunc</a><br />
 <a href="html/libxml-schematron.html#xmlSchematronValidityWarningFunc">xmlSchematronValidityWarningFunc</a><br />
 <a href="html/libxml-parser.html#xmlSetFeature">xmlSetFeature</a><br />
@@ -1956,6 +1957,7 @@
 </p><h2>Type xmlSchematronPtr:</h2><p><a href="html/libxml-schematron.html#xmlSchematronFree">xmlSchematronFree</a><br />
 <a href="html/libxml-schematron.html#xmlSchematronNewValidCtxt">xmlSchematronNewValidCtxt</a><br />
 </p><h2>Type xmlSchematronValidCtxtPtr:</h2><p><a href="html/libxml-schematron.html#xmlSchematronFreeValidCtxt">xmlSchematronFreeValidCtxt</a><br />
+<a href="html/libxml-schematron.html#xmlSchematronSetValidStructuredErrors">xmlSchematronSetValidStructuredErrors</a><br />
 <a href="html/libxml-schematron.html#xmlSchematronValidateDoc">xmlSchematronValidateDoc</a><br />
 </p><h2>Type xmlShellCtxtPtr:</h2><p><a href="html/libxml-debugXML.html#xmlShellBase">xmlShellBase</a><br />
 <a href="html/libxml-debugXML.html#xmlShellCat">xmlShellCat</a><br />
@@ -1983,6 +1985,7 @@
 <a href="html/libxml-relaxng.html#xmlRelaxNGSetValidStructuredErrors">xmlRelaxNGSetValidStructuredErrors</a><br />
 <a href="html/libxml-xmlschemas.html#xmlSchemaSetParserStructuredErrors">xmlSchemaSetParserStructuredErrors</a><br />
 <a href="html/libxml-xmlschemas.html#xmlSchemaSetValidStructuredErrors">xmlSchemaSetValidStructuredErrors</a><br />
+<a href="html/libxml-schematron.html#xmlSchematronSetValidStructuredErrors">xmlSchematronSetValidStructuredErrors</a><br />
 <a href="html/libxml-xmlerror.html#xmlSetStructuredErrorFunc">xmlSetStructuredErrorFunc</a><br />
 <a href="html/libxml-xmlreader.html#xmlTextReaderSetStructuredErrorHandler">xmlTextReaderSetStructuredErrorHandler</a><br />
 <a href="html/libxml-globals.html#xmlThrDefSetStructuredErrorFunc">xmlThrDefSetStructuredErrorFunc</a><br />
diff --git a/doc/APIsymbols.html b/doc/APIsymbols.html
index e2ce107..af09644 100644
--- a/doc/APIsymbols.html
+++ b/doc/APIsymbols.html
@@ -435,6 +435,7 @@
 <a href="html/libxml-xmlerror.html#XML_FROM_RELAXNGV">XML_FROM_RELAXNGV</a><br />
 <a href="html/libxml-xmlerror.html#XML_FROM_SCHEMASP">XML_FROM_SCHEMASP</a><br />
 <a href="html/libxml-xmlerror.html#XML_FROM_SCHEMASV">XML_FROM_SCHEMASV</a><br />
+<a href="html/libxml-xmlerror.html#XML_FROM_SCHEMATRONV">XML_FROM_SCHEMATRONV</a><br />
 <a href="html/libxml-xmlerror.html#XML_FROM_TREE">XML_FROM_TREE</a><br />
 <a href="html/libxml-xmlerror.html#XML_FROM_VALID">XML_FROM_VALID</a><br />
 <a href="html/libxml-xmlerror.html#XML_FROM_WRITER">XML_FROM_WRITER</a><br />
@@ -1128,7 +1129,10 @@
 <a href="html/libxml-schemasInternals.html#XML_SCHEMAS_UNKNOWN">XML_SCHEMAS_UNKNOWN</a><br />
 <a href="html/libxml-schemasInternals.html#XML_SCHEMAS_USHORT">XML_SCHEMAS_USHORT</a><br />
 <a href="html/libxml-schemasInternals.html#XML_SCHEMAS_WILDCARD_COMPLETE">XML_SCHEMAS_WILDCARD_COMPLETE</a><br />
+<a href="html/libxml-xmlerror.html#XML_SCHEMATRONV_ASSERT">XML_SCHEMATRONV_ASSERT</a><br />
+<a href="html/libxml-xmlerror.html#XML_SCHEMATRONV_REPORT">XML_SCHEMATRONV_REPORT</a><br />
 <a href="html/libxml-schematron.html#XML_SCHEMATRON_OUT_BUFFER">XML_SCHEMATRON_OUT_BUFFER</a><br />
+<a href="html/libxml-schematron.html#XML_SCHEMATRON_OUT_ERROR">XML_SCHEMATRON_OUT_ERROR</a><br />
 <a href="html/libxml-schematron.html#XML_SCHEMATRON_OUT_FILE">XML_SCHEMATRON_OUT_FILE</a><br />
 <a href="html/libxml-schematron.html#XML_SCHEMATRON_OUT_IO">XML_SCHEMATRON_OUT_IO</a><br />
 <a href="html/libxml-schematron.html#XML_SCHEMATRON_OUT_QUIET">XML_SCHEMATRON_OUT_QUIET</a><br />
@@ -2780,6 +2784,7 @@
 <a href="html/libxml-schematron.html#xmlSchematronParserCtxt">xmlSchematronParserCtxt</a><br />
 <a href="html/libxml-schematron.html#xmlSchematronParserCtxtPtr">xmlSchematronParserCtxtPtr</a><br />
 <a href="html/libxml-schematron.html#xmlSchematronPtr">xmlSchematronPtr</a><br />
+<a href="html/libxml-schematron.html#xmlSchematronSetValidStructuredErrors">xmlSchematronSetValidStructuredErrors</a><br />
 <a href="html/libxml-schematron.html#xmlSchematronValidCtxt">xmlSchematronValidCtxt</a><br />
 <a href="html/libxml-schematron.html#xmlSchematronValidCtxtPtr">xmlSchematronValidCtxtPtr</a><br />
 <a href="html/libxml-schematron.html#xmlSchematronValidOptions">xmlSchematronValidOptions</a><br />
diff --git a/doc/devhelp/libxml2-parser.html b/doc/devhelp/libxml2-parser.html
index c12cd02..83ca82e 100644
--- a/doc/devhelp/libxml2-parser.html
+++ b/doc/devhelp/libxml2-parser.html
@@ -477,7 +477,7 @@
 <div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>an XML parser context</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the index in bytes from the beginning of the entity or -1 in case the index could not be computed.</td></tr></tbody></table></div></div>
         <hr/>
         <div class="refsect2" lang="en"><h3><a name="xmlCleanupParser"/>xmlCleanupParser ()</h3><pre class="programlisting">void	xmlCleanupParser		(void)<br/>
-</pre><p>Cleanup function for the XML library. It tries to reclaim all parsing related global memory allocated for the library processing. It doesn't deallocate any document related memory. Calling this function should not prevent reusing the library but one should call xmlCleanupParser() only when the process has finished using the library or XML document built with it.</p>
+</pre><p>This function name is somewhat misleading. It does not clean up parser state, it cleans up memory allocated by the library itself. It is a cleanup function for the XML library. It tries to reclaim all related global memory allocated for the library processing. It doesn't deallocate any document related memory. One should call xmlCleanupParser() only when the process has finished using the library and all XML/HTML documents built with it. See also xmlInitParser() which has the opposite function of preparing the library for operations.</p>
 </div>
         <hr/>
         <div class="refsect2" lang="en"><h3><a name="xmlClearNodeInfoSeq"/>xmlClearNodeInfoSeq ()</h3><pre class="programlisting">void	xmlClearNodeInfoSeq		(<a href="libxml2-parser.html#xmlParserNodeInfoSeqPtr">xmlParserNodeInfoSeqPtr</a> seq)<br/>
diff --git a/doc/devhelp/libxml2-schematron.html b/doc/devhelp/libxml2-schematron.html
index 995d96a..bdcb944 100644
--- a/doc/devhelp/libxml2-schematron.html
+++ b/doc/devhelp/libxml2-schematron.html
@@ -57,6 +57,7 @@
 <a href="libxml2-schematron.html#xmlSchematronParserCtxtPtr">xmlSchematronParserCtxtPtr</a>	<a href="#xmlSchematronNewParserCtxt">xmlSchematronNewParserCtxt</a>	(const char * URL);
 typedef void <a href="#xmlSchematronValidityWarningFunc">xmlSchematronValidityWarningFunc</a>	(void * ctx, <br/>						 const char * msg, <br/>						 ... ...);
 void	<a href="#xmlSchematronFree">xmlSchematronFree</a>		(<a href="libxml2-schematron.html#xmlSchematronPtr">xmlSchematronPtr</a> schema);
+void	<a href="#xmlSchematronSetValidStructuredErrors">xmlSchematronSetValidStructuredErrors</a>	(<a href="libxml2-schematron.html#xmlSchematronValidCtxtPtr">xmlSchematronValidCtxtPtr</a> ctxt, <br/>						 <a href="libxml2-xmlerror.html#xmlStructuredErrorFunc">xmlStructuredErrorFunc</a> serror, <br/>						 void * ctx);
 void	<a href="#xmlSchematronFreeValidCtxt">xmlSchematronFreeValidCtxt</a>	(<a href="libxml2-schematron.html#xmlSchematronValidCtxtPtr">xmlSchematronValidCtxtPtr</a> ctxt);
 <a href="libxml2-schematron.html#xmlSchematronPtr">xmlSchematronPtr</a>	<a href="#xmlSchematronParse">xmlSchematronParse</a>	(<a href="libxml2-schematron.html#xmlSchematronParserCtxtPtr">xmlSchematronParserCtxtPtr</a> ctxt);
 <a href="libxml2-schematron.html#xmlSchematronParserCtxtPtr">xmlSchematronParserCtxtPtr</a>	<a href="#xmlSchematronNewDocParserCtxt">xmlSchematronNewDocParserCtxt</a>	(<a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> doc);
@@ -103,6 +104,7 @@
     <a name="XML_SCHEMATRON_OUT_QUIET">XML_SCHEMATRON_OUT_QUIET</a> = 1 /* quiet no report */
     <a name="XML_SCHEMATRON_OUT_TEXT">XML_SCHEMATRON_OUT_TEXT</a> = 2 /* build a textual report */
     <a name="XML_SCHEMATRON_OUT_XML">XML_SCHEMATRON_OUT_XML</a> = 4 /* output SVRL */
+    <a name="XML_SCHEMATRON_OUT_ERROR">XML_SCHEMATRON_OUT_ERROR</a> = 8 /* output via xmlStructuredErrorFunc */
     <a name="XML_SCHEMATRON_OUT_FILE">XML_SCHEMATRON_OUT_FILE</a> = 256 /* output to a file descriptor */
     <a name="XML_SCHEMATRON_OUT_BUFFER">XML_SCHEMATRON_OUT_BUFFER</a> = 512 /* output to a buffer */
     <a name="XML_SCHEMATRON_OUT_IO">XML_SCHEMATRON_OUT_IO</a> = 1024 /*  output to I/O mechanism */
@@ -150,6 +152,10 @@
 </pre><p>parse a schema definition resource and build an internal XML Shema struture which can be used to validate instances.</p>
 <div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>a schema validation context</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the internal XML Schematron structure built from the resource or NULL in case of error</td></tr></tbody></table></div></div>
         <hr/>
+        <div class="refsect2" lang="en"><h3><a name="xmlSchematronSetValidStructuredErrors"/>xmlSchematronSetValidStructuredErrors ()</h3><pre class="programlisting">void	xmlSchematronSetValidStructuredErrors	(<a href="libxml2-schematron.html#xmlSchematronValidCtxtPtr">xmlSchematronValidCtxtPtr</a> ctxt, <br/>						 <a href="libxml2-xmlerror.html#xmlStructuredErrorFunc">xmlStructuredErrorFunc</a> serror, <br/>						 void * ctx)<br/>
+</pre><p>Set the structured error callback</p>
+<div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>a Schematron validation context</td></tr><tr><td><span class="term"><i><tt>serror</tt></i>:</span></td><td>the structured error function</td></tr><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the functions context</td></tr></tbody></table></div></div>
+        <hr/>
         <div class="refsect2" lang="en"><h3><a name="xmlSchematronValidateDoc"/>xmlSchematronValidateDoc ()</h3><pre class="programlisting">int	xmlSchematronValidateDoc	(<a href="libxml2-schematron.html#xmlSchematronValidCtxtPtr">xmlSchematronValidCtxtPtr</a> ctxt, <br/>					 <a href="libxml2-tree.html#xmlDocPtr">xmlDocPtr</a> instance)<br/>
 </pre><p>Validate a tree instance against the schematron</p>
 <div class="variablelist"><table border="0"><col align="left"/><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>the schema validation context</td></tr><tr><td><span class="term"><i><tt>instance</tt></i>:</span></td><td>the document instace tree</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success, -1 in case of internal error and an error count otherwise.</td></tr></tbody></table></div></div>
diff --git a/doc/devhelp/libxml2-xmlerror.html b/doc/devhelp/libxml2-xmlerror.html
index f67f734..eaacd0b 100644
--- a/doc/devhelp/libxml2-xmlerror.html
+++ b/doc/devhelp/libxml2-xmlerror.html
@@ -119,7 +119,8 @@
     <a name="XML_FROM_CHECK">XML_FROM_CHECK</a> = 24 /* The error checking module */
     <a name="XML_FROM_WRITER">XML_FROM_WRITER</a> = 25 /* The xmlwriter module */
     <a name="XML_FROM_MODULE">XML_FROM_MODULE</a> = 26 /* The dynamically loaded module modul */
-    <a name="XML_FROM_I18N">XML_FROM_I18N</a> = 27 /*  The module handling character conversion */
+    <a name="XML_FROM_I18N">XML_FROM_I18N</a> = 27 /* The module handling character conversion */
+    <a name="XML_FROM_SCHEMATRONV">XML_FROM_SCHEMATRONV</a> = 28 /*  The Schematron validator module */
 };
 </pre><p/>
 </div>
@@ -818,6 +819,8 @@
     <a name="XML_SCHEMAP_AU_PROPS_CORRECT">XML_SCHEMAP_AU_PROPS_CORRECT</a> = 3089 /* 3088 */
     <a name="XML_SCHEMAP_A_PROPS_CORRECT_3">XML_SCHEMAP_A_PROPS_CORRECT_3</a> = 3090 /* 3089 */
     <a name="XML_SCHEMAP_COS_ALL_LIMITED">XML_SCHEMAP_COS_ALL_LIMITED</a> = 3091 /* 3090 */
+    <a name="XML_SCHEMATRONV_ASSERT">XML_SCHEMATRONV_ASSERT</a> = 4000 /* 4000 */
+    <a name="XML_SCHEMATRONV_REPORT">XML_SCHEMATRONV_REPORT</a> = 4001
     <a name="XML_MODULE_OPEN">XML_MODULE_OPEN</a> = 4900 /* 4900 */
     <a name="XML_MODULE_CLOSE">XML_MODULE_CLOSE</a> = 4901 /* 4901 */
     <a name="XML_CHECK_FOUND_ELEMENT">XML_CHECK_FOUND_ELEMENT</a> = 5000
diff --git a/doc/devhelp/libxml2.devhelp b/doc/devhelp/libxml2.devhelp
index 3bc7ce5..499bcb9 100644
--- a/doc/devhelp/libxml2.devhelp
+++ b/doc/devhelp/libxml2.devhelp
@@ -620,6 +620,7 @@
     <function name="XML_FROM_RELAXNGV" link="libxml2-xmlerror.html#XML_FROM_RELAXNGV"/>
     <function name="XML_FROM_SCHEMASP" link="libxml2-xmlerror.html#XML_FROM_SCHEMASP"/>
     <function name="XML_FROM_SCHEMASV" link="libxml2-xmlerror.html#XML_FROM_SCHEMASV"/>
+    <function name="XML_FROM_SCHEMATRONV" link="libxml2-xmlerror.html#XML_FROM_SCHEMATRONV"/>
     <function name="XML_FROM_TREE" link="libxml2-xmlerror.html#XML_FROM_TREE"/>
     <function name="XML_FROM_VALID" link="libxml2-xmlerror.html#XML_FROM_VALID"/>
     <function name="XML_FROM_WRITER" link="libxml2-xmlerror.html#XML_FROM_WRITER"/>
@@ -1226,7 +1227,10 @@
     <function name="XML_SCHEMAS_ULONG" link="libxml2-schemasInternals.html#XML_SCHEMAS_ULONG"/>
     <function name="XML_SCHEMAS_UNKNOWN" link="libxml2-schemasInternals.html#XML_SCHEMAS_UNKNOWN"/>
     <function name="XML_SCHEMAS_USHORT" link="libxml2-schemasInternals.html#XML_SCHEMAS_USHORT"/>
+    <function name="XML_SCHEMATRONV_ASSERT" link="libxml2-xmlerror.html#XML_SCHEMATRONV_ASSERT"/>
+    <function name="XML_SCHEMATRONV_REPORT" link="libxml2-xmlerror.html#XML_SCHEMATRONV_REPORT"/>
     <function name="XML_SCHEMATRON_OUT_BUFFER" link="libxml2-schematron.html#XML_SCHEMATRON_OUT_BUFFER"/>
+    <function name="XML_SCHEMATRON_OUT_ERROR" link="libxml2-schematron.html#XML_SCHEMATRON_OUT_ERROR"/>
     <function name="XML_SCHEMATRON_OUT_FILE" link="libxml2-schematron.html#XML_SCHEMATRON_OUT_FILE"/>
     <function name="XML_SCHEMATRON_OUT_IO" link="libxml2-schematron.html#XML_SCHEMATRON_OUT_IO"/>
     <function name="XML_SCHEMATRON_OUT_QUIET" link="libxml2-schematron.html#XML_SCHEMATRON_OUT_QUIET"/>
@@ -2854,6 +2858,7 @@
     <function name="xmlSchematronNewParserCtxt ()" link="libxml2-schematron.html#xmlSchematronNewParserCtxt"/>
     <function name="xmlSchematronNewValidCtxt ()" link="libxml2-schematron.html#xmlSchematronNewValidCtxt"/>
     <function name="xmlSchematronParse ()" link="libxml2-schematron.html#xmlSchematronParse"/>
+    <function name="xmlSchematronSetValidStructuredErrors ()" link="libxml2-schematron.html#xmlSchematronSetValidStructuredErrors"/>
     <function name="xmlSchematronValidateDoc ()" link="libxml2-schematron.html#xmlSchematronValidateDoc"/>
     <function name="xmlSearchNs ()" link="libxml2-tree.html#xmlSearchNs"/>
     <function name="xmlSearchNsByHref ()" link="libxml2-tree.html#xmlSearchNsByHref"/>
diff --git a/doc/libxml2-api.xml b/doc/libxml2-api.xml
index 41a13b7..4297ac3 100644
--- a/doc/libxml2-api.xml
+++ b/doc/libxml2-api.xml
@@ -1328,6 +1328,7 @@
      <description>interface to the XML Schematron validity checking. </description>
      <author>Daniel Veillard </author>
      <exports symbol='XML_SCHEMATRON_OUT_IO' type='enum'/>
+     <exports symbol='XML_SCHEMATRON_OUT_ERROR' type='enum'/>
      <exports symbol='XML_SCHEMATRON_OUT_BUFFER' type='enum'/>
      <exports symbol='XML_SCHEMATRON_OUT_FILE' type='enum'/>
      <exports symbol='XML_SCHEMATRON_OUT_XML' type='enum'/>
@@ -1347,6 +1348,7 @@
      <exports symbol='xmlSchematronNewParserCtxt' type='function'/>
      <exports symbol='xmlSchematronValidityWarningFunc' type='function'/>
      <exports symbol='xmlSchematronFree' type='function'/>
+     <exports symbol='xmlSchematronSetValidStructuredErrors' type='function'/>
      <exports symbol='xmlSchematronFreeValidCtxt' type='function'/>
      <exports symbol='xmlSchematronParse' type='function'/>
      <exports symbol='xmlSchematronNewDocParserCtxt' type='function'/>
@@ -2011,6 +2013,7 @@
      <exports symbol='XML_IO_EFAULT' type='enum'/>
      <exports symbol='XML_HTML_STRUCURE_ERROR' type='enum'/>
      <exports symbol='XML_DTD_INVALID_DEFAULT' type='enum'/>
+     <exports symbol='XML_FROM_SCHEMATRONV' type='enum'/>
      <exports symbol='XML_DTD_EMPTY_NOTATION' type='enum'/>
      <exports symbol='XML_RNGP_ELEMENT_EMPTY' type='enum'/>
      <exports symbol='XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED' type='enum'/>
@@ -2512,6 +2515,7 @@
      <exports symbol='XML_RNGP_PAT_LIST_ATTR' type='enum'/>
      <exports symbol='XML_IO_EACCES' type='enum'/>
      <exports symbol='XML_ERR_NOTATION_NOT_FINISHED' type='enum'/>
+     <exports symbol='XML_SCHEMATRONV_ASSERT' type='enum'/>
      <exports symbol='XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_2' type='enum'/>
      <exports symbol='XML_SCHEMAV_INVALIDATTR' type='enum'/>
      <exports symbol='XML_SCHEMAP_RECURSIVE' type='enum'/>
@@ -2619,6 +2623,7 @@
      <exports symbol='XML_ERR_NS_DECL_ERROR' type='enum'/>
      <exports symbol='XML_ERR_INTERNAL_ERROR' type='enum'/>
      <exports symbol='XML_SCHEMAP_COS_ST_RESTRICTS_1_3_1' type='enum'/>
+     <exports symbol='XML_SCHEMATRONV_REPORT' type='enum'/>
      <exports symbol='XML_ERR_ELEMCONTENT_NOT_FINISHED' type='enum'/>
      <exports symbol='XML_FROM_NAMESPACE' type='enum'/>
      <exports symbol='XML_IO_EBUSY' type='enum'/>
@@ -4845,7 +4850,7 @@
     <enum name='XML_FROM_FTP' file='xmlerror' value='9' type='xmlErrorDomain' info='The FTP module'/>
     <enum name='XML_FROM_HTML' file='xmlerror' value='5' type='xmlErrorDomain' info='The HTML parser'/>
     <enum name='XML_FROM_HTTP' file='xmlerror' value='10' type='xmlErrorDomain' info='The HTTP module'/>
-    <enum name='XML_FROM_I18N' file='xmlerror' value='27' type='xmlErrorDomain' info=' The module handling character conversion'/>
+    <enum name='XML_FROM_I18N' file='xmlerror' value='27' type='xmlErrorDomain' info='The module handling character conversion'/>
     <enum name='XML_FROM_IO' file='xmlerror' value='8' type='xmlErrorDomain' info='The Input/Output stack'/>
     <enum name='XML_FROM_MEMORY' file='xmlerror' value='6' type='xmlErrorDomain' info='The memory allocator'/>
     <enum name='XML_FROM_MODULE' file='xmlerror' value='26' type='xmlErrorDomain' info='The dynamically loaded module modul'/>
@@ -4858,6 +4863,7 @@
     <enum name='XML_FROM_RELAXNGV' file='xmlerror' value='19' type='xmlErrorDomain' info='The Relax-NG validator module'/>
     <enum name='XML_FROM_SCHEMASP' file='xmlerror' value='16' type='xmlErrorDomain' info='The W3C XML Schemas parser module'/>
     <enum name='XML_FROM_SCHEMASV' file='xmlerror' value='17' type='xmlErrorDomain' info='The W3C XML Schemas validation module'/>
+    <enum name='XML_FROM_SCHEMATRONV' file='xmlerror' value='28' type='xmlErrorDomain' info=' The Schematron validator module'/>
     <enum name='XML_FROM_TREE' file='xmlerror' value='2' type='xmlErrorDomain' info='The tree module'/>
     <enum name='XML_FROM_VALID' file='xmlerror' value='23' type='xmlErrorDomain' info='The XML DTD validation with valid context'/>
     <enum name='XML_FROM_WRITER' file='xmlerror' value='25' type='xmlErrorDomain' info='The xmlwriter module'/>
@@ -5466,7 +5472,10 @@
     <enum name='XML_SCHEMAS_ULONG' file='schemasInternals' value='38' type='xmlSchemaValType'/>
     <enum name='XML_SCHEMAS_UNKNOWN' file='schemasInternals' value='0' type='xmlSchemaValType'/>
     <enum name='XML_SCHEMAS_USHORT' file='schemasInternals' value='40' type='xmlSchemaValType'/>
+    <enum name='XML_SCHEMATRONV_ASSERT' file='xmlerror' value='4000' type='xmlParserErrors' info='4000'/>
+    <enum name='XML_SCHEMATRONV_REPORT' file='xmlerror' value='4001' type='xmlParserErrors'/>
     <enum name='XML_SCHEMATRON_OUT_BUFFER' file='schematron' value='512' type='xmlSchematronValidOptions' info='output to a buffer'/>
+    <enum name='XML_SCHEMATRON_OUT_ERROR' file='schematron' value='8' type='xmlSchematronValidOptions' info='output via xmlStructuredErrorFunc'/>
     <enum name='XML_SCHEMATRON_OUT_FILE' file='schematron' value='256' type='xmlSchematronValidOptions' info='output to a file descriptor'/>
     <enum name='XML_SCHEMATRON_OUT_IO' file='schematron' value='1024' type='xmlSchematronValidOptions' info=' output to I/O mechanism'/>
     <enum name='XML_SCHEMATRON_OUT_QUIET' file='schematron' value='1' type='xmlSchematronValidOptions' info='quiet no report'/>
@@ -8789,7 +8798,7 @@
       <return type='void'/>
     </function>
     <function name='xmlCleanupParser' file='parser' module='parser'>
-      <info>Cleanup function for the XML library. It tries to reclaim all parsing related global memory allocated for the library processing. It doesn&apos;t deallocate any document related memory. Calling this function should not prevent reusing the library but one should call xmlCleanupParser() only when the process has finished using the library or XML document built with it.</info>
+      <info>This function name is somewhat misleading. It does not clean up parser state, it cleans up memory allocated by the library itself. It is a cleanup function for the XML library. It tries to reclaim all related global memory allocated for the library processing. It doesn&apos;t deallocate any document related memory. One should call xmlCleanupParser() only when the process has finished using the library and all XML/HTML documents built with it. See also xmlInitParser() which has the opposite function of preparing the library for operations.</info>
       <return type='void'/>
     </function>
     <function name='xmlCleanupPredefinedEntities' file='entities' module='legacy'>
@@ -13817,6 +13826,14 @@
       <return type='xmlSchematronPtr' info='the internal XML Schematron structure built from the resource or NULL in case of error'/>
       <arg name='ctxt' type='xmlSchematronParserCtxtPtr' info='a schema validation context'/>
     </function>
+    <function name='xmlSchematronSetValidStructuredErrors' file='schematron' module='schematron'>
+      <cond>defined(LIBXML_SCHEMATRON_ENABLED)</cond>
+      <info>Set the structured error callback</info>
+      <return type='void'/>
+      <arg name='ctxt' type='xmlSchematronValidCtxtPtr' info='a Schematron validation context'/>
+      <arg name='serror' type='xmlStructuredErrorFunc' info='the structured error function'/>
+      <arg name='ctx' type='void *' info='the functions context'/>
+    </function>
     <function name='xmlSchematronValidateDoc' file='schematron' module='schematron'>
       <cond>defined(LIBXML_SCHEMATRON_ENABLED)</cond>
       <info>Validate a tree instance against the schematron</info>
diff --git a/doc/libxml2-refs.xml b/doc/libxml2-refs.xml
index 3941733..6901f38 100644
--- a/doc/libxml2-refs.xml
+++ b/doc/libxml2-refs.xml
@@ -429,6 +429,7 @@
     <reference name='XML_FROM_RELAXNGV' href='html/libxml-xmlerror.html#XML_FROM_RELAXNGV'/>
     <reference name='XML_FROM_SCHEMASP' href='html/libxml-xmlerror.html#XML_FROM_SCHEMASP'/>
     <reference name='XML_FROM_SCHEMASV' href='html/libxml-xmlerror.html#XML_FROM_SCHEMASV'/>
+    <reference name='XML_FROM_SCHEMATRONV' href='html/libxml-xmlerror.html#XML_FROM_SCHEMATRONV'/>
     <reference name='XML_FROM_TREE' href='html/libxml-xmlerror.html#XML_FROM_TREE'/>
     <reference name='XML_FROM_VALID' href='html/libxml-xmlerror.html#XML_FROM_VALID'/>
     <reference name='XML_FROM_WRITER' href='html/libxml-xmlerror.html#XML_FROM_WRITER'/>
@@ -1122,7 +1123,10 @@
     <reference name='XML_SCHEMAS_UNKNOWN' href='html/libxml-schemasInternals.html#XML_SCHEMAS_UNKNOWN'/>
     <reference name='XML_SCHEMAS_USHORT' href='html/libxml-schemasInternals.html#XML_SCHEMAS_USHORT'/>
     <reference name='XML_SCHEMAS_WILDCARD_COMPLETE' href='html/libxml-schemasInternals.html#XML_SCHEMAS_WILDCARD_COMPLETE'/>
+    <reference name='XML_SCHEMATRONV_ASSERT' href='html/libxml-xmlerror.html#XML_SCHEMATRONV_ASSERT'/>
+    <reference name='XML_SCHEMATRONV_REPORT' href='html/libxml-xmlerror.html#XML_SCHEMATRONV_REPORT'/>
     <reference name='XML_SCHEMATRON_OUT_BUFFER' href='html/libxml-schematron.html#XML_SCHEMATRON_OUT_BUFFER'/>
+    <reference name='XML_SCHEMATRON_OUT_ERROR' href='html/libxml-schematron.html#XML_SCHEMATRON_OUT_ERROR'/>
     <reference name='XML_SCHEMATRON_OUT_FILE' href='html/libxml-schematron.html#XML_SCHEMATRON_OUT_FILE'/>
     <reference name='XML_SCHEMATRON_OUT_IO' href='html/libxml-schematron.html#XML_SCHEMATRON_OUT_IO'/>
     <reference name='XML_SCHEMATRON_OUT_QUIET' href='html/libxml-schematron.html#XML_SCHEMATRON_OUT_QUIET'/>
@@ -2774,6 +2778,7 @@
     <reference name='xmlSchematronParserCtxt' href='html/libxml-schematron.html#xmlSchematronParserCtxt'/>
     <reference name='xmlSchematronParserCtxtPtr' href='html/libxml-schematron.html#xmlSchematronParserCtxtPtr'/>
     <reference name='xmlSchematronPtr' href='html/libxml-schematron.html#xmlSchematronPtr'/>
+    <reference name='xmlSchematronSetValidStructuredErrors' href='html/libxml-schematron.html#xmlSchematronSetValidStructuredErrors'/>
     <reference name='xmlSchematronValidCtxt' href='html/libxml-schematron.html#xmlSchematronValidCtxt'/>
     <reference name='xmlSchematronValidCtxtPtr' href='html/libxml-schematron.html#xmlSchematronValidCtxtPtr'/>
     <reference name='xmlSchematronValidOptions' href='html/libxml-schematron.html#xmlSchematronValidOptions'/>
@@ -3941,6 +3946,7 @@
       <ref name='XML_FROM_RELAXNGV'/>
       <ref name='XML_FROM_SCHEMASP'/>
       <ref name='XML_FROM_SCHEMASV'/>
+      <ref name='XML_FROM_SCHEMATRONV'/>
       <ref name='XML_FROM_TREE'/>
       <ref name='XML_FROM_VALID'/>
       <ref name='XML_FROM_WRITER'/>
@@ -4634,7 +4640,10 @@
       <ref name='XML_SCHEMAS_UNKNOWN'/>
       <ref name='XML_SCHEMAS_USHORT'/>
       <ref name='XML_SCHEMAS_WILDCARD_COMPLETE'/>
+      <ref name='XML_SCHEMATRONV_ASSERT'/>
+      <ref name='XML_SCHEMATRONV_REPORT'/>
       <ref name='XML_SCHEMATRON_OUT_BUFFER'/>
+      <ref name='XML_SCHEMATRON_OUT_ERROR'/>
       <ref name='XML_SCHEMATRON_OUT_FILE'/>
       <ref name='XML_SCHEMATRON_OUT_IO'/>
       <ref name='XML_SCHEMATRON_OUT_QUIET'/>
@@ -6322,6 +6331,7 @@
       <ref name='xmlSchematronParserCtxt'/>
       <ref name='xmlSchematronParserCtxtPtr'/>
       <ref name='xmlSchematronPtr'/>
+      <ref name='xmlSchematronSetValidStructuredErrors'/>
       <ref name='xmlSchematronValidCtxt'/>
       <ref name='xmlSchematronValidCtxtPtr'/>
       <ref name='xmlSchematronValidOptions'/>
@@ -8728,6 +8738,7 @@
       <ref name='xmlSchemaValidateStream'/>
       <ref name='xmlSchemaValidityErrorFunc'/>
       <ref name='xmlSchemaValidityWarningFunc'/>
+      <ref name='xmlSchematronSetValidStructuredErrors'/>
       <ref name='xmlSchematronValidityErrorFunc'/>
       <ref name='xmlSchematronValidityWarningFunc'/>
       <ref name='xmlSetFeature'/>
@@ -10100,6 +10111,7 @@
     </type>
     <type name='xmlSchematronValidCtxtPtr'>
       <ref name='xmlSchematronFreeValidCtxt'/>
+      <ref name='xmlSchematronSetValidStructuredErrors'/>
       <ref name='xmlSchematronValidateDoc'/>
     </type>
     <type name='xmlShellCtxtPtr'>
@@ -10139,6 +10151,7 @@
       <ref name='xmlRelaxNGSetValidStructuredErrors'/>
       <ref name='xmlSchemaSetParserStructuredErrors'/>
       <ref name='xmlSchemaSetValidStructuredErrors'/>
+      <ref name='xmlSchematronSetValidStructuredErrors'/>
       <ref name='xmlSetStructuredErrorFunc'/>
       <ref name='xmlTextReaderSetStructuredErrorHandler'/>
       <ref name='xmlThrDefSetStructuredErrorFunc'/>
@@ -11743,6 +11756,7 @@
     </file>
     <file name='schematron'>
       <ref name='XML_SCHEMATRON_OUT_BUFFER'/>
+      <ref name='XML_SCHEMATRON_OUT_ERROR'/>
       <ref name='XML_SCHEMATRON_OUT_FILE'/>
       <ref name='XML_SCHEMATRON_OUT_IO'/>
       <ref name='XML_SCHEMATRON_OUT_QUIET'/>
@@ -11760,6 +11774,7 @@
       <ref name='xmlSchematronParserCtxt'/>
       <ref name='xmlSchematronParserCtxtPtr'/>
       <ref name='xmlSchematronPtr'/>
+      <ref name='xmlSchematronSetValidStructuredErrors'/>
       <ref name='xmlSchematronValidCtxt'/>
       <ref name='xmlSchematronValidCtxtPtr'/>
       <ref name='xmlSchematronValidOptions'/>
@@ -12534,6 +12549,7 @@
       <ref name='XML_FROM_RELAXNGV'/>
       <ref name='XML_FROM_SCHEMASP'/>
       <ref name='XML_FROM_SCHEMASV'/>
+      <ref name='XML_FROM_SCHEMATRONV'/>
       <ref name='XML_FROM_TREE'/>
       <ref name='XML_FROM_VALID'/>
       <ref name='XML_FROM_WRITER'/>
@@ -12940,6 +12956,8 @@
       <ref name='XML_SCHEMAP_WARN_SKIP_SCHEMA'/>
       <ref name='XML_SCHEMAP_WARN_UNLOCATED_SCHEMA'/>
       <ref name='XML_SCHEMAP_WILDCARD_INVALID_NS_MEMBER'/>
+      <ref name='XML_SCHEMATRONV_ASSERT'/>
+      <ref name='XML_SCHEMATRONV_REPORT'/>
       <ref name='XML_SCHEMAV_ATTRINVALID'/>
       <ref name='XML_SCHEMAV_ATTRUNKNOWN'/>
       <ref name='XML_SCHEMAV_CONSTRUCT'/>
@@ -14593,7 +14611,6 @@
           <ref name='startElementSAXFunc'/>
         </word>
         <word name='Calling'>
-          <ref name='xmlCleanupParser'/>
           <ref name='xmlRegisterHTTPPostCallbacks'/>
         </word>
         <word name='Canonical'>
@@ -14710,7 +14727,6 @@
         </word>
         <word name='Cleanup'>
           <ref name='xmlCleanupCharEncodingHandlers'/>
-          <ref name='xmlCleanupParser'/>
           <ref name='xmlCleanupPredefinedEntities'/>
           <ref name='xmlCtxtResetLastError'/>
           <ref name='xmlNanoFTPCleanup'/>
@@ -16568,6 +16584,7 @@
         </word>
         <word name='One'>
           <ref name='INPUT_CHUNK'/>
+          <ref name='xmlCleanupParser'/>
           <ref name='xmlParseAttributeType'/>
           <ref name='xmlSetGenericErrorFunc'/>
           <ref name='xmlValidateElementDecl'/>
@@ -17342,6 +17359,7 @@
           <ref name='LIBXML_SCHEMATRON_ENABLED'/>
           <ref name='xmlSchematronFree'/>
           <ref name='xmlSchematronParse'/>
+          <ref name='xmlSchematronSetValidStructuredErrors'/>
         </word>
         <word name='Schematrons'>
           <ref name='xmlSchematronNewDocParserCtxt'/>
@@ -17392,6 +17410,7 @@
           <ref name='xmlNormalizeURIPath'/>
         </word>
         <word name='See'>
+          <ref name='xmlCleanupParser'/>
           <ref name='xmlLinkGetData'/>
           <ref name='xmlParseNotationDecl'/>
           <ref name='xmlTextReaderByteConsumed'/>
@@ -18821,6 +18840,7 @@
         <word name='also'>
           <ref name='xmlCharEncodingOutputFunc'/>
           <ref name='xmlCheckHTTPInput'/>
+          <ref name='xmlCleanupParser'/>
           <ref name='xmlHasProp'/>
           <ref name='xmlKeepBlanksDefault'/>
           <ref name='xmlNanoFTPProxy'/>
@@ -19860,15 +19880,20 @@
           <ref name='XML_SCHEMAS_ELEM_CIRCULAR'/>
           <ref name='XML_SCHEMAS_TYPE_MARKED'/>
         </word>
+        <word name='clean'>
+          <ref name='xmlCleanupParser'/>
+        </word>
         <word name='cleanly'>
           <ref name='xmlCheckHTTPInput'/>
         </word>
         <word name='cleans'>
+          <ref name='xmlCleanupParser'/>
           <ref name='xmlNanoFTPScanProxy'/>
           <ref name='xmlNanoHTTPScanProxy'/>
         </word>
         <word name='cleanup'>
           <ref name='xmlCleanupGlobals'/>
+          <ref name='xmlCleanupParser'/>
           <ref name='xmlCleanupThreads'/>
           <ref name='xmlNanoFTPCleanup'/>
         </word>
@@ -21397,6 +21422,7 @@
           <ref name='xmlParseDocument'/>
         </word>
         <word name='documents'>
+          <ref name='xmlCleanupParser'/>
           <ref name='xmlIsID'/>
           <ref name='xmlParseEntityRef'/>
           <ref name='xmlParserHandleReference'/>
@@ -22675,6 +22701,7 @@
           <ref name='xmlRelaxNGSetValidStructuredErrors'/>
           <ref name='xmlSchemaSetParserErrors'/>
           <ref name='xmlSchemaSetParserStructuredErrors'/>
+          <ref name='xmlSchematronSetValidStructuredErrors'/>
           <ref name='xmlShellCmd'/>
           <ref name='xmlSwitchEncoding'/>
           <ref name='xmlSwitchInputEncoding'/>
@@ -23829,6 +23856,7 @@
           <ref name='_xmlDoc'/>
           <ref name='xlinkIsLink'/>
           <ref name='xmlCharEncFirstLine'/>
+          <ref name='xmlCleanupParser'/>
           <ref name='xmlParsePEReference'/>
           <ref name='xmlParserHandlePEReference'/>
           <ref name='xmlXPathNextSelf'/>
@@ -24679,6 +24707,7 @@
           <ref name='xmlXPathContextSetCache'/>
         </word>
         <word name='misleading'>
+          <ref name='xmlCleanupParser'/>
           <ref name='xmlParsePEReference'/>
           <ref name='xmlParserHandlePEReference'/>
         </word>
@@ -25503,6 +25532,7 @@
         </word>
         <word name='operations'>
           <ref name='_xmlDOMWrapCtxt'/>
+          <ref name='xmlCleanupParser'/>
           <ref name='xmlModuleClose'/>
           <ref name='xmlModuleFree'/>
           <ref name='xmlReconciliateNs'/>
@@ -25520,6 +25550,9 @@
           <ref name='xmlXPathSubValues'/>
           <ref name='xmlXPathValueFlipSign'/>
         </word>
+        <word name='opposite'>
+          <ref name='xmlCleanupParser'/>
+        </word>
         <word name='optimized'>
           <ref name='xmlXPathNodeSetAddUnique'/>
         </word>
@@ -26119,6 +26152,9 @@
           <ref name='xmlDOMWrapCloneNode'/>
           <ref name='xmlDOMWrapReconcileNamespaces'/>
         </word>
+        <word name='preparing'>
+          <ref name='xmlCleanupParser'/>
+        </word>
         <word name='preparsed'>
           <ref name='xmlReaderNewWalker'/>
           <ref name='xmlReaderWalker'/>
@@ -26166,7 +26202,6 @@
         </word>
         <word name='prevent'>
           <ref name='_xmlParserCtxt'/>
-          <ref name='xmlCleanupParser'/>
         </word>
         <word name='previous'>
           <ref name='_xmlAttr'/>
@@ -27298,7 +27333,6 @@
           <ref name='xmlReaderNewWalker'/>
         </word>
         <word name='reusing'>
-          <ref name='xmlCleanupParser'/>
           <ref name='xmlXIncludeProcessNode'/>
         </word>
         <word name='reverse'>
@@ -27957,6 +27991,7 @@
         </word>
         <word name='somewhat'>
           <ref name='xmlCheckLanguageID'/>
+          <ref name='xmlCleanupParser'/>
         </word>
         <word name='sorted'>
           <ref name='xmlParserAddNodeInfo'/>
@@ -28395,6 +28430,7 @@
         <word name='structured'>
           <ref name='xmlRelaxNGSetValidStructuredErrors'/>
           <ref name='xmlSchemaSetParserStructuredErrors'/>
+          <ref name='xmlSchematronSetValidStructuredErrors'/>
           <ref name='xmlSetStructuredErrorFunc'/>
         </word>
         <word name='structures'>
@@ -30342,6 +30378,7 @@
         </word>
         <word name='xmlInitParser'>
           <ref name='htmlInitAutoClose'/>
+          <ref name='xmlCleanupParser'/>
         </word>
         <word name='xmlInitThreads'>
           <ref name='xmlInitThreads'/>
diff --git a/doc/xml.html b/doc/xml.html
index bd46fad..877e7c2 100644
--- a/doc/xml.html
+++ b/doc/xml.html
@@ -3356,7 +3356,7 @@
 <ol>
   <li><a href="#General3">General overview</a></li>
   <li><a href="#setting">Setting libxml2 set of memory routines</a></li>
-  <li><a href="#cleanup">Cleaning up after parsing</a></li>
+  <li><a href="#cleanup">Cleaning up after using the library</a></li>
   <li><a href="#Debugging">Debugging routines</a></li>
   <li><a href="#General4">General memory requirements</a></li>
   <li><a href="#Compacting">Returning memory to the kernel</a></li>
@@ -3392,27 +3392,29 @@
 any other libxml2 routines (unless you are sure your allocations routines are
 compatibles).</p>
 
-<h3><a name="cleanup">Cleaning up after parsing</a></h3>
+<h3><a name="cleanup">Cleaning up after using the library</a></h3>
 
 <p>Libxml2 is not stateless, there is a few set of memory structures needing
 allocation before the parser is fully functional (some encoding structures
 for example). This also mean that once parsing is finished there is a tiny
 amount of memory (a few hundred bytes) which can be recollected if you don't
-reuse the parser immediately:</p>
+reuse the library or any document built with it:</p>
 <ul>
   <li><a href="http://xmlsoft.org/html/libxml-parser.html">xmlCleanupParser
-    ()</a> is a centralized routine to free the parsing states. Note that it
-    won't deallocate any produced tree if any (use the xmlFreeDoc() and
-    related routines for this).</li>
+    ()</a> is a centralized routine to free the library state and data. Note
+    that it won't deallocate any produced tree if any (use the xmlFreeDoc()
+    and related routines for this). This should be called only when the library
+    is not used anymore.</li>
   <li><a href="http://xmlsoft.org/html/libxml-parser.html">xmlInitParser
     ()</a> is the dual routine allowing to preallocate the parsing state
     which can be useful for example to avoid initialization reentrancy
     problems when using libxml2 in multithreaded applications</li>
 </ul>
 
-<p>Generally xmlCleanupParser() is safe, if needed the state will be rebuild
-at the next invocation of parser routines, but be careful of the consequences
-in multithreaded applications.</p>
+<p>Generally xmlCleanupParser() is safe assuming no parsing is ongoing and
+no document is still being used, if needed the state will be rebuild at the
+next invocation of parser routines (or by xmlInitParser()), but be careful
+of the consequences in multithreaded applications.</p>
 
 <h3><a name="Debugging">Debugging routines</a></h3>
 
diff --git a/doc/xmlmem.html b/doc/xmlmem.html
index 5437e73..5599444 100644
--- a/doc/xmlmem.html
+++ b/doc/xmlmem.html
@@ -9,7 +9,7 @@
 A:link, A:visited, A:active { text-decoration: underline }
 </style><title>Memory Management</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000"><table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr><td width="120"><a href="http://swpat.ffii.org/"><img src="epatents.png" alt="Action against software patents" /></a></td><td width="180"><a href="http://www.gnome.org/"><img src="gnome2.png" alt="Gnome2 Logo" /></a><a href="http://www.w3.org/Status"><img src="w3c.png" alt="W3C Logo" /></a><a href="http://www.redhat.com/"><img src="redhat.gif" alt="Red Hat Logo" /></a><div align="left"><a href="http://xmlsoft.org/"><img src="Libxml2-Logo-180x168.gif" alt="Made with Libxml2 Logo" /></a></div></td><td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center"><h1>The XML C parser and toolkit of Gnome</h1><h2>Memory Management</h2></td></tr></table></td></tr></table></td></tr></table><table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Developer Menu</b></center></td></tr><tr><td bgcolor="#fffacd"><form action="search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form><ul><li><a href="index.html" style="font-weight:bold">Main Menu</a></li><li><a href="html/index.html" style="font-weight:bold">Reference Manual</a></li><li><a href="examples/index.html" style="font-weight:bold">Code Examples</a></li><li><a href="guidelines.html">XML Guidelines</a></li><li><a href="tutorial/index.html">Tutorial</a></li><li><a href="xmlreader.html">The Reader Interface</a></li><li><a href="ChangeLog.html">ChangeLog</a></li><li><a href="XSLT.html">XSLT</a></li><li><a href="python.html">Python and bindings</a></li><li><a href="architecture.html">libxml2 architecture</a></li><li><a href="tree.html">The tree output</a></li><li><a href="interface.html">The SAX interface</a></li><li><a href="xmlmem.html">Memory Management</a></li><li><a href="xmlio.html">I/O Interfaces</a></li><li><a href="library.html">The parser interfaces</a></li><li><a href="entities.html">Entities or no entities</a></li><li><a href="namespaces.html">Namespaces</a></li><li><a href="upgrade.html">Upgrading 1.x code</a></li><li><a href="threads.html">Thread safety</a></li><li><a href="DOM.html">DOM Principles</a></li><li><a href="example.html">A real example</a></li><li><a href="xml.html">flat page</a>, <a href="site.xsl">stylesheet</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="APIchunk0.html">Alphabetic</a></li><li><a href="APIconstructors.html">Constructors</a></li><li><a href="APIfunctions.html">Functions/Types</a></li><li><a href="APIfiles.html">Modules</a></li><li><a href="APIsymbols.html">Symbols</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="http://mail.gnome.org/archives/xml/">Mail archive</a></li><li><a href="http://xmlsoft.org/XSLT/">XSLT libxslt</a></li><li><a href="http://phd.cs.unibo.it/gdome2/">DOM gdome2</a></li><li><a href="http://www.aleksey.com/xmlsec/">XML-DSig xmlsec</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://www.blastwave.org/packages.php/libxml2">Solaris binaries</a></li><li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://codespeak.net/lxml/">lxml Python bindings</a></li><li><a href="http://cpan.uwinnipeg.ca/dist/XML-LibXML">Perl bindings</a></li><li><a href="http://libxmlplusplus.sourceforge.net/">C++ bindings</a></li><li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading4">PHP bindings</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://libxml.rubyforge.org/">Ruby bindings</a></li><li><a href="http://tclxml.sourceforge.net/">Tcl bindings</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxml2">Bug Tracker</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><p>Table of Content:</p><ol><li><a href="#General3">General overview</a></li>
   <li><a href="#setting">Setting libxml2 set of memory routines</a></li>
-  <li><a href="#cleanup">Cleaning up after parsing</a></li>
+  <li><a href="#cleanup">Cleaning up after using the library</a></li>
   <li><a href="#Debugging">Debugging routines</a></li>
   <li><a href="#General4">General memory requirements</a></li>
   <li><a href="#Compacting">Returning memory to the kernel</a></li>
@@ -27,21 +27,23 @@
     which allow to set up a new set of memory allocation functions</li>
 </ul><p>Of course a call to xmlMemSetup() should probably be done before calling
 any other libxml2 routines (unless you are sure your allocations routines are
-compatibles).</p><h3><a name="cleanup" id="cleanup">Cleaning up after parsing</a></h3><p>Libxml2 is not stateless, there is a few set of memory structures needing
+compatibles).</p><h3><a name="cleanup" id="cleanup">Cleaning up after using the library</a></h3><p>Libxml2 is not stateless, there is a few set of memory structures needing
 allocation before the parser is fully functional (some encoding structures
 for example). This also mean that once parsing is finished there is a tiny
 amount of memory (a few hundred bytes) which can be recollected if you don't
-reuse the parser immediately:</p><ul><li><a href="http://xmlsoft.org/html/libxml-parser.html">xmlCleanupParser
-    ()</a> is a centralized routine to free the parsing states. Note that it
-    won't deallocate any produced tree if any (use the xmlFreeDoc() and
-    related routines for this).</li>
+reuse the library or any document built with it:</p><ul><li><a href="http://xmlsoft.org/html/libxml-parser.html">xmlCleanupParser
+    ()</a> is a centralized routine to free the library state and data. Note
+    that it won't deallocate any produced tree if any (use the xmlFreeDoc()
+    and related routines for this). This should be called only when the library
+    is not used anymore.</li>
   <li><a href="http://xmlsoft.org/html/libxml-parser.html">xmlInitParser
     ()</a> is the dual routine allowing to preallocate the parsing state
     which can be useful for example to avoid initialization reentrancy
     problems when using libxml2 in multithreaded applications</li>
-</ul><p>Generally xmlCleanupParser() is safe, if needed the state will be rebuild
-at the next invocation of parser routines, but be careful of the consequences
-in multithreaded applications.</p><h3><a name="Debugging" id="Debugging">Debugging routines</a></h3><p>When configured using --with-mem-debug flag (off by default), libxml2 uses
+</ul><p>Generally xmlCleanupParser() is safe assuming no parsing is ongoing and
+no document is still being used, if needed the state will be rebuild at the
+next invocation of parser routines (or by xmlInitParser()), but be careful
+of the consequences in multithreaded applications.</p><h3><a name="Debugging" id="Debugging">Debugging routines</a></h3><p>When configured using --with-mem-debug flag (off by default), libxml2 uses
 a set of memory allocation debugging routines keeping track of all allocated
 blocks and the location in the code where the routine was called. A couple of
 other debugging routines allow to dump the memory allocated infos to a file
diff --git a/elfgcchack.h b/elfgcchack.h
index cd9605c..a17fa97 100644
--- a/elfgcchack.h
+++ b/elfgcchack.h
@@ -2877,6 +2877,16 @@
 #endif
 #endif
 
+#ifdef bottom_threads
+#undef xmlDllMain
+extern __typeof (xmlDllMain) xmlDllMain __attribute((alias("xmlDllMain__internal_alias")));
+#else
+#ifndef xmlDllMain
+extern __typeof (xmlDllMain) xmlDllMain__internal_alias __attribute((visibility("hidden")));
+#define xmlDllMain xmlDllMain__internal_alias
+#endif
+#endif
+
 #ifdef bottom_tree
 #undef xmlDocCopyNode
 extern __typeof (xmlDocCopyNode) xmlDocCopyNode __attribute((alias("xmlDocCopyNode__internal_alias")));
@@ -10119,6 +10129,18 @@
 
 #if defined(LIBXML_SCHEMATRON_ENABLED)
 #ifdef bottom_schematron
+#undef xmlSchematronSetValidStructuredErrors
+extern __typeof (xmlSchematronSetValidStructuredErrors) xmlSchematronSetValidStructuredErrors __attribute((alias("xmlSchematronSetValidStructuredErrors__internal_alias")));
+#else
+#ifndef xmlSchematronSetValidStructuredErrors
+extern __typeof (xmlSchematronSetValidStructuredErrors) xmlSchematronSetValidStructuredErrors__internal_alias __attribute((visibility("hidden")));
+#define xmlSchematronSetValidStructuredErrors xmlSchematronSetValidStructuredErrors__internal_alias
+#endif
+#endif
+#endif
+
+#if defined(LIBXML_SCHEMATRON_ENABLED)
+#ifdef bottom_schematron
 #undef xmlSchematronValidateDoc
 extern __typeof (xmlSchematronValidateDoc) xmlSchematronValidateDoc __attribute((alias("xmlSchematronValidateDoc__internal_alias")));
 #else
diff --git a/parser.c b/parser.c
index e0f30e7..2530e60 100644
--- a/parser.c
+++ b/parser.c
@@ -13176,12 +13176,15 @@
 /**
  * xmlCleanupParser:
  *
- * Cleanup function for the XML library. It tries to reclaim all
- * parsing related global memory allocated for the library processing.
- * It doesn't deallocate any document related memory. Calling this
- * function should not prevent reusing the library but one should
- * call xmlCleanupParser() only when the process has
- * finished using the library and all XML document built with it.
+ * This function name is somewhat misleading. It does not clean up
+ * parser state, it cleans up memory allocated by the library itself.
+ * It is a cleanup function for the XML library. It tries to reclaim all
+ * related global memory allocated for the library processing.
+ * It doesn't deallocate any document related memory. One should
+ * call xmlCleanupParser() only when the process has finished using
+ * the library and all XML/HTML documents built with it.
+ * See also xmlInitParser() which has the opposite function of preparing
+ * the library for operations.
  */
 
 void
diff --git a/testapi.c b/testapi.c
index af71ac2..8a50e88 100644
--- a/testapi.c
+++ b/testapi.c
@@ -18024,6 +18024,16 @@
 
 
 static int
+test_xmlSchematronSetValidStructuredErrors(void) {
+    int test_ret = 0;
+
+
+    /* missing type support */
+    return(test_ret);
+}
+
+
+static int
 test_xmlSchematronValidateDoc(void) {
     int test_ret = 0;
 
@@ -18067,12 +18077,13 @@
 test_schematron(void) {
     int test_ret = 0;
 
-    if (quiet == 0) printf("Testing schematron : 1 of 9 functions ...\n");
+    if (quiet == 0) printf("Testing schematron : 1 of 10 functions ...\n");
     test_ret += test_xmlSchematronNewDocParserCtxt();
     test_ret += test_xmlSchematronNewMemParserCtxt();
     test_ret += test_xmlSchematronNewParserCtxt();
     test_ret += test_xmlSchematronNewValidCtxt();
     test_ret += test_xmlSchematronParse();
+    test_ret += test_xmlSchematronSetValidStructuredErrors();
     test_ret += test_xmlSchematronValidateDoc();
 
     if (test_ret != 0)
diff --git a/win32/libxml2.def.src b/win32/libxml2.def.src
index e37cfe0..db05ad4 100644
--- a/win32/libxml2.def.src
+++ b/win32/libxml2.def.src
@@ -768,6 +768,7 @@
 xmlDictQLookup
 xmlDictReference
 xmlDictSize
+xmlDllMain
 xmlDocCopyNode
 xmlDocCopyNodeList
 xmlDocDump
@@ -1783,6 +1784,7 @@
 xmlSchematronNewParserCtxt
 xmlSchematronNewValidCtxt
 xmlSchematronParse
+xmlSchematronSetValidStructuredErrors
 xmlSchematronValidateDoc
 xmlSearchNs
 xmlSearchNsByHref