From 17049f05f9ef09b3dc2a9c5d1de3f21de7c03193 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Tue, 13 Sep 2005 09:58:33 +0000 Subject: Load /tmp/tmp.2Zlqcz/libxml2-2.6.22 into packages/libxml2/branches/upstream/current. --- doc/devhelp/libxml2-uri.html | 148 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 doc/devhelp/libxml2-uri.html (limited to 'doc/devhelp/libxml2-uri.html') diff --git a/doc/devhelp/libxml2-uri.html b/doc/devhelp/libxml2-uri.html new file mode 100644 index 0000000..22f724e --- /dev/null +++ b/doc/devhelp/libxml2-uri.html @@ -0,0 +1,148 @@ + + + + + uri: library of generic URI related routines + + + + + + + + + + + + + + + + +

+ uri +

+

uri - library of generic URI related routines

+

library of generic URI related routines Implements RFC 2396

+

Author(s): Daniel Veillard

+
+

Synopsis

+
typedef struct _xmlURI xmlURI;
+typedef xmlURI * xmlURIPtr;
+int	xmlNormalizeURIPath		(char * path);
+void	xmlPrintURI			(FILE * stream, 
xmlURIPtr uri); +xmlURIPtr xmlParseURIRaw (const char * str,
int raw); +char * xmlURIUnescapeString (const char * str,
int len,
char * target); +xmlURIPtr xmlParseURI (const char * str); +xmlURIPtr xmlCreateURI (void); +xmlChar * xmlURIEscapeStr (const xmlChar * str,
const xmlChar * list); +xmlChar * xmlCanonicPath (const xmlChar * path); +void xmlFreeURI (xmlURIPtr uri); +int xmlParseURIReference (xmlURIPtr uri,
const char * str); +xmlChar * xmlBuildRelativeURI (const xmlChar * URI,
const xmlChar * base); +xmlChar * xmlSaveUri (xmlURIPtr uri); +xmlChar * xmlURIEscape (const xmlChar * str); +xmlChar * xmlBuildURI (const xmlChar * URI,
const xmlChar * base); +
+
+
+

Description

+
+
+

Details

+
+

Structure xmlURI

struct _xmlURI {
+    char *	scheme	: the URI scheme
+    char *	opaque	: opaque part
+    char *	authority	: the authority part
+    char *	server	: the server part
+    char *	user	: the user part
+    int	port	: the port number
+    char *	path	: the path string
+    char *	query	: the query string
+    char *	fragment	: the fragment identifier
+    int	cleanup	: parsing potentially unclean URI
+} xmlURI;
+

+

+
+

Typedef xmlURIPtr

xmlURI * xmlURIPtr;
+

+

+
+

xmlBuildRelativeURI ()

xmlChar *	xmlBuildRelativeURI	(const xmlChar * URI, 
const xmlChar * base)
+

Expresses the URI of the reference in terms relative to the base. Some examples of this operation include: base = "http://site1.com/docs/book1.html" URI input URI returned docs/pic1.gif pic1.gif docs/img/pic1.gif img/pic1.gif img/pic1.gif ../img/pic1.gif http://site1.com/docs/pic1.gif pic1.gif http://site2.com/docs/pic1.gif http://site2.com/docs/pic1.gif base = "docs/book1.html" URI input URI returned docs/pic1.gif pic1.gif docs/img/pic1.gif img/pic1.gif img/pic1.gif ../img/pic1.gif http://site1.com/docs/pic1.gif http://site1.com/docs/pic1.gif Note: if the URI reference is really wierd or complicated, it may be worthwhile to first convert it into a "nice" one by calling xmlBuildURI (using 'base') before calling this routine, since this routine (for reasonable efficiency) assumes URI has already been through some validation.

+
URI:the URI reference under consideration
base:the base value
Returns:a new URI string (to be freed by the caller) or NULL in case error.
+
+

xmlBuildURI ()

xmlChar *	xmlBuildURI		(const xmlChar * URI, 
const xmlChar * base)
+

Computes he final URI of the reference done by checking that the given URI is valid, and building the final URI using the base URI. This is processed according to section 5.2 of the RFC 2396 5.2. Resolving Relative References to Absolute Form

+
URI:the URI instance found in the document
base:the base value
Returns:a new URI string (to be freed by the caller) or NULL in case of error.
+
+

xmlCanonicPath ()

xmlChar *	xmlCanonicPath		(const xmlChar * path)
+

Constructs a canonic path from the specified path.

+
path:the resource locator in a filesystem notation
Returns:a new canonic path, or a duplicate of the path parameter if the construction fails. The caller is responsible for freeing the memory occupied by the returned string. If there is insufficient memory available, or the argument is NULL, the function returns NULL.
+
+

xmlCreateURI ()

xmlURIPtr	xmlCreateURI		(void)
+

Simply creates an empty xmlURI

+
Returns:the new structure or NULL in case of error
+
+

xmlFreeURI ()

void	xmlFreeURI			(xmlURIPtr uri)
+

Free up the xmlURI struct

+
uri:pointer to an xmlURI
+
+ +
+

xmlParseURI ()

xmlURIPtr	xmlParseURI		(const char * str)
+

Parse an URI URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]

+
str:the URI string to analyze
Returns:a newly built xmlURIPtr or NULL in case of error
+
+

xmlParseURIRaw ()

xmlURIPtr	xmlParseURIRaw		(const char * str, 
int raw)
+

Parse an URI but allows to keep intact the original fragments. URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]

+
str:the URI string to analyze
raw:if 1 unescaping of URI pieces are disabled
Returns:a newly built xmlURIPtr or NULL in case of error
+
+

xmlParseURIReference ()

int	xmlParseURIReference		(xmlURIPtr uri, 
const char * str)
+

Parse an URI reference string and fills in the appropriate fields of the @uri structure URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]

+
uri:pointer to an URI structure
str:the string to analyze
Returns:0 or the error code
+
+

xmlPrintURI ()

void	xmlPrintURI			(FILE * stream, 
xmlURIPtr uri)
+

Prints the URI in the stream @stream.

+
stream:a FILE* for the output
uri:pointer to an xmlURI
+
+

xmlSaveUri ()

xmlChar *	xmlSaveUri		(xmlURIPtr uri)
+

Save the URI as an escaped string

+
uri:pointer to an xmlURI
Returns:a new string (to be deallocated by caller)
+
+

xmlURIEscape ()

xmlChar *	xmlURIEscape		(const xmlChar * str)
+

Escaping routine, does not do validity checks ! It will try to escape the chars needing this, but this is heuristic based it's impossible to be sure.

+
str:the string of the URI to escape
Returns:an copy of the string, but escaped 25 May 2001 Uses xmlParseURI and xmlURIEscapeStr to try to escape correctly according to RFC2396. - Carl Douglas
+
+

xmlURIEscapeStr ()

xmlChar *	xmlURIEscapeStr		(const xmlChar * str, 
const xmlChar * list)
+

This routine escapes a string to hex, ignoring reserved characters (a-z) and the characters in the exception list.

+
str:string to escape
list:exception list string of chars not to escape
Returns:a new escaped string or NULL in case of error.
+
+ +
+
+
+ + -- cgit v1.2.3 From 968041a8b2ec86c39b5074024ce97d136ecd9a95 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Thu, 26 Oct 2006 11:17:37 +0200 Subject: Load /tmp/libxml2-2.6.27 into libxml2/branches/upstream/current. --- ChangeLog | 442 +++ HTMLparser.c | 245 +- HTMLtree.c | 10 +- Makefile.in | 3 + NEWS | 68 + SAX2.c | 15 +- aclocal.m4 | 15 +- configure | 185 +- configure.in | 8 +- doc/APIchunk0.html | 4 +- doc/APIchunk1.html | 4 +- doc/APIchunk10.html | 9 +- doc/APIchunk11.html | 3 +- doc/APIchunk12.html | 32 +- doc/APIchunk13.html | 3 +- doc/APIchunk14.html | 10 +- doc/APIchunk15.html | 6 + doc/APIchunk16.html | 1 + doc/APIchunk17.html | 11 +- doc/APIchunk18.html | 6 +- doc/APIchunk19.html | 2 +- doc/APIchunk2.html | 1 + doc/APIchunk20.html | 13 +- doc/APIchunk21.html | 4 +- doc/APIchunk22.html | 2 + doc/APIchunk23.html | 5 +- doc/APIchunk24.html | 6 +- doc/APIchunk25.html | 8 +- doc/APIchunk26.html | 2 +- doc/APIchunk27.html | 5 +- doc/APIchunk28.html | 10 +- doc/APIchunk3.html | 3 +- doc/APIchunk4.html | 32 +- doc/APIchunk5.html | 1 - doc/APIchunk7.html | 1 - doc/APIchunk8.html | 1 + doc/APIchunk9.html | 10 +- doc/APIconstructors.html | 3 + doc/APIfiles.html | 7 + doc/APIfunctions.html | 10 +- doc/APIsymbols.html | 7 + doc/DOM.html | 16 +- doc/FAQ.html | 333 +-- doc/Makefile.in | 3 + doc/XMLinfo.html | 33 +- doc/XSLT.html | 9 +- doc/apibuild.py | 1 + doc/architecture.html | 7 +- doc/bugs.html | 118 +- doc/catalog.html | 324 +-- doc/contribs.html | 53 +- doc/devhelp/Makefile.in | 3 + doc/devhelp/libxml2-HTMLparser.html | 5 + doc/devhelp/libxml2-parser.html | 5 +- doc/devhelp/libxml2-tree.html | 22 +- doc/devhelp/libxml2-uri.html | 5 + doc/devhelp/libxml2-xinclude.html | 5 + doc/devhelp/libxml2-xmlsave.html | 2 +- doc/devhelp/libxml2-xmlversion.html | 9 +- doc/devhelp/libxml2-xpath.html | 11 +- doc/devhelp/libxml2.devhelp | 7 + doc/docs.html | 35 +- doc/downloads.html | 42 +- doc/encoding.html | 312 +-- doc/entities.html | 74 +- doc/example.html | 70 +- doc/examples/Makefile.am | 1 + doc/examples/Makefile.in | 4 + doc/help.html | 26 +- doc/html/index.html | 13 - doc/html/libxml-HTMLparser.html | 5 +- doc/html/libxml-parser.html | 5 +- doc/html/libxml-tree.html | 25 +- doc/html/libxml-uri.html | 5 +- doc/html/libxml-xinclude.html | 5 +- doc/html/libxml-xmlsave.html | 2 +- doc/html/libxml-xmlversion.html | 7 +- doc/html/libxml-xpath.html | 7 +- doc/index.html | 109 +- doc/interface.html | 35 +- doc/intro.html | 40 +- doc/library.html | 137 +- doc/libxml2-api.xml | 90 +- doc/libxml2.xsa | 17 +- doc/namespaces.html | 70 +- doc/news.html | 1730 ++++++------ doc/python.html | 247 +- doc/threads.html | 23 +- doc/tree.html | 32 +- doc/upgrade.html | 188 +- doc/xml.html | 5046 ++++++++++++++++++----------------- doc/xmlcatalog.1 | 62 +- doc/xmlcatalog_man.xml | 79 +- doc/xmldtd.html | 154 +- doc/xmlio.html | 123 +- doc/xmllint.1 | 89 +- doc/xmllint.xml | 116 +- doc/xmlmem.html | 166 +- encoding.c | 6 + entities.c | 11 +- example/Makefile.in | 3 + include/Makefile.in | 3 + include/libxml/HTMLparser.h | 3 + include/libxml/Makefile.in | 3 + include/libxml/entities.h | 1 + include/libxml/parser.h | 5 +- include/libxml/tree.h | 51 +- include/libxml/uri.h | 2 + include/libxml/xinclude.h | 4 + include/libxml/xmlversion.h | 23 +- include/libxml/xmlversion.h.in | 13 +- include/libxml/xpath.h | 6 +- libxml-2.0.pc.in | 3 +- libxml2.spec | 6 +- ltmain.sh | 162 +- parser.c | 197 +- parserInternals.c | 1 + python/Makefile.am | 2 +- python/Makefile.in | 5 +- python/generator.py | 2 +- python/libxml.c | 36 + python/libxml.py | 30 +- python/libxml2-py.c | 38 +- python/setup.py | 2 +- python/tests/Makefile.am | 3 +- python/tests/Makefile.in | 6 +- python/tests/compareNodes.py | 50 + python/types.c | 112 + relaxng.c | 2 + runtest.c | 21 +- testapi.c | 170 +- threads.c | 4 +- tree.c | 668 +++-- uri.c | 58 +- valid.c | 22 +- xinclude.c | 30 +- xmlIO.c | 494 ++-- xmllint.c | 121 +- xmlmemory.c | 6 +- xmlregexp.c | 7 +- xmlsave.c | 112 +- xmlschemas.c | 313 ++- xmlschemastypes.c | 14 +- xmlwriter.c | 11 +- xpath.c | 2298 +++++++++------- xstc/Makefile.am | 22 +- xstc/Makefile.in | 25 +- 147 files changed, 9627 insertions(+), 6935 deletions(-) delete mode 100644 doc/html/index.html create mode 100755 python/tests/compareNodes.py (limited to 'doc/devhelp/libxml2-uri.html') diff --git a/ChangeLog b/ChangeLog index f6b31ef..11098d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,445 @@ +Fri Oct 20 14:55:47 CEST 2006 Daniel Veillard + + * tree.c: fix comment for xmlDocSetRootElement c.f. #351981 + * xmllint.c: order XPath elements when using --shell + +Tue Oct 17 23:23:26 CEST 2006 Daniel Veillard + + * xmlregexp.c: applied fix from Christopher Boumenot for bug + #362714 on regexps missing ']' + +Tue Oct 17 22:32:42 CEST 2006 Daniel Veillard + + * parserInternals.c: applied patch from Marius Konitzer to avoid + leaking in xmlNewInputFromFile() in case of HTTP redirection + +Tue Oct 17 22:19:02 CEST 2006 Daniel Veillard + + * HTMLparser.c: fix one problem found in htmlCtxtUseOptions() + and pointed in #340591 + +Tue Oct 17 22:04:31 CEST 2006 Daniel Veillard + + * HTMLparser.c: fixed teh 2 stupid bugs affecting htmlReadDoc() and + htmlReadIO() this should fix #340322 + +Tue Oct 17 21:39:23 CEST 2006 Daniel Veillard + + * xpath.c: applied patch from Olaf Walkowiak which should fix #334104 + +Tue Oct 17 18:12:34 CEST 2006 Daniel Veillard + + * HTMLparser.c: fixing HTML minimized attribute values to be generated + internally if not present, fixes bug #332124 + * result/HTML/doc2.htm.sax result/HTML/doc3.htm.sax + result/HTML/wired.html.sax: this affects the SAX event strem for + a few test cases + +Tue Oct 17 17:56:31 CEST 2006 Daniel Veillard + + * HTMLparser.c: fixing HTML entities in attributes parsing bug #362552 + * result/HTML/entities2.html* test/HTML/entities2.html: added to + the regression suite + +Tue Oct 17 01:21:37 CEST 2006 Daniel Veillard + + * xmllint.c: started to switch xmllint to use xmlSaveDoc to test + #342556 + * xmlsave.c: fixed #342556 easy and a whole set of problems with + encodings, BOM and xmlSaveDoc() + +Mon Oct 16 15:14:53 CEST 2006 Daniel Veillard + + * HTMLparser.c: fix #348252 if the document clains to be in a + different encoding in the meta tag and it's obviously wrong, + don't screw up the end of the content. + +Mon Oct 16 11:32:09 CEST 2006 Daniel Veillard + + * HTMLparser.c: fix a chunking and script bug #347708 + +Mon Oct 16 09:51:05 CEST 2006 Daniel Veillard + + * HTMLparser.c: remove a warning + * encoding.c: check with uppercase for AIX iconv() should fix #352644 + * doc/examples/Makefile.am: partially handle one bug report + +Sun Oct 15 22:31:42 CEST 2006 Daniel Veillard + + * parser.c: fix the patch for unreproductable #343000 but + also fix a line/column keeping error + * result/errors/attr1.xml.err result/errors/attr2.xml.err + result/errors/name.xml.err result/errors/name2.xml.err + result/schemas/anyAttr-processContents-err1_0_0.err + result/schemas/bug312957_1_0.err: affected lines in error output + of the regression tests + +Sat Oct 14 10:46:46 CEST 2006 Daniel Veillard + + * tree.c: fixing bug #344390 with xmlReconciliateNs + +Sat Oct 14 00:31:49 CEST 2006 Daniel Veillard + + * xmllint.c: added --html --memory to test htmlReadMemory to + test #321632 + * HTMLparser.c: added various initialization calls which may help + #321632 but not conclusive + * testapi.c tree.c include/libxml/tree.h: fixed compilation with + --with-minimum --with-sax1 and --with-minimum --with-schemas + fixing #326442 + +Fri Oct 13 18:30:55 CEST 2006 Daniel Veillard + + * relaxng.c: fix a Relax-NG bug related to element content processing, + fixes bug #302836 + * test/relaxng/302836.rng test/relaxng/302836_0.xml + result/relaxng/302836*: added to regression tests + +Fri Oct 13 14:42:44 CEST 2006 Daniel Veillard + + * parser.c: fix a problem in xmlSplitQName resulting in bug #334669 + +Fri Oct 13 12:27:22 CEST 2006 Daniel Veillard + + * parser.c: fixed xmlIOParseDTD handling of @input in error case, + Should fix #335085 + * testapi.c: reset the http_proxy env variable to not waste time + on regression tests + +Thu Oct 12 23:07:43 CEST 2006 Rob Richards + + * xmlIO.c: fix Windows compile - missing xmlWrapOpen. + +Thu Oct 12 18:21:18 CEST 2006 Daniel Veillard + + * parser.c: fixed the heuristic used when trying to detect mixed-content + elememts if the parser wants to treat ignorable whitespaces + in a non-standard way, should fix bug #300263 + +Thu Oct 12 14:52:38 CEST 2006 Daniel Veillard + + * parser.c: fix a first arg error in SAX callback pointed out by + Mike Hommey, and another one still hanging around. Should fix #342737 + +Wed Oct 11 23:11:58 CEST 2006 Daniel Veillard + + * include/libxml/xmlversion.h.in: fix comment on versions + * xmlmemory.c: do not spend too much time digging in dumped memory + +Wed Oct 11 18:40:00 CEST 2006 Daniel Veillard + + * valid.c: fixed a weird error where validity context whould not + show up if warnings were disabled pointed out by Bob Stayton + * xmlIO.c doc/generator.py: cleanup and fix to regenerate the docs + * doc//* testapi.c: rebuilt the docs + +Wed Oct 11 14:32:00 CEST 2006 Daniel Veillard + + * libxml-2.0.pc.in: applied patch from Mikhail Zabaluev to separate + library flags for shared and static builds, fixes #344594. If this + bites you, use xml2-config. + +Wed Oct 11 11:27:37 CEST 2006 Daniel Veillard + + * python/Makefile.am: remove the build path recorded in the python + shared module as Peter Breitenlohner pointed out, should fix #346022 + +Wed Oct 11 11:14:51 CEST 2006 Daniel Veillard + + * xmlIO.c: applied patch from Mikhail Zabaluev fixing the conditions + of unescaping from URL to filepath, should fix #344588. + +Wed Oct 11 10:24:58 CEST 2006 Daniel Veillard + + * configure.in xstc/Makefile.am: applied patch from Peter Breitenlohner + for wget detection and fix of a Python path problem, should fix + #340993 + +Tue Oct 10 22:02:29 CEST 2006 Daniel Veillard + + * include/libxml/entities.h entities.c SAX2.c parser.c: trying to + fix entities behaviour when using SAX, had to extend entities + content and hack on the entities processing code, but that should + fix the long standing bug #159219 + +Tue Oct 10 14:36:18 CEST 2006 Daniel Veillard + + * uri.c include/libxml/uri.h: add a new function xmlPathToUri() + to provide a clean conversion when setting up a base + * SAX2.c tree.c: use said function when setting up doc->URL + or using the xmlSetBase function. Should fix #346261 + +Tue Oct 10 11:05:59 CEST 2006 Daniel Veillard + + * xmlIO.c: applied a portability patch from Emelyanov Alexey + +Tue Oct 10 10:52:01 CEST 2006 Daniel Veillard + + * parser.c: applied and slightly modified a patch from Michael Day to + keep _private in the parser context when parsing external entities + +Tue Oct 10 10:33:43 CEST 2006 Daniel Veillard + + * python/libxml.py python/types.c: applied patch from Ross Reedstrom, + Brian West and Stefan Anca to add XPointer suport to the Python bindings + +Fri Sep 29 11:13:59 CEST 2006 Daniel Veillard + + * xmlsave.c: fixed a comment + * xinclude.c include/libxml/xinclude.h: applied a patch from Michael Day + to add a new function providing the _private field for the generated + parser contexts xmlXIncludeProcessFlagsData() + +Thu Sep 21 10:36:11 CEST 2006 Daniel Veillard + + * xmlIO.c: applied patch from Michael Day doing some refactoring + for the catalog entity loaders. + +Thu Sep 21 08:53:06 CEST 2006 Daniel Veillard + + * HTMLparser.c include/libxml/HTMLparser.h: exports htmlNewParserCtxt() + as Michael Day pointed out this is needed to use htmlCtxtRead*() + +Tue Sep 19 14:42:59 CEST 2006 Daniel Veillard + + * parser.c: applied patch from Ben Darnell on #321545, I could not + reproduce the problem but 1/ this is safe 2/ it's better to be safe. + +Sat Sep 16 16:02:23 CEST 2006 Rob Richards + + * tree.c: xmlTextConcat works with comments and PI nodes (bug #355962). + * parser.c: fix resulting tree corruption when using XML namespace + with existing doc in xmlParseBalancedChunkMemoryRecover. + +Fri Sep 1 11:52:55 CEST 2006 Daniel Veillard + + * xmlIO.c: another patch from Emelyanov Alexey to clean up a few things + in the previous patch. + +Wed Aug 30 15:10:09 CEST 2006 Daniel Veillard + + * xmlIO.c: applied patch from Roland Schwingel to fix the problem + with file names in UTF-8 on Windows, and compat on older win9x + versions. + +Tue Aug 22 16:51:22 CEST 2006 Daniel Veillard + + * valid.c: fixed a bug #203125 in Red hat bugzilla, crashing PHP4 + on validation errors, the heuristic to guess is a vctxt user + pointer is the parsing context was insufficient. + +Mon Aug 21 10:40:10 CEST 2006 Daniel Veillard + + * doc/xmlcatalog.1 doc/xmlcatalog_man.xml doc/xmllint.1 doc/xmllint.xml: + applied patch to man pages from Daniel Leidert and regenerated + +Thu Aug 17 00:48:31 CEST 2006 Rob Richards + + * xmlwriter.c: Add a document to the xmlwriter structure and + pass document when writing attribute content for encoding support. + +Wed Aug 16 01:15:12 CEST 2006 Rob Richards + + * HTMLtree.c xmlsave.c: Add linefeeds to error messages allowing + for consistant handling. + +Tue Aug 15 15:02:18 CEST 2006 Kasimier Buchcik + + * xpath.c: Applied the proposed fix for the documentation + of xmlXPathCastToString(); see bug #346202. + +Tue Aug 15 14:49:18 CEST 2006 Kasimier Buchcik + + * xmlschemas.c: While investigating bug #350247, I noticed + that xmlSchemaIDCMatcher structs are massively recreated + although only a maximum of 3 structs is used at the same + time; added a cache for those structures to the + validation context. + +Sat Aug 12 16:12:53 CEST 2006 Daniel Veillard + + * xmlschemas.c: applied patch from Marton Illes to fix an allocation + bug in xmlSchemaXPathEvaluate should close #351032 + +Mon Aug 7 13:08:46 CEST 2006 Daniel Veillard + + * xmlschemas.c: applied patch from Bertrand Fritsch to fix a bug in + xmlSchemaClearValidCtxt + +Fri Aug 4 14:50:41 CEST 2006 Daniel Veillard + + * python/generator.py: fixed the conversion of long parameters + +Thu Jul 13 15:03:11 CEST 2006 Kasimier Buchcik + + * xmlsave.c: Removed the automatic generation of CDATA sections + for the content of the "script" and "style" elements when + serializing XHTML. The issue was reported by Vincent Lefevre, + bug #345147. + * result/xhtml1 result/noent/xhtml1: Adjusted regression test + results due to the serialization change described above. + +Thu Jul 13 08:32:21 CEST 2006 Daniel Veillard + + * configure.in parser.c xmllint.c include/libxml/parser.h + include/libxml/xmlversion.h.in: applied patch from Andrew W. Nosenko + to expose if zlib support was compiled in, in the header, in the + feature API and in the xmllint --version output. + +Thu Jul 13 08:24:14 CEST 2006 Daniel Veillard + + * SAX2.c: refactor to use normal warnings for entities problem + and not straight SAX callbacks. + +Wed Jul 12 17:13:03 CEST 2006 Kasimier Buchcik + + * xmlschemas.c: Fixed bug #347316, reported by David Belius: + The simple type, which was the content type definition + of a complex type, which in turn was the base type of a + extending complex type, was missed to be set on this + extending complex type in the derivation machinery. + +Mon Jul 3 13:36:43 CEST 2006 Kasimier Buchcik + + * xpath.c: Changed xmlXPathCollectAndTest() to use + xmlXPathNodeSetAddNs() when adding a ns-node in case of + NODE_TEST_TYPE (the ns-node was previously added plainly + to the list). Since for NODE_TEST_ALL and NODE_TEST_NAME + this specialized ns-addition function was already used, + I assume it was missed to be used with NODE_TEST_TYPE. + +Mon Jul 3 10:57:33 CEST 2006 Daniel Veillard + + * HTMLparser.c: applied const'ification of strings patch from + Matthias Clasen + +Thu Jun 29 13:51:12 CEST 2006 Daniel Veillard + + * threads.c: patch from Andrew W. Nosenko, xmlFreeRMutex forgot to + destroy the condition associated to the mutex. + +Thu Jun 29 12:48:00 CEST 2006 Kasimier Buchcik + + * xpath.c: Fixed a double-free in xmlXPathCompOpEvalToBoolean(), + revealed by a Libxslt regression test. + +Thu Jun 29 12:28:07 CEST 2006 Kasimier Buchcik + + * xpath.c: Enhanced xmlXPathCompOpEvalToBoolean() to be also + usable outside predicate evaluation; the intention is to + use it via xmlXPathCompiledEvalToBoolean() for XSLT tests, + like in . + +Wed Jun 28 19:11:16 CEST 2006 Kasimier Buchcik + + * xpath.c: Fix a memory leak which occurred when using + xmlXPathCompiledEvalToBoolean(). + +Mon Jun 26 17:24:28 UTC 2006 William Brack + + * python/libxml.c, python/libxml.py, python/tests/compareNodes.py, + python/tests/Makefile.am: + Added code submitted by Andreas Pakulat to provide node + equality, inequality and hash functions, plus a single + test program to check the functions (bugs 345779 + 345961). + +Mon Jun 26 18:38:51 CEST 2006 Kasimier Buchcik + + * xpath.c: Added xmlXPathCompiledEvalToBoolean() to the API and + adjusted/added xmlXPathRunEval(), xmlXPathRunStreamEval(), + xmlXPathCompOpEvalToBoolean(), xmlXPathNodeCollectAndTest() + to be aware of a boolean result request. The new function + is now used to evaluate predicates. + +Mon Jun 26 16:22:50 CEST 2006 Kasimier Buchcik + + * xpath.c: Fixed an bug in xmlXPathCompExprAdd(): the newly + introduced field @rewriteType on xmlXPathStepOp was not + initialized to zero here; this could lead to the activation + of the axis rewrite code in xmlXPathNodeCollectAndTest() when + @rewriteType is randomly set to the value 1. A test + (hardcoding the intial value to 1) revealed that the + resulting incorrect behaviour is similar to the behaviour + as described by Arnold Hendriks on the mailing list; so I + hope that will fix the issue. + +Fri Jun 23 18:26:08 CEST 2006 Kasimier Buchcik + + * xpath.c: Fixed an error in xmlXPathEvalExpr(), which + was introduced with the addition of the d-o-s rewrite + and made xpath.c unable to compile if XPATH_STREAMING + was not defined (reported by Kupriyanov Anatolij - + #345752). Fixed the check for d-o-s rewrite + to work on the correct XPath string, which is ctxt->base + and not comp->expr in this case. + +Mon Jun 19 12:23:41 CEST 2006 Kasimier Buchcik + + * xpath.c: Added optimization for positional predicates + (only short-hand form "[n]"), which have a preceding + predicate: "/foo[descendant::bar][3]". + +Sun Jun 18 20:59:02 EDT 2006 Daniel Veillard + + * parser.c: try to fix the crash raised by the parser in + recover mode as pointed by Ryan Phillips + +Sun Jun 18 18:44:56 EDT 2006 Daniel Veillard + + * python/types.c: patch from Nic Ferrier to provide a better type + mapping from XPath to python + +Sun Jun 18 18:35:50 EDT 2006 Daniel Veillard + + * runtest.c: applied patch from Boz for VMS and reporting + Schemas errors. + +Sun Jun 18 18:22:25 EDT 2006 Daniel Veillard + + * testapi.c: applied patch from Felipe Contreras when compiling + with --with-minimum + +Fri Jun 16 21:37:44 CEST 2006 Kasimier Buchcik + + * tree.c include/libxml/tree.h: Fixed a bug in + xmlDOMWrapAdoptNode(); the tree traversal stopped if the + very first given node had an attribute node :-( This was due + to a missed check in the traversal mechanism. + Expanded the xmlDOMWrapCtxt: it now holds the namespace map + used in xmlDOMWrapAdoptNode() and xmlDOMWrapCloneNode() for + reusal; so the map-items don't need to be created for every + cloning/adoption. Added a callback function to it for + retrieval of xmlNsPtr to be set on node->ns; this is needed + for my custom handling of ns-references in my DOM wrapper. + Substituted code which created the XML namespace decl on + the doc for a call to xmlTreeEnsureXMLDecl(). Removed + those nastly "warnigns" from the docs of the clone/adopt + functions; they work fine on my side. + +Mon Jun 12 13:23:11 CEST 2006 Kasimier Buchcik + + * result/pattern/namespaces: Adjusted the result of a + regression test, since the fix of xmlGetNodePath() revealed a + bug in this test result. + +Mon Jun 12 13:06:03 CEST 2006 Kasimier Buchcik + + * tree.c: Got rid of a compiler warning in xmlGetNodePath(). + +Mon Jun 12 12:54:25 CEST 2006 Kasimier Buchcik + + * tree.c: Fixed xmlGetNodePath() to generate the node test "*" + for elements in the default namespace, rather than generating + an unprefixed named node test and loosing the namespace + information. + +Fri Jun 9 21:45:02 CEST 2006 Kasimier Buchcik + + * include/libxml/parser.h: Clarified in the docs that the tree + must not be tried to be modified if using the parser flag + XML_PARSE_COMPACT as suggested by Stefan Behnel + (#344390). + Tue Jun 6 17:50:43 CEST 2006 Daniel Veillard * configure.ini NEWS doc//* libxml.spec.in : preparing release of 2.6.26 diff --git a/HTMLparser.c b/HTMLparser.c index 2e646ad..5e23ad7 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -493,11 +493,11 @@ htmlSkipBlankChars(xmlParserCtxtPtr ctxt) { #define EMPTY NULL -static const char* html_flow[] = { FLOW, NULL } ; -static const char* html_inline[] = { INLINE, NULL } ; +static const char* const html_flow[] = { FLOW, NULL } ; +static const char* const html_inline[] = { INLINE, NULL } ; /* placeholders: elts with content but no subelements */ -static const char* html_pcdata[] = { NULL } ; +static const char* const html_pcdata[] = { NULL } ; #define html_cdata html_pcdata @@ -516,103 +516,104 @@ static const char* html_pcdata[] = { NULL } ; #define CELLVALIGN "valign" #define NB_CELLVALIGN 1 -static const char* html_attrs[] = { ATTRS, NULL } ; -static const char* core_i18n_attrs[] = { COREATTRS, I18N, NULL } ; -static const char* core_attrs[] = { COREATTRS, NULL } ; -static const char* i18n_attrs[] = { I18N, NULL } ; +static const char* const html_attrs[] = { ATTRS, NULL } ; +static const char* const core_i18n_attrs[] = { COREATTRS, I18N, NULL } ; +static const char* const core_attrs[] = { COREATTRS, NULL } ; +static const char* const i18n_attrs[] = { I18N, NULL } ; /* Other declarations that should go inline ... */ -static const char* a_attrs[] = { ATTRS, "charset", "type", "name", +static const char* const a_attrs[] = { ATTRS, "charset", "type", "name", "href", "hreflang", "rel", "rev", "accesskey", "shape", "coords", "tabindex", "onfocus", "onblur", NULL } ; -static const char* target_attr[] = { "target", NULL } ; -static const char* rows_cols_attr[] = { "rows", "cols", NULL } ; -static const char* alt_attr[] = { "alt", NULL } ; -static const char* src_alt_attrs[] = { "src", "alt", NULL } ; -static const char* href_attrs[] = { "href", NULL } ; -static const char* clear_attrs[] = { "clear", NULL } ; -static const char* inline_p[] = { INLINE, "p", NULL } ; -static const char* flow_param[] = { FLOW, "param", NULL } ; -static const char* applet_attrs[] = { COREATTRS , "codebase", +static const char* const target_attr[] = { "target", NULL } ; +static const char* const rows_cols_attr[] = { "rows", "cols", NULL } ; +static const char* const alt_attr[] = { "alt", NULL } ; +static const char* const src_alt_attrs[] = { "src", "alt", NULL } ; +static const char* const href_attrs[] = { "href", NULL } ; +static const char* const clear_attrs[] = { "clear", NULL } ; +static const char* const inline_p[] = { INLINE, "p", NULL } ; + +static const char* const flow_param[] = { FLOW, "param", NULL } ; +static const char* const applet_attrs[] = { COREATTRS , "codebase", "archive", "alt", "name", "height", "width", "align", "hspace", "vspace", NULL } ; -static const char* area_attrs[] = { "shape", "coords", "href", "nohref", +static const char* const area_attrs[] = { "shape", "coords", "href", "nohref", "tabindex", "accesskey", "onfocus", "onblur", NULL } ; -static const char* basefont_attrs[] = +static const char* const basefont_attrs[] = { "id", "size", "color", "face", NULL } ; -static const char* quote_attrs[] = { ATTRS, "cite", NULL } ; -static const char* body_contents[] = { FLOW, "ins", "del", NULL } ; -static const char* body_attrs[] = { ATTRS, "onload", "onunload", NULL } ; -static const char* body_depr[] = { "background", "bgcolor", "text", +static const char* const quote_attrs[] = { ATTRS, "cite", NULL } ; +static const char* const body_contents[] = { FLOW, "ins", "del", NULL } ; +static const char* const body_attrs[] = { ATTRS, "onload", "onunload", NULL } ; +static const char* const body_depr[] = { "background", "bgcolor", "text", "link", "vlink", "alink", NULL } ; -static const char* button_attrs[] = { ATTRS, "name", "value", "type", +static const char* const button_attrs[] = { ATTRS, "name", "value", "type", "disabled", "tabindex", "accesskey", "onfocus", "onblur", NULL } ; -static const char* col_attrs[] = { ATTRS, "span", "width", CELLHALIGN, CELLVALIGN, NULL } ; -static const char* col_elt[] = { "col", NULL } ; -static const char* edit_attrs[] = { ATTRS, "datetime", "cite", NULL } ; -static const char* compact_attrs[] = { ATTRS, "compact", NULL } ; -static const char* dl_contents[] = { "dt", "dd", NULL } ; -static const char* compact_attr[] = { "compact", NULL } ; -static const char* label_attr[] = { "label", NULL } ; -static const char* fieldset_contents[] = { FLOW, "legend" } ; -static const char* font_attrs[] = { COREATTRS, I18N, "size", "color", "face" , NULL } ; -static const char* form_contents[] = { HEADING, LIST, INLINE, "pre", "p", "div", "center", "noscript", "noframes", "blockquote", "isindex", "hr", "table", "fieldset", "address", NULL } ; -static const char* form_attrs[] = { ATTRS, "method", "enctype", "accept", "name", "onsubmit", "onreset", "accept-charset", NULL } ; -static const char* frame_attrs[] = { COREATTRS, "longdesc", "name", "src", "frameborder", "marginwidth", "marginheight", "noresize", "scrolling" , NULL } ; -static const char* frameset_attrs[] = { COREATTRS, "rows", "cols", "onload", "onunload", NULL } ; -static const char* frameset_contents[] = { "frameset", "frame", "noframes", NULL } ; -static const char* head_attrs[] = { I18N, "profile", NULL } ; -static const char* head_contents[] = { "title", "isindex", "base", "script", "style", "meta", "link", "object", NULL } ; -static const char* hr_depr[] = { "align", "noshade", "size", "width", NULL } ; -static const char* version_attr[] = { "version", NULL } ; -static const char* html_content[] = { "head", "body", "frameset", NULL } ; -static const char* iframe_attrs[] = { COREATTRS, "longdesc", "name", "src", "frameborder", "marginwidth", "marginheight", "scrolling", "align", "height", "width", NULL } ; -static const char* img_attrs[] = { ATTRS, "longdesc", "name", "height", "width", "usemap", "ismap", NULL } ; -static const char* input_attrs[] = { ATTRS, "type", "name", "value", "checked", "disabled", "readonly", "size", "maxlength", "src", "alt", "usemap", "ismap", "tabindex", "accesskey", "onfocus", "onblur", "onselect", "onchange", "accept", NULL } ; -static const char* prompt_attrs[] = { COREATTRS, I18N, "prompt", NULL } ; -static const char* label_attrs[] = { ATTRS, "for", "accesskey", "onfocus", "onblur", NULL } ; -static const char* legend_attrs[] = { ATTRS, "accesskey", NULL } ; -static const char* align_attr[] = { "align", NULL } ; -static const char* link_attrs[] = { ATTRS, "charset", "href", "hreflang", "type", "rel", "rev", "media", NULL } ; -static const char* map_contents[] = { BLOCK, "area", NULL } ; -static const char* name_attr[] = { "name", NULL } ; -static const char* action_attr[] = { "action", NULL } ; -static const char* blockli_elt[] = { BLOCK, "li", NULL } ; -static const char* meta_attrs[] = { I18N, "http-equiv", "name", "scheme", NULL } ; -static const char* content_attr[] = { "content", NULL } ; -static const char* type_attr[] = { "type", NULL } ; -static const char* noframes_content[] = { "body", FLOW MODIFIER, NULL } ; -static const char* object_contents[] = { FLOW, "param", NULL } ; -static const char* object_attrs[] = { ATTRS, "declare", "classid", "codebase", "data", "type", "codetype", "archive", "standby", "height", "width", "usemap", "name", "tabindex", NULL } ; -static const char* object_depr[] = { "align", "border", "hspace", "vspace", NULL } ; -static const char* ol_attrs[] = { "type", "compact", "start", NULL} ; -static const char* option_elt[] = { "option", NULL } ; -static const char* optgroup_attrs[] = { ATTRS, "disabled", NULL } ; -static const char* option_attrs[] = { ATTRS, "disabled", "label", "selected", "value", NULL } ; -static const char* param_attrs[] = { "id", "value", "valuetype", "type", NULL } ; -static const char* width_attr[] = { "width", NULL } ; -static const char* pre_content[] = { PHRASE, "tt", "i", "b", "u", "s", "strike", "a", "br", "script", "map", "q", "span", "bdo", "iframe", NULL } ; -static const char* script_attrs[] = { "charset", "src", "defer", "event", "for", NULL } ; -static const char* language_attr[] = { "language", NULL } ; -static const char* select_content[] = { "optgroup", "option", NULL } ; -static const char* select_attrs[] = { ATTRS, "name", "size", "multiple", "disabled", "tabindex", "onfocus", "onblur", "onchange", NULL } ; -static const char* style_attrs[] = { I18N, "media", "title", NULL } ; -static const char* table_attrs[] = { ATTRS "summary", "width", "border", "frame", "rules", "cellspacing", "cellpadding", "datapagesize", NULL } ; -static const char* table_depr[] = { "align", "bgcolor", NULL } ; -static const char* table_contents[] = { "caption", "col", "colgroup", "thead", "tfoot", "tbody", "tr", NULL} ; -static const char* tr_elt[] = { "tr", NULL } ; -static const char* talign_attrs[] = { ATTRS, CELLHALIGN, CELLVALIGN, NULL} ; -static const char* th_td_depr[] = { "nowrap", "bgcolor", "width", "height", NULL } ; -static const char* th_td_attr[] = { ATTRS, "abbr", "axis", "headers", "scope", "rowspan", "colspan", CELLHALIGN, CELLVALIGN, NULL } ; -static const char* textarea_attrs[] = { ATTRS, "name", "disabled", "readonly", "tabindex", "accesskey", "onfocus", "onblur", "onselect", "onchange", NULL } ; -static const char* tr_contents[] = { "th", "td", NULL } ; -static const char* bgcolor_attr[] = { "bgcolor", NULL } ; -static const char* li_elt[] = { "li", NULL } ; -static const char* ul_depr[] = { "type", "compact", NULL} ; -static const char* dir_attr[] = { "dir", NULL} ; +static const char* const col_attrs[] = { ATTRS, "span", "width", CELLHALIGN, CELLVALIGN, NULL } ; +static const char* const col_elt[] = { "col", NULL } ; +static const char* const edit_attrs[] = { ATTRS, "datetime", "cite", NULL } ; +static const char* const compact_attrs[] = { ATTRS, "compact", NULL } ; +static const char* const dl_contents[] = { "dt", "dd", NULL } ; +static const char* const compact_attr[] = { "compact", NULL } ; +static const char* const label_attr[] = { "label", NULL } ; +static const char* const fieldset_contents[] = { FLOW, "legend" } ; +static const char* const font_attrs[] = { COREATTRS, I18N, "size", "color", "face" , NULL } ; +static const char* const form_contents[] = { HEADING, LIST, INLINE, "pre", "p", "div", "center", "noscript", "noframes", "blockquote", "isindex", "hr", "table", "fieldset", "address", NULL } ; +static const char* const form_attrs[] = { ATTRS, "method", "enctype", "accept", "name", "onsubmit", "onreset", "accept-charset", NULL } ; +static const char* const frame_attrs[] = { COREATTRS, "longdesc", "name", "src", "frameborder", "marginwidth", "marginheight", "noresize", "scrolling" , NULL } ; +static const char* const frameset_attrs[] = { COREATTRS, "rows", "cols", "onload", "onunload", NULL } ; +static const char* const frameset_contents[] = { "frameset", "frame", "noframes", NULL } ; +static const char* const head_attrs[] = { I18N, "profile", NULL } ; +static const char* const head_contents[] = { "title", "isindex", "base", "script", "style", "meta", "link", "object", NULL } ; +static const char* const hr_depr[] = { "align", "noshade", "size", "width", NULL } ; +static const char* const version_attr[] = { "version", NULL } ; +static const char* const html_content[] = { "head", "body", "frameset", NULL } ; +static const char* const iframe_attrs[] = { COREATTRS, "longdesc", "name", "src", "frameborder", "marginwidth", "marginheight", "scrolling", "align", "height", "width", NULL } ; +static const char* const img_attrs[] = { ATTRS, "longdesc", "name", "height", "width", "usemap", "ismap", NULL } ; +static const char* const input_attrs[] = { ATTRS, "type", "name", "value", "checked", "disabled", "readonly", "size", "maxlength", "src", "alt", "usemap", "ismap", "tabindex", "accesskey", "onfocus", "onblur", "onselect", "onchange", "accept", NULL } ; +static const char* const prompt_attrs[] = { COREATTRS, I18N, "prompt", NULL } ; +static const char* const label_attrs[] = { ATTRS, "for", "accesskey", "onfocus", "onblur", NULL } ; +static const char* const legend_attrs[] = { ATTRS, "accesskey", NULL } ; +static const char* const align_attr[] = { "align", NULL } ; +static const char* const link_attrs[] = { ATTRS, "charset", "href", "hreflang", "type", "rel", "rev", "media", NULL } ; +static const char* const map_contents[] = { BLOCK, "area", NULL } ; +static const char* const name_attr[] = { "name", NULL } ; +static const char* const action_attr[] = { "action", NULL } ; +static const char* const blockli_elt[] = { BLOCK, "li", NULL } ; +static const char* const meta_attrs[] = { I18N, "http-equiv", "name", "scheme", NULL } ; +static const char* const content_attr[] = { "content", NULL } ; +static const char* const type_attr[] = { "type", NULL } ; +static const char* const noframes_content[] = { "body", FLOW MODIFIER, NULL } ; +static const char* const object_contents[] = { FLOW, "param", NULL } ; +static const char* const object_attrs[] = { ATTRS, "declare", "classid", "codebase", "data", "type", "codetype", "archive", "standby", "height", "width", "usemap", "name", "tabindex", NULL } ; +static const char* const object_depr[] = { "align", "border", "hspace", "vspace", NULL } ; +static const char* const ol_attrs[] = { "type", "compact", "start", NULL} ; +static const char* const option_elt[] = { "option", NULL } ; +static const char* const optgroup_attrs[] = { ATTRS, "disabled", NULL } ; +static const char* const option_attrs[] = { ATTRS, "disabled", "label", "selected", "value", NULL } ; +static const char* const param_attrs[] = { "id", "value", "valuetype", "type", NULL } ; +static const char* const width_attr[] = { "width", NULL } ; +static const char* const pre_content[] = { PHRASE, "tt", "i", "b", "u", "s", "strike", "a", "br", "script", "map", "q", "span", "bdo", "iframe", NULL } ; +static const char* const script_attrs[] = { "charset", "src", "defer", "event", "for", NULL } ; +static const char* const language_attr[] = { "language", NULL } ; +static const char* const select_content[] = { "optgroup", "option", NULL } ; +static const char* const select_attrs[] = { ATTRS, "name", "size", "multiple", "disabled", "tabindex", "onfocus", "onblur", "onchange", NULL } ; +static const char* const style_attrs[] = { I18N, "media", "title", NULL } ; +static const char* const table_attrs[] = { ATTRS "summary", "width", "border", "frame", "rules", "cellspacing", "cellpadding", "datapagesize", NULL } ; +static const char* const table_depr[] = { "align", "bgcolor", NULL } ; +static const char* const table_contents[] = { "caption", "col", "colgroup", "thead", "tfoot", "tbody", "tr", NULL} ; +static const char* const tr_elt[] = { "tr", NULL } ; +static const char* const talign_attrs[] = { ATTRS, CELLHALIGN, CELLVALIGN, NULL} ; +static const char* const th_td_depr[] = { "nowrap", "bgcolor", "width", "height", NULL } ; +static const char* const th_td_attr[] = { ATTRS, "abbr", "axis", "headers", "scope", "rowspan", "colspan", CELLHALIGN, CELLVALIGN, NULL } ; +static const char* const textarea_attrs[] = { ATTRS, "name", "disabled", "readonly", "tabindex", "accesskey", "onfocus", "onblur", "onselect", "onchange", NULL } ; +static const char* const tr_contents[] = { "th", "td", NULL } ; +static const char* const bgcolor_attr[] = { "bgcolor", NULL } ; +static const char* const li_elt[] = { "li", NULL } ; +static const char* const ul_depr[] = { "type", "compact", NULL} ; +static const char* const dir_attr[] = { "dir", NULL} ; #define DECL (const char**) @@ -896,7 +897,7 @@ html40ElementTable[] = { /* * start tags that imply the end of current element */ -static const char *htmlStartClose[] = { +static const char * const htmlStartClose[] = { "form", "form", "p", "hr", "h1", "h2", "h3", "h4", "h5", "h6", "dl", "ul", "ol", "menu", "dir", "address", "pre", "listing", "xmp", "head", NULL, @@ -961,7 +962,7 @@ NULL * TODO: extend that list by reading the HTML SGML DTD on * implied paragraph */ -static const char *htmlNoContentElements[] = { +static const char *const htmlNoContentElements[] = { "html", "head", NULL @@ -972,7 +973,7 @@ static const char *htmlNoContentElements[] = { * NOTE: when adding ones, check htmlIsScriptAttribute() since * it assumes the name starts with 'on' */ -static const char *htmlScriptAttributes[] = { +static const char *const htmlScriptAttributes[] = { "onclick", "ondblclick", "onmousedown", @@ -1046,7 +1047,7 @@ htmlInitAutoClose(void) { for (indx = 0;indx < 100;indx ++) htmlStartCloseIndex[indx] = NULL; indx = 0; while ((htmlStartClose[i] != NULL) && (indx < 100 - 1)) { - htmlStartCloseIndex[indx++] = &htmlStartClose[i]; + htmlStartCloseIndex[indx++] = (const char**) &htmlStartClose[i]; while (htmlStartClose[i] != NULL) i++; i++; } @@ -2376,7 +2377,7 @@ htmlParseHTMLAttribute(htmlParserCtxtPtr ctxt, const xmlChar stop) { growBuffer(buffer); out = &buffer[indx]; } - c = (xmlChar)ent->value; + c = ent->value; if (c < 0x80) { *out++ = c; bits= -6; } else if (c < 0x800) @@ -2706,7 +2707,7 @@ htmlParseScript(htmlParserCtxtPtr ctxt) { cur = CUR_CHAR(l); } - if (!(IS_CHAR_CH(cur))) { + if ((!(IS_CHAR_CH(cur))) && (!((cur == 0) && (ctxt->progressive)))) { htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, "Invalid char in CDATA 0x%X\n", cur); NEXT; @@ -3234,12 +3235,11 @@ htmlParseAttribute(htmlParserCtxtPtr ctxt, xmlChar **value) { NEXT; SKIP_BLANKS; val = htmlParseAttValue(ctxt); - /****** - } else { - * TODO : some attribute must have values, some may not - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->warning(ctxt->userData, - "No value for attribute %s\n", name); */ + } else if (htmlIsBooleanAttr(name)) { + /* + * assume a minimized attribute + */ + val = xmlStrdup(name); } *value = val; @@ -3290,7 +3290,18 @@ htmlCheckEncoding(htmlParserCtxtPtr ctxt, const xmlChar *attvalue) { * registered set of known encodings */ if (enc != XML_CHAR_ENCODING_ERROR) { - xmlSwitchEncoding(ctxt, enc); + if (((enc == XML_CHAR_ENCODING_UTF16LE) || + (enc == XML_CHAR_ENCODING_UTF16BE) || + (enc == XML_CHAR_ENCODING_UCS4LE) || + (enc == XML_CHAR_ENCODING_UCS4BE)) && + (ctxt->input->buf != NULL) && + (ctxt->input->buf->encoder == NULL)) { + htmlParseErr(ctxt, XML_ERR_INVALID_ENCODING, + "htmlCheckEncoding: wrong encoding meta\n", + NULL, NULL); + } else { + xmlSwitchEncoding(ctxt, enc); + } ctxt->charset = XML_CHAR_ENCODING_UTF8; } else { /* @@ -4260,10 +4271,10 @@ htmlFreeParserCtxt(htmlParserCtxtPtr ctxt) * * Allocate and initialize a new parser context. * - * Returns the xmlParserCtxtPtr or NULL + * Returns the htmlParserCtxtPtr or NULL in case of allocation error */ -static htmlParserCtxtPtr +htmlParserCtxtPtr htmlNewParserCtxt(void) { xmlParserCtxtPtr ctxt; @@ -4336,7 +4347,8 @@ htmlCreateMemoryParserCtxt(const char *buffer, int size) { * Returns the new parser context or NULL */ static htmlParserCtxtPtr -htmlCreateDocParserCtxt(xmlChar *cur, const char *encoding ATTRIBUTE_UNUSED) { +htmlCreateDocParserCtxt(const xmlChar *cur, + const char *encoding ATTRIBUTE_UNUSED) { int len; htmlParserCtxtPtr ctxt; @@ -4939,9 +4951,17 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { /* * Handle SCRIPT/STYLE separately */ - if ((!terminate) && - (htmlParseLookupSequence(ctxt, '<', '/', 0, 0) < 0)) - goto done; + if (!terminate) { + int idx; + xmlChar val; + + idx = htmlParseLookupSequence(ctxt, '<', '/', 0, 0); + if (idx < 0) + goto done; + val = in->cur[idx + 2]; + if (val == 0) /* bad cut of input */ + goto done; + } htmlParseScript(ctxt); if ((cur == '<') && (next == '/')) { ctxt->instate = XML_PARSER_END_TAG; @@ -5379,6 +5399,7 @@ htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, void *user_data, xmlGenericError(xmlGenericErrorContext, "HPP: pushed %d\n", size); #endif } + ctxt->progressive = 1; return(ctxt); } @@ -5727,6 +5748,7 @@ htmlCtxtReset(htmlParserCtxtPtr ctxt) if (ctxt == NULL) return; + xmlInitParser(); dict = ctxt->dict; while ((input = inputPop(ctxt)) != NULL) { /* Non consuming */ @@ -5842,6 +5864,7 @@ htmlCtxtUseOptions(htmlParserCtxtPtr ctxt, int options) ctxt->keepBlanks = 1; if (options & HTML_PARSE_RECOVER) { ctxt->recovery = 1; + options -= HTML_PARSE_RECOVER; } else ctxt->recovery = 0; if (options & HTML_PARSE_COMPACT) { @@ -5914,7 +5937,8 @@ htmlReadDoc(const xmlChar * cur, const char *URL, const char *encoding, int opti if (cur == NULL) return (NULL); - ctxt = xmlCreateDocParserCtxt(cur); + xmlInitParser(); + ctxt = htmlCreateDocParserCtxt(cur, NULL); if (ctxt == NULL) return (NULL); return (htmlDoRead(ctxt, URL, encoding, options, 0)); @@ -5935,6 +5959,7 @@ htmlReadFile(const char *filename, const char *encoding, int options) { htmlParserCtxtPtr ctxt; + xmlInitParser(); ctxt = htmlCreateFileParserCtxt(filename, encoding); if (ctxt == NULL) return (NULL); @@ -5958,9 +5983,11 @@ htmlReadMemory(const char *buffer, int size, const char *URL, const char *encodi { htmlParserCtxtPtr ctxt; + xmlInitParser(); ctxt = xmlCreateMemoryParserCtxt(buffer, size); if (ctxt == NULL) return (NULL); + htmlDefaultSAXHandlerInit(); if (ctxt->sax != NULL) memcpy(ctxt->sax, &htmlDefaultSAXHandler, sizeof(xmlSAXHandlerV1)); return (htmlDoRead(ctxt, URL, encoding, options, 0)); @@ -5987,6 +6014,7 @@ htmlReadFd(int fd, const char *URL, const char *encoding, int options) if (fd < 0) return (NULL); + xmlInitParser(); input = xmlParserInputBufferCreateFd(fd, XML_CHAR_ENCODING_NONE); if (input == NULL) return (NULL); @@ -6028,12 +6056,13 @@ htmlReadIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, if (ioread == NULL) return (NULL); + xmlInitParser(); input = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx, XML_CHAR_ENCODING_NONE); if (input == NULL) return (NULL); - ctxt = xmlNewParserCtxt(); + ctxt = htmlNewParserCtxt(); if (ctxt == NULL) { xmlFreeParserInputBuffer(input); return (NULL); diff --git a/HTMLtree.c b/HTMLtree.c index d73024a..c1e5a0a 100644 --- a/HTMLtree.c +++ b/HTMLtree.c @@ -348,19 +348,19 @@ htmlSaveErr(int code, xmlNodePtr node, const char *extra) switch(code) { case XML_SAVE_NOT_UTF8: - msg = "string is not in UTF-8"; + msg = "string is not in UTF-8\n"; break; case XML_SAVE_CHAR_INVALID: - msg = "invalid character value"; + msg = "invalid character value\n"; break; case XML_SAVE_UNKNOWN_ENCODING: - msg = "unknown encoding %s"; + msg = "unknown encoding %s\n"; break; case XML_SAVE_NO_DOCTYPE: - msg = "HTML has no DOCTYPE"; + msg = "HTML has no DOCTYPE\n"; break; default: - msg = "unexpected error number"; + msg = "unexpected error number\n"; } __xmlSimpleError(XML_FROM_OUTPUT, code, node, msg, extra); } diff --git a/Makefile.in b/Makefile.in index 980d634..d0b3f87 100644 --- a/Makefile.in +++ b/Makefile.in @@ -302,6 +302,7 @@ RDL_LIBS = @RDL_LIBS@ READER_TEST = @READER_TEST@ RELDATE = @RELDATE@ RM = @RM@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STATIC_BINARIES = @STATIC_BINARIES@ @@ -330,6 +331,7 @@ THREAD_CFLAGS = @THREAD_CFLAGS@ THREAD_LIBS = @THREAD_LIBS@ U = @U@ VERSION = @VERSION@ +WGET = @WGET@ WIN32_EXTRA_LDFLAGS = @WIN32_EXTRA_LDFLAGS@ WIN32_EXTRA_LIBADD = @WIN32_EXTRA_LIBADD@ WITH_C14N = @WITH_C14N@ @@ -365,6 +367,7 @@ WITH_WRITER = @WITH_WRITER@ WITH_XINCLUDE = @WITH_XINCLUDE@ WITH_XPATH = @WITH_XPATH@ WITH_XPTR = @WITH_XPTR@ +WITH_ZLIB = @WITH_ZLIB@ XINCLUDE_OBJ = @XINCLUDE_OBJ@ XMLLINT = @XMLLINT@ XML_CFLAGS = @XML_CFLAGS@ diff --git a/NEWS b/NEWS index 5c9554a..e13224f 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,74 @@ ChangeLog.html to the CVS at http://cvs.gnome.org/viewcvs/libxml2/ code base.There is the list of public releases: +2.6.27: Oct 25 2006: + - Portability fixes: file names on windows (Roland Schwingel, + Emelyanov Alexey), windows compile fixup (Rob Richards), + AIX iconv() is apparently case sensitive + - improvements: Python XPath types mapping (Nic Ferrier), XPath optimization + (Kasimier), add xmlXPathCompiledEvalToBoolean (Kasimier), Python node + equality and comparison (Andreas Pakulat), xmlXPathCollectAndTest + improvememt (Kasimier), expose if library was compiled with zlib + support (Andrew Nosenko), cache for xmlSchemaIDCMatcher structs + (Kasimier), xmlTextConcat should work with comments and PIs (Rob + Richards), export htmlNewParserCtxt needed by Michael Day, refactoring + of catalog entity loaders (Michael Day), add XPointer support to + python bindings (Ross Reedstrom, Brian West and Stefan Anca), + try to sort out most file path to URI conversions and xmlPathToUri, + add --html --memory case to xmllint + - building fix: fix --with-minimum (Felipe Contreras), VMS fix, + const'ification of HTML parser structures (Matthias Clasen), + portability fix (Emelyanov Alexey), wget autodetection (Peter + Breitenlohner), remove the build path recorded in the python + shared module, separate library flags for shared and static builds + (Mikhail Zabaluev), fix --with-minimum --with-sax1 builds, fix + --with-minimum --with-schemas builds + - bug fix: xmlGetNodePath fix (Kasimier), xmlDOMWrapAdoptNode and + attribute (Kasimier), crash when using the recover mode, + xmlXPathEvalExpr problem (Kasimier), xmlXPathCompExprAdd bug (Kasimier), + missing destry in xmlFreeRMutex (Andrew Nosenko), XML Schemas fixes + (Kasimier), warning on entities processing, XHTML script and style + serialization (Kasimier), python generator for long types, bug in + xmlSchemaClearValidCtxt (Bertrand Fritsch), xmlSchemaXPathEvaluate + allocation bug (Marton Illes), error message end of line (Rob Richards), + fix attribute serialization in writer (Rob Richards), PHP4 DTD validation + crasher, parser safety patch (Ben Darnell), _private context propagation + when parsing entities (with Michael Day), fix entities behaviour when + using SAX, URI to file path fix (Mikhail Zabaluev), disapearing validity + context, arg error in SAX callback (Mike Hommey), fix mixed-content + autodetect when using --noblanks, fix xmlIOParseDTD error handling, + fix bug in xmlSplitQName on special Names, fix Relax-NG element content + validation bug, fix xmlReconciliateNs bug, fix potential attribute + XML parsing bug, fix line/column accounting in XML parser, chunking bug + in the HTML parser on script, try to detect obviously buggy HTML + meta encoding indications, bugs with encoding BOM and xmlSaveDoc, + HTML entities in attributes parsing, HTML minimized attribute values, + htmlReadDoc and htmlReadIO were broken, error handling bug in + xmlXPathEvalExpression (Olaf Walkowiak), fix a problem in + htmlCtxtUseOptions, xmlNewInputFromFile could leak (Marius Konitzer), + bug on misformed SSD regexps (Christopher Boumenot) + + - documentation: warning about XML_PARSE_COMPACT (Kasimier Buchcik), + fix xmlXPathCastToString documentation, improve man pages for + xmllitn and xmlcatalog (Daniel Leidert), fixed comments of a few + functions + + +2.6.26: Jun 6 2006: + - portability fixes: Python detection (Joseph Sacco), compilation + error(William Brack and Graham Bennett), LynxOS patch (Olli Savia) + - bug fixes: encoding buffer problem, mix of code and data in + xmlIO.c(Kjartan Maraas), entities in XSD validation (Kasimier Buchcik), + variousXSD validation fixes (Kasimier), memory leak in pattern (Rob + Richards andKasimier), attribute with colon in name (Rob Richards), XPath + leak inerror reporting (Aleksey Sanin), XInclude text include of + selfdocument. + - improvements: Xpath optimizations (Kasimier), XPath object + cache(Kasimier) + + +2.6.25: Jun 6 2006:: +Do not use or package 2.6.25 2.6.24: Apr 28 2006: - Portability fixes: configure on Windows, testapi compile on windows (Kasimier Buchcik, venkat naidu), Borland C++ 6 compile (Eric Zurcher), diff --git a/SAX2.c b/SAX2.c index 75d5f4c..7d4ab64 100644 --- a/SAX2.c +++ b/SAX2.c @@ -580,6 +580,7 @@ xmlSAX2GetEntity(void *ctx, const xmlChar *name) return(NULL); } ret->owner = 1; + ret->checked = 1; } return(ret); } @@ -987,7 +988,7 @@ xmlSAX2StartDocument(void *ctx) } if ((ctxt->myDoc != NULL) && (ctxt->myDoc->URL == NULL) && (ctxt->input != NULL) && (ctxt->input->filename != NULL)) { - ctxt->myDoc->URL = xmlCanonicPath((const xmlChar *) ctxt->input->filename); + ctxt->myDoc->URL = xmlPathToURI((const xmlChar *)ctxt->input->filename); if (ctxt->myDoc->URL == NULL) xmlSAX2ErrMemory(ctxt, "xmlSAX2StartDocument"); } @@ -1645,9 +1646,9 @@ xmlSAX2StartElement(void *ctx, const xmlChar *fullname, const xmlChar **atts) ns = xmlSearchNs(ctxt->myDoc, parent, prefix); if ((prefix != NULL) && (ns == NULL)) { ns = xmlNewNs(ret, NULL, prefix); - if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) - ctxt->sax->warning(ctxt->userData, - "Namespace prefix %s is not defined\n", prefix); + xmlNsWarnMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE, + "Namespace prefix %s is not defined\n", + prefix, NULL); } /* @@ -2255,9 +2256,9 @@ xmlSAX2StartElementNs(void *ctx, xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs"); return; } - if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) - ctxt->sax->warning(ctxt->userData, - "Namespace prefix %s was not found\n", prefix); + xmlNsWarnMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE, + "Namespace prefix %s was not found\n", + prefix, NULL); } } diff --git a/aclocal.m4 b/aclocal.m4 index 7786a0f..6ec819a 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1597,7 +1597,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra" fi @@ -4305,6 +4305,9 @@ CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) # Is the compiler the GNU C compiler? with_gcc=$_LT_AC_TAGVAR(GCC, $1) +gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\` +gcc_ver=\`gcc -dumpversion\` + # An ERE matcher. EGREP=$lt_EGREP @@ -4438,11 +4441,11 @@ striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. -predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) +predep_objects=\`echo $lt_[]_LT_AC_TAGVAR(predep_objects, $1) | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Dependencies to place after the objects being linked to create a # shared library. -postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) +postdep_objects=\`echo $lt_[]_LT_AC_TAGVAR(postdep_objects, $1) | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Dependencies to place before the objects being linked to create a # shared library. @@ -4454,7 +4457,7 @@ postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) # The library search path used internally by the compiler when linking # a shared library. -compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) +compiler_lib_search_path=\`echo $lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -4534,7 +4537,7 @@ variables_saved_for_relink="$variables_saved_for_relink" link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) # Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec +sys_lib_search_path_spec=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec @@ -6370,6 +6373,7 @@ do done done done +IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris @@ -6402,6 +6406,7 @@ for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do done ]) SED=$lt_cv_path_SED +AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ]) diff --git a/configure b/configure index 5bf44bb..0749a93 100755 --- a/configure +++ b/configure @@ -463,7 +463,7 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os LIBXML_MAJOR_VERSION LIBXML_MINOR_VERSION LIBXML_MICRO_VERSION LIBXML_VERSION LIBXML_VERSION_INFO LIBXML_VERSION_NUMBER LIBXML_VERSION_EXTRA INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP RM MV TAR PERL XMLLINT XSLTPROC EGREP U ANSI2KNR LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB DLLTOOL ac_ct_DLLTOOL AS ac_ct_AS OBJDUMP ac_ct_OBJDUMP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL HTML_DIR Z_CFLAGS Z_LIBS PYTHON WITH_PYTHON_TRUE WITH_PYTHON_FALSE pythondir PYTHON_SUBDIR WITH_MODULES MODULE_PLATFORM_LIBS MODULE_EXTENSION TEST_MODULES STATIC_BINARIES WITH_TRIO_SOURCES_TRUE WITH_TRIO_SOURCES_FALSE WITH_TRIO THREAD_LIBS BASE_THREAD_LIBS WITH_THREADS THREAD_CFLAGS TEST_THREADS THREADS_W32 WITH_TREE WITH_FTP FTP_OBJ WITH_HTTP HTTP_OBJ WITH_LEGACY WITH_READER READER_TEST WITH_WRITER WITH_PATTERN TEST_PATTERN WITH_SAX1 TEST_SAX WITH_PUSH TEST_PUSH WITH_HTML HTML_OBJ TEST_HTML TEST_PHTML WITH_VALID TEST_VALID TEST_VTIME WITH_CATALOG CATALOG_OBJ TEST_CATALOG WITH_DOCB DOCB_OBJ WITH_XPTR XPTR_OBJ TEST_XPTR WITH_C14N C14N_OBJ TEST_C14N WITH_XINCLUDE XINCLUDE_OBJ TEST_XINCLUDE WITH_XPATH XPATH_OBJ TEST_XPATH WITH_OUTPUT WITH_ICONV WITH_ISO8859X WITH_SCHEMATRON TEST_SCHEMATRON WITH_SCHEMAS TEST_SCHEMAS WITH_REGEXPS TEST_REGEXPS WITH_DEBUG DEBUG_OBJ TEST_DEBUG WITH_MEM_DEBUG WITH_RUN_DEBUG WIN32_EXTRA_LIBADD WIN32_EXTRA_LDFLAGS CYGWIN_EXTRA_LDFLAGS CYGWIN_EXTRA_PYTHON_LIBADD XML_CFLAGS XML_LIBDIR XML_LIBS XML_LIBTOOLLIBS ICONV_LIBS XML_INCLUDEDIR HAVE_ISNAN HAVE_ISINF PYTHON_VERSION PYTHON_INCLUDES PYTHON_SITE_PACKAGES M_LIBS RDL_LIBS RELDATE PYTHON_TESTS LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os LIBXML_MAJOR_VERSION LIBXML_MINOR_VERSION LIBXML_MICRO_VERSION LIBXML_VERSION LIBXML_VERSION_INFO LIBXML_VERSION_NUMBER LIBXML_VERSION_EXTRA INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP RM MV TAR PERL WGET XMLLINT XSLTPROC EGREP U ANSI2KNR SED LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB DLLTOOL ac_ct_DLLTOOL AS ac_ct_AS OBJDUMP ac_ct_OBJDUMP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL HTML_DIR Z_CFLAGS Z_LIBS WITH_ZLIB PYTHON WITH_PYTHON_TRUE WITH_PYTHON_FALSE pythondir PYTHON_SUBDIR WITH_MODULES MODULE_PLATFORM_LIBS MODULE_EXTENSION TEST_MODULES STATIC_BINARIES WITH_TRIO_SOURCES_TRUE WITH_TRIO_SOURCES_FALSE WITH_TRIO THREAD_LIBS BASE_THREAD_LIBS WITH_THREADS THREAD_CFLAGS TEST_THREADS THREADS_W32 WITH_TREE WITH_FTP FTP_OBJ WITH_HTTP HTTP_OBJ WITH_LEGACY WITH_READER READER_TEST WITH_WRITER WITH_PATTERN TEST_PATTERN WITH_SAX1 TEST_SAX WITH_PUSH TEST_PUSH WITH_HTML HTML_OBJ TEST_HTML TEST_PHTML WITH_VALID TEST_VALID TEST_VTIME WITH_CATALOG CATALOG_OBJ TEST_CATALOG WITH_DOCB DOCB_OBJ WITH_XPTR XPTR_OBJ TEST_XPTR WITH_C14N C14N_OBJ TEST_C14N WITH_XINCLUDE XINCLUDE_OBJ TEST_XINCLUDE WITH_XPATH XPATH_OBJ TEST_XPATH WITH_OUTPUT WITH_ICONV WITH_ISO8859X WITH_SCHEMATRON TEST_SCHEMATRON WITH_SCHEMAS TEST_SCHEMAS WITH_REGEXPS TEST_REGEXPS WITH_DEBUG DEBUG_OBJ TEST_DEBUG WITH_MEM_DEBUG WITH_RUN_DEBUG WIN32_EXTRA_LIBADD WIN32_EXTRA_LDFLAGS CYGWIN_EXTRA_LDFLAGS CYGWIN_EXTRA_PYTHON_LIBADD XML_CFLAGS XML_LIBDIR XML_LIBS XML_LIBTOOLLIBS ICONV_LIBS XML_INCLUDEDIR HAVE_ISNAN HAVE_ISINF PYTHON_VERSION PYTHON_INCLUDES PYTHON_SITE_PACKAGES M_LIBS RDL_LIBS RELDATE PYTHON_TESTS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -1618,7 +1618,7 @@ host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` LIBXML_MAJOR_VERSION=2 LIBXML_MINOR_VERSION=6 -LIBXML_MICRO_VERSION=26 +LIBXML_MICRO_VERSION=27 LIBXML_MICRO_VERSION_SUFFIX= LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION @@ -3633,6 +3633,46 @@ else echo "${ECHO_T}no" >&6 fi +# Extract the first word of "wget", so it can be a program name with args. +set dummy wget; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_WGET+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $WGET in + [\\/]* | ?:[\\/]*) + ac_cv_path_WGET="$WGET" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_WGET="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_WGET" && ac_cv_path_WGET="/usr/bin/wget" + ;; +esac +fi +WGET=$ac_cv_path_WGET + +if test -n "$WGET"; then + echo "$as_me:$LINENO: result: $WGET" >&5 +echo "${ECHO_T}$WGET" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + # Extract the first word of "xmllint", so it can be a program name with args. set dummy xmllint; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 @@ -4246,6 +4286,7 @@ do done done done +IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris @@ -4280,6 +4321,7 @@ done fi SED=$lt_cv_path_SED + echo "$as_me:$LINENO: result: $SED" >&5 echo "${ECHO_T}$SED" >&6 @@ -4704,7 +4746,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 4707 "configure"' > conftest.$ac_ext + echo '#line 4749 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -6072,7 +6114,7 @@ fi # Provide some information about the compiler. -echo "$as_me:6075:" \ +echo "$as_me:6117:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -7135,11 +7177,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7138: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7180: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7142: \$? = $ac_status" >&5 + echo "$as_me:7184: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7403,11 +7445,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7406: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7448: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7410: \$? = $ac_status" >&5 + echo "$as_me:7452: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7507,11 +7549,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7510: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7552: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7514: \$? = $ac_status" >&5 + echo "$as_me:7556: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8976,7 +9018,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 8979 "configure"' > conftest.$ac_ext + echo '#line 9021 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -8995,7 +9037,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra" fi @@ -9873,7 +9915,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:12361: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12320: \$? = $ac_status" >&5 + echo "$as_me:12365: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -12417,11 +12462,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12420: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12465: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12424: \$? = $ac_status" >&5 + echo "$as_me:12469: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12953,7 +12998,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 12956 "configure"' > conftest.$ac_ext + echo '#line 13001 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -12972,7 +13017,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra" fi @@ -13357,6 +13402,9 @@ CC=$lt_compiler_CXX # Is the compiler the GNU C compiler? with_gcc=$GCC_CXX +gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\` +gcc_ver=\`gcc -dumpversion\` + # An ERE matcher. EGREP=$lt_EGREP @@ -13490,11 +13538,11 @@ striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. -predep_objects=$lt_predep_objects_CXX +predep_objects=\`echo $lt_predep_objects_CXX | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Dependencies to place after the objects being linked to create a # shared library. -postdep_objects=$lt_postdep_objects_CXX +postdep_objects=\`echo $lt_postdep_objects_CXX | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Dependencies to place before the objects being linked to create a # shared library. @@ -13506,7 +13554,7 @@ postdeps=$lt_postdeps_CXX # The library search path used internally by the compiler when linking # a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_CXX +compiler_lib_search_path=\`echo $lt_compiler_lib_search_path_CXX | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -13586,7 +13634,7 @@ variables_saved_for_relink="$variables_saved_for_relink" link_all_deplibs=$link_all_deplibs_CXX # Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec +sys_lib_search_path_spec=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec @@ -14008,11 +14056,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14011: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14059: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14015: \$? = $ac_status" >&5 + echo "$as_me:14063: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14112,11 +14160,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14115: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14163: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14119: \$? = $ac_status" >&5 + echo "$as_me:14167: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15561,7 +15609,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 15564 "configure"' > conftest.$ac_ext + echo '#line 15612 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -15580,7 +15628,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra" fi @@ -15965,6 +16013,9 @@ CC=$lt_compiler_F77 # Is the compiler the GNU C compiler? with_gcc=$GCC_F77 +gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\` +gcc_ver=\`gcc -dumpversion\` + # An ERE matcher. EGREP=$lt_EGREP @@ -16098,11 +16149,11 @@ striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. -predep_objects=$lt_predep_objects_F77 +predep_objects=\`echo $lt_predep_objects_F77 | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Dependencies to place after the objects being linked to create a # shared library. -postdep_objects=$lt_postdep_objects_F77 +postdep_objects=\`echo $lt_postdep_objects_F77 | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Dependencies to place before the objects being linked to create a # shared library. @@ -16114,7 +16165,7 @@ postdeps=$lt_postdeps_F77 # The library search path used internally by the compiler when linking # a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_F77 +compiler_lib_search_path=\`echo $lt_compiler_lib_search_path_F77 | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -16194,7 +16245,7 @@ variables_saved_for_relink="$variables_saved_for_relink" link_all_deplibs=$link_all_deplibs_F77 # Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec +sys_lib_search_path_spec=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec @@ -16336,11 +16387,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16339: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16390: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16343: \$? = $ac_status" >&5 + echo "$as_me:16394: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16604,11 +16655,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16607: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16658: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16611: \$? = $ac_status" >&5 + echo "$as_me:16662: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16708,11 +16759,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16711: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16762: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16715: \$? = $ac_status" >&5 + echo "$as_me:16766: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -18177,7 +18228,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 18180 "configure"' > conftest.$ac_ext + echo '#line 18231 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -18196,7 +18247,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra" fi @@ -18581,6 +18632,9 @@ CC=$lt_compiler_GCJ # Is the compiler the GNU C compiler? with_gcc=$GCC_GCJ +gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\` +gcc_ver=\`gcc -dumpversion\` + # An ERE matcher. EGREP=$lt_EGREP @@ -18714,11 +18768,11 @@ striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. -predep_objects=$lt_predep_objects_GCJ +predep_objects=\`echo $lt_predep_objects_GCJ | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Dependencies to place after the objects being linked to create a # shared library. -postdep_objects=$lt_postdep_objects_GCJ +postdep_objects=\`echo $lt_postdep_objects_GCJ | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Dependencies to place before the objects being linked to create a # shared library. @@ -18730,7 +18784,7 @@ postdeps=$lt_postdeps_GCJ # The library search path used internally by the compiler when linking # a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ +compiler_lib_search_path=\`echo $lt_compiler_lib_search_path_GCJ | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -18810,7 +18864,7 @@ variables_saved_for_relink="$variables_saved_for_relink" link_all_deplibs=$link_all_deplibs_GCJ # Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec +sys_lib_search_path_spec=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec @@ -19062,6 +19116,9 @@ CC=$lt_compiler_RC # Is the compiler the GNU C compiler? with_gcc=$GCC_RC +gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\` +gcc_ver=\`gcc -dumpversion\` + # An ERE matcher. EGREP=$lt_EGREP @@ -19195,11 +19252,11 @@ striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. -predep_objects=$lt_predep_objects_RC +predep_objects=\`echo $lt_predep_objects_RC | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Dependencies to place after the objects being linked to create a # shared library. -postdep_objects=$lt_postdep_objects_RC +postdep_objects=\`echo $lt_postdep_objects_RC | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Dependencies to place before the objects being linked to create a # shared library. @@ -19211,7 +19268,7 @@ postdeps=$lt_postdeps_RC # The library search path used internally by the compiler when linking # a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_RC +compiler_lib_search_path=\`echo $lt_compiler_lib_search_path_RC | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -19291,7 +19348,7 @@ variables_saved_for_relink="$variables_saved_for_relink" link_all_deplibs=$link_all_deplibs_RC # Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec +sys_lib_search_path_spec=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec @@ -19805,6 +19862,7 @@ fi echo Checking zlib +WITH_ZLIB=0 if test "$with_zlib" = "no"; then echo "Disabling compression support" else @@ -20021,9 +20079,10 @@ if test $ac_cv_lib_z_gzread = yes; then cat >>confdefs.h <<\_ACEOF -#define HAVE_LIBZ +#define HAVE_LIBZ 1 _ACEOF + WITH_ZLIB=1 if test "x${Z_DIR}" != "x"; then Z_CFLAGS="-I${Z_DIR}/include" Z_LIBS="-L${Z_DIR}/lib -lz" @@ -20046,6 +20105,7 @@ fi + CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags} @@ -25988,7 +26048,7 @@ fi echo "$as_me:$LINENO: checking for type of socket length (socklen_t)" >&5 echo $ECHO_N "checking for type of socket length (socklen_t)... $ECHO_C" >&6 cat > conftest.$ac_ext < @@ -25999,7 +26059,7 @@ int main(void) { (void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL) ; return 0; } EOF -if { (eval echo configure:26002: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then +if { (eval echo configure:26062: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then rm -rf conftest* echo "$as_me:$LINENO: result: socklen_t *" >&5 @@ -26011,7 +26071,7 @@ else rm -rf conftest* cat > conftest.$ac_ext < @@ -26022,7 +26082,7 @@ int main(void) { (void)getsockopt (1, 1, 1, NULL, (size_t *)NULL) ; return 0; } EOF -if { (eval echo configure:26025: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then +if { (eval echo configure:26085: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then rm -rf conftest* echo "$as_me:$LINENO: result: size_t *" >&5 @@ -26034,7 +26094,7 @@ else rm -rf conftest* cat > conftest.$ac_ext < @@ -26045,7 +26105,7 @@ int main(void) { (void)getsockopt (1, 1, 1, NULL, (int *)NULL) ; return 0; } EOF -if { (eval echo configure:26048: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then +if { (eval echo configure:26108: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then rm -rf conftest* echo "$as_me:$LINENO: result: int *" >&5 @@ -29698,11 +29758,13 @@ s,@RM@,$RM,;t t s,@MV@,$MV,;t t s,@TAR@,$TAR,;t t s,@PERL@,$PERL,;t t +s,@WGET@,$WGET,;t t s,@XMLLINT@,$XMLLINT,;t t s,@XSLTPROC@,$XSLTPROC,;t t s,@EGREP@,$EGREP,;t t s,@U@,$U,;t t s,@ANSI2KNR@,$ANSI2KNR,;t t +s,@SED@,$SED,;t t s,@LN_S@,$LN_S,;t t s,@ECHO@,$ECHO,;t t s,@AR@,$AR,;t t @@ -29729,6 +29791,7 @@ s,@LIBTOOL@,$LIBTOOL,;t t s,@HTML_DIR@,$HTML_DIR,;t t s,@Z_CFLAGS@,$Z_CFLAGS,;t t s,@Z_LIBS@,$Z_LIBS,;t t +s,@WITH_ZLIB@,$WITH_ZLIB,;t t s,@PYTHON@,$PYTHON,;t t s,@WITH_PYTHON_TRUE@,$WITH_PYTHON_TRUE,;t t s,@WITH_PYTHON_FALSE@,$WITH_PYTHON_FALSE,;t t diff --git a/configure.in b/configure.in index e01408a..b2174c6 100644 --- a/configure.in +++ b/configure.in @@ -5,7 +5,7 @@ AC_CANONICAL_HOST LIBXML_MAJOR_VERSION=2 LIBXML_MINOR_VERSION=6 -LIBXML_MICRO_VERSION=26 +LIBXML_MICRO_VERSION=27 LIBXML_MICRO_VERSION_SUFFIX= LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION @@ -40,6 +40,7 @@ AC_PATH_PROG(RM, rm, /bin/rm) AC_PATH_PROG(MV, mv, /bin/mv) AC_PATH_PROG(TAR, tar, /bin/tar) AC_PATH_PROG(PERL, perl, /usr/bin/perl) +AC_PATH_PROG(WGET, wget, /usr/bin/wget) AC_PATH_PROG(XMLLINT, xmllint, /usr/bin/xmllint) AC_PATH_PROG(XSLTPROC, xsltproc, /usr/bin/xsltproc) @@ -325,12 +326,14 @@ echo Checking zlib dnl Checks for zlib library. +WITH_ZLIB=0 if test "$with_zlib" = "no"; then echo "Disabling compression support" else AC_CHECK_HEADERS(zlib.h, AC_CHECK_LIB(z, gzread,[ - AC_DEFINE([HAVE_LIBZ], [], [Have compression library]) + AC_DEFINE([HAVE_LIBZ], [1], [Have compression library]) + WITH_ZLIB=1 if test "x${Z_DIR}" != "x"; then Z_CFLAGS="-I${Z_DIR}/include" Z_LIBS="-L${Z_DIR}/lib -lz" @@ -346,6 +349,7 @@ fi AC_SUBST(Z_CFLAGS) AC_SUBST(Z_LIBS) +AC_SUBST(WITH_ZLIB) CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags} diff --git a/doc/APIchunk0.html b/doc/APIchunk0.html index 4e55d77..f67a902 100644 --- a/doc/APIchunk0.html +++ b/doc/APIchunk0.html @@ -104,7 +104,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNanoFTPList
xmlParseAttValue
xmlTextWriterEndDocument
-
Allocate
xmlNanoFTPNewCtxt
+
Allocate
htmlNewParserCtxt
+xmlNanoFTPNewCtxt
xmlNewDocElementContent
xmlNewElementContent
xmlNewParserCtxt
@@ -129,6 +130,7 @@ A:link, A:visited, A:active { text-decoration: underline }
Applies
htmlCtxtUseOptions
xmlCtxtUseOptions
xmlNormalizeURIPath
+xmlXPathCompiledEvalToBoolean
Apply
XML_SCHEMAS_ANYATTR_STRICT
XML_SCHEMAS_ANY_STRICT
Arabic
xmlUCSIsArabic
diff --git a/doc/APIchunk1.html b/doc/APIchunk1.html index 7c9ff72..a222fe0 100644 --- a/doc/APIchunk1.html +++ b/doc/APIchunk1.html @@ -267,6 +267,7 @@ A:link, A:visited, A:active { text-decoration: underline }
Computes
xmlBuildURI
Concat
xmlTextConcat
Constructs
xmlCanonicPath
+xmlPathToURI
Content
xmlNodeGetBase
xmlParseElementContentDecl
Content-Type
xmlNanoHTTPFetch
@@ -337,7 +338,8 @@ A:link, A:visited, A:active { text-decoration: underline }
Current
_xmlParserCtxt
_xmlParserInput
_xmlValidCtxt
-
Currently
xmlNanoFTPGetConnection
+
Currently
xmlDOMWrapCloneNode
+xmlNanoFTPGetConnection
xmlNanoFTPInit
xmlNanoHTTPInit
xmlTextReaderNextSibling
diff --git a/doc/APIchunk10.html b/doc/APIchunk10.html index 0486624..432eb31 100644 --- a/doc/APIchunk10.html +++ b/doc/APIchunk10.html @@ -105,9 +105,12 @@ A:link, A:visited, A:active { text-decoration: underline } xmlParserHandleReference
xmlValidCtxtNormalizeAttributeValue
account
xmlSchemaValidateFacetWhtsp
+
acquire
_xmlDOMWrapCtxt
+xmlDOMWrapAcquireNsFunction
act
xmlStreamPush
xmlStreamPushAttr
xmlStreamPushNode
+
action
xmlDocSetRootElement
activate
xmlTextReaderSetParserProp
activated
DEBUG_MEMORY
xmlAutomataNewAllTrans
@@ -177,6 +180,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlAddChild
xmlAddNextSibling
xmlAddPrevSibling
+xmlDOMWrapCloneNode
xmlDocDumpFormatMemory
xmlDocDumpFormatMemoryEnc
xmlDocFormatDump
@@ -223,7 +227,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlAddChildList
xmlAddPrevSibling
xmlAddSibling
-
adoption
xmlDOMWrapCloneNode
affect
xmlKeepBlanksDefault
affiliation
_xmlSchemaElement
afraid
xmlEncodeEntities
@@ -280,7 +283,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNewRMutex
xmlReallocLoc
xmlXPathObjectCopy
-
allocation
xmlBufferSetAllocationScheme
+
allocation
htmlNewParserCtxt
+xmlBufferSetAllocationScheme
xmlGetBufferAllocationScheme
xmlMallocAtomicLoc
xmlMallocLoc
@@ -476,6 +480,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlParseAttValue
xmlSAX2ResolveEntity
xmlSetExternalEntityLoader
+xmlXIncludeProcessFlagsData
applications
xmlSetGenericErrorFunc
xmlSetStructuredErrorFunc
applied
xmlHashCopy
diff --git a/doc/APIchunk11.html b/doc/APIchunk11.html index 515f882..dc764d5 100644 --- a/doc/APIchunk11.html +++ b/doc/APIchunk11.html @@ -190,7 +190,8 @@ A:link, A:visited, A:active { text-decoration: underline }
boundary
xmlParseElementChildrenContentDecl
xmlParseElementMixedContentDecl
bracket
xmlParseCharData
-
branch
xmlDOMWrapRemoveNode
+
branch
xmlDOMWrapCloneNode
+xmlDOMWrapRemoveNode
break
_xmlError
xmlDOMWrapAdoptNode
xmlDOMWrapCloneNode
diff --git a/doc/APIchunk12.html b/doc/APIchunk12.html index 1c552b1..b036fc8 100644 --- a/doc/APIchunk12.html +++ b/doc/APIchunk12.html @@ -193,6 +193,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlParserInputBufferCreateMem
xmlParserInputBufferCreateStatic
checked
XML_SCHEMAS_ELEM_INTERNAL_CHECKED
+_xmlEntity
xmlNodeGetBase
xmlNodeGetLang
xmlNodeGetSpacePreserve
@@ -269,6 +270,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlCleanupOutputCallbacks
client
xmlKeepBlanksDefault
clone
xmlDOMWrapCloneNode
+
cloned
xmlDOMWrapCloneNode
close
htmlAutoCloseTag
htmlCtxtReadIO
htmlIsAutoClosed
@@ -413,33 +415,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlRecoverFile
xmlSAXParseFile
xmlSAXParseFileWithData
-
compiled
LIBXML_AUTOMATA_ENABLED
-LIBXML_EXPR_ENABLED
-LIBXML_LEGACY_ENABLED
-LIBXML_MODULES_ENABLED
-LIBXML_REGEXP_ENABLED
-LIBXML_SCHEMAS_ENABLED
-LIBXML_SCHEMATRON_ENABLED
-LIBXML_TEST_VERSION
-LIBXML_UNICODE_ENABLED
-_xmlSchemaAttribute
-_xmlSchemaElement
-_xmlSchemaFacet
-xmlAutomataCompile
-xmlCheckVersion
-xmlExpDump
-xmlExpMaxToken
-xmlGetLastError
-xmlHasFeature
-xmlPatterncompile
-xmlRegexpCompile
-xmlRegexpExec
-xmlRegexpIsDeterminist
-xmlRegexpPrint
-xmlSaveFile
-xmlSaveFormatFile
-xmlXPathCompiledEval
-xmlXPathDebugDumpCompExpr
compiled-in
xmlCleanupInputCallbacks
xmlCleanupOutputCallbacks
xmlPopInputCallbacks
@@ -604,6 +579,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlValidGetValidElements
construct
xmlParseElementChildrenContentDecl
construction
xmlCanonicPath
+xmlPathToURI
constructs
xmlExpParse
xmlParseNamespace
consumed
UTF8ToHtml
@@ -703,6 +679,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlTextWriterWriteDTDExternalEntityContents
contentspec
xmlParseElementContentDecl
xmlParseElementDecl
+
contexts
_xmlDOMWrapCtxt
contextual
xmlRelaxNGGetParserErrors
xmlRelaxNGSetParserErrors
xmlRelaxNGSetParserStructuredErrors
@@ -867,7 +844,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlValidityWarningFunc
cur
xmlXPathAxisFunc
currently
XML_SCHEMAS_INCLUDING_CONVERT_NS
-xmlDOMWrapCloneNode
xmlGcMemGet
xmlMemBlocks
xmlMemGet
diff --git a/doc/APIchunk13.html b/doc/APIchunk13.html index 5980cc2..1c9e865 100644 --- a/doc/APIchunk13.html +++ b/doc/APIchunk13.html @@ -395,7 +395,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlDictReference
xmlDictSize
xmlExpNewCtxt
-
dicts
xmlDOMWrapCloneNode
did
XML_SCHEMAS_TYPE_BLOCK_DEFAULT
xmlTextReaderGetRemainder
xmlTextReaderStandalone
@@ -528,6 +527,7 @@ A:link, A:visited, A:active { text-decoration: underline }
don
XML_SCHEMAS_ANY_LAX
xlinkIsLink
xmlCreatePushParserCtxt
+xmlDOMWrapCloneNode
xmlNewDocNode
xmlNewDocNodeEatName
xmlParseStartTag
@@ -589,6 +589,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlShellCat
xmlShellDir
duplicate
xmlCanonicPath
+xmlPathToURI
duplicated
xmlRelaxNGNewDocParserCtxt
xmlXPathNodeSetFreeNs
duplicates
xmlSchemaCopyValue
diff --git a/doc/APIchunk14.html b/doc/APIchunk14.html index f5134af..dfe748d 100644 --- a/doc/APIchunk14.html +++ b/doc/APIchunk14.html @@ -70,6 +70,7 @@ A:link, A:visited, A:active { text-decoration: underline } resolveEntitySAXFunc
xmlSAX2ResolveEntity
elem
XML_SCHEMAS_ELEM_INTERNAL_CHECKED
+
elem-
_xmlDOMWrapCtxt
element-
xmlStreamPushNode
xmlXPathOrderDocElems
element-node
xmlDOMWrapReconcileNamespaces
@@ -234,7 +235,6 @@ A:link, A:visited, A:active { text-decoration: underline }
equal
xmlAddChild
xmlAddNextSibling
xmlAddPrevSibling
-xmlDOMWrapCloneNode
xmlStrEqual
xmlStrQEqual
xmlTextReaderConstName
@@ -290,7 +290,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlDocSetRootElement
xmlParseInNodeContext
evaluate
xmlXPathEvalExpr
-
evaluated
xmlXPathEvalPredicate
+
evaluated
xmlXPathCompiledEvalToBoolean
+xmlXPathEvalPredicate
xmlXPathEvaluatePredicateResult
xmlXPtrNewContext
evaluating
xmlXPathEvalPredicate
@@ -382,13 +383,10 @@ A:link, A:visited, A:active { text-decoration: underline } xmlStreamPush
xmlStreamPushAttr
xmlStreamPushNode
-
experimental
xmlDOMWrapAdoptNode
-xmlDOMWrapCloneNode
-xmlDOMWrapReconcileNamespaces
-xmlDOMWrapRemoveNode
explicitly
xmlSAXDefaultVersion
explored
xmlXPathAxisFunc
exposing
xmlTextReaderRead
+
expressing
xmlPathToURI
expressions
LIBXML_EXPR_ENABLED
LIBXML_REGEXP_ENABLED
xmlExpExpDerive
diff --git a/doc/APIchunk15.html b/doc/APIchunk15.html index 4ac0a55..5bd7b26 100644 --- a/doc/APIchunk15.html +++ b/doc/APIchunk15.html @@ -74,6 +74,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlShellLoad
xmlXIncludeProcess
xmlXIncludeProcessFlags
+xmlXIncludeProcessFlagsData
xmlXIncludeProcessNode
xmlXIncludeProcessTree
xmlXIncludeProcessTreeFlags
@@ -89,6 +90,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlCharEncOutFunc
xmlCheckFilename
xmlFileOpen
+xmlPathToURI
fallback
XINCLUDE_FALLBACK
docbSAXParseDoc
docbSAXParseFile
@@ -134,6 +136,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_SKIP_IDS
_xmlError
xmlParseMisc
+xmlXIncludeProcessFlagsData
xmlXPathOrderDocElems
fields
XML_SAX2_MAGIC
_htmlElemDesc
@@ -145,6 +148,7 @@ A:link, A:visited, A:active { text-decoration: underline } htmlReadFile
xmlCanonicPath
xmlCtxtReadFile
+xmlPathToURI
xmlReadFile
xmlReaderForFile
xmlReaderNewFile
@@ -320,6 +324,7 @@ A:link, A:visited, A:active { text-decoration: underline }
fragments
xmlParseURIRaw
freeing
xmlCanonicPath
xmlParserInputDeallocate
+xmlPathToURI
frees
xmlBufferFree
xmlXPathContextSetCache
front
xmlValidateNCName
@@ -398,6 +403,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlValidCtxtNormalizeAttributeValue
xmlValidNormalizeAttributeValue
xmlXIncludeSetFlags
+
future
_xmlDOMWrapCtxt

A-B C-C D-E diff --git a/doc/APIchunk16.html b/doc/APIchunk16.html index 5585cd5..0f91dc8 100644 --- a/doc/APIchunk16.html +++ b/doc/APIchunk16.html @@ -287,6 +287,7 @@ A:link, A:visited, A:active { text-decoration: underline } htmlEntityValueLookup
htmlParseEntityRef
htmlNodePtr
htmlNodeStatus
+
htmlParserCtxtPtr
htmlNewParserCtxt
htmlParserOption
htmlCtxtReadDoc
htmlCtxtReadFd
htmlCtxtReadFile
diff --git a/doc/APIchunk17.html b/doc/APIchunk17.html index 071403e..9842c3a 100644 --- a/doc/APIchunk17.html +++ b/doc/APIchunk17.html @@ -153,6 +153,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlCleanupOutputCallbacks
xmlPopInputCallbacks
xmlXIncludeProcessFlags
+xmlXIncludeProcessFlagsData
xmlXIncludeProcessTreeFlags
xmlXIncludeSetFlags
including
XML_SCHEMAS_INCLUDING_CONVERT_NS
@@ -357,6 +358,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_DETECT_IDS
XML_SKIP_IDS
htmlNewDocNoDtD
+htmlNewParserCtxt
xmlCharEncodingOutputFunc
xmlCreateEntitiesTable
xmlCreateEnumeration
@@ -403,6 +405,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlAddNextSibling
xmlAddPrevSibling
xmlCopyElementContent
+xmlDocSetRootElement
xmlFreeElementContent
xmlIsBaseChar
xmlIsBlank
@@ -425,6 +428,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNewPI
xmlSAX2ProcessingInstruction
insufficient
xmlCanonicPath
+xmlPathToURI
intact
xmlParseURIRaw
integer
xmlStrcasecmp
xmlStrcmp
@@ -434,7 +438,11 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXPathFloorFunction
xmlXPathRoundFunction
xmlXPathStringFunction
-
intended
xmlSchemaNewStringValue
+
intended
_xmlDOMWrapCtxt
+xmlSchemaNewStringValue
+
intensively
xmlDOMWrapAdoptNode
+xmlDOMWrapReconcileNamespaces
+xmlDOMWrapRemoveNode
interact
xmlParseExternalID
interface
LIBXML_PATTERN_ENABLED
LIBXML_READER_ENABLED
@@ -480,7 +488,6 @@ A:link, A:visited, A:active { text-decoration: underline }
invoking
xmlGetLineNo
isinf
xmlXPathIsInf
isn
xmlRegisterCharEncodingHandler
-xmlXPathCastToString
isnan
xmlXPathIsNaN
issue
xmlEncodeEntities
issued
xlinkIsLink
diff --git a/doc/APIchunk18.html b/doc/APIchunk18.html index 60efc29..f965440 100644 --- a/doc/APIchunk18.html +++ b/doc/APIchunk18.html @@ -37,7 +37,8 @@ A:link, A:visited, A:active { text-decoration: underline } w-w x-x y-z -

Letter j:

just
htmlSetMetaEncoding
+

Letter j:

just
_xmlDOMWrapCtxt
+htmlSetMetaEncoding
inputPop
namePop
nodePop
@@ -46,7 +47,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlCreateEntitiesTable
xmlCreateEnumeration
xmlDOMWrapAdoptNode
-xmlDOMWrapCloneNode
xmlHandleEntity
xmlNanoFTPInit
xmlNanoHTTPInit
@@ -82,6 +82,7 @@ A:link, A:visited, A:active { text-decoration: underline } _xmlSchemaType
_xmlSchemaWildcard
know
BAD_CAST
+xmlDOMWrapCloneNode
knowledge
htmlAttrAllowed
known
_xmlParserInput
xmlAllocParserInputBuffer
@@ -345,6 +346,7 @@ A:link, A:visited, A:active { text-decoration: underline } xlinkExtendedLinkFunk
xlinkExtendedLinkSetFunk
xmlCanonicPath
+xmlPathToURI
xmlSAX2SetDocumentLocator
xmlTextReaderLocatorBaseURI
xmlTextReaderLocatorLineNumber
diff --git a/doc/APIchunk19.html b/doc/APIchunk19.html index 8541fe1..5bb6121 100644 --- a/doc/APIchunk19.html +++ b/doc/APIchunk19.html @@ -79,6 +79,7 @@ A:link, A:visited, A:active { text-decoration: underline }
manipulation
LIBXML_TREE_ENABLED
many
_xmlParserInput
xmlXPathStringFunction
+
map
_xmlDOMWrapCtxt
maps
xmlTextReaderLookupNamespace
xmlTextWriterWriteDocType
xmlTextWriterWriteProcessingInstruction
@@ -306,7 +307,6 @@ A:link, A:visited, A:active { text-decoration: underline }
most
xmlC14NExecute
xmlGetFeaturesList
move
xmlDOMWrapAdoptNode
-xmlDOMWrapCloneNode
moved
xmlTextReaderMoveToElement
much
xmlReconciliateNs
multi-threaded
xmlSetGenericErrorFunc
diff --git a/doc/APIchunk2.html b/doc/APIchunk2.html index 93faeaf..e771872 100644 --- a/doc/APIchunk2.html +++ b/doc/APIchunk2.html @@ -74,6 +74,7 @@ A:link, A:visited, A:active { text-decoration: underline } ignorableWhitespaceSAXFunc
resolveEntity
resolveEntitySAXFunc
+xmlDOMWrapAcquireNsFunction
xmlDOMWrapReconcileNamespaces
xmlDOMWrapRemoveNode
xmlDocDumpFormatMemoryEnc
diff --git a/doc/APIchunk20.html b/doc/APIchunk20.html index ffcf125..2a9174d 100644 --- a/doc/APIchunk20.html +++ b/doc/APIchunk20.html @@ -65,6 +65,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlC14NExecute
xmlCopyDoc
xmlCopyNode
+xmlDOMWrapAcquireNsFunction
xmlDocCopyNode
xmlFreeNsList
xmlGetProp
@@ -92,6 +93,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_SUBSTITUTE_NONE
XML_SUBSTITUTE_PEREF
XML_SUBSTITUTE_REF
+_xmlDOMWrapCtxt
xmlCreatePushParserCtxt
xmlGetNsList
xmlInitCharEncodingHandlers
@@ -126,7 +128,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlTextReaderCurrentDoc
xmlValidCtxtNormalizeAttributeValue
xmlValidNormalizeAttributeValue
-xmlXPathCastToString
xmlXPathPopBoolean
xmlXPathPopExternal
xmlXPathPopNodeSet
@@ -179,7 +180,8 @@ A:link, A:visited, A:active { text-decoration: underline }
nillable
XML_SCHEMAS_ELEM_NILLABLE
xmlExpIsNillable
nod
xmlEntityReferenceFunc
-
node-
xmlDOMWrapRemoveNode
+
node-
_xmlDOMWrapCtxt
+xmlDOMWrapRemoveNode
xmlValidGetValidElements
node-set?
xmlXPathLocalNameFunction
xmlXPathNamespaceURIFunction
@@ -221,7 +223,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXPathBooleanFunction
none
XML_SCHEMAS_TYPE_VARIETY_ABSENT
getNamespace
-xmlDOMWrapCloneNode
xmlDecodeEntities
xmlGetLastChild
xmlOutputBufferCreateFilename
@@ -260,7 +261,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlValidNormalizeAttributeValue
xmlXPathNormalizeFunction
normalizing
xmlCurrentChar
-
normally
c
+
normally
_xmlNs
+c
xmlValidityErrorFunc
xmlValidityWarningFunc
notations
_xmlDtd
@@ -279,7 +281,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlDOMWrapReconcileNamespaces
ns-references
xmlDOMWrapReconcileNamespaces
xmlDOMWrapRemoveNode
-
nsDef
xmlDOMWrapAdoptNode
+
nsDef
_xmlDOMWrapCtxt
+xmlDOMWrapAdoptNode
xmlDOMWrapCloneNode
xmlDOMWrapRemoveNode
null
xmlHashScan3
diff --git a/doc/APIchunk21.html b/doc/APIchunk21.html index f503ffe..f7cf410 100644 --- a/doc/APIchunk21.html +++ b/doc/APIchunk21.html @@ -55,6 +55,7 @@ A:link, A:visited, A:active { text-decoration: underline }
obsolete
xmlNormalizeWindowsPath
obsolete:
XML_SCHEMAS_ELEM_TOPLEVEL
occupied
xmlCanonicPath
+xmlPathToURI
occur
XML_SCHEMAS_TYPE_VARIETY_ABSENT
xmlParseComment
xmlParseMarkupDecl
@@ -212,7 +213,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXPathNotEqualValues
xmlXPathSubValues
xmlXPathValueFlipSign
-
operations
xmlModuleClose
+
operations
_xmlDOMWrapCtxt
+xmlModuleClose
xmlModuleFree
xmlReconciliateNs
operator
xmlExpParse
diff --git a/doc/APIchunk22.html b/doc/APIchunk22.html index f4c8321..bd256cb 100644 --- a/doc/APIchunk22.html +++ b/doc/APIchunk22.html @@ -101,6 +101,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlParseAttValue
xmlSetGenericErrorFunc
xmlSetStructuredErrorFunc
+xmlXIncludeProcessFlagsData
xmlXPathEvalFunc
xmlXPathIntersection
passive
xmlNanoFTPGetConnection
@@ -122,6 +123,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNormalizeURIPath
xmlNormalizeWindowsPath
xmlParserGetDirectory
+xmlPathToURI
xmlShellPwd
xmlShellValidate
xmlTextReaderRelaxNGValidate
diff --git a/doc/APIchunk23.html b/doc/APIchunk23.html index 4a78224..effe8f5 100644 --- a/doc/APIchunk23.html +++ b/doc/APIchunk23.html @@ -353,6 +353,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlBufferShrink
xmlCatalogRemove
xmlDecodeEntities
+xmlDocSetRootElement
xmlEncodeEntities
xmlHashRemoveEntry
xmlHashRemoveEntry2
@@ -441,7 +442,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNanoHTTPOpen
xmlNanoHTTPOpenRedir
xmlNanoHTTPReturnCode
-
requested
xmlExternalEntityLoader
+
requested
xmlDOMWrapAcquireNsFunction
+xmlExternalEntityLoader
xmlHasFeature
xmlIsID
xmlMallocFunc
@@ -517,6 +519,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNanoHTTPContentLength
responsible
xmlC14NDocDumpMemory
xmlCanonicPath
+xmlPathToURI
restored
xmlTextReaderSetErrorHandler
xmlTextReaderSetStructuredErrorHandler
restrict
xmlParseExternalID
diff --git a/doc/APIchunk24.html b/doc/APIchunk24.html index 6ac493b..b737b67 100644 --- a/doc/APIchunk24.html +++ b/doc/APIchunk24.html @@ -67,6 +67,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlGcMemGet
xmlMemGet
xmlNanoHTTPFetch
+xmlSaveTree
xmlShell
xmlShellSave
saved
_htmlElemDesc
@@ -415,6 +416,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlValidatePushCData
xmlXIncludeProcess
xmlXIncludeProcessFlags
+xmlXIncludeProcessFlagsData
xmlXIncludeProcessNode
xmlXIncludeProcessTree
xmlXIncludeProcessTreeFlags
@@ -492,7 +494,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNewDocNode
xmlNewDocNodeEatName
xmlTextWriterWriteRawLen
-
specialized
xmlGcMemGet
+
specialized
_xmlDOMWrapCtxt
+xmlGcMemGet
xmlGcMemSetup
specific
XML_CATALOG_PI
_xmlValidCtxt
@@ -755,6 +758,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlStringLenDecodeEntities
xmlXIncludeProcess
xmlXIncludeProcessFlags
+xmlXIncludeProcessFlagsData
xmlXIncludeProcessNode
xmlXIncludeProcessTree
xmlXIncludeProcessTreeFlags
diff --git a/doc/APIchunk25.html b/doc/APIchunk25.html index befc7fa..848a69a 100644 --- a/doc/APIchunk25.html +++ b/doc/APIchunk25.html @@ -60,6 +60,7 @@ A:link, A:visited, A:active { text-decoration: underline } htmlIsAutoClosed
htmlSetMetaEncoding
take
xmlLockLibrary
+
taken
xmlDocSetRootElement
takes
xmlSchemaValidateFacetWhtsp
tatkes
xmlExpExpDerive
tell
XML_COMPLETE_ATTRS
@@ -96,11 +97,13 @@ A:link, A:visited, A:active { text-decoration: underline }
termination
xmlStrcat
xmlStrdup
terms
xmlBuildRelativeURI
-
test
xmlDOMWrapCloneNode
-xmlParserHandleReference
+
test
xmlParserHandleReference
xmlXPathEqualValues
xmlXPathNotEqualValues
tested
_xmlParserInput
+xmlDOMWrapAdoptNode
+xmlDOMWrapReconcileNamespaces
+xmlDOMWrapRemoveNode
testing
xmlRegexpCompile
text-
xmlStreamPushNode
xmlStreamWantsAnyNode
@@ -259,6 +262,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlPopInputCallbacks
xmlPushInput
xmlReconciliateNs
+xmlSaveTree
xmlSetTreeDoc
total
_xmlOutputBuffer
xmlGetFeaturesList
diff --git a/doc/APIchunk26.html b/doc/APIchunk26.html index be247f2..828659a 100644 --- a/doc/APIchunk26.html +++ b/doc/APIchunk26.html @@ -101,7 +101,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlHasProp
xmlXPathNextNamespace
unliked
xmlDOMWrapAdoptNode
-xmlDOMWrapCloneNode
unlink
xmlFreeNode
unlinked
xmlAddNextSibling
xmlAddPrevSibling
@@ -263,6 +262,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_SCHEMAS_TYPE_VARIETY_ATOMIC
XML_SCHEMAS_TYPE_VARIETY_LIST
XML_SCHEMAS_TYPE_VARIETY_UNION
+
various
_xmlDOMWrapCtxt
very
_htmlElemDesc
_xmlParserInput
xmlCharEncFirstLine
diff --git a/doc/APIchunk27.html b/doc/APIchunk27.html index 2473a34..b0e889a 100644 --- a/doc/APIchunk27.html +++ b/doc/APIchunk27.html @@ -47,7 +47,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlCharEncInFunc
xmlCharEncOutFunc
xmlDOMWrapAdoptNode
-xmlDOMWrapCloneNode
warn
xmlCheckVersion
warning
XML_CAST_FPTR
_xmlValidCtxt
@@ -118,6 +117,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlMemShow
xmlXIncludeProcess
xmlXIncludeProcessFlags
+xmlXIncludeProcessFlagsData
xmlXIncludeProcessNode
xmlXIncludeProcessTree
xmlXIncludeProcessTreeFlags
@@ -258,7 +258,8 @@ A:link, A:visited, A:active { text-decoration: underline }
would
_xmlError
htmlAutoCloseTag
xmlTextReaderGetRemainder
-
wrapper
xmlDOMWrapReconcileNamespaces
+
wrapper
xmlDOMWrapAcquireNsFunction
+xmlDOMWrapReconcileNamespaces
xmlDOMWrapRemoveNode
wraps
xmlTextReaderByteConsumed
write
xmlFileRead
diff --git a/doc/APIchunk28.html b/doc/APIchunk28.html index b5471fb..05bde7b 100644 --- a/doc/APIchunk28.html +++ b/doc/APIchunk28.html @@ -138,6 +138,7 @@ A:link, A:visited, A:active { text-decoration: underline }
xmlDefaultSAXLocator
setDocumentLocator
setDocumentLocatorSAXFunc
xmlSAX2SetDocumentLocator
+
xmlDoc
_xmlNs
xmlDocCopyNodeList
xmlCopyNodeList
xmlDocNewPI
xmlNewPI
xmlDocPtr
xmlCopyDoc
@@ -196,6 +197,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNodeListGetRawString
xmlNodeListGetString
xmlTextReaderValue
+xmlXPathCastToString
xmlFreeDoc
xmlTextReaderCurrentDoc
xmlFreeDocElementContent
xmlFreeElementContent
xmlFreeMutex
xmlFreeMutex
@@ -293,9 +295,12 @@ A:link, A:visited, A:active { text-decoration: underline }
xmlNodeType
xmlTextReaderNodeType
xmlNotationPtr
xmlGetDtdNotationDesc
xmlNotationTablePtr
xmlCopyNotationTable
-
xmlNsPtr
getNamespace
+
xmlNs
xmlDOMWrapAcquireNsFunction
+
xmlNsPtr
_xmlDOMWrapCtxt
+getNamespace
xmlCopyNamespace
xmlCopyNamespaceList
+xmlDOMWrapAcquireNsFunction
xmlGetNsList
xmlOutputBufferClose
xmlSaveFileTo
xmlSaveFormatFileTo
@@ -432,7 +437,8 @@ A:link, A:visited, A:active { text-decoration: underline }
xmlURIFromPath
xmlNormalizeWindowsPath
xmlURIPtr
xmlParseURI
xmlParseURIRaw
-
xmlUnlinkNode
xmlFreeNode
+
xmlUnlinkNode
xmlDocSetRootElement
+xmlFreeNode
xmlUnlockLibrary
xmlUnlockLibrary
xmlValidCtxtPtr
xmlValidityErrorFunc
xmlValidityWarningFunc
diff --git a/doc/APIchunk3.html b/doc/APIchunk3.html index b1d3cae..cffe694 100644 --- a/doc/APIchunk3.html +++ b/doc/APIchunk3.html @@ -305,7 +305,8 @@ A:link, A:visited, A:active { text-decoration: underline }
Instruction
xmlParsePI
Instuction
XML_CATALOG_PI
Intended
xmlSnprintfElementContent
-
Internal
xmlParseMarkupDecl
+
Internal
_xmlDOMWrapCtxt
+xmlParseMarkupDecl

A-B C-C D-E diff --git a/doc/APIchunk4.html b/doc/APIchunk4.html index 561a743..b3c8364 100644 --- a/doc/APIchunk4.html +++ b/doc/APIchunk4.html @@ -200,6 +200,9 @@ A:link, A:visited, A:active { text-decoration: underline }

NOTE:
_xmlParserInput
htmlSetMetaEncoding
xmlCheckLanguageID
+xmlDOMWrapAdoptNode
+xmlDOMWrapReconcileNamespaces
+xmlDOMWrapRemoveNode
xmlGetProp
xmlInitCharEncodingHandlers
xmlNewChild
@@ -289,35 +292,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlParseNotationDecl
NotationType
xmlParseEnumeratedType
xmlParseNotationType
-
Note
ftpListCallback
-htmlElementAllowedHere
-xmlAddAttributeDecl
-xmlAutomataNewNegTrans
-xmlCheckUTF8
-xmlDOMWrapAdoptNode
-xmlDOMWrapCloneNode
-xmlDOMWrapReconcileNamespaces
-xmlDocDumpFormatMemory
-xmlDocDumpFormatMemoryEnc
-xmlDocDumpMemoryEnc
-xmlDocFormatDump
-xmlExpNewOr
-xmlExpNewRange
-xmlExpNewSeq
-xmlHasNsProp
-xmlNanoHTTPContentLength
-xmlNodeDump
-xmlNodeDumpOutput
-xmlParseCharEncoding
-xmlParseEntityRef
-xmlRemoveProp
-xmlSAXDefaultVersion
-xmlSaveFormatFile
-xmlSaveFormatFileEnc
-xmlSchemaValidateFacetWhtsp
-xmlStrncat
-xmlTextReaderSetParserProp
-xmlValidateDtd
Note:
fatalErrorSAXFunc
xmlBuildRelativeURI
xmlCharEncodingOutputFunc
diff --git a/doc/APIchunk5.html b/doc/APIchunk5.html index 3ebc5a8..9a6b23f 100644 --- a/doc/APIchunk5.html +++ b/doc/APIchunk5.html @@ -67,7 +67,6 @@ A:link, A:visited, A:active { text-decoration: underline }
Open
xmlIOHTTPOpenW
Opens
xmlModuleOpen
OpticalCharacterRecognition
xmlUCSIsOpticalCharacterRecognition
-
Optimize
xmlDOMWrapCloneNode
Optional
_htmlElemDesc
Oriya
xmlUCSIsOriya
Osmanya
xmlUCSIsOsmanya
diff --git a/doc/APIchunk7.html b/doc/APIchunk7.html index 50949e1..ed7c4a2 100644 --- a/doc/APIchunk7.html +++ b/doc/APIchunk7.html @@ -263,7 +263,6 @@ A:link, A:visited, A:active { text-decoration: underline }
SupplementalMathematicalOperators
xmlUCSIsSupplementalMathematicalOperators
SupplementaryPrivateUseArea-A
xmlUCSIsSupplementaryPrivateUseAreaA
SupplementaryPrivateUseArea-B
xmlUCSIsSupplementaryPrivateUseAreaB
-
Support
xmlDOMWrapCloneNode
Syriac
xmlUCSIsSyriac
System
_xmlNotation
xmlExternalEntityLoader
diff --git a/doc/APIchunk8.html b/doc/APIchunk8.html index 82de64b..a980c2f 100644 --- a/doc/APIchunk8.html +++ b/doc/APIchunk8.html @@ -228,6 +228,7 @@ A:link, A:visited, A:active { text-decoration: underline }
Upgrade
xmlKeepBlanksDefault
Use
XML_COMPLETE_ATTRS
XML_DETECT_IDS
+_xmlDOMWrapCtxt
_xmlParserCtxt
xmlCopyNodeList
xmlGetProp
diff --git a/doc/APIchunk9.html b/doc/APIchunk9.html index 556b273..882ab74 100644 --- a/doc/APIchunk9.html +++ b/doc/APIchunk9.html @@ -72,11 +72,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlParseVersionNum

Letter W:

W3C
xmlTextReaderSchemaValidate
xmlTextReaderSchemaValidateCtxt
-
WARNING:
xmlDOMWrapAdoptNode
-xmlDOMWrapCloneNode
-xmlDOMWrapReconcileNamespaces
-xmlDOMWrapRemoveNode
-xmlSchemaGetCanonValue
+
WARNING:
xmlSchemaGetCanonValue
xmlSchemaNewStringValue
WFC:
xmlParseAttribute
xmlParseCharRef
@@ -113,6 +109,7 @@ A:link, A:visited, A:active { text-decoration: underline } notationDeclSAXFunc
unparsedEntityDecl
unparsedEntityDeclSAXFunc
+xmlDOMWrapCloneNode
xmlSAX2NotationDecl
xmlSAX2UnparsedEntityDecl
When
xmlHandleEntity
@@ -142,10 +139,12 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXIncludeNewContext
xmlXIncludeProcess
xmlXIncludeProcessFlags
+xmlXIncludeProcessFlagsData
xmlXIncludeProcessNode
xmlXIncludeProcessTree
xmlXIncludeProcessTreeFlags
xmlXIncludeSetFlags
+
XInclude?
xmlDOMWrapCloneNode
XLINK_TYPE_NONE
xlinkIsLink
XML-1
xmlDetectCharEncoding
xmlValidateAttributeDecl
@@ -244,6 +243,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSAXUserParseFile
xmlSetCompressMode
xmlSetDocCompressMode
+
Zlib
LIBXML_ZLIB_ENABLED

A-B C-C D-E diff --git a/doc/APIconstructors.html b/doc/APIconstructors.html index 9e91cfa..c4d348c 100644 --- a/doc/APIconstructors.html +++ b/doc/APIconstructors.html @@ -79,6 +79,7 @@ A:link, A:visited, A:active { text-decoration: underline }

Type htmlParserCtxtPtr:

htmlCreateFileParserCtxt
htmlCreateMemoryParserCtxt
htmlCreatePushParserCtxt
+htmlNewParserCtxt

Type htmlStatus:

htmlAttrAllowed
htmlElementStatusHere
htmlNodeStatus
@@ -207,6 +208,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlParseSystemLiteral
xmlParseVersionInfo
xmlParseVersionNum
+xmlPathToURI
xmlSaveUri
xmlScanName
xmlSchemaCollapseString
@@ -422,6 +424,7 @@ A:link, A:visited, A:active { text-decoration: underline }

Type xmlNsPtr:

getNamespace
xmlCopyNamespace
xmlCopyNamespaceList
+xmlDOMWrapAcquireNsFunction
xmlNewGlobalNs
xmlNewNs
xmlSearchNs
diff --git a/doc/APIfiles.html b/doc/APIfiles.html index 2a5af4b..e10fe00 100644 --- a/doc/APIfiles.html +++ b/doc/APIfiles.html @@ -66,6 +66,7 @@ A:link, A:visited, A:active { text-decoration: underline } htmlHandleOmittedElem
htmlIsAutoClosed
htmlIsScriptAttribute
+htmlNewParserCtxt
htmlNodePtr
htmlNodeStatus
htmlParseCharRef
@@ -651,6 +652,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_WITH_XINCLUDE
XML_WITH_XPATH
XML_WITH_XPTR
+XML_WITH_ZLIB
_xmlParserCtxt
_xmlParserInput
_xmlParserNodeInfo
@@ -1374,6 +1376,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlCopyProp
xmlCopyPropList
xmlCreateIntSubset
+xmlDOMWrapAcquireNsFunction
xmlDOMWrapAdoptNode
xmlDOMWrapCloneNode
xmlDOMWrapCtxt
@@ -1543,6 +1546,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlParseURI
xmlParseURIRaw
xmlParseURIReference
+xmlPathToURI
xmlPrintURI
xmlSaveUri
xmlURI
@@ -1655,6 +1659,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXIncludeNewContext
xmlXIncludeProcess
xmlXIncludeProcessFlags
+xmlXIncludeProcessFlagsData
xmlXIncludeProcessNode
xmlXIncludeProcessTree
xmlXIncludeProcessTreeFlags
@@ -3120,6 +3125,7 @@ A:link, A:visited, A:active { text-decoration: underline } LIBXML_XINCLUDE_ENABLED
LIBXML_XPATH_ENABLED
LIBXML_XPTR_ENABLED
+LIBXML_ZLIB_ENABLED
WITHOUT_TRIO
WITH_TRIO
xmlCheckVersion
@@ -3273,6 +3279,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXPathCompExprPtr
xmlXPathCompile
xmlXPathCompiledEval
+xmlXPathCompiledEvalToBoolean
xmlXPathContext
xmlXPathContextPtr
xmlXPathContextSetCache
diff --git a/doc/APIfunctions.html b/doc/APIfunctions.html index 92489fb..fea4fd3 100644 --- a/doc/APIfunctions.html +++ b/doc/APIfunctions.html @@ -213,6 +213,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlCreateEnumeration
xmlCreateIntSubset
xmlCtxtReadDoc
+xmlDOMWrapAcquireNsFunction
xmlDebugDumpString
xmlDictExists
xmlDictLookup
@@ -304,6 +305,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlParseElementContentDecl
xmlParseExternalEntity
xmlParseExternalSubset
+xmlPathToURI
xmlPatterncompile
xmlReadDoc
xmlReaderForDoc
@@ -861,6 +863,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlThrDefSetStructuredErrorFunc
xmlValidityErrorFunc
xmlValidityWarningFunc
+xmlXIncludeProcessFlagsData
xmlXPathFuncLookupFunc
xmlXPathRegisterFuncLookup
xmlXPathRegisterVariableLookup
@@ -1063,7 +1066,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlOutputBufferWriteEscape
xmlSaveSetAttrEscape
xmlSaveSetEscape
-

Type xmlDOMWrapCtxtPtr:

xmlDOMWrapAdoptNode
+

Type xmlDOMWrapCtxtPtr:

xmlDOMWrapAcquireNsFunction
+xmlDOMWrapAdoptNode
xmlDOMWrapCloneNode
xmlDOMWrapFreeCtxt
xmlDOMWrapReconcileNamespaces
@@ -1214,6 +1218,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXIncludeNewContext
xmlXIncludeProcess
xmlXIncludeProcessFlags
+xmlXIncludeProcessFlagsData
xmlXPathNewContext
xmlXPathOrderDocElems
xmlXPtrNewContext
@@ -1427,6 +1432,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlC14NIsVisibleCallback
xmlCopyProp
xmlCopyPropList
+xmlDOMWrapAcquireNsFunction
xmlDOMWrapAdoptNode
xmlDOMWrapCloneNode
xmlDOMWrapReconcileNamespaces
@@ -2161,9 +2167,11 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXIncludeProcessNode
xmlXIncludeSetFlags

Type xmlXPathCompExprPtr:

xmlXPathCompiledEval
+xmlXPathCompiledEvalToBoolean
xmlXPathDebugDumpCompExpr
xmlXPathFreeCompExpr

Type xmlXPathContextPtr:

xmlXPathCompiledEval
+xmlXPathCompiledEvalToBoolean
xmlXPathContextSetCache
xmlXPathCtxtCompile
xmlXPathEval
diff --git a/doc/APIsymbols.html b/doc/APIsymbols.html index 7e1ba3c..c6c5265 100644 --- a/doc/APIsymbols.html +++ b/doc/APIsymbols.html @@ -94,6 +94,7 @@ A:link, A:visited, A:active { text-decoration: underline } LIBXML_XINCLUDE_ENABLED
LIBXML_XPATH_ENABLED
LIBXML_XPTR_ENABLED
+LIBXML_ZLIB_ENABLED

Letter M:

MOVETO_ENDTAG
MOVETO_STARTTAG

Letter S:

SKIP_EOL
@@ -1320,6 +1321,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_WITH_XINCLUDE
XML_WITH_XPATH
XML_WITH_XPTR
+XML_WITH_ZLIB
XML_XINCLUDE_BUILD_FAILED
XML_XINCLUDE_DEPRECATED_NS
XML_XINCLUDE_END
@@ -1566,6 +1568,7 @@ A:link, A:visited, A:active { text-decoration: underline } htmlIsScriptAttribute
htmlNewDoc
htmlNewDocNoDtD
+htmlNewParserCtxt
htmlNodeDump
htmlNodeDumpFile
htmlNodeDumpFileFormat
@@ -1846,6 +1849,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlCtxtResetPush
xmlCtxtUseOptions
xmlCurrentChar
+xmlDOMWrapAcquireNsFunction
xmlDOMWrapAdoptNode
xmlDOMWrapCloneNode
xmlDOMWrapCtxt
@@ -2472,6 +2476,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlParserValidityWarning
xmlParserVersion
xmlParserWarning
+xmlPathToURI
xmlPattern
xmlPatternFlags
xmlPatternFromRoot
@@ -3258,6 +3263,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXIncludeNewContext
xmlXIncludeProcess
xmlXIncludeProcessFlags
+xmlXIncludeProcessFlagsData
xmlXIncludeProcessNode
xmlXIncludeProcessTree
xmlXIncludeProcessTreeFlags
@@ -3289,6 +3295,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXPathCompareValues
xmlXPathCompile
xmlXPathCompiledEval
+xmlXPathCompiledEvalToBoolean
xmlXPathConcatFunction
xmlXPathContainsFunction
xmlXPathContext
diff --git a/doc/DOM.html b/doc/DOM.html index a637399..52f1139 100644 --- a/doc/DOM.html +++ b/doc/DOM.html @@ -7,11 +7,11 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -DOM Principles
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

The XML C parser and toolkit of Gnome

DOM Principles

Developer Menu
API Indexes
Related links

DOMstands for the -DocumentObjectModel; this is an API for accessing XML or HTML -structureddocuments.Native support for DOM in Gnome is on the way (module -gnome-dom),and will bebased on gnome-xml. This will be a far cleaner -interface tomanipulate XMLfiles within Gnome since it won't expose the -internalstructure.

The current DOM implementation on top of libxml2 is the gdome2 Gnome module,thisis -a full DOM interface, thanks to Paolo Casarini, check the Gdome2 -homepageformoreinformations.

Daniel Veillard

+DOM Principles
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

The XML C parser and toolkit of Gnome

DOM Principles

Developer Menu
API Indexes
Related links

DOM stands for the Document +Object Model; this is an API for accessing XML or HTML structured +documents. Native support for DOM in Gnome is on the way (module gnome-dom), +and will be based on gnome-xml. This will be a far cleaner interface to +manipulate XML files within Gnome since it won't expose the internal +structure.

The current DOM implementation on top of libxml2 is the gdome2 Gnome module, this +is a full DOM interface, thanks to Paolo Casarini, check the Gdome2 homepage for more +informations.

Daniel Veillard

diff --git a/doc/FAQ.html b/doc/FAQ.html index cdc6585..0d5ded6 100644 --- a/doc/FAQ.html +++ b/doc/FAQ.html @@ -12,49 +12,53 @@ A:link, A:visited, A:active { text-decoration: underline }

  • Compilation
  • Developer corner
  • License(s)

    1. Licensing Terms for libxml -

      libxml2 is released under the MITLicense;see - the file Copyright in the distribution for the precisewording

      +

      libxml2 is released under the MIT + License; see the file Copyright in the distribution for the precise + wording

    2. Can I embed libxml2 in a proprietary application ? -

      Yes. The MIT License allows you to keep proprietary the changesyoumade - to libxml, but it would be graceful to send-back bug fixesandimprovements - as patches for possible incorporation in themaindevelopment tree.

      +

      Yes. The MIT License allows you to keep proprietary the changes you + made to libxml, but it would be graceful to send-back bug fixes and + improvements as patches for possible incorporation in the main + development tree.

    3. -

    Installation

    1. Do - NotUselibxml1, use libxml2
    2. -
    3. Where can I get libxml? -

      The original distribution comes from xmlsoft.orgor gnome.org

      -

      Most Linux and BSD distributions include libxml, this is - probablythesafer way for end-users to use libxml.

      +

    Installation

    1. Do Not Use + libxml1, use libxml2
    2. +
    3. Where can I get libxml ? +

      The original distribution comes from xmlsoft.org or gnome.org

      +

      Most Linux and BSD distributions include libxml, this is probably the + safer way for end-users to use libxml.

      David Doolin provides precompiled Windows versions at http://www.ce.berkeley.edu/~doolin/code/libxmlwin32/

    4. I see libxml and libxml2 releases, which one should I install ? -
      • If you are not constrained by backward compatibility - issueswithexisting applications, install libxml2 only
      • -
      • If you are not doing development, you can safely - installboth.Usually the packages libxmland libxml2arecompatible(this - is not the case for development packages).
      • -
      • If you are a developer and your system provides - separatepackagingfor shared libraries and the development components, - it ispossibleto install libxml and libxml2, and also libxml-develandlibxml2-develtoofor - libxml2 >= 2.3.0
      • -
      • If you are developing a new application, please - developagainstlibxml2(-devel)
      • +
        • If you are not constrained by backward compatibility issues with + existing applications, install libxml2 only
        • +
        • If you are not doing development, you can safely install both. + Usually the packages libxml and libxml2 are + compatible (this is not the case for development packages).
        • +
        • If you are a developer and your system provides separate packaging + for shared libraries and the development components, it is possible + to install libxml and libxml2, and also libxml-devel + and libxml2-devel + too for libxml2 >= 2.3.0
        • +
        • If you are developing a new application, please develop against + libxml2(-devel)
      • I can't install the libxml package, it conflicts with libxml0 -

        You probably have an old libxml0 package used to provide - thesharedlibrary for libxml.so.0, you can probably safely remove it. - Thelibxmlpackages provided on xmlsoft.orgprovidelibxml.so.0

        +

        You probably have an old libxml0 package used to provide the shared + library for libxml.so.0, you can probably safely remove it. The libxml + packages provided on xmlsoft.org provide + libxml.so.0

      • -
      • I can't install the libxml(2) RPM package due - tofaileddependencies -

        The most generic solution is to re-fetch the latest src.rpm - ,andrebuild it locally with

        +
      • I can't install the libxml(2) RPM package due to failed + dependencies +

        The most generic solution is to re-fetch the latest src.rpm , and + rebuild it locally with

        rpm --rebuild libxml(2)-xxx.src.rpm.

        -

        If everything goes well it will generate two binary rpm - packages(oneproviding the shared libs and xmllint, and the other one, - the-develpackage, providing includes, static libraries and scripts needed - tobuildapplications with libxml(2)) that you can install locally.

        +

        If everything goes well it will generate two binary rpm packages (one + providing the shared libs and xmllint, and the other one, the -devel + package, providing includes, static libraries and scripts needed to build + applications with libxml(2)) that you can install locally.

    Compilation

    1. What is the process to compile libxml2 ?

      As most UNIX libraries libxml2 follows the "standard":

      @@ -65,106 +69,109 @@ A:link, A:visited, A:active { text-decoration: underline }

      ./configure [possible options]

      make

      make install

      -

      At that point you may have to rerun ldconfig or a similar - utilitytoupdate your list of installed shared libs.

      +

      At that point you may have to rerun ldconfig or a similar utility to + update your list of installed shared libs.

    2. What other libraries are needed to compile/install libxml2 ? -

      Libxml2 does not require any other library, the normal C ANSIAPIshould - be sufficient (please report any violation to this rule youmayfind).

      -

      However if found at configuration time libxml2 will detect and - usethefollowing libs:

      -
      • libz:ahighly - portable and available widely compression library.
      • -
      • iconv: a powerful character encoding conversion library. - Itisincluded by default in recent glibc libraries, so it doesn't - needtobe installed specifically on Linux. It now seems a partofthe - official UNIXspecification. Here is one implementation - ofthelibrarywhich source can be found here.
      • +

        Libxml2 does not require any other library, the normal C ANSI API + should be sufficient (please report any violation to this rule you may + find).

        +

        However if found at configuration time libxml2 will detect and use the + following libs:

        +
        • libz : a + highly portable and available widely compression library.
        • +
        • iconv: a powerful character encoding conversion library. It is + included by default in recent glibc libraries, so it doesn't need to + be installed specifically on Linux. It now seems a part + of the official UNIX specification. Here is one implementation of the + library which source can be found here.
      • Make check fails on some platforms -

        Sometimes the regression tests' results don't completely matchthevalue - produced by the parser, and the makefile uses diff to printthedelta. On - some platforms the diff return breaks the compilationprocess;if the diff - is small this is probably not a serious problem.

        -

        Sometimes (especially on Solaris) make checks fail due tolimitationsin - make. Try using GNU-make instead.

        +

        Sometimes the regression tests' results don't completely match the + value produced by the parser, and the makefile uses diff to print the + delta. On some platforms the diff return breaks the compilation process; + if the diff is small this is probably not a serious problem.

        +

        Sometimes (especially on Solaris) make checks fail due to limitations + in make. Try using GNU-make instead.

      • I use the CVS version and there is no configure script -

        The configure script (and other Makefiles) are generated. - Usetheautogen.sh script to regenerate the configure script - andMakefiles,like:

        +

        The configure script (and other Makefiles) are generated. Use the + autogen.sh script to regenerate the configure script and Makefiles, + like:

        ./autogen.sh --prefix=/usr --disable-shared

      • I have troubles when running make tests with gcc-3.0 -

        It seems the initial release of gcc-3.0 has a problem withtheoptimizer - which miscompiles the URI module. Please useanothercompiler.

        +

        It seems the initial release of gcc-3.0 has a problem with the + optimizer which miscompiles the URI module. Please use another + compiler.

      • -

    Developercorner

    1. Troubles compiling or linking programs using libxml2 -

      Usually the problem comes from the fact that the compiler - doesn'tgetthe right compilation or linking flags. There is a small - shellscriptxml2-configwhich is installed as part of - libxml2usualinstall process which provides those flags. Use

      +

    Developer corner

    1. Troubles compiling or linking programs using libxml2 +

      Usually the problem comes from the fact that the compiler doesn't get + the right compilation or linking flags. There is a small shell script + xml2-config which is installed as part of libxml2 usual + install process which provides those flags. Use

      xml2-config --cflags

      to get the compilation flags and

      xml2-config --libs

      -

      to get the linker flags. Usually this is done directly fromtheMakefile - as:

      +

      to get the linker flags. Usually this is done directly from the + Makefile as:

      CFLAGS=`xml2-config --cflags`

      LIBS=`xml2-config --libs`

    2. -
    3. I want to install my own copy of libxml2 in my home - directoryandlink my programs against it, but it doesn't work -

      There are many different ways to accomplish this. Here is one waytodo - this under Linux. Suppose your home directory - is/home/user.Then:

      +
    4. I want to install my own copy of libxml2 in my home directory and + link my programs against it, but it doesn't work +

      There are many different ways to accomplish this. Here is one way to + do this under Linux. Suppose your home directory is /home/user. + Then:

      • Create a subdirectory, let's call it myxml
      • unpack the libxml2 distribution into that subdirectory
      • -
      • chdir into the unpacked - distribution(/home/user/myxml/libxml2)
      • -
      • configure the library using the - "--prefix"switch,specifying an installation - subdirectoryin/home/user/myxml, e.g. -

        ./configure - --prefix/home/user/myxml/xmlinst{otherconfiguration - options}

        +
      • chdir into the unpacked distribution + (/home/user/myxml/libxml2 )
      • +
      • configure the library using the "--prefix" switch, + specifying an installation subdirectory in + /home/user/myxml, e.g. +

        ./configure --prefix /home/user/myxml/xmlinst {other + configuration options}

      • -
      • now run makefollowed by make install
      • -
      • At this point, the installation subdirectory contains - thecomplete"private" include files, library files and binary - programfiles (e.g.xmllint), located in -

        /home/user/myxml/xmlinst/lib,/home/user/myxml/xmlinst/includeand - /home/user/myxml/xmlinst/bin

        +
      • now run make followed by make install
      • +
      • At this point, the installation subdirectory contains the complete + "private" include files, library files and binary program files (e.g. + xmllint), located in +

        /home/user/myxml/xmlinst/lib, + /home/user/myxml/xmlinst/include and + /home/user/myxml/xmlinst/bin

        respectively.
      • -
      • In order to use this "private" library, you should first add - ittothe beginning of your default PATH (so that your own - privateprogramfiles such as xmllint will be used instead of the - normalsystemones). To do this, the Bash command would be +
      • In order to use this "private" library, you should first add it to + the beginning of your default PATH (so that your own private program + files such as xmllint will be used instead of the normal system + ones). To do this, the Bash command would be

        export PATH=/home/user/myxml/xmlinst/bin:$PATH

      • -
      • Now suppose you have a program test1.cthat - youwouldlike to compile with your "private" library. Simply compile - itusingthe command +
      • Now suppose you have a program test1.c that you would + like to compile with your "private" library. Simply compile it using + the command

        gcc `xml2-config --cflags --libs` -o test test.c

        - Note that, because your PATH has been set - with/home/user/myxml/xmlinst/binat the beginning, - thexml2-configprogram which you just installed will be used instead - ofthe systemdefault one, and this will automaticallyget - thecorrectlibraries linked with your program.
      • + Note that, because your PATH has been set with + /home/user/myxml/xmlinst/bin at the beginning, the xml2-config + program which you just installed will be used instead of the system + default one, and this will automatically get the correct + libraries linked with your program.
    5. xmlDocDump() generates output on one line. -

      Libxml2 will not inventspaces in the content - ofadocument since all spaces in the content of a - documentaresignificant. If you build a tree from the API - andwantindentation:

      +

      Libxml2 will not invent spaces in the content of a + document since all spaces in the content of a document are + significant. If you build a tree from the API and want + indentation:

      1. the correct way is to generate those yourself too.
      2. -
      3. the dangerous way is to ask libxml2 to add those blanks - toyourcontent modifying the content of your document - intheprocess. The result may not be what you expect. - ThereisNOway to guarantee that such a - modificationwon'taffect other parts of the content of your document. - See xmlKeepBlanksDefault()andxmlSaveFormatFile()
      4. +
      5. the dangerous way is to ask libxml2 to add those blanks to your + content modifying the content of your document in the + process. The result may not be what you expect. There is + NO way to guarantee that such a modification won't + affect other parts of the content of your document. See xmlKeepBlanksDefault + () and xmlSaveFormatFile + ()
    6. Extra nodes in the document:

      For a XML file as below:

      @@ -173,10 +180,10 @@ A:link, A:visited, A:active { text-decoration: underline } <NODE CommFlag="0"/> <NODE CommFlag="1"/> </PLAN> -

      after parsing it with - thefunctionpxmlDoc=xmlParseFile(...);

      -

      I want to the get the content of the first node (node - withtheCommFlag="0")

      +

      after parsing it with the function + pxmlDoc=xmlParseFile(...);

      +

      I want to the get the content of the first node (node with the + CommFlag="0")

      so I did it as following;

      xmlNodePtr pnode;
       pnode=pxmlDoc->children->children;
      @@ -184,62 +191,63 @@ pnode=pxmlDoc->children->children;
      pnode=pxmlDoc->children->children->next;

      then it works. Can someone explain it to me.

      -

      In XML all characters in the content of the document - aresignificantincluding blanks and formatting - linebreaks.

      -

      The extra nodes you are wondering about are just that, text - nodeswiththe formatting spaces which are part of the document but that - peopletendto forget. There is a function xmlKeepBlanksDefault()toremove - those at parse time, but that's an heuristic, and itsuse should belimited - to cases where you are certain there is nomixed-content in - thedocument.

      +

      In XML all characters in the content of the document are significant + including blanks and formatting line breaks.

      +

      The extra nodes you are wondering about are just that, text nodes with + the formatting spaces which are part of the document but that people tend + to forget. There is a function xmlKeepBlanksDefault + () to remove those at parse time, but that's an heuristic, and its + use should be limited to cases where you are certain there is no + mixed-content in the document.

    7. -
    8. I get compilation errors of existing code like - whenaccessingrootor child - fieldsofnodes. -

      You are compiling code developed for libxml version 1 and - usingalibxml2 development environment. Either switch back to libxml v1 - develoreven better fix the code to compile with libxml2 (or both) by following the instructions.

      +
    9. I get compilation errors of existing code like when accessing + root or child fields of nodes. +

      You are compiling code developed for libxml version 1 and using a + libxml2 development environment. Either switch back to libxml v1 devel or + even better fix the code to compile with libxml2 (or both) by following the instructions.

    10. -
    11. I get compilation errors about - nonexistingxmlRootNodeorxmlChildrenNodefields. -

      The source code you are using has been upgradedto be able to compile with both - libxmlandlibxml2, but you need to install a more recent - version:libxml(-devel)>= 1.8.8 or libxml2(-devel) >= 2.1.0

      +
    12. I get compilation errors about non existing + xmlRootNode or xmlChildrenNode + fields. +

      The source code you are using has been upgraded to be able to compile with both libxml + and libxml2, but you need to install a more recent version: + libxml(-devel) >= 1.8.8 or libxml2(-devel) >= 2.1.0

    13. XPath implementation looks seriously broken -

      XPath implementation prior to 2.3.0 was really incomplete. Upgrade - toarecent version, there are no known bugs in the current version.

      +

      XPath implementation prior to 2.3.0 was really incomplete. Upgrade to + a recent version, there are no known bugs in the current version.

    14. The example provided in the web page does not compile. -

      It's hard to maintain the documentation in sync with - thecode<grin/> ...

      -

      Check the previous points 1/ and 2/ raised before, and - pleasesendpatches.

      +

      It's hard to maintain the documentation in sync with the code + <grin/> ...

      +

      Check the previous points 1/ and 2/ raised before, and please send + patches.

    15. -
    16. Where can I get more examples and information than provided - ontheweb page? -

      Ideally a libxml2 book would be nice. I have no such plan ... - Butyoucan:

      -
      • check more deeply the existinggenerated doc
      • -
      • have a look at the - setofexamples.
      • -
      • look for examples of use for libxml2 function using the - Gnomecode.For example the following will query the full Gnome CVS - base fortheuse of the xmlAddChild()function: +
      • Where can I get more examples and information than provided on the + web page? +

        Ideally a libxml2 book would be nice. I have no such plan ... But you + can:

        +
        • check more deeply the existing + generated doc
        • +
        • have a look at the set of + examples.
        • +
        • look for examples of use for libxml2 function using the Gnome code. + For example the following will query the full Gnome CVS base for the + use of the xmlAddChild() function:

          http://cvs.gnome.org/lxr/search?string=xmlAddChild

          -

          This may be slow, a large hardware donation to the - gnomeprojectcould cure this :-)

          +

          This may be slow, a large hardware donation to the gnome project + could cure this :-)

        • -
        • Browsethelibxml2 - source, I try to write code as clean and documentedaspossible, so - looking at it may be helpful. In particular the codeofxmllint.c and - of the various testXXX.c test programs shouldprovidegood examples of - how to do things with the library.
        • +
        • Browse + the libxml2 source , I try to write code as clean and documented + as possible, so looking at it may be helpful. In particular the code + of xmllint.c and of the various testXXX.c test programs should + provide good examples of how to do things with the library.
      • What about C++ ? -

        libxml2 is written in pure C in order to allow easy reuse on anumberof - platforms, including embedded systems. I don't intend to converttoC++.

        +

        libxml2 is written in pure C in order to allow easy reuse on a number + of platforms, including embedded systems. I don't intend to convert to + C++.

        There is however a C++ wrapper which may fulfill your needs:

      • How to validate a document a posteriori ? -

        It is possible to validate documents which had not been - validatedatinitial parsing time or documents which have been built - fromscratchusing the API. Use the xmlValidateDtd()function.It - is also possible to simply add a DTD to an existingdocument:

        +

        It is possible to validate documents which had not been validated at + initial parsing time or documents which have been built from scratch + using the API. Use the xmlValidateDtd() + function. It is also possible to simply add a DTD to an existing + document:

        xmlDocPtr doc; /* your existing document */
         xmlDtdPtr dtd = xmlParseDTD(NULL, filename_of_dtd); /* parse the DTD */
         
        @@ -268,10 +277,10 @@ xmlDtdPtr dtd = xmlParseDTD(NULL, filename_of_dtd); /* parse the DTD */
                   
      • So what is this funky "xmlChar" used all the time? -

        It is a null terminated sequence of utf-8 characters. And - onlyutf-8!You need to convert strings encoded in different ways to - utf-8beforepassing them to the API. This can be accomplished with the - iconvlibraryfor instance.

        +

        It is a null terminated sequence of utf-8 characters. And only utf-8! + You need to convert strings encoded in different ways to utf-8 before + passing them to the API. This can be accomplished with the iconv library + for instance.

      • etc ...

    Daniel Veillard

    diff --git a/doc/Makefile.in b/doc/Makefile.in index 70bd86e..56ec810 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -149,6 +149,7 @@ RDL_LIBS = @RDL_LIBS@ READER_TEST = @READER_TEST@ RELDATE = @RELDATE@ RM = @RM@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STATIC_BINARIES = @STATIC_BINARIES@ @@ -177,6 +178,7 @@ THREAD_CFLAGS = @THREAD_CFLAGS@ THREAD_LIBS = @THREAD_LIBS@ U = @U@ VERSION = @VERSION@ +WGET = @WGET@ WIN32_EXTRA_LDFLAGS = @WIN32_EXTRA_LDFLAGS@ WIN32_EXTRA_LIBADD = @WIN32_EXTRA_LIBADD@ WITH_C14N = @WITH_C14N@ @@ -212,6 +214,7 @@ WITH_WRITER = @WITH_WRITER@ WITH_XINCLUDE = @WITH_XINCLUDE@ WITH_XPATH = @WITH_XPATH@ WITH_XPTR = @WITH_XPTR@ +WITH_ZLIB = @WITH_ZLIB@ XINCLUDE_OBJ = @XINCLUDE_OBJ@ XMLLINT = @XMLLINT@ XML_CFLAGS = @XML_CFLAGS@ diff --git a/doc/XMLinfo.html b/doc/XMLinfo.html index 5314fac..474f9c1 100644 --- a/doc/XMLinfo.html +++ b/doc/XMLinfo.html @@ -7,9 +7,9 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -XML
    Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
    Made with Libxml2 Logo

    The XML C parser and toolkit of Gnome

    XML

    Main Menu
    Related links

    XML is astandardformarkup-based -structured documents. Here is an example -XMLdocument:

    <?xml version="1.0"?>
    +XML
    Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
    Made with Libxml2 Logo

    The XML C parser and toolkit of Gnome

    XML

    Main Menu
    Related links

    XML is a standard for +markup-based structured documents. Here is an example XML +document:

    <?xml version="1.0"?>
     <EXAMPLE prop1="gnome is great" prop2="&amp; linux too">
       <head>
        <title>Welcome to Gnome</title>
    @@ -20,17 +20,16 @@ XMLdocument:

    <?xml version="1.0"?>
        <image href="linus.gif"/>
        <p>...</p>
       </chapter>
    -</EXAMPLE>

    The first line specifies that it is an XML document and -givesusefulinformation about its encoding. Then the rest of the document is -atextformat whose structure is specified by tags between -brackets.Eachtag opened has to be closed. XML is pedantic -about this.However, ifa tag is empty (no content), a single tag can serve as -both theopening andclosing tag if it ends with />rather -thanwith>. Note that, for example, the image tag has no -content(justan attribute) and is closed by ending the tag -with/>.

    XML can be applied successfully to a wide range of tasks, ranging -fromlongterm structured document maintenance (where it follows the steps -ofSGML) tosimple data encoding mechanisms like configuration file -formatting(glade),spreadsheets (gnumeric), or even shorter lived documents -such asWebDAV whereit is used to encode remote calls between a client and -aserver.

    Daniel Veillard

    +</EXAMPLE>

    The first line specifies that it is an XML document and gives useful +information about its encoding. Then the rest of the document is a text +format whose structure is specified by tags between brackets. Each +tag opened has to be closed. XML is pedantic about this. However, if +a tag is empty (no content), a single tag can serve as both the opening and +closing tag if it ends with /> rather than with +>. Note that, for example, the image tag has no content (just +an attribute) and is closed by ending the tag with />.

    XML can be applied successfully to a wide range of tasks, ranging from +long term structured document maintenance (where it follows the steps of +SGML) to simple data encoding mechanisms like configuration file formatting +(glade), spreadsheets (gnumeric), or even shorter lived documents such as +WebDAV where it is used to encode remote calls between a client and a +server.

    Daniel Veillard

    diff --git a/doc/XSLT.html b/doc/XSLT.html index 4a8c09b..657ead3 100644 --- a/doc/XSLT.html +++ b/doc/XSLT.html @@ -7,8 +7,7 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -XSLT
    Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
    Made with Libxml2 Logo

    The XML C parser and toolkit of Gnome

    XSLT

    Main Menu
    Related links

    Check the separate libxslt page

    XSL Transformations, is -alanguagefor transforming XML documents into other XML documents -(orHTML/textualoutput).

    A separate library called libxslt is available implementing -XSLT-1.0forlibxml2. This module "libxslt" too can be found in the Gnome CVS -base.

    You can check the progresses on the libxslt Changelog.

    Daniel Veillard

    +XSLT
    Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
    Made with Libxml2 Logo

    The XML C parser and toolkit of Gnome

    XSLT

    Main Menu
    Related links

    Check the separate libxslt page

    XSL Transformations, is a +language for transforming XML documents into other XML documents (or +HTML/textual output).

    A separate library called libxslt is available implementing XSLT-1.0 for +libxml2. This module "libxslt" too can be found in the Gnome CVS base.

    You can check the progresses on the libxslt Changelog.

    Daniel Veillard

    diff --git a/doc/apibuild.py b/doc/apibuild.py index f1a795f..1e73725 100755 --- a/doc/apibuild.py +++ b/doc/apibuild.py @@ -49,6 +49,7 @@ ignored_files = { "runtest.c": "regression tests program", "runsuite.c": "regression tests program", "tst.c": "not part of the library", + "test.c": "not part of the library", "testdso.c": "test for dynamid shared libraries", } diff --git a/doc/architecture.html b/doc/architecture.html index 7809bc6..906c5b2 100644 --- a/doc/architecture.html +++ b/doc/architecture.html @@ -7,8 +7,8 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -libxml2 architecture
    Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
    Made with Libxml2 Logo

    The XML C parser and toolkit of Gnome

    libxml2 architecture

    Developer Menu
    API Indexes
    Related links

    Libxml2 is made of multiple components; some of them are optional, -andmostof the block interfaces are public. The main components are:

    • an Input/Output layer
    • +libxml2 architecture
      Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
      Made with Libxml2 Logo

      The XML C parser and toolkit of Gnome

      libxml2 architecture

      Developer Menu
      API Indexes
      Related links

      Libxml2 is made of multiple components; some of them are optional, and +most of the block interfaces are public. The main components are:

      • an Input/Output layer
      • FTP and HTTP client layers (optional)
      • an Internationalization layer managing the encodings support
      • a URI module
      • @@ -17,6 +17,7 @@ andmostof the block interfaces are public. The main components are:

        • a
        • a SAX tree module to build an in-memory DOM representation
        • a tree module to manipulate the DOM representation
        • a validation module using the DOM representation (optional)
        • -
        • an XPath module for global lookup in a DOM representation(optional)
        • +
        • an XPath module for global lookup in a DOM representation + (optional)
        • a debug module (optional)

        Graphically this gives the following:

        a graphical view of the various

        Daniel Veillard

      diff --git a/doc/bugs.html b/doc/bugs.html index c755d00..6415c85 100644 --- a/doc/bugs.html +++ b/doc/bugs.html @@ -7,62 +7,62 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -Reporting bugs and getting help
      Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
      Made with Libxml2 Logo

      The XML C parser and toolkit of Gnome

      Reporting bugs and getting help

      Main Menu
      Related links

      Well, bugs or missing features are always possible, and I will make -apointof fixing them in a timely fashion. The best way to report a bug is -touse theGnomebugtracking -database(make sure to use the "libxml2" module name). Ilook atreports -there regularly and it's good to have a reminder when a bugis stillopen. Be -sure to specify that the bug is for the package libxml2.

      For small problems you can try to get help on IRC, the #xml -channelonirc.gnome.org (port 6667) usually have a few person subscribed which -mayhelp(but there is no garantee and if a real issue is raised it should go -onthemailing-list for archival).

      There is also a mailing-list xml@gnome.orgfor libxml, with an on-line archive(old). To subscribe to this -list,pleasevisit the associatedWebpage -andfollow the instructions. Do not send code, I won'tdebug -it(but patches are really appreciated!).

      Please note that with the current amount of virus and SPAM, sending -mailtothe list without being subscribed won't work. There is *far too -manybounces*(in the order of a thousand a day !) I cannot approve them -manuallyanymore.If your mail to the list bounced waiting for administrator -approval,it isLOST ! Repost it and fix the problem triggering the error. Also -pleasenotethat emails -withalegal warning asking to not copy or redistribute freely the -informationstheycontainare NOTacceptable for the -mailing-list,suchmail will as much as possible be discarded automatically, -and are lesslikelyto be answered if they made it to the list, DO -NOTpost tothe list from an email address where such legal -requirements areautomaticallyadded, get private paying support if you can't -shareinformations.

      Check the following beforeposting:

      • Read the FAQand usethesearch engineto get information related to - your problem.
      • -
      • Make sure you are using - arecentversion, and that the problem still shows up in a - recentversion.
      • -
      • Check the listarchivesto see if - theproblem was reported already. In this casethere is probably a - fixavailable, similarly check the registeredopenbugs.
      • -
      • Make sure you can reproduce the bug with xmllint or one of - thetestprograms found in source in the distribution.
      • -
      • Please send the command showing the error as well as the input - (asanattachment)
      • -

      Then send the bug with associated information to reproduce it to the xml@gnome.orglist; if it's -reallylibxmlrelated I will approve it. Please do not send mail to me -directly, itmakesthings really hard to track and in some cases I am not the -best persontoanswer a given question, ask on the list.

      To be really clear about support:

      • Support or help requests MUST be senttothe - list or on bugzillain case of problems, so that theQuestionand - Answers can be shared publicly. Failing to do so carries - theimplicitmessage "I want free support but I don't want to share - thebenefits withothers" and is not welcome. I will automatically - Carbon-Copythexml@gnome.org mailing list for any technical reply made - about libxml2orlibxslt.
      • -
      • There is no garantee of - support,ifyour question remains unanswered after a week, repost - it, making sureyougave all the detail needed and the information - requested.
      • -
      • Failing to provide information as requested or double checking - firstforprior feedback also carries the implicit message "the time of - thelibrarymaintainers is less valuable than my time" and might not - bewelcome.
      • -

      Of course, bugs reported with a suggested patch for fixing -themwillprobably be processed faster than those without.

      If you're looking for help, a quick look at the list -archivemayactuallyprovide the answer. I usually send source samples when -answeringlibxml2usage questions. The auto-generateddocumentationisnot -as polished as I would like (i need to learn moreabout DocBook), butit's a -good starting point.

      Daniel Veillard

      +Reporting bugs and getting help
      Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
      Made with Libxml2 Logo

      The XML C parser and toolkit of Gnome

      Reporting bugs and getting help

      Main Menu
      Related links

      Well, bugs or missing features are always possible, and I will make a +point of fixing them in a timely fashion. The best way to report a bug is to +use the Gnome +bug tracking database (make sure to use the "libxml2" module name). I +look at reports there regularly and it's good to have a reminder when a bug +is still open. Be sure to specify that the bug is for the package libxml2.

      For small problems you can try to get help on IRC, the #xml channel on +irc.gnome.org (port 6667) usually have a few person subscribed which may help +(but there is no garantee and if a real issue is raised it should go on the +mailing-list for archival).

      There is also a mailing-list xml@gnome.org for libxml, with an on-line archive (old). To subscribe to this list, +please visit the associated Web page and +follow the instructions. Do not send code, I won't debug it +(but patches are really appreciated!).

      Please note that with the current amount of virus and SPAM, sending mail +to the list without being subscribed won't work. There is *far too many +bounces* (in the order of a thousand a day !) I cannot approve them manually +anymore. If your mail to the list bounced waiting for administrator approval, +it is LOST ! Repost it and fix the problem triggering the error. Also please +note that emails with +a legal warning asking to not copy or redistribute freely the informations +they contain are NOT acceptable for the mailing-list, +such mail will as much as possible be discarded automatically, and are less +likely to be answered if they made it to the list, DO NOT +post to the list from an email address where such legal requirements are +automatically added, get private paying support if you can't share +informations.

      Check the following before +posting:

      • Read the FAQ and use the + search engine to get information related to your problem.
      • +
      • Make sure you are using a recent + version, and that the problem still shows up in a recent version.
      • +
      • Check the list + archives to see if the problem was reported already. In this case + there is probably a fix available, similarly check the registered + open bugs.
      • +
      • Make sure you can reproduce the bug with xmllint or one of the test + programs found in source in the distribution.
      • +
      • Please send the command showing the error as well as the input (as an + attachment)
      • +

      Then send the bug with associated information to reproduce it to the xml@gnome.org list; if it's really libxml +related I will approve it. Please do not send mail to me directly, it makes +things really hard to track and in some cases I am not the best person to +answer a given question, ask on the list.

      To be really clear about support:

      • Support or help requests MUST be sent to + the list or on bugzilla in case of problems, so that the Question + and Answers can be shared publicly. Failing to do so carries the implicit + message "I want free support but I don't want to share the benefits with + others" and is not welcome. I will automatically Carbon-Copy the + xml@gnome.org mailing list for any technical reply made about libxml2 or + libxslt.
      • +
      • There is no garantee of support, if + your question remains unanswered after a week, repost it, making sure you + gave all the detail needed and the information requested.
      • +
      • Failing to provide information as requested or double checking first + for prior feedback also carries the implicit message "the time of the + library maintainers is less valuable than my time" and might not be + welcome.
      • +

      Of course, bugs reported with a suggested patch for fixing them will +probably be processed faster than those without.

      If you're looking for help, a quick look at the list archive may actually +provide the answer. I usually send source samples when answering libxml2 +usage questions. The auto-generated documentation is +not as polished as I would like (i need to learn more about DocBook), but +it's a good starting point.

      Daniel Veillard

      diff --git a/doc/catalog.html b/doc/catalog.html index 34f9902..4100fed 100644 --- a/doc/catalog.html +++ b/doc/catalog.html @@ -14,78 +14,77 @@ A:link, A:visited, A:active { text-decoration: underline }
    • How to tune catalog usage
    • How to debug catalog processing
    • How to create and maintain catalogs
    • -
    • The implementor corner quick review - oftheAPI
    • +
    • The implementor corner quick review of the + API
    • Other resources
    • -

      General overview

      What is a catalog? Basically it's a lookup mechanism used when an -entity(afile or a remote resource) references another entity. The catalog -lookupisinserted between the moment the reference is recognized by the -software(XMLparser, stylesheet processing, or even images referenced for -inclusionin arendering) and the time where loading that resource is -actuallystarted.

      It is basically used for 3 things:

      • mapping from "logical" names, the public identifiers and a - moreconcretename usable for download (and URI). For example it can - associatethelogical name +

        General overview

        What is a catalog? Basically it's a lookup mechanism used when an entity +(a file or a remote resource) references another entity. The catalog lookup +is inserted between the moment the reference is recognized by the software +(XML parser, stylesheet processing, or even images referenced for inclusion +in a rendering) and the time where loading that resource is actually +started.

        It is basically used for 3 things:

        • mapping from "logical" names, the public identifiers and a more + concrete name usable for download (and URI). For example it can associate + the logical name

          "-//OASIS//DTD DocBook XML V4.1.2//EN"

          -

          of the DocBook 4.1.2 XML DTD with the actual URL where it - canbedownloaded

          +

          of the DocBook 4.1.2 XML DTD with the actual URL where it can be + downloaded

          http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd

        • -
        • remapping from a given URL to another one, like an - HTTPindirectionsaying that +
        • remapping from a given URL to another one, like an HTTP indirection + saying that

          "http://www.oasis-open.org/committes/tr.xsl"

          should really be looked at

          "http://www.oasis-open.org/committes/entity/stylesheets/base/tr.xsl"

        • -
        • providing a local cache mechanism allowing to load - theentitiesassociated to public identifiers or remote resources, this is - areallyimportant feature for any significant deployment of XML or - SGMLsince itallows to avoid the aleas and delays associated to - fetchingremoteresources.
        • -

        The definitions

        Libxml, as of 2.4.3 implements 2 kind of catalogs:

        • the older SGML catalogs, the official spec is SGML - OpenTechnicalResolution TR9401:1997, but is better understood by reading - the SP - CatalogpagefromJames Clark. This is relatively old and not the - preferredmode ofoperation of libxml.
        • -
        • XMLCatalogsisfar - more flexible, more recent, uses an XML syntax andshould scale - quitebetter. This is the default option of libxml.
        • -

        Using catalog

        In a normal environment libxml2 will by default check the presence -ofacatalog in /etc/xml/catalog, and assuming it has been -correctlypopulated,the processing is completely transparent to the document -user. Totake aconcrete example, suppose you are authoring a DocBook document, -thisonestarts with the following DOCTYPE definition:

        <?xml version='1.0'?>
        +  
      • providing a local cache mechanism allowing to load the entities + associated to public identifiers or remote resources, this is a really + important feature for any significant deployment of XML or SGML since it + allows to avoid the aleas and delays associated to fetching remote + resources.
      • +

      The definitions

      Libxml, as of 2.4.3 implements 2 kind of catalogs:

      • the older SGML catalogs, the official spec is SGML Open Technical + Resolution TR9401:1997, but is better understood by reading the SP Catalog page from + James Clark. This is relatively old and not the preferred mode of + operation of libxml.
      • +
      • XML + Catalogs is far more flexible, more recent, uses an XML syntax and + should scale quite better. This is the default option of libxml.
      • +

      Using catalog

      In a normal environment libxml2 will by default check the presence of a +catalog in /etc/xml/catalog, and assuming it has been correctly populated, +the processing is completely transparent to the document user. To take a +concrete example, suppose you are authoring a DocBook document, this one +starts with the following DOCTYPE definition:

      <?xml version='1.0'?>
       <!DOCTYPE book PUBLIC "-//Norman Walsh//DTD DocBk XML V3.1.4//EN"
      -          "http://nwalsh.com/docbook/xml/3.1.4/db3xml.dtd">

      When validating the document with libxml, the catalog will -beautomaticallyconsulted to lookup the public identifier "-//Norman -Walsh//DTDDocBk XMLV3.1.4//EN" and the -systemidentifier"http://nwalsh.com/docbook/xml/3.1.4/db3xml.dtd", and if -theseentities havebeen installed on your system and the catalogs actually -point tothem, libxmlwill fetch them from the local disk.

      Note: Really don't usethisDOCTYPE -example it's a really old version, but is fine as an example.

      Libxml2 will check the catalog each time that it is requested to -loadanentity, this includes DTD, external parsed entities, stylesheets, etc -...Ifyour system is correctly configured all the authoring phase -andprocessingshould use only local files, even if your document stays -portablebecause ituses the canonical public and system ID, referencing the -remotedocument.

      Some examples:

      Here is a couple of fragments from XML Catalogs used in -libxml2earlyregression tests in test/catalogs:

      <?xml version="1.0"?>
      +          "http://nwalsh.com/docbook/xml/3.1.4/db3xml.dtd">

      When validating the document with libxml, the catalog will be +automatically consulted to lookup the public identifier "-//Norman Walsh//DTD +DocBk XML V3.1.4//EN" and the system identifier +"http://nwalsh.com/docbook/xml/3.1.4/db3xml.dtd", and if these entities have +been installed on your system and the catalogs actually point to them, libxml +will fetch them from the local disk.

      Note: Really don't use this +DOCTYPE example it's a really old version, but is fine as an example.

      Libxml2 will check the catalog each time that it is requested to load an +entity, this includes DTD, external parsed entities, stylesheets, etc ... If +your system is correctly configured all the authoring phase and processing +should use only local files, even if your document stays portable because it +uses the canonical public and system ID, referencing the remote document.

      Some examples:

      Here is a couple of fragments from XML Catalogs used in libxml2 early +regression tests in test/catalogs :

      <?xml version="1.0"?>
       <!DOCTYPE catalog PUBLIC 
          "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
          "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
       <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
         <public publicId="-//OASIS//DTD DocBook XML V4.1.2//EN"
          uri="http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"/>
      -...

      This is the beginning of a catalog for DocBook 4.1.2, XML -Catalogsarewritten in XML, there is a specific namespace for -catalogelements"urn:oasis:names:tc:entity:xmlns:xml:catalog". The first entry -inthiscatalog is a publicmapping it allows to associate -aPublicIdentifier with an URI.

      ...
      +...

      This is the beginning of a catalog for DocBook 4.1.2, XML Catalogs are +written in XML, there is a specific namespace for catalog elements +"urn:oasis:names:tc:entity:xmlns:xml:catalog". The first entry in this +catalog is a public mapping it allows to associate a Public +Identifier with an URI.

      ...
           <rewriteSystem systemIdStartString="http://www.oasis-open.org/docbook/"
                          rewritePrefix="file:///usr/share/xml/docbook/"/>
      -...

      A rewriteSystemis a very powerful instruction, it saysthatany -URI starting with a given prefix should be looked at anotherURIconstructed by -replacing the prefix with an new one. In effect this actslikea cache system -for a full area of the Web. In practice it is extremelyusefulwith a file -prefix if you have installed a copy of those resources onyourlocal system.

      ...
      +...

      A rewriteSystem is a very powerful instruction, it says that +any URI starting with a given prefix should be looked at another URI +constructed by replacing the prefix with an new one. In effect this acts like +a cache system for a full area of the Web. In practice it is extremely useful +with a file prefix if you have installed a copy of those resources on your +local system.

      ...
       <delegatePublic publicIdStartString="-//OASIS//DTD XML Catalog //"
                       catalog="file:///usr/share/xml/docbook.xml"/>
       <delegatePublic publicIdStartString="-//OASIS//ENTITIES DocBook XML"
      @@ -96,21 +95,21 @@ prefix if you have installed a copy of those resources onyourlocal system.

      Delegation is the core features which allows to build a tree -ofcatalogs,easier to maintain than a single catalog, based on -PublicIdentifier, SystemIdentifier or URI prefixes it instructs the -catalogsoftware to look upentries in another resource. This feature allow to -buildhierarchies ofcatalogs, the set of entries presented should be -sufficient toredirect theresolution of all DocBook references to the specific -catalogin/usr/share/xml/docbook.xmlthis one in turn could -delegateallreferences for DocBook 4.2.1 to a specific catalog installed at -the sametimeas the DocBook resources on the local machine.

      How to tune catalog usage:

      The user can change the default catalog behaviour by redirecting -queriestoits own set of catalogs, this can be done by -settingtheXML_CATALOG_FILESenvironment variable to a list of -catalogs,anempty one should deactivate loading the -default/etc/xml/catalogdefault catalog

      How to debug catalog processing:

      Setting up the XML_DEBUG_CATALOGenvironment variable -willmakelibxml2 output debugging informations for each catalog -operations,forexample:

      orchis:~/XML -> xmllint --memory --noout test/ent2
      +...

      Delegation is the core features which allows to build a tree of catalogs, +easier to maintain than a single catalog, based on Public Identifier, System +Identifier or URI prefixes it instructs the catalog software to look up +entries in another resource. This feature allow to build hierarchies of +catalogs, the set of entries presented should be sufficient to redirect the +resolution of all DocBook references to the specific catalog in +/usr/share/xml/docbook.xml this one in turn could delegate all +references for DocBook 4.2.1 to a specific catalog installed at the same time +as the DocBook resources on the local machine.

      How to tune catalog usage:

      The user can change the default catalog behaviour by redirecting queries +to its own set of catalogs, this can be done by setting the +XML_CATALOG_FILES environment variable to a list of catalogs, an +empty one should deactivate loading the default /etc/xml/catalog +default catalog

      How to debug catalog processing:

      Setting up the XML_DEBUG_CATALOG environment variable will +make libxml2 output debugging informations for each catalog operations, for +example:

      orchis:~/XML -> xmllint --memory --noout test/ent2
       warning: failed to load external entity "title.xml"
       orchis:~/XML -> export XML_DEBUG_CATALOG=
       orchis:~/XML -> xmllint --memory --noout test/ent2
      @@ -118,26 +117,26 @@ Failed to parse catalog /etc/xml/catalog
       Failed to parse catalog /etc/xml/catalog
       warning: failed to load external entity "title.xml"
       Catalogs cleanup
      -orchis:~/XML -> 

      The test/ent2 references an entity, running the parser from memorymakesthe -base URI unavailable and the the "title.xml" entity cannot beloaded.Setting -up the debug environment variable allows to detect that anattempt ismade to -load the /etc/xml/catalogbut since it's notpresent theresolution -fails.

      But the most advanced way to debug XML catalog processing is to -usethexmlcatalogcommand shipped with libxml2, it allows -toloadcatalogs and make resolution queries to see what is going on. This -isalsoused for the regression tests:

      orchis:~/XML -> ./xmlcatalog test/catalogs/docbook.xml \
      +orchis:~/XML -> 

      The test/ent2 references an entity, running the parser from memory makes +the base URI unavailable and the the "title.xml" entity cannot be loaded. +Setting up the debug environment variable allows to detect that an attempt is +made to load the /etc/xml/catalog but since it's not present the +resolution fails.

      But the most advanced way to debug XML catalog processing is to use the +xmlcatalog command shipped with libxml2, it allows to load +catalogs and make resolution queries to see what is going on. This is also +used for the regression tests:

      orchis:~/XML -> ./xmlcatalog test/catalogs/docbook.xml \
                          "-//OASIS//DTD DocBook XML V4.1.2//EN"
       http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd
      -orchis:~/XML -> 

      For debugging what is going on, adding one -v flags increase -theverbositylevel to indicate the processing done (adding a second flag -alsoindicatewhat elements are recognized at parsing):

      orchis:~/XML -> ./xmlcatalog -v test/catalogs/docbook.xml \
      +orchis:~/XML -> 

      For debugging what is going on, adding one -v flags increase the verbosity +level to indicate the processing done (adding a second flag also indicate +what elements are recognized at parsing):

      orchis:~/XML -> ./xmlcatalog -v test/catalogs/docbook.xml \
                          "-//OASIS//DTD DocBook XML V4.1.2//EN"
       Parsing catalog test/catalogs/docbook.xml's content
       Found public match -//OASIS//DTD DocBook XML V4.1.2//EN
       http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd
       Catalogs cleanup
      -orchis:~/XML -> 

      A shell interface is also available to debug and process -multiplequeries(and for regression tests):

      orchis:~/XML -> ./xmlcatalog -shell test/catalogs/docbook.xml \
      +orchis:~/XML -> 

      A shell interface is also available to debug and process multiple queries +(and for regression tests):

      orchis:~/XML -> ./xmlcatalog -shell test/catalogs/docbook.xml \
                          "-//OASIS//DTD DocBook XML V4.1.2//EN"
       > help   
       Commands available:
      @@ -153,18 +152,18 @@ exit:  quit the shell
       > public "-//OASIS//DTD DocBook XML V4.1.2//EN"
       http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd
       > quit
      -orchis:~/XML -> 

      This should be sufficient for most debugging purpose, this wasactuallyused -heavily to debug the XML Catalog implementation itself.

      How to create and maintaincatalogs:

      Basically XML Catalogs are XML files, you can either use XML toolstomanage -them or use xmlcatalogfor this. The basic stepisto create a -catalog the -create option provide this facility:

      orchis:~/XML -> ./xmlcatalog --create tst.xml
      +orchis:~/XML -> 

      This should be sufficient for most debugging purpose, this was actually +used heavily to debug the XML Catalog implementation itself.

      How to create and maintain catalogs:

      Basically XML Catalogs are XML files, you can either use XML tools to +manage them or use xmlcatalog for this. The basic step is +to create a catalog the -create option provide this facility:

      orchis:~/XML -> ./xmlcatalog --create tst.xml
       <?xml version="1.0"?>
       <!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
                "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
       <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"/>
      -orchis:~/XML -> 

      By default xmlcatalog does not overwrite the original catalog and -savetheresult on the standard output, this can be overridden using -the-nooutoption. The -addcommand allows to add entries -inthecatalog:

      orchis:~/XML -> ./xmlcatalog --noout --create --add "public" \
      +orchis:~/XML -> 

      By default xmlcatalog does not overwrite the original catalog and save the +result on the standard output, this can be overridden using the -noout +option. The -add command allows to add entries in the +catalog:

      orchis:~/XML -> ./xmlcatalog --noout --create --add "public" \
         "-//OASIS//DTD DocBook XML V4.1.2//EN" \
         http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd tst.xml
       orchis:~/XML -> cat tst.xml
      @@ -175,80 +174,83 @@ orchis:~/XML -> cat tst.xml
       <public publicId="-//OASIS//DTD DocBook XML V4.1.2//EN"
               uri="http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"/>
       </catalog>
      -orchis:~/XML -> 

      The -addoption will always take 3 parameters even if -someofthe XML Catalog constructs (like nextCatalog) will have only -asingleargument, just pass a third empty string, it will be ignored.

      Similarly the -deloption remove matching entries -fromthecatalog:

      orchis:~/XML -> ./xmlcatalog --del \
      +orchis:~/XML -> 

      The -add option will always take 3 parameters even if some of +the XML Catalog constructs (like nextCatalog) will have only a single +argument, just pass a third empty string, it will be ignored.

      Similarly the -del option remove matching entries from the +catalog:

      orchis:~/XML -> ./xmlcatalog --del \
         "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" tst.xml
       <?xml version="1.0"?>
       <!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
           "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
       <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"/>
      -orchis:~/XML -> 

      The catalog is now empty. Note that the matching -of-delisexact and would have worked in a similar fashion with -thePublic IDstring.

      This is rudimentary but should be sufficient to manage a not -toocomplexcatalog tree of resources.

      The implementor corner quick review -oftheAPI:

      First, and like for every other module of libxml, there is -anautomaticallygenerated API page -forcatalogsupport.

      The header for the catalog interfaces should be included as:

      #include <libxml/catalog.h>

      The API is voluntarily kept very simple. First it is not -obviousthatapplications really need access to it since it is the default -behaviouroflibxml2 (Note: it is possible to completely override libxml2 -defaultcatalogby using xmlSetExternalEntityLoadertoplug -anapplication specific resolver).

      Basically libxml2 support 2 catalog lists:

      • the default one, global shared by all the application
      • -
      • a per-document catalog, this one is built if the document - usestheoasis-xml-catalogPIs to specify its own catalog list, - itisassociated to the parser context and destroyed when the - parsingcontextis destroyed.
      • -

      the document one will be used first if it exists.

      Initialization routines:

      xmlInitializeCatalog(), xmlLoadCatalog() and xmlLoadCatalogs() -shouldbeused at startup to initialize the catalog, if the catalog -shouldbeinitialized with specific values xmlLoadCatalog() -orxmlLoadCatalogs()should be called before xmlInitializeCatalog() which -wouldotherwise do adefault initialization first.

      The xmlCatalogAddLocal() call is used by the parser to grow thedocumentown -catalog list if needed.

      Preferences setup:

      The XML Catalog spec requires the possibility to select -defaultpreferencesbetween public and system -delegation,xmlCatalogSetDefaultPrefer() allowsthis, xmlCatalogSetDefaults() -andxmlCatalogGetDefaults() allow to control ifXML Catalogs resolution -shouldbe forbidden, allowed for global catalog, fordocument catalog or both, -thedefault is to allow both.

      And of course xmlCatalogSetDebug() allows to generate -debugmessages(through the xmlGenericError() mechanism).

      Querying routines:

      xmlCatalogResolve(), -xmlCatalogResolveSystem(),xmlCatalogResolvePublic()and xmlCatalogResolveURI() -are relatively explicitif you read the XMLCatalog specification they -correspond to section 7algorithms, they shouldalso work if you have loaded an -SGML catalog with asimplified semantic.

      xmlCatalogLocalResolve() and xmlCatalogLocalResolveURI() are the -samebutoperate on the document catalog list

      Cleanup and Miscellaneous:

      xmlCatalogCleanup() free-up the global catalog, xmlCatalogFreeLocal()isthe -per-document equivalent.

      xmlCatalogAdd() and xmlCatalogRemove() are used to dynamically -modifythefirst catalog in the global list, and xmlCatalogDump() allows to -dumpacatalog state, those routines are primarily designed for xmlcatalog, -I'mnotsure that exposing more complex interfaces (like navigation ones) -wouldbereally useful.

      The xmlParseCatalogFile() is a function used to load XML Catalogfiles,it's -similar as xmlParseFile() except it bypass all catalog lookups,it'sprovided -because this functionality may be useful for client tools.

      threaded environments:

      Since the catalog tree is built progressively, some care has been -takentotry to avoid troubles in multithreaded environments. The code is -nowthreadsafe assuming that the libxml2 library has been compiled -withthreadssupport.

      Other resources

      The XML Catalog specification is relatively recent so there -isn'tmuchliterature to point at:

      • You can find a good rant from Norm Walsh about theneedfor - catalogs, it provides a lot of context informations even ifIdon't - agree with everything presented. Norm also wrote a morerecentarticle XMLentitiesand - URI resolversdescribing them.
      • -
      • An oldXMLcatalog - proposalfrom John Cowan
      • -
      • The Resource - DirectoryDescriptionLanguage(RDDL) another catalog system but more - orientedtowardproviding metadata for XML namespaces.
      • -
      • the page from the OASIS Technical Committee - onEntityResolutionwho maintains XML Catalog, you will find pointers - tothespecification update, some background and pointers to - otherstoolsproviding XML Catalog support
      • -
      • There is a shell scriptto - generateXMLCatalogs for DocBook 4.1.2 . If it can write to the - /etc/xml/directory,it will set-up /etc/xml/catalog and /etc/xml/docbook - based ontheresources found on the system. Otherwise it will just - create~/xmlcatalogand ~/dbkxmlcatalog and doing: +orchis:~/XML ->

      The catalog is now empty. Note that the matching of -del is +exact and would have worked in a similar fashion with the Public ID +string.

      This is rudimentary but should be sufficient to manage a not too complex +catalog tree of resources.

      The implementor corner quick review of the +API:

      First, and like for every other module of libxml, there is an +automatically generated API page for +catalog support.

      The header for the catalog interfaces should be included as:

      #include <libxml/catalog.h>

      The API is voluntarily kept very simple. First it is not obvious that +applications really need access to it since it is the default behaviour of +libxml2 (Note: it is possible to completely override libxml2 default catalog +by using xmlSetExternalEntityLoader to +plug an application specific resolver).

      Basically libxml2 support 2 catalog lists:

      • the default one, global shared by all the application
      • +
      • a per-document catalog, this one is built if the document uses the + oasis-xml-catalog PIs to specify its own catalog list, it is + associated to the parser context and destroyed when the parsing context + is destroyed.
      • +

      the document one will be used first if it exists.

      Initialization routines:

      xmlInitializeCatalog(), xmlLoadCatalog() and xmlLoadCatalogs() should be +used at startup to initialize the catalog, if the catalog should be +initialized with specific values xmlLoadCatalog() or xmlLoadCatalogs() +should be called before xmlInitializeCatalog() which would otherwise do a +default initialization first.

      The xmlCatalogAddLocal() call is used by the parser to grow the document +own catalog list if needed.

      Preferences setup:

      The XML Catalog spec requires the possibility to select default +preferences between public and system delegation, +xmlCatalogSetDefaultPrefer() allows this, xmlCatalogSetDefaults() and +xmlCatalogGetDefaults() allow to control if XML Catalogs resolution should +be forbidden, allowed for global catalog, for document catalog or both, the +default is to allow both.

      And of course xmlCatalogSetDebug() allows to generate debug messages +(through the xmlGenericError() mechanism).

      Querying routines:

      xmlCatalogResolve(), xmlCatalogResolveSystem(), xmlCatalogResolvePublic() +and xmlCatalogResolveURI() are relatively explicit if you read the XML +Catalog specification they correspond to section 7 algorithms, they should +also work if you have loaded an SGML catalog with a simplified semantic.

      xmlCatalogLocalResolve() and xmlCatalogLocalResolveURI() are the same but +operate on the document catalog list

      Cleanup and Miscellaneous:

      xmlCatalogCleanup() free-up the global catalog, xmlCatalogFreeLocal() is +the per-document equivalent.

      xmlCatalogAdd() and xmlCatalogRemove() are used to dynamically modify the +first catalog in the global list, and xmlCatalogDump() allows to dump a +catalog state, those routines are primarily designed for xmlcatalog, I'm not +sure that exposing more complex interfaces (like navigation ones) would be +really useful.

      The xmlParseCatalogFile() is a function used to load XML Catalog files, +it's similar as xmlParseFile() except it bypass all catalog lookups, it's +provided because this functionality may be useful for client tools.

      threaded environments:

      Since the catalog tree is built progressively, some care has been taken to +try to avoid troubles in multithreaded environments. The code is now thread +safe assuming that the libxml2 library has been compiled with threads +support.

      Other resources

      The XML Catalog specification is relatively recent so there isn't much +literature to point at:

      • You can find a good rant from Norm Walsh about the + need for catalogs, it provides a lot of context informations even if + I don't agree with everything presented. Norm also wrote a more recent + article XML + entities and URI resolvers describing them.
      • +
      • An old XML + catalog proposal from John Cowan
      • +
      • The Resource Directory Description + Language (RDDL) another catalog system but more oriented toward + providing metadata for XML namespaces.
      • +
      • the page from the OASIS Technical Committee on Entity + Resolution who maintains XML Catalog, you will find pointers to the + specification update, some background and pointers to others tools + providing XML Catalog support
      • +
      • There is a shell script to generate + XML Catalogs for DocBook 4.1.2 . If it can write to the /etc/xml/ + directory, it will set-up /etc/xml/catalog and /etc/xml/docbook based on + the resources found on the system. Otherwise it will just create + ~/xmlcatalog and ~/dbkxmlcatalog and doing:

        export XML_CATALOG_FILES=$HOME/xmlcatalog

        -

        should allow to process DocBook documentations withoutrequiringnetwork - accesses for the DTD or stylesheets

        +

        should allow to process DocBook documentations without requiring + network accesses for the DTD or stylesheets

      • -
      • I have uploaded asmalltarballcontaining - XML Catalogs for DocBook 4.1.2 which seemsto workfine for me too
      • -
      • The xmlcatalogmanualpage
      • -

      If you have suggestions for corrections or additions, simply contactme:

      Daniel Veillard

    +
  • I have uploaded a + small tarball containing XML Catalogs for DocBook 4.1.2 which seems + to work fine for me too
  • +
  • The xmlcatalog + manual page
  • +

    If you have suggestions for corrections or additions, simply contact +me:

    Daniel Veillard

    diff --git a/doc/contribs.html b/doc/contribs.html index 2163d60..e493eb3 100644 --- a/doc/contribs.html +++ b/doc/contribs.html @@ -7,29 +7,34 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -Contributions
    Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
    Made with Libxml2 Logo

    The XML C parser and toolkit of Gnome

    Contributions

    Main Menu
    Related links
    • Bjorn Reese, William Brack and Thomas Broyer have provided a - numberofpatches, Gary Pennington worked on the validation API, - threadingsupportand Solaris port.
    • +Contributions
      Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
      Made with Libxml2 Logo

      The XML C parser and toolkit of Gnome

      Contributions

      Main Menu
      Related links

      Daniel Veillard

      diff --git a/doc/devhelp/Makefile.in b/doc/devhelp/Makefile.in index 83b5866..0e0e053 100644 --- a/doc/devhelp/Makefile.in +++ b/doc/devhelp/Makefile.in @@ -136,6 +136,7 @@ RDL_LIBS = @RDL_LIBS@ READER_TEST = @READER_TEST@ RELDATE = @RELDATE@ RM = @RM@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STATIC_BINARIES = @STATIC_BINARIES@ @@ -164,6 +165,7 @@ THREAD_CFLAGS = @THREAD_CFLAGS@ THREAD_LIBS = @THREAD_LIBS@ U = @U@ VERSION = @VERSION@ +WGET = @WGET@ WIN32_EXTRA_LDFLAGS = @WIN32_EXTRA_LDFLAGS@ WIN32_EXTRA_LIBADD = @WIN32_EXTRA_LIBADD@ WITH_C14N = @WITH_C14N@ @@ -199,6 +201,7 @@ WITH_WRITER = @WITH_WRITER@ WITH_XINCLUDE = @WITH_XINCLUDE@ WITH_XPATH = @WITH_XPATH@ WITH_XPTR = @WITH_XPTR@ +WITH_ZLIB = @WITH_ZLIB@ XINCLUDE_OBJ = @XINCLUDE_OBJ@ XMLLINT = @XMLLINT@ XML_CFLAGS = @XML_CFLAGS@ diff --git a/doc/devhelp/libxml2-HTMLparser.html b/doc/devhelp/libxml2-HTMLparser.html index 3a4a67d..827da39 100644 --- a/doc/devhelp/libxml2-HTMLparser.html +++ b/doc/devhelp/libxml2-HTMLparser.html @@ -95,6 +95,7 @@ void htmlFreeParserCtxt (htmlDocPtr htmlReadFile (const char * filename,
      const char * encoding,
      int options); htmlDocPtr htmlCtxtReadFile (htmlParserCtxtPtr ctxt,
      const char * filename,
      const char * encoding,
      int options); int htmlParseDocument (htmlParserCtxtPtr ctxt); +htmlParserCtxtPtr htmlNewParserCtxt (void); htmlDocPtr htmlSAXParseDoc (xmlChar * cur,
      const char * encoding,
      htmlSAXHandlerPtr sax,
      void * userData); int htmlCtxtUseOptions (htmlParserCtxtPtr ctxt,
      int options); htmlDocPtr htmlParseDoc (xmlChar * cur,
      const char * encoding); @@ -294,6 +295,10 @@ int htmlCtxtUseOptions (

      htmlIsScriptAttribute ()

      int	htmlIsScriptAttribute		(const xmlChar * name)

      Check if an attribute is of content type Script

      name:an attribute name
      Returns:1 is the attribute is a script 0 otherwise
      +
      +

      htmlNewParserCtxt ()

      htmlParserCtxtPtr	htmlNewParserCtxt	(void)
      +

      Allocate and initialize a new parser context.

      +
      Returns:the htmlParserCtxtPtr or NULL in case of allocation error

      htmlNodeStatus ()

      htmlStatus	htmlNodeStatus		(const htmlNodePtr node, 
      int legacy)

      Checks whether the tree node is valid. Experimental (the author only uses the HTML enhancements in a SAX parser)

      diff --git a/doc/devhelp/libxml2-parser.html b/doc/devhelp/libxml2-parser.html index bc7e54e..c12cd02 100644 --- a/doc/devhelp/libxml2-parser.html +++ b/doc/devhelp/libxml2-parser.html @@ -219,6 +219,7 @@ void xmlSetExternalEntityLoader (XML_WITH_DEBUG = 28 XML_WITH_DEBUG_MEM = 29 XML_WITH_DEBUG_RUN = 30 + XML_WITH_ZLIB = 31 XML_WITH_NONE = 99999 /* just to be sure of allocation size */ };

      @@ -301,7 +302,7 @@ void xmlSetExternalEntityLoader (XML_PARSE_NSCLEAN = 8192 /* remove redundant namespaces declarations */ XML_PARSE_NOCDATA = 16384 /* merge CDATA as text nodes */ XML_PARSE_NOXINCNODE = 32768 /* do not generate XINCLUDE START/END nodes */ - XML_PARSE_COMPACT = 65536 /* compact small text nodes */ + XML_PARSE_COMPACT = 65536 /* compact small text nodes; no modification of the tree allowed afterwards (will possibly crash if you try to modify the tree) */ };

      @@ -553,7 +554,7 @@ void xmlSetExternalEntityLoader (

      xmlIOParseDTD ()

      xmlDtdPtr	xmlIOParseDTD		(xmlSAXHandlerPtr sax, 
      xmlParserInputBufferPtr input,
      xmlCharEncoding enc)

      Load and parse a DTD

      -
      sax:the SAX handler block or NULL
      input:an Input Buffer
      enc:the charset encoding if known
      Returns:the resulting xmlDtdPtr or NULL in case of error. @input will be freed at parsing end.
      +
      sax:the SAX handler block or NULL
      input:an Input Buffer
      enc:the charset encoding if known
      Returns:the resulting xmlDtdPtr or NULL in case of error. @input will be freed by the function in any case.

      xmlInitNodeInfoSeq ()

      void	xmlInitNodeInfoSeq		(xmlParserNodeInfoSeqPtr seq)

      -- Initialize (set to initial state) node info sequence

      diff --git a/doc/devhelp/libxml2-tree.html b/doc/devhelp/libxml2-tree.html index d7757e3..70c6e50 100644 --- a/doc/devhelp/libxml2-tree.html +++ b/doc/devhelp/libxml2-tree.html @@ -187,6 +187,7 @@ void xmlSetDocCompressMode (xmlNodePtr xmlCopyNode (const xmlNodePtr node,
      int extended); void xmlUnlinkNode (xmlNodePtr cur); const xmlChar * xmlSplitQName3 (const xmlChar * name,
      int * len); +typedef xmlNsPtr xmlDOMWrapAcquireNsFunction (xmlDOMWrapCtxtPtr ctxt,
      xmlNodePtr node,
      const xmlChar * nsName,
      const xmlChar * nsPrefix); xmlNodePtr xmlDocSetRootElement (xmlDocPtr doc,
      xmlNodePtr root); long xmlGetLineNo (xmlNodePtr node); const xmlChar * xmlBufferContent (const xmlBufferPtr buf); @@ -385,7 +386,10 @@ void xmlFreeNsList (

      Structure xmlDOMWrapCtxt

      struct _xmlDOMWrapCtxt {
      -    void *	_private
      +    void *	_private	: * The type of this context, just in case we need specialized * context
      +    int	type	: * Internal namespace map used for various operations. *
      +    void *	namespaceMap	: * Use this one to acquire an xmlNsPtr intended for node->ns. * (Note t
      +    xmlDOMWrapAcquireNsFunction	getNsForNodeFunc
       } xmlDOMWrapCtxt;
       

      @@ -563,6 +567,7 @@ void xmlFreeNsList (xmlChar * URI : the full URI as computed int owner : does the entity own the childrens + int checked : was the entity content checked } xmlEntity;

      @@ -640,6 +645,7 @@ void xmlFreeNsList (xmlChar * href : URL for the namespace const xmlChar * prefix : prefix for the namespace void * _private : application data + struct _xmlDoc * context : normally an xmlDoc } xmlNs;

      @@ -868,6 +874,10 @@ void xmlFreeNsList (

      Typedef xmlSAXLocatorPtr

      xmlSAXLocator * xmlSAXLocatorPtr;
       

      +


      +

      Function type xmlDOMWrapAcquireNsFunction

      xmlNsPtr	xmlDOMWrapAcquireNsFunction	(xmlDOMWrapCtxtPtr ctxt, 
      xmlNodePtr node,
      const xmlChar * nsName,
      const xmlChar * nsPrefix)
      +

      A function called to acquire namespaces (xmlNs) from the wrapper.

      +
      ctxt:a DOM wrapper context
      node:the context node (element or attribute)
      nsName:the requested namespace name
      nsPrefix:the requested namespace prefix
      Returns:an xmlNsPtr or NULL in case of an error.

      xmlAddChild ()

      xmlNodePtr	xmlAddChild		(xmlNodePtr parent, 
      xmlNodePtr cur)

      Add a new node to @parent, at the end of the child (or property) list merging adjacent TEXT nodes (in which case @cur is freed) If the new node is ATTRIBUTE, it is added into properties instead of children. If there is an attribute with equal name, it is first destroyed.

      @@ -1010,11 +1020,11 @@ void xmlFreeNsList (
      doc:the document pointer
      name:the DTD name
      ExternalID:the external (PUBLIC) ID
      SystemID:the system ID
      Returns:a pointer to the new DTD structure

      xmlDOMWrapAdoptNode ()

      int	xmlDOMWrapAdoptNode		(xmlDOMWrapCtxtPtr ctxt, 
      xmlDocPtr sourceDoc,
      xmlNodePtr node,
      xmlDocPtr destDoc,
      xmlNodePtr destParent,
      int options)
      -

      References of out-of scope ns-decls are remapped to point to @destDoc: 1) If @destParent is given, then nsDef entries on element-nodes are used 2) If *no* @destParent is given, then @destDoc->oldNs entries are used This is the case when you have an unliked node and just want to move it to the context of If @destParent is given, it ensures that the tree is namespace wellformed by creating additional ns-decls where needed. Note that, since prefixes of already existent ns-decls can be shadowed by this process, it could break QNames in attribute values or element content. WARNING: This function is in a experimental state.

      +

      References of out-of scope ns-decls are remapped to point to @destDoc: 1) If @destParent is given, then nsDef entries on element-nodes are used 2) If *no* @destParent is given, then @destDoc->oldNs entries are used This is the case when you have an unliked node and just want to move it to the context of If @destParent is given, it ensures that the tree is namespace wellformed by creating additional ns-decls where needed. Note that, since prefixes of already existent ns-decls can be shadowed by this process, it could break QNames in attribute values or element content. NOTE: This function was not intensively tested.

      ctxt:the optional context for custom processing
      sourceDoc:the optional sourceDoc
      node:the node to start with
      destDoc:the destination doc
      destParent:the optional new parent of @node in @destDoc
      options:option flags
      Returns:0 if the operation succeeded, 1 if a node of unsupported type was given, 2 if a node of not yet supported type was given and -1 on API/internal errors.

      xmlDOMWrapCloneNode ()

      int	xmlDOMWrapCloneNode		(xmlDOMWrapCtxtPtr ctxt, 
      xmlDocPtr sourceDoc,
      xmlNodePtr node,
      xmlNodePtr * resNode,
      xmlDocPtr destDoc,
      xmlNodePtr destParent,
      int deep,
      int options)
      -

      References of out-of scope ns-decls are remapped to point to @destDoc: 1) If @destParent is given, then nsDef entries on element-nodes are used 2) If *no* @destParent is given, then @destDoc->oldNs entries are used This is the case when you have an unliked node and just want to move it to the context of If @destParent is given, it ensures that the tree is namespace wellformed by creating additional ns-decls where needed. Note that, since prefixes of already existent ns-decls can be shadowed by this process, it could break QNames in attribute values or element content. TODO: 1) Support dicts Optimize string adoption for equal or none dicts. 2) XInclude WARNING: This function is in a experimental state and should only be currently only be used to test it.

      +

      References of out-of scope ns-decls are remapped to point to @destDoc: 1) If @destParent is given, then nsDef entries on element-nodes are used 2) If *no* @destParent is given, then @destDoc->oldNs entries are used. This is the case when you don't know already where the cloned branch will be added to. If @destParent is given, it ensures that the tree is namespace wellformed by creating additional ns-decls where needed. Note that, since prefixes of already existent ns-decls can be shadowed by this process, it could break QNames in attribute values or element content. TODO: 1) What to do with XInclude? Currently this returns an error for XInclude.

      ctxt:the optional context for custom processing
      sourceDoc:the optional sourceDoc
      node:the node to start with
      resNode:the clone of the given @node
      destDoc:the destination doc
      destParent:the optional new parent of @node in @destDoc
      deep:descend into child if set
      options:option flags
      Returns:0 if the operation succeeded, 1 if a node of unsupported (or not yet supported) type was given, -1 on API/internal errors.


      xmlDOMWrapReconcileNamespaces ()

      int	xmlDOMWrapReconcileNamespaces	(xmlDOMWrapCtxtPtr ctxt, 
      xmlNodePtr elem,
      int options)
      -

      Ensures that ns-references point to ns-decls hold on element-nodes. Ensures that the tree is namespace wellformed by creating additional ns-decls where needed. Note that, since prefixes of already existent ns-decls can be shadowed by this process, it could break QNames in attribute values or element content. WARNING: This function is in a experimental state.

      +

      Ensures that ns-references point to ns-decls hold on element-nodes. Ensures that the tree is namespace wellformed by creating additional ns-decls where needed. Note that, since prefixes of already existent ns-decls can be shadowed by this process, it could break QNames in attribute values or element content. NOTE: This function was not intensively tested.

      ctxt:DOM wrapper context, unused at the moment
      elem:the element-node
      options:option flags
      Returns:0 if succeeded, -1 otherwise and on API/internal errors.

      xmlDOMWrapRemoveNode ()

      int	xmlDOMWrapRemoveNode		(xmlDOMWrapCtxtPtr ctxt, 
      xmlDocPtr doc,
      xmlNodePtr node,
      int options)
      -

      Unlinks the given node from its owner. This will substitute ns-references to node->nsDef for ns-references to doc->oldNs, thus ensuring the removed branch to be autark wrt ns-references. WARNING: This function is in a experimental state.

      +

      Unlinks the given node from its owner. This will substitute ns-references to node->nsDef for ns-references to doc->oldNs, thus ensuring the removed branch to be autark wrt ns-references. NOTE: This function was not intensively tested.

      ctxt:a DOM wrapper context
      doc:the doc
      node:the node to be removed.
      options:set of options, unused at the moment
      Returns:0 on success, 1 if the node is not supported, -1 on API and internal errors.

      xmlDocCopyNode ()

      xmlNodePtr	xmlDocCopyNode		(const xmlNodePtr node, 
      xmlDocPtr doc,
      int extended)
      @@ -1071,7 +1081,7 @@ void xmlFreeNsList (

      xmlDocSetRootElement ()

      xmlNodePtr	xmlDocSetRootElement	(xmlDocPtr doc, 
      xmlNodePtr root)

      Set the root element of the document (doc->children is a list containing possibly comments, PIs, etc ...).

      -
      doc:the document
      root:the new document root element
      Returns:the old root element if any was found
      +
      doc:the document
      root:the new document root element, if root is NULL no action is taken, to remove a node from a document use xmlUnlinkNode(root) instead.
      Returns:the old root element if any was found, NULL if root was NULL

      xmlElemDump ()

      void	xmlElemDump			(FILE * f, 
      xmlDocPtr doc,
      xmlNodePtr cur)

      Dump an XML/HTML node, recursive behaviour, children are printed too.

      diff --git a/doc/devhelp/libxml2-uri.html b/doc/devhelp/libxml2-uri.html index 22f724e..33f32fa 100644 --- a/doc/devhelp/libxml2-uri.html +++ b/doc/devhelp/libxml2-uri.html @@ -52,6 +52,7 @@ char * xmlURIUnescapeString (const char * s xmlURIPtr xmlParseURI (const char * str); xmlURIPtr xmlCreateURI (void); xmlChar * xmlURIEscapeStr (const xmlChar * str,
      const xmlChar * list); +xmlChar * xmlPathToURI (const xmlChar * path); xmlChar * xmlCanonicPath (const xmlChar * path); void xmlFreeURI (xmlURIPtr uri); int xmlParseURIReference (xmlURIPtr uri,
      const char * str); @@ -121,6 +122,10 @@ int xmlParseURIReference (

      xmlParseURIReference ()

      int	xmlParseURIReference		(xmlURIPtr uri, 
      const char * str)

      Parse an URI reference string and fills in the appropriate fields of the @uri structure URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]

      uri:pointer to an URI structure
      str:the string to analyze
      Returns:0 or the error code
      +
      +

      xmlPathToURI ()

      xmlChar *	xmlPathToURI		(const xmlChar * path)
      +

      Constructs an URI expressing the existing path

      +
      path:the resource locator in a filesystem notation
      Returns:a new URI, or a duplicate of the path parameter if the construction fails. The caller is responsible for freeing the memory occupied by the returned string. If there is insufficient memory available, or the argument is NULL, the function returns NULL.

      xmlPrintURI ()

      void	xmlPrintURI			(FILE * stream, 
      xmlURIPtr uri)

      Prints the URI in the stream @stream.

      diff --git a/doc/devhelp/libxml2-xinclude.html b/doc/devhelp/libxml2-xinclude.html index 6ffcd5a..31df927 100644 --- a/doc/devhelp/libxml2-xinclude.html +++ b/doc/devhelp/libxml2-xinclude.html @@ -55,6 +55,7 @@ #define XINCLUDE_OLD_NS; typedef struct _xmlXIncludeCtxt xmlXIncludeCtxt; typedef xmlXIncludeCtxt * xmlXIncludeCtxtPtr; +int xmlXIncludeProcessFlagsData (xmlDocPtr doc,
      int flags,
      void * data); int xmlXIncludeProcessFlags (xmlDocPtr doc,
      int flags); int xmlXIncludeProcessTree (xmlNodePtr tree); int xmlXIncludeProcessNode (xmlXIncludeCtxtPtr ctxt,
      xmlNodePtr node); @@ -136,6 +137,10 @@ The content of this structure is not made public by the API.

      xmlXIncludeProcessFlags ()

      int	xmlXIncludeProcessFlags		(xmlDocPtr doc, 
      int flags)

      Implement the XInclude substitution on the XML document @doc

      doc:an XML document
      flags:a set of xmlParserOption used for parsing XML includes
      Returns:0 if no substitution were done, -1 if some processing failed or the number of substitutions done.
      +
      +

      xmlXIncludeProcessFlagsData ()

      int	xmlXIncludeProcessFlagsData	(xmlDocPtr doc, 
      int flags,
      void * data)
      +

      Implement the XInclude substitution on the XML document @doc

      +
      doc:an XML document
      flags:a set of xmlParserOption used for parsing XML includes
      data:application data that will be passed to the parser context in the _private field of the parser context(s)
      Returns:0 if no substitution were done, -1 if some processing failed or the number of substitutions done.

      xmlXIncludeProcessNode ()

      int	xmlXIncludeProcessNode		(xmlXIncludeCtxtPtr ctxt, 
      xmlNodePtr node)

      Implement the XInclude substitution for the given subtree reusing the informations and data coming from the given context.

      diff --git a/doc/devhelp/libxml2-xmlsave.html b/doc/devhelp/libxml2-xmlsave.html index 910a1df..cbe12bb 100644 --- a/doc/devhelp/libxml2-xmlsave.html +++ b/doc/devhelp/libxml2-xmlsave.html @@ -121,7 +121,7 @@ The content of this structure is not made public by the API.

      xmlSaveTree ()

      long	xmlSaveTree			(xmlSaveCtxtPtr ctxt, 
      xmlNodePtr node)

      Save a subtree starting at the node parameter to a saving context TODO: The function is not fully implemented yet as it does not return the byte count but 0 instead

      -
      ctxt:a document saving context
      node:a document
      Returns:the number of byte written or -1 in case of error
      +
      ctxt:a document saving context
      node:the top node of the subtree to save
      Returns:the number of byte written or -1 in case of error

      diff --git a/doc/devhelp/libxml2-xmlversion.html b/doc/devhelp/libxml2-xmlversion.html index dcf26f8..6a3a089 100644 --- a/doc/devhelp/libxml2-xmlversion.html +++ b/doc/devhelp/libxml2-xmlversion.html @@ -73,6 +73,7 @@ #define LIBXML_UNICODE_ENABLED; #define LIBXML_FTP_ENABLED; #define LIBXML_AUTOMATA_ENABLED; +#define LIBXML_ZLIB_ENABLED; #define LIBXML_WRITER_ENABLED; #define LIBXML_C14N_ENABLED; #define LIBXML_SCHEMAS_ENABLED; @@ -217,7 +218,7 @@ void xmlCheckVersion (int version);

      Macro LIBXML_VERSION

      #define LIBXML_VERSION;
      -

      the version number: 1.2.3 value is 1002003

      +

      the version number: 1.2.3 value is 10203


      Macro LIBXML_VERSION_EXTRA

      #define LIBXML_VERSION_EXTRA;
      @@ -225,7 +226,7 @@ void	xmlCheckVersion			(int version);
       

      Macro LIBXML_VERSION_STRING

      #define LIBXML_VERSION_STRING;
      -

      the version number string, 1.2.3 value is "1002003"

      +

      the version number string, 1.2.3 value is "10203"


      Macro LIBXML_WRITER_ENABLED

      #define LIBXML_WRITER_ENABLED;
      @@ -242,6 +243,10 @@ void	xmlCheckVersion			(int version);
               

      Macro LIBXML_XPTR_ENABLED

      #define LIBXML_XPTR_ENABLED;
       

      Whether XPointer is configured in

      +
      +
      +

      Macro LIBXML_ZLIB_ENABLED

      #define LIBXML_ZLIB_ENABLED;
      +

      Whether the Zlib support is compiled in


      Macro WITHOUT_TRIO

      #define WITHOUT_TRIO;
      diff --git a/doc/devhelp/libxml2-xpath.html b/doc/devhelp/libxml2-xpath.html
      index f3fe7a6..86b0cc2 100644
      --- a/doc/devhelp/libxml2-xpath.html
      +++ b/doc/devhelp/libxml2-xpath.html
      @@ -74,7 +74,7 @@ typedef xmlXPathFunction xmlXPathIsNaN			(double val);
       int	xmlXPathContextSetCache		(xmlXPathContextPtr ctxt, 
      int active,
      int value,
      int options); xmlXPathObjectPtr xmlXPathConvertString (xmlXPathObjectPtr val); -xmlXPathObjectPtr xmlXPathConvertBoolean (xmlXPathObjectPtr val); +int xmlXPathCompiledEvalToBoolean (xmlXPathCompExprPtr comp,
      xmlXPathContextPtr ctxt); int xmlXPathIsInf (double val); long xmlXPathOrderDocElems (xmlDocPtr doc); xmlNodeSetPtr xmlXPathNodeSetCreate (xmlNodePtr val); @@ -96,11 +96,12 @@ void xmlXPathFreeNodeSetList (xmlXPathObjectPtr xmlXPathCompiledEval (xmlXPathCompExprPtr comp,
      xmlXPathContextPtr ctx); xmlXPathObjectPtr xmlXPathEvalExpression (const xmlChar * str,
      xmlXPathContextPtr ctxt); void xmlXPathInit (void); -xmlXPathCompExprPtr xmlXPathCtxtCompile (xmlXPathContextPtr ctxt,
      const xmlChar * str); +xmlXPathObjectPtr xmlXPathConvertBoolean (xmlXPathObjectPtr val); typedef int xmlXPathConvertFunc (xmlXPathObjectPtr obj,
      int type); typedef void xmlXPathFunction (xmlXPathParserContextPtr ctxt,
      int nargs); int xmlXPathCmpNodes (xmlNodePtr node1,
      xmlNodePtr node2); xmlChar * xmlXPathCastToString (xmlXPathObjectPtr val); +xmlXPathCompExprPtr xmlXPathCtxtCompile (xmlXPathContextPtr ctxt,
      const xmlChar * str); typedef void xmlXPathEvalFunc (xmlXPathParserContextPtr ctxt,
      int nargs); xmlChar * xmlXPathCastBooleanToString (int val); int xmlXPathCastNumberToBoolean (double val); @@ -424,7 +425,7 @@ The content of this structure is not made public by the API.

      xmlXPathCastToString ()

      xmlChar *	xmlXPathCastToString	(xmlXPathObjectPtr val)

      Converts an existing object to its string() equivalent

      -
      val:an XPath object
      Returns:the string value of the object, NULL in case of error. A new string is allocated only if needed (@val isn't a string object).
      +
      val:an XPath object
      Returns:the allocated string value of the object, NULL in case of error. It's up to the caller to free the string memory with xmlFree().

      xmlXPathCmpNodes ()

      int	xmlXPathCmpNodes		(xmlNodePtr node1, 
      xmlNodePtr node2)

      Compare two nodes w.r.t document order

      @@ -437,6 +438,10 @@ The content of this structure is not made public by the API.

      xmlXPathCompiledEval ()

      xmlXPathObjectPtr	xmlXPathCompiledEval	(xmlXPathCompExprPtr comp, 
      xmlXPathContextPtr ctx)

      Evaluate the Precompiled XPath expression in the given context.

      comp:the compiled XPath expression
      ctx:the XPath context
      Returns:the xmlXPathObjectPtr resulting from the evaluation or NULL. the caller has to free the object.
      +
      +

      xmlXPathCompiledEvalToBoolean ()

      int	xmlXPathCompiledEvalToBoolean	(xmlXPathCompExprPtr comp, 
      xmlXPathContextPtr ctxt)
      +

      Applies the XPath boolean() function on the result of the given compiled expression.

      +
      comp:the compiled XPath expression
      ctxt:the XPath context
      Returns:1 if the expression evaluated to true, 0 if to false and -1 in API and internal errors.

      xmlXPathContextSetCache ()

      int	xmlXPathContextSetCache		(xmlXPathContextPtr ctxt, 
      int active,
      int value,
      int options)

      Creates/frees an object cache on the XPath context. If activates XPath objects (xmlXPathObject) will be cached internally to be reused. @options: 0: This will set the XPath object caching: @value: This will set the maximum number of XPath objects to be cached per slot There are 5 slots for: node-set, string, number, boolean, and misc objects. Use <0 for the default number (100). Other values for @options have currently no effect.

      diff --git a/doc/devhelp/libxml2.devhelp b/doc/devhelp/libxml2.devhelp index e0af836..d789934 100644 --- a/doc/devhelp/libxml2.devhelp +++ b/doc/devhelp/libxml2.devhelp @@ -127,6 +127,7 @@ + @@ -1413,6 +1414,7 @@ + @@ -1788,6 +1790,7 @@ + @@ -1948,6 +1951,7 @@ + @@ -2633,6 +2637,7 @@ + @@ -3294,6 +3299,7 @@ + @@ -3319,6 +3325,7 @@ + diff --git a/doc/docs.html b/doc/docs.html index fa30ac2..4c5fe55 100644 --- a/doc/docs.html +++ b/doc/docs.html @@ -7,22 +7,27 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -Developer Menu
      Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
      Made with Libxml2 Logo

      The XML C parser and toolkit of Gnome

      Developer Menu

      Developer Menu
      API Indexes
      Related links

      There are several on-line resources related to using libxml:

      1. Use the search engineto lookupinformation.
      2. +Developer Menu
        Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
        Made with Libxml2 Logo

        The XML C parser and toolkit of Gnome

        Developer Menu

        Developer Menu
        API Indexes
        Related links

        There are several on-line resources related to using libxml:

        1. Use the search engine to look up + information.
        2. Check the FAQ.
        3. -
        4. Check the extensivedocumentationautomaticallyextracted - from code comments.
        5. -
        6. Look at the documentation about libxmlinternationalization support.
        7. -
        8. This page provides a global overview and someexampleson how to use libxml.
        9. +
        10. Check the extensive + documentation automatically extracted from code comments.
        11. +
        12. Look at the documentation about libxml + internationalization support.
        13. +
        14. This page provides a global overview and some + examples on how to use libxml.
        15. Code examples
        16. -
        17. John Fleck's libxml2 tutorial: htmlorpdf.
        18. -
        19. If you need to parse large files, check the xmlReaderAPI tutorial
        20. -
        21. James Henstridgewrote somenicedocumentationexplaining - how to use the libxml SAX interface.
        22. -
        23. George Lebl wrote anarticlefor - IBM developerWorksabout using libxml.
        24. -
        25. Check theTODOfile.
        26. -
        27. Read the 1.x to 2.x upgrade - pathdescription.If you are starting a new project using libxml you - shouldreally use the2.x version.
        28. +
        29. John Fleck's libxml2 tutorial: html + or pdf.
        30. +
        31. If you need to parse large files, check the xmlReader API tutorial
        32. +
        33. James Henstridge wrote some nice + documentation explaining how to use the libxml SAX interface.
        34. +
        35. George Lebl wrote an article + for IBM developerWorks about using libxml.
        36. +
        37. Check the TODO + file.
        38. +
        39. Read the 1.x to 2.x upgrade path + description. If you are starting a new project using libxml you should + really use the 2.x version.
        40. And don't forget to look at the mailing-list archive.

        Daniel Veillard

        diff --git a/doc/downloads.html b/doc/downloads.html index 71ce9a6..e49f483 100644 --- a/doc/downloads.html +++ b/doc/downloads.html @@ -7,28 +7,30 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -Downloads
        Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
        Made with Libxml2 Logo

        The XML C parser and toolkit of Gnome

        Downloads

        Main Menu
        Related links

        The latest versions of libxml2 can be found on the xmlsoft.orgserver ( HTTP, FTPand rsync are available), there -isalsomirrors (Australia(Web), France) or on the Gnome FTP serveras source -archive,Antonin Sprinzl also provide amirror in Austria. (NOTE -thatyou need both the libxml(2)and libxml(2)-develpackagesinstalled -to compile applications using libxml.)

        You can find all the history of libxml(2) and libxslt releases in the olddirectory. -TheprecompiledWindows binaries made by Igor Zlatovic are available in the win32directory.

        Binary ports:

        • Red Hat RPMs for i386 are available directly on xmlsoft.org, the source RPM - willcompile onany architecture supported by Red Hat.
        • -
        • Igor Zlatkovicis - nowthemaintainer of the Windows port, heprovidesbinaries.
        • -
        • Blastwave provides Solarisbinaries.
        • -
        • Steve Ballprovides Mac - OsXbinaries.
        • +Downloads
          Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
          Made with Libxml2 Logo

          The XML C parser and toolkit of Gnome

          Downloads

          Main Menu
          Related links

          The latest versions of libxml2 can be found on the xmlsoft.org server ( HTTP, FTP and rsync are available), there is also +mirrors (Australia( Web), France) or on the Gnome FTP server as source archive +, Antonin Sprinzl also provide a +mirror in Austria. (NOTE that you need both the libxml(2) and libxml(2)-devel +packages installed to compile applications using libxml.)

          You can find all the history of libxml(2) and libxslt releases in the old directory. The precompiled +Windows binaries made by Igor Zlatovic are available in the win32 directory.

          Binary ports:

          If you know other supported binary ports, please contact me.

          Snapshot:

          Contributions:

          I do accept external contributions, especially if compiling -onanotherplatform, get in touch with the list to upload the package, -wrappersforvarious languages have been provided, and can be found in the bindings section

          Libxml2 is also available from CVS:

          Contributions:

          I do accept external contributions, especially if compiling on another +platform, get in touch with the list to upload the package, wrappers for +various languages have been provided, and can be found in the bindings section

          Libxml2 is also available from CVS:

          • The Gnome CVS + base. Check the Gnome CVS Tools + page; the CVS module is libxml2.

          • -
          • The libxsltmodule is also present there
          • +
          • The libxslt module is also present there

          Daniel Veillard

          diff --git a/doc/encoding.html b/doc/encoding.html index 8db787e..1f4558d 100644 --- a/doc/encoding.html +++ b/doc/encoding.html @@ -7,44 +7,44 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -Encodings support
          Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
          Made with Libxml2 Logo

          The XML C parser and toolkit of Gnome

          Encodings support

          Main Menu
          Related links

          If you are not really familiar with Internationalization (usual -shortcutisI18N) , Unicode, characters and glyphs, I suggest you read a presentationbyTim -Bray on Unicode and why you should care about it.

          If you don't understand why it does not make sense to have -astringwithout knowing what encoding it uses, then as Joel Spolsky said -please do -notwriteanother line of code until you finish reading that article.. It -isaprerequisite to understand this page, and avoid a lot of -problemswithlibxml2, XML or text processing in general.

          Table of Content:

          1. What does internationalization - supportmean?
          2. -
          3. The internal encoding, - howandwhy
          4. +Encodings support
            Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
            Made with Libxml2 Logo

            The XML C parser and toolkit of Gnome

            Encodings support

            Main Menu
            Related links

            If you are not really familiar with Internationalization (usual shortcut +is I18N) , Unicode, characters and glyphs, I suggest you read a presentation +by Tim Bray on Unicode and why you should care about it.

            If you don't understand why it does not make sense to have a string +without knowing what encoding it uses, then as Joel Spolsky said please do not +write another line of code until you finish reading that article.. It is +a prerequisite to understand this page, and avoid a lot of problems with +libxml2, XML or text processing in general.

            Table of Content:

            1. What does internationalization support + mean ?
            2. +
            3. The internal encoding, how and + why
            4. How is it implemented ?
            5. Default supported encodings
            6. -
            7. How to extend theexistingsupport
            8. -

            What does internationalization support mean ?

            XML was designed from the start to allow the support of any charactersetby -using Unicode. Any conformant XML parser has to support the UTF-8andUTF-16 -default encodings which can both express the full unicode ranges.UTF8is a -variable length encoding whose greatest points are to reuse thesameencoding -for ASCII and to save space for Western encodings, but it is abitmore complex -to handle in practice. UTF-16 use 2 bytes per character(andsometimes combines -two pairs), it makes implementation easier, but looksabit overkill for -Western languages encoding. Moreover the XMLspecificationallows the document -to be encoded in other encodings at thecondition thatthey are clearly labeled -as such. For example the following isa wellformedXML document encoded in -ISO-8859-1 and using accentuated lettersthat weFrench like for both markup -and content:

            <?xml version="1.0" encoding="ISO-8859-1"?>
            +  
          5. How to extend the existing + support
          6. +

            What does internationalization support mean ?

            XML was designed from the start to allow the support of any character set +by using Unicode. Any conformant XML parser has to support the UTF-8 and +UTF-16 default encodings which can both express the full unicode ranges. UTF8 +is a variable length encoding whose greatest points are to reuse the same +encoding for ASCII and to save space for Western encodings, but it is a bit +more complex to handle in practice. UTF-16 use 2 bytes per character (and +sometimes combines two pairs), it makes implementation easier, but looks a +bit overkill for Western languages encoding. Moreover the XML specification +allows the document to be encoded in other encodings at the condition that +they are clearly labeled as such. For example the following is a wellformed +XML document encoded in ISO-8859-1 and using accentuated letters that we +French like for both markup and content:

            <?xml version="1.0" encoding="ISO-8859-1"?>
             <très>là</très>

            Having internationalization support in libxml2 means the following:

            • the document is properly parsed
            • informations about it's encoding are saved
            • it can be modified
            • it can be saved in its original encoding
            • -
            • it can also be saved in another encoding supported by - libxml2(forexample straight UTF8 or even an ASCII form)
            • -

            Another very important point is that the whole libxml2 API, -withtheexception of a few routines to read with a specific encoding or save -toaspecific encoding, is completely agnostic about the original encoding -ofthedocument.

            It should be noted too that the HTML parser embedded in libxml2 nowobeythe -same rules too, the following document will be (as of 2.2.2) handledinan -internationalized fashion by libxml2 too:

            <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
            +  
          7. it can also be saved in another encoding supported by libxml2 (for + example straight UTF8 or even an ASCII form)
          8. +

            Another very important point is that the whole libxml2 API, with the +exception of a few routines to read with a specific encoding or save to a +specific encoding, is completely agnostic about the original encoding of the +document.

            It should be noted too that the HTML parser embedded in libxml2 now obey +the same rules too, the following document will be (as of 2.2.2) handled in +an internationalized fashion by libxml2 too:

            <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
                                   "http://www.w3.org/TR/REC-html40/loose.dtd">
             <html lang="fr">
             <head>
            @@ -52,60 +52,59 @@ internationalized fashion by libxml2 too:

            <!DOCTYPE HTML PUBLIC "-//W
             </head>
             <body>
             <p>W3C crée des standards pour le Web.</body>
            -</html>

            The internal encoding, how and why

            One of the core decisions was to force all documents to be converted -toadefault internal encoding, and that encoding to be UTF-8, here -aretherationales for those choices:

            • keeping the native encoding in the internal form would force - thelibxmlusers (or the code associated) to be fully aware of the encoding - oftheoriginal document, for examples when adding a text node to - adocument,the content would have to be provided in the document - encoding,i.e. theclient code would have to check it before hand, make - sure it'sconformantto the encoding, etc ... Very hard in practice, though - in somespecificcases this may make sense.
            • -
            • the second decision was which encoding. From the XML spec only - UTF8andUTF16 really makes sense as being the two only encodings for - whichthereis mandatory support. UCS-4 (32 bits fixed size encoding) - couldbeconsidered an intelligent choice too since it's a direct - Unicodemappingsupport. I selected UTF-8 on the basis of efficiency - andcompatibilitywith surrounding software: -
              • UTF-8 while a bit more complex to convert from/to (i.e.slightlymore - costly to import and export CPU wise) is also far morecompactthan - UTF-16 (and UCS-4) for a majority of the documents I seeit usedfor - right now (RPM RDF catalogs, advogato data, variousconfigurationfile - formats, etc.) and the key point for today'scomputerarchitecture is - efficient uses of caches. If one nearlydouble thememory requirement - to store the same amount of data, thiswill trashcaches (main - memory/external caches/internal caches) and mytake isthat this harms - the system far more than the CPU requirementsneededfor the conversion - to UTF-8
              • -
              • Most of libxml2 version 1 users were using it with - straightASCIImost of the time, doing the conversion with an - internalencodingrequiring all their code to be rewritten was a - seriousshow-stopperfor using UTF-16 or UCS-4.
              • -
              • UTF-8 is being used as the de-facto internal encoding - standardforrelated code like the pangoupcoming Gnome text widget, - anda lot of Unix code (yet another placewhere Unix programmer base - takesa different approach from Microsoft- they are using UTF-16)
              • +</html>

            The internal encoding, how and why

            One of the core decisions was to force all documents to be converted to a +default internal encoding, and that encoding to be UTF-8, here are the +rationales for those choices:

            • keeping the native encoding in the internal form would force the libxml + users (or the code associated) to be fully aware of the encoding of the + original document, for examples when adding a text node to a document, + the content would have to be provided in the document encoding, i.e. the + client code would have to check it before hand, make sure it's conformant + to the encoding, etc ... Very hard in practice, though in some specific + cases this may make sense.
            • +
            • the second decision was which encoding. From the XML spec only UTF8 and + UTF16 really makes sense as being the two only encodings for which there + is mandatory support. UCS-4 (32 bits fixed size encoding) could be + considered an intelligent choice too since it's a direct Unicode mapping + support. I selected UTF-8 on the basis of efficiency and compatibility + with surrounding software: +
              • UTF-8 while a bit more complex to convert from/to (i.e. slightly + more costly to import and export CPU wise) is also far more compact + than UTF-16 (and UCS-4) for a majority of the documents I see it used + for right now (RPM RDF catalogs, advogato data, various configuration + file formats, etc.) and the key point for today's computer + architecture is efficient uses of caches. If one nearly double the + memory requirement to store the same amount of data, this will trash + caches (main memory/external caches/internal caches) and my take is + that this harms the system far more than the CPU requirements needed + for the conversion to UTF-8
              • +
              • Most of libxml2 version 1 users were using it with straight ASCII + most of the time, doing the conversion with an internal encoding + requiring all their code to be rewritten was a serious show-stopper + for using UTF-16 or UCS-4.
              • +
              • UTF-8 is being used as the de-facto internal encoding standard for + related code like the pango + upcoming Gnome text widget, and a lot of Unix code (yet another place + where Unix programmer base takes a different approach from Microsoft + - they are using UTF-16)
            • -

            What does this mean in practice for the libxml2 user:

            • xmlChar, the libxml2 data type is a byte, those bytes must - beassembledas UTF-8 valid strings. The proper way to terminate an xmlChar - *stringis simply to append 0 byte, as usual.
            • -
            • One just need to make sure that when using chars outside the - ASCIIset,the values has been properly converted to UTF-8
            • -

            How is it implemented ?

            Let's describe how all this works within libxml, basically -theI18N(internationalization) support get triggered only during I/O -operation,i.e.when reading a document or saving one. Let's look first at -thereadingsequence:

            1. when a document is processed, we usually don't know the - encoding,asimple heuristic allows to detect UTF-16 and UCS-4 from - encodingswherethe ASCII range (0-0x7F) maps with ASCII
            2. -
            3. the xml declaration if available is parsed, including - theencodingdeclaration. At that point, if the autodetected encoding - isdifferentfrom the one declared a call to xmlSwitchEncoding() - isissued.
            4. -
            5. If there is no encoding declaration, then the input has to be - ineitherUTF-8 or UTF-16, if it is not then at some point when - processingtheinput, the converter/checker of UTF-8 form will raise an - encodingerror.You may end-up with a garbled document, or no document at - all !Example: +

              What does this mean in practice for the libxml2 user:

              • xmlChar, the libxml2 data type is a byte, those bytes must be assembled + as UTF-8 valid strings. The proper way to terminate an xmlChar * string + is simply to append 0 byte, as usual.
              • +
              • One just need to make sure that when using chars outside the ASCII set, + the values has been properly converted to UTF-8
              • +

              How is it implemented ?

              Let's describe how all this works within libxml, basically the I18N +(internationalization) support get triggered only during I/O operation, i.e. +when reading a document or saving one. Let's look first at the reading +sequence:

              1. when a document is processed, we usually don't know the encoding, a + simple heuristic allows to detect UTF-16 and UCS-4 from encodings where + the ASCII range (0-0x7F) maps with ASCII
              2. +
              3. the xml declaration if available is parsed, including the encoding + declaration. At that point, if the autodetected encoding is different + from the one declared a call to xmlSwitchEncoding() is issued.
              4. +
              5. If there is no encoding declaration, then the input has to be in either + UTF-8 or UTF-16, if it is not then at some point when processing the + input, the converter/checker of UTF-8 form will raise an encoding error. + You may end-up with a garbled document, or no document at all ! Example:
                ~/XML -> ./xmllint err.xml 
                 err.xml:1: error: Input is not proper UTF-8, indicate encoding !
                 <très>là</très>
                @@ -114,93 +113,94 @@ err.xml:1: error: Bytes: 0xE8 0x73 0x3E 0x6C
                 <très>là</très>
                    ^
              6. -
              7. xmlSwitchEncoding() does an encoding name lookup, canonicalize - it,andthen search the default registered encoding converters for - thatencoding.If it's not within the default set and iconv() support has - beencompiledit, it will ask iconv for such an encoder. If this fails then - theparserwill report an error and stops processing: +
              8. xmlSwitchEncoding() does an encoding name lookup, canonicalize it, and + then search the default registered encoding converters for that encoding. + If it's not within the default set and iconv() support has been compiled + it, it will ask iconv for such an encoder. If this fails then the parser + will report an error and stops processing:
                ~/XML -> ./xmllint err2.xml 
                 err2.xml:1: error: Unsupported encoding UnsupportedEnc
                 <?xml version="1.0" encoding="UnsupportedEnc"?>
                                                              ^
              9. -
              10. From that point the encoder processes progressively the input - (itisplugged as a front-end to the I/O module) for that entity. - Itcapturesand converts on-the-fly the document to be parsed to UTF-8. - Theparseritself just does UTF-8 checking of this input and - processittransparently. The only difference is that the encoding - informationhasbeen added to the parsing context (more precisely to - theinputcorresponding to this entity).
              11. -
              12. The result (when using DOM) is an internal form completely in - UTF-8withjust an encoding information on the document node.
              13. -

              Ok then what happens when saving the document (assuming -youcollected/builtan xmlDoc DOM like structure) ? It depends on the -functioncalled,xmlSaveFile() will just try to save in the original -encoding,whilexmlSaveFileTo() and xmlSaveFileEnc() can optionally save to -agivenencoding:

              1. if no encoding is given, libxml2 will look for an - encodingvalueassociated to the document and if it exists will try to save - tothatencoding, +
              2. From that point the encoder processes progressively the input (it is + plugged as a front-end to the I/O module) for that entity. It captures + and converts on-the-fly the document to be parsed to UTF-8. The parser + itself just does UTF-8 checking of this input and process it + transparently. The only difference is that the encoding information has + been added to the parsing context (more precisely to the input + corresponding to this entity).
              3. +
              4. The result (when using DOM) is an internal form completely in UTF-8 + with just an encoding information on the document node.
              5. +

              Ok then what happens when saving the document (assuming you +collected/built an xmlDoc DOM like structure) ? It depends on the function +called, xmlSaveFile() will just try to save in the original encoding, while +xmlSaveFileTo() and xmlSaveFileEnc() can optionally save to a given +encoding:

              1. if no encoding is given, libxml2 will look for an encoding value + associated to the document and if it exists will try to save to that + encoding,

                otherwise everything is written in the internal form, i.e. UTF-8

              2. -
              3. so if an encoding was specified, either at the API level or - onthedocument, libxml2 will again canonicalize the encoding name, - lookupfor aconverter in the registered set or through iconv. If not - foundthefunction will return an error code
              4. -
              5. the converter is placed before the I/O buffer layer, as another - kindofbuffer, then libxml2 will simply push the UTF-8 serialization - tothroughthat buffer, which will then progressively be converted and - pushedontothe I/O layer.
              6. -
              7. It is possible that the converter code fails on some input, - forexampletrying to push an UTF-8 encoded Chinese character through - theUTF-8 toISO-8859-1 converter won't work. Since the encoders - areprogressive theywill just report the error and the number of - bytesconverted, at thatpoint libxml2 will decode the offending - character,remove it from thebuffer and replace it with the associated - charRefencoding &#123; andresume the conversion. This guarantees that - anydocument will be savedwithout losses (except for markup names where - thisis not legal, this isa problem in the current version, in practice - avoidusing non-asciicharacters for tag or attribute names). A special - "ascii"encoding nameis used to save documents to a pure ascii form can be - usedwhenportability is really crucial
              8. +
              9. so if an encoding was specified, either at the API level or on the + document, libxml2 will again canonicalize the encoding name, lookup for a + converter in the registered set or through iconv. If not found the + function will return an error code
              10. +
              11. the converter is placed before the I/O buffer layer, as another kind of + buffer, then libxml2 will simply push the UTF-8 serialization to through + that buffer, which will then progressively be converted and pushed onto + the I/O layer.
              12. +
              13. It is possible that the converter code fails on some input, for example + trying to push an UTF-8 encoded Chinese character through the UTF-8 to + ISO-8859-1 converter won't work. Since the encoders are progressive they + will just report the error and the number of bytes converted, at that + point libxml2 will decode the offending character, remove it from the + buffer and replace it with the associated charRef encoding &#123; and + resume the conversion. This guarantees that any document will be saved + without losses (except for markup names where this is not legal, this is + a problem in the current version, in practice avoid using non-ascii + characters for tag or attribute names). A special "ascii" encoding name + is used to save documents to a pure ascii form can be used when + portability is really crucial

              Here are a few examples based on the same test document:

              ~/XML -> ./xmllint isolat1 
               <?xml version="1.0" encoding="ISO-8859-1"?>
               <très>là</très>
               ~/XML -> ./xmllint --encode UTF-8 isolat1 
               <?xml version="1.0" encoding="UTF-8"?>
               <très>là  </très>
              -~/XML -> 

              The same processing is applied (and reuse most of the code) for -HTMLI18Nprocessing. Looking up and modifying the content encoding is a -bitmoredifficult since it is located in a <meta> tag under -the<head>,so a couple of functions htmlGetMetaEncoding() -andhtmlSetMetaEncoding() havebeen provided. The parser also attempts to -switchencoding on the fly whendetecting such a tag on input. Except for that -theprocessing is the same(and again reuses the same code).

              Default supported encodings

              libxml2 has a set of default converters for the followingencodings(located -in encoding.c):

              1. UTF-8 is supported by default (null handlers)
              2. +~/XML ->

            The same processing is applied (and reuse most of the code) for HTML I18N +processing. Looking up and modifying the content encoding is a bit more +difficult since it is located in a <meta> tag under the <head>, +so a couple of functions htmlGetMetaEncoding() and htmlSetMetaEncoding() have +been provided. The parser also attempts to switch encoding on the fly when +detecting such a tag on input. Except for that the processing is the same +(and again reuses the same code).

            Default supported encodings

            libxml2 has a set of default converters for the following encodings +(located in encoding.c):

            1. UTF-8 is supported by default (null handlers)
            2. UTF-16, both little and big endian
            3. ISO-Latin-1 (ISO-8859-1) covering most western languages
            4. ASCII, useful mostly for saving
            5. -
            6. HTML, a specific handler for the conversion of UTF-8 to ASCII - withHTMLpredefined entities like &copy; for the Copyright sign.
            7. -

            More over when compiled on an Unix platform with iconv support the -fullsetof encodings supported by iconv can be instantly be used by libxml. On -alinuxmachine with glibc-2.1 the list of supported encodings and aliases -fill3 fullpages, and include UCS-4, the full set of ISO-Latin encodings, and -thevariousJapanese ones.

            To convert from the UTF-8 values returned from the API to -anotherencodingthen it is possible to use the function provided from the encoding modulelike UTF8Toisolat1, or -usethePOSIX iconv()APIdirectly.

            Encoding aliases

            From 2.2.3, libxml2 has support to register encoding names aliases.Thegoal -is to be able to parse document whose encoding is supported butwherethe name -differs (for example from the default set of names acceptedbyiconv). The -following functions allow to register and handle new aliasesforexisting -encodings. Once registered libxml2 will automatically lookupthealiases when -handling a document:

            • int xmlAddEncodingAlias(const char *name, const char *alias);
            • +
            • HTML, a specific handler for the conversion of UTF-8 to ASCII with HTML + predefined entities like &copy; for the Copyright sign.
            • +

              More over when compiled on an Unix platform with iconv support the full +set of encodings supported by iconv can be instantly be used by libxml. On a +linux machine with glibc-2.1 the list of supported encodings and aliases fill +3 full pages, and include UCS-4, the full set of ISO-Latin encodings, and the +various Japanese ones.

              To convert from the UTF-8 values returned from the API to another encoding +then it is possible to use the function provided from the encoding module like UTF8Toisolat1, or use the +POSIX iconv() +API directly.

              Encoding aliases

              From 2.2.3, libxml2 has support to register encoding names aliases. The +goal is to be able to parse document whose encoding is supported but where +the name differs (for example from the default set of names accepted by +iconv). The following functions allow to register and handle new aliases for +existing encodings. Once registered libxml2 will automatically lookup the +aliases when handling a document:

              • int xmlAddEncodingAlias(const char *name, const char *alias);
              • int xmlDelEncodingAlias(const char *alias);
              • const char * xmlGetEncodingAlias(const char *alias);
              • void xmlCleanupEncodingAliases(void);
              • -

              How to extend the existing support

              Well adding support for new encoding, or overriding one of -theencoders(assuming it is buggy) should not be hard, just write input -andoutputconversion routines to/from UTF-8, and register -themusingxmlNewCharEncodingHandler(name, xxxToUTF8, UTF8Toxxx), and they -willbecalled automatically if the parser(s) encounter such an -encodingname(register it uppercase, this will help). The description of -theencoders,their arguments and expected return values are described in -theencoding.hheader.

              Daniel Veillard

            +

            How to extend the existing support

            Well adding support for new encoding, or overriding one of the encoders +(assuming it is buggy) should not be hard, just write input and output +conversion routines to/from UTF-8, and register them using +xmlNewCharEncodingHandler(name, xxxToUTF8, UTF8Toxxx), and they will be +called automatically if the parser(s) encounter such an encoding name +(register it uppercase, this will help). The description of the encoders, +their arguments and expected return values are described in the encoding.h +header.

            Daniel Veillard

          diff --git a/doc/entities.html b/doc/entities.html index 732562a..c234b41 100644 --- a/doc/entities.html +++ b/doc/entities.html @@ -7,35 +7,34 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -Entities or no entities
          Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
          Made with Libxml2 Logo

          The XML C parser and toolkit of Gnome

          Entities or no entities

          Developer Menu
          API Indexes
          Related links

          Entities in principle are similar to simple C macros. An entity -definesanabbreviation for a given string that you can reuse many times -throughoutthecontent of your document. Entities are especially useful when a -givenstringmay occur frequently within a document, or to confine the change -neededto adocument to a restricted area in the internal subset of the -document (atthebeginning). Example:

          1 <?xml version="1.0"?>
          +Entities or no entities
          Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
          Made with Libxml2 Logo

          The XML C parser and toolkit of Gnome

          Entities or no entities

          Developer Menu
          API Indexes
          Related links

          Entities in principle are similar to simple C macros. An entity defines an +abbreviation for a given string that you can reuse many times throughout the +content of your document. Entities are especially useful when a given string +may occur frequently within a document, or to confine the change needed to a +document to a restricted area in the internal subset of the document (at the +beginning). Example:

          1 <?xml version="1.0"?>
           2 <!DOCTYPE EXAMPLE SYSTEM "example.dtd" [
           3 <!ENTITY xml "Extensible Markup Language">
           4 ]>
           5 <EXAMPLE>
           6    &xml;
          -7 </EXAMPLE>

          Line 3 declares the xml entity. Line 6 uses the xml entity, byprefixingits -name with '&' and following it by ';' without any spacesadded. Thereare 5 -predefined entities in libxml2 allowing you to escapecharacters -withpredefined meaning in some parts of the xml -documentcontent:&lt;for the character -'<',&gt;for the character -'>',&apos;for the -character''',&quot;for the character -'"',and&amp;for the character '&'.

          One of the problems related to entities is that you may want the -parsertosubstitute an entity's content so that you can see the replacement -textinyour application. Or you may prefer to keep entity references as such -inthecontent to be able to save the document back without losing -thisusuallyprecious information (if the user went through the pain -ofexplicitlydefining entities, he may have a a rather negative attitude if -youblindlysubstitute them as saving time). The xmlSubstituteEntitiesDefault()functionallows -you to check and change the behaviour, which is to notsubstituteentities by -default.

          Here is the DOM tree built by libxml2 for the previous document -inthedefault case:

          /gnome/src/gnome-xml -> ./xmllint --debug test/ent1
          +7 </EXAMPLE>

          Line 3 declares the xml entity. Line 6 uses the xml entity, by prefixing +its name with '&' and following it by ';' without any spaces added. There +are 5 predefined entities in libxml2 allowing you to escape characters with +predefined meaning in some parts of the xml document content: +&lt; for the character '<', &gt; +for the character '>', &apos; for the character ''', +&quot; for the character '"', and +&amp; for the character '&'.

          One of the problems related to entities is that you may want the parser to +substitute an entity's content so that you can see the replacement text in +your application. Or you may prefer to keep entity references as such in the +content to be able to save the document back without losing this usually +precious information (if the user went through the pain of explicitly +defining entities, he may have a a rather negative attitude if you blindly +substitute them as saving time). The xmlSubstituteEntitiesDefault() +function allows you to check and change the behaviour, which is to not +substitute entities by default.

          Here is the DOM tree built by libxml2 for the previous document in the +default case:

          /gnome/src/gnome-xml -> ./xmllint --debug test/ent1
           DOCUMENT
           version=1.0
              ELEMENT EXAMPLE
          @@ -50,17 +49,16 @@ DOCUMENT
           version=1.0
              ELEMENT EXAMPLE
                TEXT
          -     content=     Extensible Markup Language

          So, entities or no entities? Basically, it depends on your use -case.Isuggest that you keep the non-substituting default behaviour and -avoidusingentities in your XML document or data if you are not willing to -handletheentity references elements in the DOM tree.

          Note that at save time libxml2 enforces the conversion of -thepredefinedentities where necessary to prevent well-formedness problems, -andwill alsotransparently replace those with chars (i.e. it will not -generateentityreference elements in the DOM tree or call the reference() SAX -callbackwhenfinding them in the input).

          WARNING: handlingentitieson -top of the libxml2 SAX interface is difficult!!! If you plan -tousenon-predefined entities in your documents, then the learning curve -tohandlethen using the SAX API may be long. If you plan to use -complexdocuments, Istrongly suggest you consider using the DOM interface -instead andlet libxmldeal with the complexity rather than trying to do it -yourself.

          Daniel Veillard

          + content= Extensible Markup Language

          So, entities or no entities? Basically, it depends on your use case. I +suggest that you keep the non-substituting default behaviour and avoid using +entities in your XML document or data if you are not willing to handle the +entity references elements in the DOM tree.

          Note that at save time libxml2 enforces the conversion of the predefined +entities where necessary to prevent well-formedness problems, and will also +transparently replace those with chars (i.e. it will not generate entity +reference elements in the DOM tree or call the reference() SAX callback when +finding them in the input).

          WARNING: handling entities +on top of the libxml2 SAX interface is difficult!!! If you plan to use +non-predefined entities in your documents, then the learning curve to handle +then using the SAX API may be long. If you plan to use complex documents, I +strongly suggest you consider using the DOM interface instead and let libxml +deal with the complexity rather than trying to do it yourself.

          Daniel Veillard

          diff --git a/doc/example.html b/doc/example.html index 194f619..894f03a 100644 --- a/doc/example.html +++ b/doc/example.html @@ -7,11 +7,11 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -A real example
          Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
          Made with Libxml2 Logo

          The XML C parser and toolkit of Gnome

          A real example

          Developer Menu
          API Indexes
          Related links

          Here is a real size example, where the actual content of -theapplicationdata is not kept in the DOM tree but uses internal structures. -Itis based ona proposal to keep a database of jobs related to Gnome, with -anXML basedstorage structure. Here is an XML -encodedjobsbase:

          <?xml version="1.0"?>
          +A real example
          Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
          Made with Libxml2 Logo

          The XML C parser and toolkit of Gnome

          A real example

          Developer Menu
          API Indexes
          Related links

          Here is a real size example, where the actual content of the application +data is not kept in the DOM tree but uses internal structures. It is based on +a proposal to keep a database of jobs related to Gnome, with an XML based +storage structure. Here is an XML encoded jobs +base:

          <?xml version="1.0"?>
           <gjob:Helping xmlns:gjob="http://www.gnome.org/some-location">
             <gjob:Jobs>
           
          @@ -66,14 +66,13 @@ encodedjobsbase:

          <?xml version="1.0"?>
               </gjob:Job>
           
             </gjob:Jobs>
          -</gjob:Helping>

          While loading the XML file into an internal DOM tree is a matter -ofcallingonly a couple of functions, browsing the tree to gather the data -andgeneratethe internal structures is harder, and more error prone.

          The suggested principle is to be tolerant with respect to -theinputstructure. For example, the ordering of the attributes is -notsignificant,the XML specification is clear about it. It's also usually a -goodidea not todepend on the order of the children of a given node, unless -itreally makesthings harder. Here is some code to parse the information for -aperson:

          /*
          +</gjob:Helping>

          While loading the XML file into an internal DOM tree is a matter of +calling only a couple of functions, browsing the tree to gather the data and +generate the internal structures is harder, and more error prone.

          The suggested principle is to be tolerant with respect to the input +structure. For example, the ordering of the attributes is not significant, +the XML specification is clear about it. It's also usually a good idea not to +depend on the order of the children of a given node, unless it really makes +things harder. Here is some code to parse the information for a person:

          /*
            * A person record
            */
           typedef struct person {
          @@ -114,22 +113,21 @@ DEBUG("parsePerson\n");
               }
           
               return(ret);
          -}

          Here are a couple of things to notice:

          • Usually a recursive parsing style is the more convenient one: XMLdatais - by nature subject to repetitive constructs and usually - exhibitshighlystructured patterns.
          • -
          • The two arguments of type xmlDocPtrand - xmlNsPtr,i.e.the pointer to the global XML document and the - namespace reserved totheapplication. Document wide information are needed - for example todecodeentities and it's a good coding practice to define a - namespace foryourapplication set of data and test that the element and - attributesyou'reanalyzing actually pertains to your application space. - This isdone by asimple equality test (cur->ns == ns).
          • -
          • To retrieve text and attributes value, you can use - thefunctionxmlNodeListGetStringto gather all the text and - entityreferencenodes generated by the DOM output and produce an single - textstring.
          • -

          Here is another piece of code used to parse another level -ofthestructure:

          #include <libxml/tree.h>
          +}

          Here are a couple of things to notice:

          • Usually a recursive parsing style is the more convenient one: XML data + is by nature subject to repetitive constructs and usually exhibits highly + structured patterns.
          • +
          • The two arguments of type xmlDocPtr and xmlNsPtr, + i.e. the pointer to the global XML document and the namespace reserved to + the application. Document wide information are needed for example to + decode entities and it's a good coding practice to define a namespace for + your application set of data and test that the element and attributes + you're analyzing actually pertains to your application space. This is + done by a simple equality test (cur->ns == ns).
          • +
          • To retrieve text and attributes value, you can use the function + xmlNodeListGetString to gather all the text and entity reference + nodes generated by the DOM output and produce an single text string.
          • +

          Here is another piece of code used to parse another level of the +structure:

          #include <libxml/tree.h>
           /*
            * a Description for a Job
            */
          @@ -179,10 +177,10 @@ DEBUG("parseJob\n");
               }
           
               return(ret);
          -}

          Once you are used to it, writing this kind of code is quite -simple,butboring. Ultimately, it could be possible to write stubbers taking -eitherCdata structure definitions, a set of XML examples or an XML DTD -andproducethe code needed to import and export the content between C data -andXMLstorage. This is left as an exercise to the reader :-)

          Feel free to use the code for the -fullCparsing exampleas a template, it is also available with Makefile -intheGnome CVS base under gnome-xml/example

          Daniel Veillard

          +}

          Once you are used to it, writing this kind of code is quite simple, but +boring. Ultimately, it could be possible to write stubbers taking either C +data structure definitions, a set of XML examples or an XML DTD and produce +the code needed to import and export the content between C data and XML +storage. This is left as an exercise to the reader :-)

          Feel free to use the code for the full C +parsing example as a template, it is also available with Makefile in the +Gnome CVS base under gnome-xml/example

          Daniel Veillard

          diff --git a/doc/examples/Makefile.am b/doc/examples/Makefile.am index 55a674d..cd9f4ef 100644 --- a/doc/examples/Makefile.am +++ b/doc/examples/Makefile.am @@ -9,6 +9,7 @@ examples.xml: index.py *.c -@($(srcdir)/index.py) index.html: examples.xml examples.xsl + -@(touch index.html) -@(xsltproc examples.xsl examples.xml && echo "Rebuilt web page" && xmllint --valid --noout index.html) install-data-local: diff --git a/doc/examples/Makefile.in b/doc/examples/Makefile.in index b0b4d33..f8af861 100644 --- a/doc/examples/Makefile.in +++ b/doc/examples/Makefile.in @@ -196,6 +196,7 @@ RDL_LIBS = @RDL_LIBS@ READER_TEST = @READER_TEST@ RELDATE = @RELDATE@ RM = @RM@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STATIC_BINARIES = @STATIC_BINARIES@ @@ -224,6 +225,7 @@ THREAD_CFLAGS = @THREAD_CFLAGS@ THREAD_LIBS = @THREAD_LIBS@ U = @U@ VERSION = @VERSION@ +WGET = @WGET@ WIN32_EXTRA_LDFLAGS = @WIN32_EXTRA_LDFLAGS@ WIN32_EXTRA_LIBADD = @WIN32_EXTRA_LIBADD@ WITH_C14N = @WITH_C14N@ @@ -259,6 +261,7 @@ WITH_WRITER = @WITH_WRITER@ WITH_XINCLUDE = @WITH_XINCLUDE@ WITH_XPATH = @WITH_XPATH@ WITH_XPTR = @WITH_XPTR@ +WITH_ZLIB = @WITH_ZLIB@ XINCLUDE_OBJ = @XINCLUDE_OBJ@ XMLLINT = @XMLLINT@ XML_CFLAGS = @XML_CFLAGS@ @@ -696,6 +699,7 @@ examples.xml: index.py *.c -@($(srcdir)/index.py) index.html: examples.xml examples.xsl + -@(touch index.html) -@(xsltproc examples.xsl examples.xml && echo "Rebuilt web page" && xmllint --valid --noout index.html) install-data-local: diff --git a/doc/help.html b/doc/help.html index a660a87..5559007 100644 --- a/doc/help.html +++ b/doc/help.html @@ -7,17 +7,19 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -How to help
          Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
          Made with Libxml2 Logo

          The XML C parser and toolkit of Gnome

          How to help

          Main Menu
          Related links

          You can help the project in various ways, the best thing to do first -istosubscribe to the mailing-list as explained before, check the archives and the Gnomebugdatabase:

          1. Provide patches when you find problems.
          2. -
          3. Provide the diffs when you port libxml2 to a new platform. They - maynotbe integrated in all cases but help pinpointing - portabilityproblemsand
          4. -
          5. Provide documentation fixes (either as patches to the code commentsoras - HTML diffs).
          6. -
          7. Provide new documentations pieces (translations, examples, etc...).
          8. +How to help
            Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
            Made with Libxml2 Logo

            The XML C parser and toolkit of Gnome

            How to help

            Main Menu
            Related links

            You can help the project in various ways, the best thing to do first is to +subscribe to the mailing-list as explained before, check the archives and the Gnome bug +database:

            1. Provide patches when you find problems.
            2. +
            3. Provide the diffs when you port libxml2 to a new platform. They may not + be integrated in all cases but help pinpointing portability problems + and
            4. +
            5. Provide documentation fixes (either as patches to the code comments or + as HTML diffs).
            6. +
            7. Provide new documentations pieces (translations, examples, etc + ...).
            8. Check the TODO file and try to close one of the items.
            9. -
            10. Take one of the points raised in the archive or the bug - databaseandprovide a fix. Get in - touch withmebefore to avoid synchronization problems and check that - thesuggestedfix will fit in nicely :-)
            11. +
            12. Take one of the points raised in the archive or the bug database and + provide a fix. Get in touch with me + before to avoid synchronization problems and check that the suggested + fix will fit in nicely :-)

            Daniel Veillard

            diff --git a/doc/html/index.html b/doc/html/index.html deleted file mode 100644 index 4a4962a..0000000 --- a/doc/html/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - -Reference Manual for libxml2
            Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
            Made with Libxml2 Logo

            Reference Manual for libxml2

            API Menu
            API Indexes
            Related links

            Table of Contents

            • DOCBparser: old DocBook SGML parser
            • HTMLparser: interface for an HTML 4.0 non-verifying parser
            • HTMLtree: specific APIs to process HTML tree, especially serialization
            • SAX: Old SAX version 1 handler, deprecated
            • SAX2: SAX2 parser interface used to build the DOM tree
            • c14n: Provide Canonical XML and Exclusive XML Canonicalization
            • catalog: interfaces to the Catalog handling system
            • chvalid: Unicode character range checking
            • debugXML: Tree debugging APIs
            • dict: string dictionnary
            • encoding: interface for the encoding conversion functions
            • entities: interface for the XML entities handling
            • globals: interface for all global variables of the library
            • hash: Chained hash tables
            • list: lists interfaces
            • nanoftp: minimal FTP implementation
            • nanohttp: minimal HTTP implementation
            • parser: the core parser module
            • parserInternals: internals routines exported by the parser.
            • pattern: pattern expression handling
            • relaxng: implementation of the Relax-NG validation
            • schemasInternals: internal interfaces for XML Schemas
            • schematron: XML Schemastron implementation
            • threads: interfaces for thread handling
            • tree: interfaces for tree manipulation
            • uri: library of generic URI related routines
            • valid: The DTD validation
            • xinclude: implementation of XInclude
            • xlink: unfinished XLink detection module
            • xmlIO: interface for the I/O interfaces used by the parser
            • xmlautomata: API to build regexp automata
            • xmlerror: error handling
            • xmlexports: macros for marking symbols as exportable/importable.
            • xmlmemory: interface for the memory allocator
            • xmlmodule: dynamic module loading
            • xmlreader: the XMLReader implementation
            • xmlregexp: regular expressions handling
            • xmlsave: the XML document serializer
            • xmlschemas: incomplete XML Schemas structure implementation
            • xmlschemastypes: implementation of XML Schema Datatypes
            • xmlstring: set of routines to process strings
            • xmlunicode: Unicode character APIs
            • xmlversion: compile-time version informations
            • xmlwriter: text writing API for XML
            • xpath: XML Path Language implementation
            • xpathInternals: internal interfaces for XML Path Language implementation
            • xpointer: API to handle XML Pointers

            Daniel Veillard

            diff --git a/doc/html/libxml-HTMLparser.html b/doc/html/libxml-HTMLparser.html index adc6875..694a08f 100644 --- a/doc/html/libxml-HTMLparser.html +++ b/doc/html/libxml-HTMLparser.html @@ -46,6 +46,7 @@ A:link, A:visited, A:active { text-decoration: underline }
            int	htmlHandleOmittedElem		(int val)
            int	htmlIsAutoClosed		(htmlDocPtr doc, 
            htmlNodePtr elem)
            int	htmlIsScriptAttribute		(const xmlChar * name)
            +
            htmlParserCtxtPtr	htmlNewParserCtxt	(void)
            htmlStatus	htmlNodeStatus		(const htmlNodePtr node, 
            int legacy)
            int	htmlParseCharRef		(htmlParserCtxtPtr ctxt)
            int	htmlParseChunk			(htmlParserCtxtPtr ctxt, 
            const char * chunk,
            int size,
            int terminate)
            @@ -143,7 +144,9 @@ A:link, A:visited, A:active { text-decoration: underline }

            The HTML DTD allows a tag to implicitly close other tags. The list is kept in htmlStartClose array. This function checks if a tag is autoclosed by one of it's child

            doc:the HTML document
            elem:the HTML element
            Returns:1 if autoclosed, 0 otherwise

            Function: htmlIsScriptAttribute

            int	htmlIsScriptAttribute		(const xmlChar * name)

            Check if an attribute is of content type Script

            -
            name:an attribute name
            Returns:1 is the attribute is a script 0 otherwise

            Function: htmlNodeStatus

            htmlStatus	htmlNodeStatus		(const htmlNodePtr node, 
            int legacy)
            +
            name:an attribute name
            Returns:1 is the attribute is a script 0 otherwise

            Function: htmlNewParserCtxt

            htmlParserCtxtPtr	htmlNewParserCtxt	(void)
            +

            Allocate and initialize a new parser context.

            +
            Returns:the htmlParserCtxtPtr or NULL in case of allocation error

            Function: htmlNodeStatus

            htmlStatus	htmlNodeStatus		(const htmlNodePtr node, 
            int legacy)

            Checks whether the tree node is valid. Experimental (the author only uses the HTML enhancements in a SAX parser)

            node:an htmlNodePtr in a tree
            legacy:whether to allow deprecated elements (YES is faster here for Element nodes)
            Returns:for Element nodes, a return from htmlElementAllowedHere (if legacy allowed) or htmlElementStatusHere (otherwise). for Attribute nodes, a return from htmlAttrAllowed for other nodes, HTML_NA (no checks performed)

            Function: htmlParseCharRef

            int	htmlParseCharRef		(htmlParserCtxtPtr ctxt)

            parse Reference declarations [66] CharRef ::= '&#' [0-9]+ ';' | '&#x' [0-9a-fA-F]+ ';'

            diff --git a/doc/html/libxml-parser.html b/doc/html/libxml-parser.html index 438500b..b0849cf 100644 --- a/doc/html/libxml-parser.html +++ b/doc/html/libxml-parser.html @@ -223,6 +223,7 @@ void xmlParserInputDeallocate (XML_WITH_DEBUG = 28 XML_WITH_DEBUG_MEM = 29 XML_WITH_DEBUG_RUN = 30 + XML_WITH_ZLIB = 31 XML_WITH_NONE = 99999 : just to be sure of allocation size }

            Enum xmlParserInputState

            Enum xmlParserInputState {
            @@ -280,7 +281,7 @@ void	xmlParserInputDeallocate	(XML_PARSE_NSCLEAN = 8192 : remove redundant namespaces declarations
                 XML_PARSE_NOCDATA = 16384 : merge CDATA as text nodes
                 XML_PARSE_NOXINCNODE = 32768 : do not generate XINCLUDE START/END nodes
            -    XML_PARSE_COMPACT = 65536 : compact small text nodes
            +    XML_PARSE_COMPACT = 65536 : compact small text nodes; no modification of the tree allowed afterwards (will possibly crash if you try to modify the tree)
             }
             

            Structure xmlSAXHandlerV1

            Structure xmlSAXHandlerV1
            struct _xmlSAXHandlerV1 { internalSubsetSAXFunc internalSubset @@ -446,7 +447,7 @@ void warningSAXFunc (void * ctx,
            const char * msg,
            ...

            Examines if the library has been compiled with a given feature.

            feature:the feature to be examined
            Returns:a non-zero value if the feature exist, otherwise zero. Returns zero (0) if the feature does not exist or an unknown unknown feature is requested, non-zero otherwise.

            Function: xmlIOParseDTD

            xmlDtdPtr	xmlIOParseDTD		(xmlSAXHandlerPtr sax, 
            xmlParserInputBufferPtr input,
            xmlCharEncoding enc)

            Load and parse a DTD

            -
            sax:the SAX handler block or NULL
            input:an Input Buffer
            enc:the charset encoding if known
            Returns:the resulting xmlDtdPtr or NULL in case of error. @input will be freed at parsing end.

            Function: xmlInitNodeInfoSeq

            void	xmlInitNodeInfoSeq		(xmlParserNodeInfoSeqPtr seq)
            +
            sax:the SAX handler block or NULL
            input:an Input Buffer
            enc:the charset encoding if known
            Returns:the resulting xmlDtdPtr or NULL in case of error. @input will be freed by the function in any case.

            Function: xmlInitNodeInfoSeq

            void	xmlInitNodeInfoSeq		(xmlParserNodeInfoSeqPtr seq)

            -- Initialize (set to initial state) node info sequence

            seq:a node info sequence pointer

            Function: xmlInitParser

            void	xmlInitParser			(void)

            Initialization function for the XML parser. This is not reentrant. Call once before processing in case of use in multithreaded programs.

            diff --git a/doc/html/libxml-tree.html b/doc/html/libxml-tree.html index 9e45be1..26ec73b 100644 --- a/doc/html/libxml-tree.html +++ b/doc/html/libxml-tree.html @@ -95,6 +95,9 @@ A:link, A:visited, A:active { text-decoration: underline }
            xmlAttrPtr	xmlCopyProp		(xmlNodePtr target, 
            xmlAttrPtr cur)
            xmlAttrPtr	xmlCopyPropList		(xmlNodePtr target, 
            xmlAttrPtr cur)
            xmlDtdPtr	xmlCreateIntSubset	(xmlDocPtr doc, 
            const xmlChar * name,
            const xmlChar * ExternalID,
            const xmlChar * SystemID)
            +
            Function type: xmlDOMWrapAcquireNsFunction
            +xmlNsPtr	xmlDOMWrapAcquireNsFunction	(xmlDOMWrapCtxtPtr ctxt, 
            xmlNodePtr node,
            const xmlChar * nsName,
            const xmlChar * nsPrefix) +
            int	xmlDOMWrapAdoptNode		(xmlDOMWrapCtxtPtr ctxt, 
            xmlDocPtr sourceDoc,
            xmlNodePtr node,
            xmlDocPtr destDoc,
            xmlNodePtr destParent,
            int options)
            int	xmlDOMWrapCloneNode		(xmlDOMWrapCtxtPtr ctxt, 
            xmlDocPtr sourceDoc,
            xmlNodePtr node,
            xmlNodePtr * resNode,
            xmlDocPtr destDoc,
            xmlNodePtr destParent,
            int deep,
            int options)
            void	xmlDOMWrapFreeCtxt		(xmlDOMWrapCtxtPtr ctxt)
            @@ -280,7 +283,10 @@ A:link, A:visited, A:active { text-decoration: underline } XML_BUFFER_ALLOC_IMMUTABLE = 3 }

            Structure xmlDOMWrapCtxt

            Structure xmlDOMWrapCtxt
            struct _xmlDOMWrapCtxt { - void * _private + void * _private : * The type of this context, just in case + int type : * Internal namespace map used for variou + void * namespaceMap : * Use this one to acquire an xmlNsPtr in + xmlDOMWrapAcquireNsFunction getNsForNodeFunc }

            Structure xmlDoc

            Structure xmlDoc
            struct _xmlDoc { void * _private : application data xmlElementType type : XML_DOCUMENT_NODE, must be second ! @@ -406,6 +412,7 @@ A:link, A:visited, A:active { text-decoration: underline } struct _xmlEntity * nexte : unused const xmlChar * URI : the full URI as computed int owner : does the entity own the childrens + int checked : was the entity content checked }

            Structure xmlEnumeration

            Structure xmlEnumeration
            struct _xmlEnumeration { struct _xmlEnumeration * next : next one const xmlChar * name : Enumeration name @@ -443,6 +450,7 @@ A:link, A:visited, A:active { text-decoration: underline } const xmlChar * href : URL for the namespace const xmlChar * prefix : prefix for the namespace void * _private : application data + struct _xmlDoc * context : normally an xmlDoc }

            Structure xmlOutputBuffer

            Structure xmlOutputBuffer
            struct _xmlOutputBuffer { void * context xmlOutputWriteCallback writecallback @@ -674,18 +682,21 @@ A:link, A:visited, A:active { text-decoration: underline }

            Do a copy of an attribute list.

            target:the element where the attributes will be grafted
            cur:the first attribute
            Returns:a new #xmlAttrPtr, or NULL in case of error.

            Function: xmlCreateIntSubset

            xmlDtdPtr	xmlCreateIntSubset	(xmlDocPtr doc, 
            const xmlChar * name,
            const xmlChar * ExternalID,
            const xmlChar * SystemID)

            Create the internal subset of a document

            -
            doc:the document pointer
            name:the DTD name
            ExternalID:the external (PUBLIC) ID
            SystemID:the system ID
            Returns:a pointer to the new DTD structure

            Function: xmlDOMWrapAdoptNode

            int	xmlDOMWrapAdoptNode		(xmlDOMWrapCtxtPtr ctxt, 
            xmlDocPtr sourceDoc,
            xmlNodePtr node,
            xmlDocPtr destDoc,
            xmlNodePtr destParent,
            int options)
            -

            References of out-of scope ns-decls are remapped to point to @destDoc: 1) If @destParent is given, then nsDef entries on element-nodes are used 2) If *no* @destParent is given, then @destDoc->oldNs entries are used This is the case when you have an unliked node and just want to move it to the context of If @destParent is given, it ensures that the tree is namespace wellformed by creating additional ns-decls where needed. Note that, since prefixes of already existent ns-decls can be shadowed by this process, it could break QNames in attribute values or element content. WARNING: This function is in a experimental state.

            +
            doc:the document pointer
            name:the DTD name
            ExternalID:the external (PUBLIC) ID
            SystemID:the system ID
            Returns:a pointer to the new DTD structure

            Function type: xmlDOMWrapAcquireNsFunction

            Function type: xmlDOMWrapAcquireNsFunction
            +xmlNsPtr	xmlDOMWrapAcquireNsFunction	(xmlDOMWrapCtxtPtr ctxt, 
            xmlNodePtr node,
            const xmlChar * nsName,
            const xmlChar * nsPrefix) +

            A function called to acquire namespaces (xmlNs) from the wrapper.

            ctxt:a DOM wrapper context
            node:the context node (element or attribute)
            nsName:the requested namespace name
            nsPrefix:the requested namespace prefix
            Returns:an xmlNsPtr or NULL in case of an error.

            +

            Function: xmlDOMWrapAdoptNode

            int	xmlDOMWrapAdoptNode		(xmlDOMWrapCtxtPtr ctxt, 
            xmlDocPtr sourceDoc,
            xmlNodePtr node,
            xmlDocPtr destDoc,
            xmlNodePtr destParent,
            int options)
            +

            References of out-of scope ns-decls are remapped to point to @destDoc: 1) If @destParent is given, then nsDef entries on element-nodes are used 2) If *no* @destParent is given, then @destDoc->oldNs entries are used This is the case when you have an unliked node and just want to move it to the context of If @destParent is given, it ensures that the tree is namespace wellformed by creating additional ns-decls where needed. Note that, since prefixes of already existent ns-decls can be shadowed by this process, it could break QNames in attribute values or element content. NOTE: This function was not intensively tested.

            ctxt:the optional context for custom processing
            sourceDoc:the optional sourceDoc
            node:the node to start with
            destDoc:the destination doc
            destParent:the optional new parent of @node in @destDoc
            options:option flags
            Returns:0 if the operation succeeded, 1 if a node of unsupported type was given, 2 if a node of not yet supported type was given and -1 on API/internal errors.

            Function: xmlDOMWrapCloneNode

            int	xmlDOMWrapCloneNode		(xmlDOMWrapCtxtPtr ctxt, 
            xmlDocPtr sourceDoc,
            xmlNodePtr node,
            xmlNodePtr * resNode,
            xmlDocPtr destDoc,
            xmlNodePtr destParent,
            int deep,
            int options)
            -

            References of out-of scope ns-decls are remapped to point to @destDoc: 1) If @destParent is given, then nsDef entries on element-nodes are used 2) If *no* @destParent is given, then @destDoc->oldNs entries are used This is the case when you have an unliked node and just want to move it to the context of If @destParent is given, it ensures that the tree is namespace wellformed by creating additional ns-decls where needed. Note that, since prefixes of already existent ns-decls can be shadowed by this process, it could break QNames in attribute values or element content. TODO: 1) Support dicts Optimize string adoption for equal or none dicts. 2) XInclude WARNING: This function is in a experimental state and should only be currently only be used to test it.

            +

            References of out-of scope ns-decls are remapped to point to @destDoc: 1) If @destParent is given, then nsDef entries on element-nodes are used 2) If *no* @destParent is given, then @destDoc->oldNs entries are used. This is the case when you don't know already where the cloned branch will be added to. If @destParent is given, it ensures that the tree is namespace wellformed by creating additional ns-decls where needed. Note that, since prefixes of already existent ns-decls can be shadowed by this process, it could break QNames in attribute values or element content. TODO: 1) What to do with XInclude? Currently this returns an error for XInclude.

            ctxt:the optional context for custom processing
            sourceDoc:the optional sourceDoc
            node:the node to start with
            resNode:the clone of the given @node
            destDoc:the destination doc
            destParent:the optional new parent of @node in @destDoc
            deep:descend into child if set
            options:option flags
            Returns:0 if the operation succeeded, 1 if a node of unsupported (or not yet supported) type was given, -1 on API/internal errors.

            Function: xmlDOMWrapFreeCtxt

            void	xmlDOMWrapFreeCtxt		(xmlDOMWrapCtxtPtr ctxt)

            Frees the DOM-wrapper context.

            ctxt:the DOM-wrapper context

            Function: xmlDOMWrapNewCtxt

            xmlDOMWrapCtxtPtr	xmlDOMWrapNewCtxt	(void)

            Allocates and initializes a new DOM-wrapper context.

            Returns:the xmlDOMWrapCtxtPtr or NULL in case of an internal errror.

            Function: xmlDOMWrapReconcileNamespaces

            int	xmlDOMWrapReconcileNamespaces	(xmlDOMWrapCtxtPtr ctxt, 
            xmlNodePtr elem,
            int options)
            -

            Ensures that ns-references point to ns-decls hold on element-nodes. Ensures that the tree is namespace wellformed by creating additional ns-decls where needed. Note that, since prefixes of already existent ns-decls can be shadowed by this process, it could break QNames in attribute values or element content. WARNING: This function is in a experimental state.

            +

            Ensures that ns-references point to ns-decls hold on element-nodes. Ensures that the tree is namespace wellformed by creating additional ns-decls where needed. Note that, since prefixes of already existent ns-decls can be shadowed by this process, it could break QNames in attribute values or element content. NOTE: This function was not intensively tested.

            ctxt:DOM wrapper context, unused at the moment
            elem:the element-node
            options:option flags
            Returns:0 if succeeded, -1 otherwise and on API/internal errors.

            Function: xmlDOMWrapRemoveNode

            int	xmlDOMWrapRemoveNode		(xmlDOMWrapCtxtPtr ctxt, 
            xmlDocPtr doc,
            xmlNodePtr node,
            int options)
            -

            Unlinks the given node from its owner. This will substitute ns-references to node->nsDef for ns-references to doc->oldNs, thus ensuring the removed branch to be autark wrt ns-references. WARNING: This function is in a experimental state.

            +

            Unlinks the given node from its owner. This will substitute ns-references to node->nsDef for ns-references to doc->oldNs, thus ensuring the removed branch to be autark wrt ns-references. NOTE: This function was not intensively tested.

            ctxt:a DOM wrapper context
            doc:the doc
            node:the node to be removed.
            options:set of options, unused at the moment
            Returns:0 on success, 1 if the node is not supported, -1 on API and internal errors.

            Function: xmlDocCopyNode

            xmlNodePtr	xmlDocCopyNode		(const xmlNodePtr node, 
            xmlDocPtr doc,
            int extended)

            Do a copy of the node to a given document.

            node:the node
            doc:the document
            extended:if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable)
            Returns:a new #xmlNodePtr, or NULL in case of error.

            Function: xmlDocCopyNodeList

            xmlNodePtr	xmlDocCopyNodeList	(xmlDocPtr doc, 
            const xmlNodePtr node)
            @@ -706,7 +717,7 @@ A:link, A:visited, A:active { text-decoration: underline }

            Get the root element of the document (doc->children is a list containing possibly comments, PIs, etc ...).

            doc:the document
            Returns:the #xmlNodePtr for the root or NULL

            Function: xmlDocSetRootElement

            xmlNodePtr	xmlDocSetRootElement	(xmlDocPtr doc, 
            xmlNodePtr root)

            Set the root element of the document (doc->children is a list containing possibly comments, PIs, etc ...).

            -
            doc:the document
            root:the new document root element
            Returns:the old root element if any was found

            Function: xmlElemDump

            void	xmlElemDump			(FILE * f, 
            xmlDocPtr doc,
            xmlNodePtr cur)
            +
            doc:the document
            root:the new document root element, if root is NULL no action is taken, to remove a node from a document use xmlUnlinkNode(root) instead.
            Returns:the old root element if any was found, NULL if root was NULL

            Function: xmlElemDump

            void	xmlElemDump			(FILE * f, 
            xmlDocPtr doc,
            xmlNodePtr cur)

            Dump an XML/HTML node, recursive behaviour, children are printed too.

            f:the FILE * for the output
            doc:the document
            cur:the current node

            Function: xmlFreeDoc

            void	xmlFreeDoc			(xmlDocPtr cur)

            Free up all the structures used by a document, tree included.

            diff --git a/doc/html/libxml-uri.html b/doc/html/libxml-uri.html index cb2a419..fa7ee19 100644 --- a/doc/html/libxml-uri.html +++ b/doc/html/libxml-uri.html @@ -21,6 +21,7 @@ A:link, A:visited, A:active { text-decoration: underline }
            xmlURIPtr	xmlParseURI		(const char * str)
            xmlURIPtr	xmlParseURIRaw		(const char * str, 
            int raw)
            int	xmlParseURIReference		(xmlURIPtr uri, 
            const char * str)
            +
            xmlChar *	xmlPathToURI		(const xmlChar * path)
            void	xmlPrintURI			(FILE * stream, 
            xmlURIPtr uri)
            xmlChar *	xmlSaveUri		(xmlURIPtr uri)
            xmlChar *	xmlURIEscape		(const xmlChar * str)
            @@ -56,7 +57,9 @@ A:link, A:visited, A:active { text-decoration: underline }

            Parse an URI but allows to keep intact the original fragments. URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]

            str:the URI string to analyze
            raw:if 1 unescaping of URI pieces are disabled
            Returns:a newly built xmlURIPtr or NULL in case of error

            Function: xmlParseURIReference

            int	xmlParseURIReference		(xmlURIPtr uri, 
            const char * str)

            Parse an URI reference string and fills in the appropriate fields of the @uri structure URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]

            -
            uri:pointer to an URI structure
            str:the string to analyze
            Returns:0 or the error code

            Function: xmlPrintURI

            void	xmlPrintURI			(FILE * stream, 
            xmlURIPtr uri)
            +
            uri:pointer to an URI structure
            str:the string to analyze
            Returns:0 or the error code

            Function: xmlPathToURI

            xmlChar *	xmlPathToURI		(const xmlChar * path)
            +

            Constructs an URI expressing the existing path

            +
            path:the resource locator in a filesystem notation
            Returns:a new URI, or a duplicate of the path parameter if the construction fails. The caller is responsible for freeing the memory occupied by the returned string. If there is insufficient memory available, or the argument is NULL, the function returns NULL.

            Function: xmlPrintURI

            void	xmlPrintURI			(FILE * stream, 
            xmlURIPtr uri)

            Prints the URI in the stream @stream.

            stream:a FILE* for the output
            uri:pointer to an xmlURI

            Function: xmlSaveUri

            xmlChar *	xmlSaveUri		(xmlURIPtr uri)

            Save the URI as an escaped string

            diff --git a/doc/html/libxml-xinclude.html b/doc/html/libxml-xinclude.html index 44771b9..58c1c19 100644 --- a/doc/html/libxml-xinclude.html +++ b/doc/html/libxml-xinclude.html @@ -17,6 +17,7 @@ The content of this structure is not made public by the API.
            xmlXIncludeCtxtPtr	xmlXIncludeNewContext	(xmlDocPtr doc)
            int	xmlXIncludeProcess		(xmlDocPtr doc)
            int	xmlXIncludeProcessFlags		(xmlDocPtr doc, 
            int flags)
            +
            int	xmlXIncludeProcessFlagsData	(xmlDocPtr doc, 
            int flags,
            void * data)
            int	xmlXIncludeProcessNode		(xmlXIncludeCtxtPtr ctxt, 
            xmlNodePtr node)
            int	xmlXIncludeProcessTree		(xmlNodePtr tree)
            int	xmlXIncludeProcessTreeFlags	(xmlNodePtr tree, 
            int flags)
            @@ -42,7 +43,9 @@ The content of this structure is not made public by the API.

            Implement the XInclude substitution on the XML document @doc

            doc:an XML document
            Returns:0 if no substitution were done, -1 if some processing failed or the number of substitutions done.

            Function: xmlXIncludeProcessFlags

            int	xmlXIncludeProcessFlags		(xmlDocPtr doc, 
            int flags)

            Implement the XInclude substitution on the XML document @doc

            -
            doc:an XML document
            flags:a set of xmlParserOption used for parsing XML includes
            Returns:0 if no substitution were done, -1 if some processing failed or the number of substitutions done.

            Function: xmlXIncludeProcessNode

            int	xmlXIncludeProcessNode		(xmlXIncludeCtxtPtr ctxt, 
            xmlNodePtr node)
            +
            doc:an XML document
            flags:a set of xmlParserOption used for parsing XML includes
            Returns:0 if no substitution were done, -1 if some processing failed or the number of substitutions done.

            Function: xmlXIncludeProcessFlagsData

            int	xmlXIncludeProcessFlagsData	(xmlDocPtr doc, 
            int flags,
            void * data)
            +

            Implement the XInclude substitution on the XML document @doc

            +
            doc:an XML document
            flags:a set of xmlParserOption used for parsing XML includes
            data:application data that will be passed to the parser context in the _private field of the parser context(s)
            Returns:0 if no substitution were done, -1 if some processing failed or the number of substitutions done.

            Function: xmlXIncludeProcessNode

            int	xmlXIncludeProcessNode		(xmlXIncludeCtxtPtr ctxt, 
            xmlNodePtr node)

            Implement the XInclude substitution for the given subtree reusing the informations and data coming from the given context.

            ctxt:an existing XInclude context
            node:a node in an XML document
            Returns:0 if no substitution were done, -1 if some processing failed or the number of substitutions done.

            Function: xmlXIncludeProcessTree

            int	xmlXIncludeProcessTree		(xmlNodePtr tree)

            Implement the XInclude substitution for the given subtree

            diff --git a/doc/html/libxml-xmlsave.html b/doc/html/libxml-xmlsave.html index 664c6ef..d649ef7 100644 --- a/doc/html/libxml-xmlsave.html +++ b/doc/html/libxml-xmlsave.html @@ -53,4 +53,4 @@ The content of this structure is not made public by the API.

            Create a document saving context serializing to a file descriptor with the encoding and the options given

            iowrite:an I/O write function
            ioclose:an I/O close function
            ioctx:an I/O handler
            encoding:the encoding name to use or NULL
            options:a set of xmlSaveOptions
            Returns:a new serialization context or NULL in case of error.

            Function: xmlSaveTree

            long	xmlSaveTree			(xmlSaveCtxtPtr ctxt, 
            xmlNodePtr node)

            Save a subtree starting at the node parameter to a saving context TODO: The function is not fully implemented yet as it does not return the byte count but 0 instead

            -
            ctxt:a document saving context
            node:a document
            Returns:the number of byte written or -1 in case of error

            Daniel Veillard

          +
          ctxt:a document saving context
          node:the top node of the subtree to save
          Returns:the number of byte written or -1 in case of error

          Daniel Veillard

        diff --git a/doc/html/libxml-xmlversion.html b/doc/html/libxml-xmlversion.html index c27b701..3e9d50a 100644 --- a/doc/html/libxml-xmlversion.html +++ b/doc/html/libxml-xmlversion.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } Module xmlversion from libxml2
        Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
        Made with Libxml2 Logo

        Module xmlversion from libxml2

        API Menu
        API Indexes
        Related links

        compile-time version informations for the XML library

        Table of Contents

        #define ATTRIBUTE_UNUSED
        #define DEBUG_MEMORY_LOCATION
        #define LIBXML_AUTOMATA_ENABLED
        #define LIBXML_C14N_ENABLED
        #define LIBXML_CATALOG_ENABLED
        #define LIBXML_DEBUG_ENABLED
        #define LIBXML_DEBUG_RUNTIME
        #define LIBXML_DOCB_ENABLED
        #define LIBXML_DOTTED_VERSION
        #define LIBXML_EXPR_ENABLED
        #define LIBXML_FTP_ENABLED
        #define LIBXML_HTML_ENABLED
        #define LIBXML_HTTP_ENABLED
        #define LIBXML_ICONV_ENABLED
        #define LIBXML_ISO8859X_ENABLED
        #define LIBXML_LEGACY_ENABLED
        #define LIBXML_MODULES_ENABLED
        #define LIBXML_MODULE_EXTENSION
        #define LIBXML_OUTPUT_ENABLED
        #define LIBXML_PATTERN_ENABLED
        #define LIBXML_PUSH_ENABLED
        #define LIBXML_READER_ENABLED
        #define LIBXML_REGEXP_ENABLED
        #define LIBXML_SAX1_ENABLED
        #define LIBXML_SCHEMAS_ENABLED
        #define LIBXML_SCHEMATRON_ENABLED
        #define LIBXML_TEST_VERSION
        #define LIBXML_THREAD_ENABLED
        #define LIBXML_TREE_ENABLED
        #define LIBXML_UNICODE_ENABLED
        #define LIBXML_VALID_ENABLED
        #define LIBXML_VERSION
        #define LIBXML_VERSION_EXTRA
        #define LIBXML_VERSION_STRING
        #define LIBXML_WRITER_ENABLED
        #define LIBXML_XINCLUDE_ENABLED
        #define LIBXML_XPATH_ENABLED
        #define LIBXML_XPTR_ENABLED
        #define WITHOUT_TRIO
        #define WITH_TRIO
        void	xmlCheckVersion			(int version)
        + Module xmlversion from libxml2
        Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
        Made with Libxml2 Logo

        Module xmlversion from libxml2

        API Menu
        API Indexes
        Related links

        compile-time version informations for the XML library

        Table of Contents

        #define ATTRIBUTE_UNUSED
        #define DEBUG_MEMORY_LOCATION
        #define LIBXML_AUTOMATA_ENABLED
        #define LIBXML_C14N_ENABLED
        #define LIBXML_CATALOG_ENABLED
        #define LIBXML_DEBUG_ENABLED
        #define LIBXML_DEBUG_RUNTIME
        #define LIBXML_DOCB_ENABLED
        #define LIBXML_DOTTED_VERSION
        #define LIBXML_EXPR_ENABLED
        #define LIBXML_FTP_ENABLED
        #define LIBXML_HTML_ENABLED
        #define LIBXML_HTTP_ENABLED
        #define LIBXML_ICONV_ENABLED
        #define LIBXML_ISO8859X_ENABLED
        #define LIBXML_LEGACY_ENABLED
        #define LIBXML_MODULES_ENABLED
        #define LIBXML_MODULE_EXTENSION
        #define LIBXML_OUTPUT_ENABLED
        #define LIBXML_PATTERN_ENABLED
        #define LIBXML_PUSH_ENABLED
        #define LIBXML_READER_ENABLED
        #define LIBXML_REGEXP_ENABLED
        #define LIBXML_SAX1_ENABLED
        #define LIBXML_SCHEMAS_ENABLED
        #define LIBXML_SCHEMATRON_ENABLED
        #define LIBXML_TEST_VERSION
        #define LIBXML_THREAD_ENABLED
        #define LIBXML_TREE_ENABLED
        #define LIBXML_UNICODE_ENABLED
        #define LIBXML_VALID_ENABLED
        #define LIBXML_VERSION
        #define LIBXML_VERSION_EXTRA
        #define LIBXML_VERSION_STRING
        #define LIBXML_WRITER_ENABLED
        #define LIBXML_XINCLUDE_ENABLED
        #define LIBXML_XPATH_ENABLED
        #define LIBXML_XPTR_ENABLED
        #define LIBXML_ZLIB_ENABLED
        #define WITHOUT_TRIO
        #define WITH_TRIO
        void	xmlCheckVersion			(int version)

        Description

        Macro: ATTRIBUTE_UNUSED

        #define ATTRIBUTE_UNUSED

        Macro used to signal to GCC unused function parameters

        Macro: DEBUG_MEMORY_LOCATION

        #define DEBUG_MEMORY_LOCATION

        Whether the memory debugging is configured in

        @@ -43,13 +43,14 @@ A:link, A:visited, A:active { text-decoration: underline }

        Macro: LIBXML_TREE_ENABLED

        #define LIBXML_TREE_ENABLED

        Whether the DOM like tree manipulation API support is configured in

        Macro: LIBXML_UNICODE_ENABLED

        #define LIBXML_UNICODE_ENABLED

        Whether the Unicode related interfaces are compiled in

        Macro: LIBXML_VALID_ENABLED

        #define LIBXML_VALID_ENABLED

        Whether the DTD validation support is configured in

        -

        Macro: LIBXML_VERSION

        #define LIBXML_VERSION

        the version number: 1.2.3 value is 1002003

        +

        Macro: LIBXML_VERSION

        #define LIBXML_VERSION

        the version number: 1.2.3 value is 10203

        Macro: LIBXML_VERSION_EXTRA

        #define LIBXML_VERSION_EXTRA

        extra version information, used to show a CVS compilation

        -

        Macro: LIBXML_VERSION_STRING

        #define LIBXML_VERSION_STRING

        the version number string, 1.2.3 value is "1002003"

        +

        Macro: LIBXML_VERSION_STRING

        #define LIBXML_VERSION_STRING

        the version number string, 1.2.3 value is "10203"

        Macro: LIBXML_WRITER_ENABLED

        #define LIBXML_WRITER_ENABLED

        Whether the xmlWriter saving interface is configured in

        Macro: LIBXML_XINCLUDE_ENABLED

        #define LIBXML_XINCLUDE_ENABLED

        Whether XInclude is configured in

        Macro: LIBXML_XPATH_ENABLED

        #define LIBXML_XPATH_ENABLED

        Whether XPath is configured in

        Macro: LIBXML_XPTR_ENABLED

        #define LIBXML_XPTR_ENABLED

        Whether XPointer is configured in

        +

        Macro: LIBXML_ZLIB_ENABLED

        #define LIBXML_ZLIB_ENABLED

        Whether the Zlib support is compiled in

        Macro: WITHOUT_TRIO

        #define WITHOUT_TRIO

        defined if the trio support should not be configured in

        Macro: WITH_TRIO

        #define WITH_TRIO

        defined if the trio support need to be configured in

        Function: xmlCheckVersion

        void	xmlCheckVersion			(int version)
        diff --git a/doc/html/libxml-xpath.html b/doc/html/libxml-xpath.html index a0d9ba7..6aca3c3 100644 --- a/doc/html/libxml-xpath.html +++ b/doc/html/libxml-xpath.html @@ -51,6 +51,7 @@ The content of this structure is not made public by the API.
        int	xmlXPathCmpNodes		(xmlNodePtr node1, 
        xmlNodePtr node2)
        xmlXPathCompExprPtr	xmlXPathCompile	(const xmlChar * str)
        xmlXPathObjectPtr	xmlXPathCompiledEval	(xmlXPathCompExprPtr comp, 
        xmlXPathContextPtr ctx)
        +
        int	xmlXPathCompiledEvalToBoolean	(xmlXPathCompExprPtr comp, 
        xmlXPathContextPtr ctxt)
        int	xmlXPathContextSetCache		(xmlXPathContextPtr ctxt, 
        int active,
        int value,
        int options)
        xmlXPathObjectPtr	xmlXPathConvertBoolean	(xmlXPathObjectPtr val)
        Function type: xmlXPathConvertFunc
        @@ -240,13 +241,15 @@ The content of this structure is not made public by the API.
         

        Converts an XPath object to its number value

        val:an XPath object
        Returns:the number value

        Function: xmlXPathCastToString

        xmlChar *	xmlXPathCastToString	(xmlXPathObjectPtr val)

        Converts an existing object to its string() equivalent

        -
        val:an XPath object
        Returns:the string value of the object, NULL in case of error. A new string is allocated only if needed (@val isn't a string object).

        Function: xmlXPathCmpNodes

        int	xmlXPathCmpNodes		(xmlNodePtr node1, 
        xmlNodePtr node2)
        +
        val:an XPath object
        Returns:the allocated string value of the object, NULL in case of error. It's up to the caller to free the string memory with xmlFree().

        Function: xmlXPathCmpNodes

        int	xmlXPathCmpNodes		(xmlNodePtr node1, 
        xmlNodePtr node2)

        Compare two nodes w.r.t document order

        node1:the first node
        node2:the second node
        Returns:-2 in case of error 1 if first point < second point, 0 if it's the same node, -1 otherwise

        Function: xmlXPathCompile

        xmlXPathCompExprPtr	xmlXPathCompile	(const xmlChar * str)

        Compile an XPath expression

        str:the XPath expression
        Returns:the xmlXPathCompExprPtr resulting from the compilation or NULL. the caller has to free the object.

        Function: xmlXPathCompiledEval

        xmlXPathObjectPtr	xmlXPathCompiledEval	(xmlXPathCompExprPtr comp, 
        xmlXPathContextPtr ctx)

        Evaluate the Precompiled XPath expression in the given context.

        -
        comp:the compiled XPath expression
        ctx:the XPath context
        Returns:the xmlXPathObjectPtr resulting from the evaluation or NULL. the caller has to free the object.

        Function: xmlXPathContextSetCache

        int	xmlXPathContextSetCache		(xmlXPathContextPtr ctxt, 
        int active,
        int value,
        int options)
        +
        comp:the compiled XPath expression
        ctx:the XPath context
        Returns:the xmlXPathObjectPtr resulting from the evaluation or NULL. the caller has to free the object.

        Function: xmlXPathCompiledEvalToBoolean

        int	xmlXPathCompiledEvalToBoolean	(xmlXPathCompExprPtr comp, 
        xmlXPathContextPtr ctxt)
        +

        Applies the XPath boolean() function on the result of the given compiled expression.

        +
        comp:the compiled XPath expression
        ctxt:the XPath context
        Returns:1 if the expression evaluated to true, 0 if to false and -1 in API and internal errors.

        Function: xmlXPathContextSetCache

        int	xmlXPathContextSetCache		(xmlXPathContextPtr ctxt, 
        int active,
        int value,
        int options)

        Creates/frees an object cache on the XPath context. If activates XPath objects (xmlXPathObject) will be cached internally to be reused. @options: 0: This will set the XPath object caching: @value: This will set the maximum number of XPath objects to be cached per slot There are 5 slots for: node-set, string, number, boolean, and misc objects. Use <0 for the default number (100). Other values for @options have currently no effect.

        ctxt:the XPath context
        active:enables/disables (creates/frees) the cache
        value:a value with semantics dependant on @options
        options:options (currently only the value 0 is used)
        Returns:0 if the setting succeeded, and -1 on API or internal errors.

        Function: xmlXPathConvertBoolean

        xmlXPathObjectPtr	xmlXPathConvertBoolean	(xmlXPathObjectPtr val)

        Converts an existing object to its boolean() equivalent

        diff --git a/doc/index.html b/doc/index.html index 22f013b..21d61eb 100644 --- a/doc/index.html +++ b/doc/index.html @@ -216,73 +216,74 @@ A:link, A:visited, A:active { text-decoration: underline }

        -

        "Programmingwithlibxml2 -is like the thrilling embrace of an exotic stranger." MarkPilgrim

        -

        Libxml2 is the XML C parser and toolkit developed for the Gnomeproject(but -usable outside of the Gnome platform), it is free softwareavailableunder the -MITLicense.XML -itself is a metalanguage to design markup languages, i.e.text languagewhere -semantic and structure are added to the content usingextra -"markup"information enclosed between angle brackets. HTML is the -mostwell-knownmarkup language. Though the library is written in C avariety of language bindingsmake it available inother -environments.

        -

        Libxml2 is known to be very portable, the library should build -andworkwithout serious troubles on a variety of systems (Linux, -Unix,Windows,CygWin, MacOS, MacOS X, RISC Os, OS/2, VMS, QNX, MVS, ...)

        -

        Libxml2 implements a number of existing standards related -tomarkuplanguages:

        +

        "Programming +with libxml2 is like the thrilling embrace of an exotic stranger." Mark +Pilgrim

        +

        Libxml2 is the XML C parser and toolkit developed for the Gnome project +(but usable outside of the Gnome platform), it is free software available +under the MIT +License. XML itself is a metalanguage to design markup languages, i.e. +text language where semantic and structure are added to the content using +extra "markup" information enclosed between angle brackets. HTML is the most +well-known markup language. Though the library is written in C a variety of language bindings make it available in +other environments.

        +

        Libxml2 is known to be very portable, the library should build and work +without serious troubles on a variety of systems (Linux, Unix, Windows, +CygWin, MacOS, MacOS X, RISC Os, OS/2, VMS, QNX, MVS, ...)

        +

        Libxml2 implements a number of existing standards related to markup +languages:

        -

        In most cases libxml2 tries to implement the specifications in -arelativelystrictly compliant way. As of release 2.4.16, libxml2 passed -all1800+ testsfrom the OASIS -XMLTestsSuite.

        -

        To some extent libxml2 provides support for the -followingadditionalspecifications but doesn't claim to implement them -completely:

        -
        • Document Object Model (DOM) http://www.w3.org/TR/DOM-Level-2-Core/thedocument - model, but it doesn't implement the API itself, gdome2 doesthison top of - libxml2
        • -
        • RFC959:libxml2 - implements a basic FTP client code
        • -
        • RFC1945:HTTP/1.0, - again a basic HTTP client code
        • -
        • SAX: a SAX2 like interface and a minimal SAX1 - implementationcompatiblewith early expat versions
        • +

          In most cases libxml2 tries to implement the specifications in a +relatively strictly compliant way. As of release 2.4.16, libxml2 passed all +1800+ tests from the OASIS XML Tests +Suite.

          +

          To some extent libxml2 provides support for the following additional +specifications but doesn't claim to implement them completely:

          +
          • Document Object Model (DOM) http://www.w3.org/TR/DOM-Level-2-Core/ + the document model, but it doesn't implement the API itself, gdome2 does + this on top of libxml2
          • +
          • RFC 959 : + libxml2 implements a basic FTP client code
          • +
          • RFC 1945 : + HTTP/1.0, again a basic HTTP client code
          • +
          • SAX: a SAX2 like interface and a minimal SAX1 implementation compatible + with early expat versions
          -

          A partial implementation of XML Schemas -Part1:Structureis being worked on but it would be far too early to -makeanyconformance statement about it at the moment.

          +

          A partial implementation of XML Schemas Part +1: Structure is being worked on but it would be far too early to make any +conformance statement about it at the moment.

          Separate documents:

          -
          • the libxslt - pageprovidinganimplementation of XSLT 1.0 and common extensions like - EXSLTforlibxml2
          • -
          • the gdome2 - page:a standard DOM2 implementation for libxml2
          • -
          • the XMLSec - page:animplementation of W3CXMLDigital Signaturefor - libxml2
          • -
          • also check the related links section below for more related - andactiveprojects.
          • +

            Logo designed by Marc Liyanage.

            diff --git a/doc/interface.html b/doc/interface.html index 88ec0d8..8163c41 100644 --- a/doc/interface.html +++ b/doc/interface.html @@ -7,18 +7,19 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -The SAX interface
            Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
            Made with Libxml2 Logo

            The XML C parser and toolkit of Gnome

            The SAX interface

            Developer Menu
            API Indexes
            Related links

            Sometimes the DOM tree output is just too large to fit -reasonablyintomemory. In that case (and if you don't expect to save back the -XMLdocumentloaded using libxml), it's better to use the SAX interface of -libxml.SAX isa callback-based interfaceto the parser. -Beforeparsing,the application layer registers a customized set of callbacks -whicharecalled by the library as it progresses through the XML input.

            To get more detailed step-by-step guidance on using the SAX -interfaceoflibxml, see the nicedocumentation.writtenby -JamesHenstridge.

            You can debug the SAX behaviour by using -thetestSAXprogram located in the gnome-xml module (it's -usuallynot shipped in thebinary packages of libxml, but you can find it in -the tarsourcedistribution). Here is the sequence of callbacks that would be -reportedbytestSAX when parsing the example XML document shown earlier:

            SAX.setDocumentLocator()
            +The SAX interface
            Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
            Made with Libxml2 Logo

            The XML C parser and toolkit of Gnome

            The SAX interface

            Developer Menu
            API Indexes
            Related links

            Sometimes the DOM tree output is just too large to fit reasonably into +memory. In that case (and if you don't expect to save back the XML document +loaded using libxml), it's better to use the SAX interface of libxml. SAX is +a callback-based interface to the parser. Before parsing, +the application layer registers a customized set of callbacks which are +called by the library as it progresses through the XML input.

            To get more detailed step-by-step guidance on using the SAX interface of +libxml, see the nice +documentation.written by James +Henstridge.

            You can debug the SAX behaviour by using the testSAX +program located in the gnome-xml module (it's usually not shipped in the +binary packages of libxml, but you can find it in the tar source +distribution). Here is the sequence of callbacks that would be reported by +testSAX when parsing the example XML document shown earlier:

            SAX.setDocumentLocator()
             SAX.startDocument()
             SAX.getEntity(amp)
             SAX.startElement(EXAMPLE, prop1='gnome is great', prop2='&amp; linux too')
            @@ -51,8 +52,8 @@ SAX.characters(   , 3)
             SAX.endElement(chapter)
             SAX.characters( , 1)
             SAX.endElement(EXAMPLE)
            -SAX.endDocument()

            Most of the other interfaces of libxml2 are based on the -DOMtree-buildingfacility, so nearly everything up to the end of this -documentpresupposes theuse of the standard DOM tree build. Note that the DOM -treeitself is built bya set of registered default callbacks, without -internalspecificinterface.

            Daniel Veillard

            +SAX.endDocument()

            Most of the other interfaces of libxml2 are based on the DOM tree-building +facility, so nearly everything up to the end of this document presupposes the +use of the standard DOM tree build. Note that the DOM tree itself is built by +a set of registered default callbacks, without internal specific +interface.

            Daniel Veillard

            diff --git a/doc/intro.html b/doc/intro.html index 1ae322f..650eccb 100644 --- a/doc/intro.html +++ b/doc/intro.html @@ -7,23 +7,25 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -Introduction
            Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
            Made with Libxml2 Logo

            The XML C parser and toolkit of Gnome

            Introduction

            Main Menu
            Related links

            This document describes libxml, the XMLC parser and toolkit developed for theGnomeproject. XML is a standardfor -buildingtag-basedstructured documents/data.

            Here are some key points about libxml:

            Warning: unless you are forced to because your application links with a +Gnome-1.X library requiring it, Do Not Use libxml1, use +libxml2

            Daniel Veillard

            diff --git a/doc/library.html b/doc/library.html index afe4d77..b5faade 100644 --- a/doc/library.html +++ b/doc/library.html @@ -7,25 +7,27 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -The parser interfaces
            Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
            Made with Libxml2 Logo

            The XML C parser and toolkit of Gnome

            The parser interfaces

            Developer Menu
            API Indexes
            Related links

            This section is directly intended to help programmers -gettingbootstrappedusing the XML tollkit from the C language. It is not -intended tobeextensive. I hope the automatically generated documents will -providethecompleteness required, but as a separate set of documents. The -interfacesofthe XML parser are by principle low level, Those interested in a -higherlevelAPI should look at DOM.

            The parser interfaces -forXMLareseparated from the HTMLparserinterfaces. Let's have a -look at how the XML parser can becalled:

            Invoking the parser : the pull method

            Usually, the first thing to do is to read an XML input. The -parseracceptsdocuments either from in-memory strings or from files. The -functionsaredefined in "parser.h":

            xmlDocPtr xmlParseMemory(char *buffer, int size);
            +The parser interfaces
            Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
            Made with Libxml2 Logo

            The XML C parser and toolkit of Gnome

            The parser interfaces

            Developer Menu
            API Indexes
            Related links

            This section is directly intended to help programmers getting bootstrapped +using the XML tollkit from the C language. It is not intended to be +extensive. I hope the automatically generated documents will provide the +completeness required, but as a separate set of documents. The interfaces of +the XML parser are by principle low level, Those interested in a higher level +API should look at DOM.

            The parser interfaces for XML are +separated from the HTML parser +interfaces. Let's have a look at how the XML parser can be called:

            Invoking the parser : the pull method

            Usually, the first thing to do is to read an XML input. The parser accepts +documents either from in-memory strings or from files. The functions are +defined in "parser.h":

            xmlDocPtr xmlParseMemory(char *buffer, int size);

            Parse a null-terminated string containing the document.

            xmlDocPtr xmlParseFile(const char *filename);
            -

            Parse an XML document contained in a (possibly compressed)file.

            +

            Parse an XML document contained in a (possibly compressed) + file.

            -

            The parser returns a pointer to the document structure (or NULL in -caseoffailure).

            Invoking the parser: the push method

            In order for the application to keep the control when the document -isbeingfetched (which is common for GUI based programs) libxml2 provides -apushinterface, too, as of version 1.8.3. Here are the interfacefunctions:

            xmlParserCtxtPtr xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax,
            +

            The parser returns a pointer to the document structure (or NULL in case of +failure).

            Invoking the parser: the push method

            In order for the application to keep the control when the document is +being fetched (which is common for GUI based programs) libxml2 provides a +push interface, too, as of version 1.8.3. Here are the interface +functions:

            xmlParserCtxtPtr xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax,
                                                      void *user_data,
                                                      const char *chunk,
                                                      int size,
            @@ -52,17 +54,17 @@ int              xmlParseChunk          (xmlParserCtxtPtr ctxt,
                                 doc = ctxt->myDoc;
                                 xmlFreeParserCtxt(ctxt);
                             }
            -            }

            The HTML parser embedded into libxml2 also has a push -interface;thefunctions are just prefixed by "html" rather than "xml".

            Invoking the parser: the SAX interface

            The tree-building interface makes the parser memory-hungry, -firstloadingthe document in memory and then building the tree itself. Reading -adocumentwithout building the tree is possible using the SAX interfaces -(seeSAX.h andJamesHenstridge'sdocumentation). -Note also that the push interface can belimited to SAX:just use the two first -arguments ofxmlCreatePushParserCtxt().

            Building a tree from scratch

            The other way to get an XML tree in memory is by building -it.Basicallythere is a set of functions dedicated to building new -elements.(These arealso described in <libxml/tree.h>.) For example, -here is apiece ofcode that produces the XML document used in the previous -examples:

                #include <libxml/tree.h>
            +            }

            The HTML parser embedded into libxml2 also has a push interface; the +functions are just prefixed by "html" rather than "xml".

            Invoking the parser: the SAX interface

            The tree-building interface makes the parser memory-hungry, first loading +the document in memory and then building the tree itself. Reading a document +without building the tree is possible using the SAX interfaces (see SAX.h and +James +Henstridge's documentation). Note also that the push interface can be +limited to SAX: just use the two first arguments of +xmlCreatePushParserCtxt().

            Building a tree from scratch

            The other way to get an XML tree in memory is by building it. Basically +there is a set of functions dedicated to building new elements. (These are +also described in <libxml/tree.h>.) For example, here is a piece of +code that produces the XML document used in the previous examples:

                #include <libxml/tree.h>
                 xmlDocPtr doc;
                 xmlNodePtr tree, subtree;
             
            @@ -76,58 +78,59 @@ examples:

                #include <libxml/tree.h>
                 subtree = xmlNewChild(tree, NULL, "title", "The Linux adventure");
                 subtree = xmlNewChild(tree, NULL, "p", "bla bla bla ...");
                 subtree = xmlNewChild(tree, NULL, "image", NULL);
            -    xmlSetProp(subtree, "href", "linus.gif");

            Not really rocket science ...

            Traversing the tree

            Basically by including"tree.h"yourcode -has access to the internal structure of all the elementsof the tree.The names -should be somewhat simple -likeparent,children, -next,prev,properties, -etc... For example, stillwith the previousexample:

            doc->children->children->children

            points to the title element,

            doc->children->children->next->children->children

            points to the text node containing the chapter title -"TheLinuxadventure".

            NOTE: XML allows PIs and -commentstobepresent before the document root, so -doc->childrenmaypointto an element which is not the document -Root Element; afunctionxmlDocGetRootElement()was added for this -purpose.

            Modifying the tree

            Functions are provided for reading and writing the document content.Hereis -an excerpt from the tree API:

            xmlAttrPtr xmlSetProp(xmlNodePtr node, const xmlChar - *name,constxmlChar *value);
            -

            This sets (or changes) an attribute carried by an ELEMENT - node.Thevalue can be NULL.

            + xmlSetProp(subtree, "href", "linus.gif");

            Not really rocket science ...

            Traversing the tree

            Basically by including "tree.h" your +code has access to the internal structure of all the elements of the tree. +The names should be somewhat simple like parent, +children, next, prev, +properties, etc... For example, still with the previous +example:

            doc->children->children->children

            points to the title element,

            doc->children->children->next->children->children

            points to the text node containing the chapter title "The Linux +adventure".

            NOTE: XML allows PIs and comments to be +present before the document root, so doc->children may point +to an element which is not the document Root Element; a function +xmlDocGetRootElement() was added for this purpose.

            Modifying the tree

            Functions are provided for reading and writing the document content. Here +is an excerpt from the tree API:

            xmlAttrPtr xmlSetProp(xmlNodePtr node, const xmlChar *name, const + xmlChar *value);
            +

            This sets (or changes) an attribute carried by an ELEMENT node. + The value can be NULL.

            -
            const xmlChar *xmlGetProp(xmlNodePtr node, - constxmlChar*name);
            -

            This function returns a pointer to new copy of thepropertycontent. - Note that the user must deallocate the result.

            +
            const xmlChar *xmlGetProp(xmlNodePtr node, const xmlChar + *name);
            +

            This function returns a pointer to new copy of the property + content. Note that the user must deallocate the result.

            -

            Two functions are provided for reading and writing the text -associatedwithelements:

            xmlNodePtr xmlStringGetNodeList(xmlDocPtr doc, - constxmlChar*value);
            -

            This function takes an "external" string and converts it toonetext - node or possibly to a list of entity and text nodes.Allnon-predefined - entity references like &Gnome; will bestoredinternally as entity - nodes, hence the result of the function maynot bea single node.

            +

            Two functions are provided for reading and writing the text associated +with elements:

            xmlNodePtr xmlStringGetNodeList(xmlDocPtr doc, const xmlChar + *value);
            +

            This function takes an "external" string and converts it to one + text node or possibly to a list of entity and text nodes. All + non-predefined entity references like &Gnome; will be stored + internally as entity nodes, hence the result of the function may not be + a single node.

            -
            xmlChar *xmlNodeListGetString(xmlDocPtr doc, xmlNodePtr - list,intinLine);
            -

            This function is the inverseofxmlStringGetNodeList(). - It generates a newstringcontaining the content of the text and entity - nodes. Note theextraargument inLine. If this argument is set to 1, the - function willexpandentity references. For example, instead of - returning the&Gnome;XML encoding in the string, it will substitute - it with itsvalue (say,"GNU Network Object Model Environment").

            +
            xmlChar *xmlNodeListGetString(xmlDocPtr doc, xmlNodePtr list, int + inLine);
            +

            This function is the inverse of + xmlStringGetNodeList(). It generates a new string + containing the content of the text and entity nodes. Note the extra + argument inLine. If this argument is set to 1, the function will expand + entity references. For example, instead of returning the &Gnome; + XML encoding in the string, it will substitute it with its value (say, + "GNU Network Object Model Environment").

            -

            Saving a tree

            Basically 3 options are possible:

            void xmlDocDumpMemory(xmlDocPtr cur, - xmlChar**mem,int*size);
            +

            Saving a tree

            Basically 3 options are possible:

            void xmlDocDumpMemory(xmlDocPtr cur, xmlChar**mem, int + *size);

            Returns a buffer into which the document has been saved.

            extern void xmlDocDump(FILE *f, xmlDocPtr doc);

            Dumps a document to an open file descriptor.

            int xmlSaveFile(const char *filename, xmlDocPtr cur);
            -

            Saves the document to a file. In this case, - thecompressioninterface is triggered if it has been turned on.

            +

            Saves the document to a file. In this case, the compression + interface is triggered if it has been turned on.

            -

            Compression

            The library transparently handles compression when -doingfile-basedaccesses. The level of compression on saves can be turned on -eithergloballyor individually for one file:

            int xmlGetDocCompressMode (xmlDocPtr doc);
            +

            Compression

            The library transparently handles compression when doing file-based +accesses. The level of compression on saves can be turned on either globally +or individually for one file:

            int xmlGetDocCompressMode (xmlDocPtr doc);

            Gets the document compression ratio (0-9).

            void xmlSetDocCompressMode (xmlDocPtr doc, int mode);
            diff --git a/doc/libxml2-api.xml b/doc/libxml2-api.xml index 2dbf900..dd49a2b 100644 --- a/doc/libxml2-api.xml +++ b/doc/libxml2-api.xml @@ -94,6 +94,7 @@ + @@ -722,6 +723,7 @@ + @@ -1587,6 +1589,7 @@ + @@ -1668,6 +1671,7 @@ + @@ -1786,6 +1790,7 @@ + @@ -3322,6 +3327,7 @@ + @@ -3501,7 +3507,7 @@ - + @@ -3523,11 +3529,12 @@ - + + @@ -3947,13 +3954,13 @@ Whether the DTD validation support is configured in - the version number: 1.2.3 value is 1002003 + the version number: 1.2.3 value is 10203 extra version information, used to show a CVS compilation - the version number string, 1.2.3 value is "1002003" + the version number string, 1.2.3 value is "10203" Whether the xmlWriter saving interface is configured in @@ -3967,6 +3974,9 @@ Whether XPointer is configured in + + Whether the Zlib support is compiled in + Skips to the next '>' char. @@ -4964,7 +4974,9 @@ - + @@ -5641,6 +5653,7 @@ + @@ -5872,7 +5885,15 @@ if necessary or NULL'/> - + + + + @@ -5977,6 +5998,7 @@ actually an xmlCharEncoding'/> + @@ -6113,6 +6135,7 @@ actually an xmlCharEncoding'/> + @@ -7432,6 +7455,11 @@ Could we use @subtypes for this?'/> + + defined(LIBXML_HTML_ENABLED) + Allocate and initialize a new parser context. + + defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) Dump an HTML node, recursive behaviour,children are printed too, and formatting returns are added. @@ -9038,8 +9066,16 @@ Could we use @subtypes for this?'/> + + A function called to acquire namespaces (xmlNs) from the wrapper. + + + + + + - References of out-of scope ns-decls are remapped to point to @destDoc: 1) If @destParent is given, then nsDef entries on element-nodes are used 2) If *no* @destParent is given, then @destDoc->oldNs entries are used This is the case when you have an unliked node and just want to move it to the context of If @destParent is given, it ensures that the tree is namespace wellformed by creating additional ns-decls where needed. Note that, since prefixes of already existent ns-decls can be shadowed by this process, it could break QNames in attribute values or element content. WARNING: This function is in a experimental state. + References of out-of scope ns-decls are remapped to point to @destDoc: 1) If @destParent is given, then nsDef entries on element-nodes are used 2) If *no* @destParent is given, then @destDoc->oldNs entries are used This is the case when you have an unliked node and just want to move it to the context of If @destParent is given, it ensures that the tree is namespace wellformed by creating additional ns-decls where needed. Note that, since prefixes of already existent ns-decls can be shadowed by this process, it could break QNames in attribute values or element content. NOTE: This function was not intensively tested. @@ -9049,7 +9085,7 @@ Could we use @subtypes for this?'/> - References of out-of scope ns-decls are remapped to point to @destDoc: 1) If @destParent is given, then nsDef entries on element-nodes are used 2) If *no* @destParent is given, then @destDoc->oldNs entries are used This is the case when you have an unliked node and just want to move it to the context of If @destParent is given, it ensures that the tree is namespace wellformed by creating additional ns-decls where needed. Note that, since prefixes of already existent ns-decls can be shadowed by this process, it could break QNames in attribute values or element content. TODO: 1) Support dicts Optimize string adoption for equal or none dicts. 2) XInclude WARNING: This function is in a experimental state and should only be currently only be used to test it. + References of out-of scope ns-decls are remapped to point to @destDoc: 1) If @destParent is given, then nsDef entries on element-nodes are used 2) If *no* @destParent is given, then @destDoc->oldNs entries are used. This is the case when you don't know already where the cloned branch will be added to. If @destParent is given, it ensures that the tree is namespace wellformed by creating additional ns-decls where needed. Note that, since prefixes of already existent ns-decls can be shadowed by this process, it could break QNames in attribute values or element content. TODO: 1) What to do with XInclude? Currently this returns an error for XInclude. @@ -9070,14 +9106,14 @@ Could we use @subtypes for this?'/> - Ensures that ns-references point to ns-decls hold on element-nodes. Ensures that the tree is namespace wellformed by creating additional ns-decls where needed. Note that, since prefixes of already existent ns-decls can be shadowed by this process, it could break QNames in attribute values or element content. WARNING: This function is in a experimental state. + Ensures that ns-references point to ns-decls hold on element-nodes. Ensures that the tree is namespace wellformed by creating additional ns-decls where needed. Note that, since prefixes of already existent ns-decls can be shadowed by this process, it could break QNames in attribute values or element content. NOTE: This function was not intensively tested. - Unlinks the given node from its owner. This will substitute ns-references to node->nsDef for ns-references to doc->oldNs, thus ensuring the removed branch to be autark wrt ns-references. WARNING: This function is in a experimental state. + Unlinks the given node from its owner. This will substitute ns-references to node->nsDef for ns-references to doc->oldNs, thus ensuring the removed branch to be autark wrt ns-references. NOTE: This function was not intensively tested. @@ -9329,9 +9365,9 @@ Could we use @subtypes for this?'/> defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) Set the root element of the document (doc->children is a list containing possibly comments, PIs, etc ...). - + - + defined(LIBXML_OUTPUT_ENABLED) @@ -9933,7 +9969,7 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) + defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) Search all the namespace applying to a given element. @@ -10279,7 +10315,7 @@ Could we use @subtypes for this?'/> defined(LIBXML_VALID_ENABLED) Load and parse a DTD - + @@ -12180,6 +12216,11 @@ Could we use @subtypes for this?'/> + + Constructs an URI expressing the existing path + + + defined(LIBXML_PATTERN_ENABLED) Check if the pattern must be looked at from the root. @@ -13250,7 +13291,7 @@ Could we use @subtypes for this?'/> Save a subtree starting at the node parameter to a saving context TODO: The function is not fully implemented yet as it does not return the byte count but 0 instead - + Save the URI as an escaped string @@ -16636,7 +16677,7 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) + defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) Check that a value conforms to the lexical space of NCName @@ -16804,6 +16845,14 @@ Could we use @subtypes for this?'/> + + defined(LIBXML_XINCLUDE_ENABLED) + Implement the XInclude substitution on the XML document @doc + + + + + defined(LIBXML_XINCLUDE_ENABLED) Implement the XInclude substitution for the given subtree reusing the informations and data coming from the given context. @@ -16932,7 +16981,7 @@ Could we use @subtypes for this?'/> defined(LIBXML_XPATH_ENABLED) Converts an existing object to its string() equivalent - + @@ -16970,6 +17019,13 @@ Could we use @subtypes for this?'/> + + defined(LIBXML_XPATH_ENABLED) + Applies the XPath boolean() function on the result of the given compiled expression. + + + + defined(LIBXML_XPATH_ENABLED) Implement the concat() XPath function string concat(string, string, string*) The concat function returns the concatenation of its arguments. diff --git a/doc/libxml2.xsa b/doc/libxml2.xsa index 0cfdca5..341e126 100644 --- a/doc/libxml2.xsa +++ b/doc/libxml2.xsa @@ -8,9 +8,20 @@ libxml2 - 2.6.25 - Jun 6 2006: + 2.6.26 + Jun 6 2006 http://xmlsoft.org/ - Do not use or package 2.6.25 + - portability fixes: Python detection (Joseph Sacco), compilation + error(William Brack and Graham Bennett), LynxOS patch (Olli Savia) + - bug fixes: encoding buffer problem, mix of code and data in + xmlIO.c(Kjartan Maraas), entities in XSD validation (Kasimier Buchcik), + variousXSD validation fixes (Kasimier), memory leak in pattern (Rob + Richards andKasimier), attribute with colon in name (Rob Richards), XPath + leak inerror reporting (Aleksey Sanin), XInclude text include of + selfdocument. + - improvements: Xpath optimizations (Kasimier), XPath object + cache(Kasimier) + + diff --git a/doc/namespaces.html b/doc/namespaces.html index a4d6ace..32c7787 100644 --- a/doc/namespaces.html +++ b/doc/namespaces.html @@ -7,44 +7,44 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -Namespaces
            Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
            Made with Libxml2 Logo

            The XML C parser and toolkit of Gnome

            Namespaces

            Main Menu
            Related links

            The libxml2 library implements XML -namespacessupportbyrecognizing namespace constructs in the input, and -does namespacelookupautomatically when building the DOM tree. A namespace -declarationisassociated with an in-memory structure and all elements or -attributeswithinthat namespace point to it. Hence testing the namespace is a -simple andfastequality operation at the user level.

            I suggest that people using libxml2 use a namespace, and declare it -intheroot element of their document as the default namespace. Then they -don'tneedto use the prefix in the content but we will have a basis for -futuresemanticrefinement and merging of data from different sources. This -doesn'tincreasethe size of the XML output significantly, but significantly -increasesitsvalue in the long-term. Example:

            <mydoc xmlns="http://mydoc.example.org/schemas/">
            +Namespaces
            Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
            Made with Libxml2 Logo

            The XML C parser and toolkit of Gnome

            Namespaces

            Main Menu
            Related links

            The libxml2 library implements XML namespaces support by +recognizing namespace constructs in the input, and does namespace lookup +automatically when building the DOM tree. A namespace declaration is +associated with an in-memory structure and all elements or attributes within +that namespace point to it. Hence testing the namespace is a simple and fast +equality operation at the user level.

            I suggest that people using libxml2 use a namespace, and declare it in the +root element of their document as the default namespace. Then they don't need +to use the prefix in the content but we will have a basis for future semantic +refinement and merging of data from different sources. This doesn't increase +the size of the XML output significantly, but significantly increases its +value in the long-term. Example:

            <mydoc xmlns="http://mydoc.example.org/schemas/">
                <elem1>...</elem1>
                <elem2>...</elem2>
            -</mydoc>

            The namespace value has to be an absolute URL, but the URL doesn't -havetopoint to any existing resource on the Web. It will bind all the -elementandattributes with that URL. I suggest to use an URL within a -domainyoucontrol, and that the URL should contain some kind of version -informationifpossible. For example, -"http://www.gnome.org/gnumeric/1.0/"isagood namespace scheme.

            Then when you load a file, make sure that a namespace -carryingtheversion-independent prefix is installed on the root element of -yourdocument,and if the version information don't match something you know, -warnthe userand be liberal in what you accept as the input. Also do *not* try -tobasenamespace checking on the prefix value. <foo:text> may be -exactlythesame as <bar:text> in another document. What really matters -is theURIassociated with the element or the attribute, not the prefix string -(whichisjust a shortcut for the full URI). In libxml, element and attributes -haveannsfield pointing to an xmlNs structure detailing -thenamespaceprefix and its URI.

            @@Interfaces@@

            xmlNodePtr node;
            +</mydoc>

            The namespace value has to be an absolute URL, but the URL doesn't have to +point to any existing resource on the Web. It will bind all the element and +attributes with that URL. I suggest to use an URL within a domain you +control, and that the URL should contain some kind of version information if +possible. For example, "http://www.gnome.org/gnumeric/1.0/" is a +good namespace scheme.

            Then when you load a file, make sure that a namespace carrying the +version-independent prefix is installed on the root element of your document, +and if the version information don't match something you know, warn the user +and be liberal in what you accept as the input. Also do *not* try to base +namespace checking on the prefix value. <foo:text> may be exactly the +same as <bar:text> in another document. What really matters is the URI +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 +ns field pointing to an xmlNs structure detailing the namespace +prefix and its URI.

            @@Interfaces@@

            xmlNodePtr node;
             if(!strncmp(node->name,"mytag",5)
               && node->ns
               && !strcmp(node->ns->href,"http://www.mysite.com/myns/1.0")) {
               ...
            -}

            Usually people object to using namespaces together with validitychecking.I -will try to make sure that using namespaces won't break validitychecking,so -even if you plan to use or currently are using validation Istronglysuggest -adding namespaces to your document. A default -namespaceschemexmlns="http://...."should not break validity even -onlessflexible parsers. Using namespaces to mix and differentiate -contentcomingfrom multiple DTDs will certainly break current validation -schemes. Tochecksuch documents one needs to use schema-validation, which is -supportedinlibxml2 as well. See relagx-ngand w3c-schema.

            Daniel Veillard

            +}

            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 +xmlns="http://...." 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. To check +such documents one needs to use schema-validation, which is supported in +libxml2 as well. See relagx-ng and w3c-schema.

            Daniel Veillard

            diff --git a/doc/news.html b/doc/news.html index b67feaa..79a89d6 100644 --- a/doc/news.html +++ b/doc/news.html @@ -7,12 +7,62 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -Releases
            Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
            Made with Libxml2 Logo

            The XML C parser and toolkit of Gnome

            Releases

            Main Menu
            Related links

            Items not finished and worked on, get in touch with the list if you -wanttohelp those

            • More testing on RelaxNG
            • -
            • Finishing up XMLSchemas
            • -

            The change logdescribes the recents -commitstothe CVScode -base.

            There is the list of public releases:

            2.6.26: Jun 6 2006

            • portability fixes: Python detection (Joseph Sacco), compilation +Releases
              Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
              Made with Libxml2 Logo

              The XML C parser and toolkit of Gnome

              Releases

              Main Menu
              Related links

              Items not finished and worked on, get in touch with the list if you want +to help those

              The change log describes the recents commits +to the CVS code base.

              There is the list of public releases:

              2.6.27: Oct 25 2006

              • Portability fixes: file names on windows (Roland Schwingel, + Emelyanov Alexey), windows compile fixup (Rob Richards), + AIX iconv() is apparently case sensitive
              • +
              • improvements: Python XPath types mapping (Nic Ferrier), XPath optimization + (Kasimier), add xmlXPathCompiledEvalToBoolean (Kasimier), Python node + equality and comparison (Andreas Pakulat), xmlXPathCollectAndTest + improvememt (Kasimier), expose if library was compiled with zlib + support (Andrew Nosenko), cache for xmlSchemaIDCMatcher structs + (Kasimier), xmlTextConcat should work with comments and PIs (Rob + Richards), export htmlNewParserCtxt needed by Michael Day, refactoring + of catalog entity loaders (Michael Day), add XPointer support to + python bindings (Ross Reedstrom, Brian West and Stefan Anca), + try to sort out most file path to URI conversions and xmlPathToUri, + add --html --memory case to xmllint
              • +
              • building fix: fix --with-minimum (Felipe Contreras), VMS fix, + const'ification of HTML parser structures (Matthias Clasen), + portability fix (Emelyanov Alexey), wget autodetection (Peter + Breitenlohner), remove the build path recorded in the python + shared module, separate library flags for shared and static builds + (Mikhail Zabaluev), fix --with-minimum --with-sax1 builds, fix + --with-minimum --with-schemas builds
              • +
              • bug fix: xmlGetNodePath fix (Kasimier), xmlDOMWrapAdoptNode and + attribute (Kasimier), crash when using the recover mode, + xmlXPathEvalExpr problem (Kasimier), xmlXPathCompExprAdd bug (Kasimier), + missing destry in xmlFreeRMutex (Andrew Nosenko), XML Schemas fixes + (Kasimier), warning on entities processing, XHTML script and style + serialization (Kasimier), python generator for long types, bug in + xmlSchemaClearValidCtxt (Bertrand Fritsch), xmlSchemaXPathEvaluate + allocation bug (Marton Illes), error message end of line (Rob Richards), + fix attribute serialization in writer (Rob Richards), PHP4 DTD validation + crasher, parser safety patch (Ben Darnell), _private context propagation + when parsing entities (with Michael Day), fix entities behaviour when + using SAX, URI to file path fix (Mikhail Zabaluev), disapearing validity + context, arg error in SAX callback (Mike Hommey), fix mixed-content + autodetect when using --noblanks, fix xmlIOParseDTD error handling, + fix bug in xmlSplitQName on special Names, fix Relax-NG element content + validation bug, fix xmlReconciliateNs bug, fix potential attribute + XML parsing bug, fix line/column accounting in XML parser, chunking bug + in the HTML parser on script, try to detect obviously buggy HTML + meta encoding indications, bugs with encoding BOM and xmlSaveDoc, + HTML entities in attributes parsing, HTML minimized attribute values, + htmlReadDoc and htmlReadIO were broken, error handling bug in + xmlXPathEvalExpression (Olaf Walkowiak), fix a problem in + htmlCtxtUseOptions, xmlNewInputFromFile could leak (Marius Konitzer), + bug on misformed SSD regexps (Christopher Boumenot) +
              • +
              • documentation: warning about XML_PARSE_COMPACT (Kasimier Buchcik), + fix xmlXPathCastToString documentation, improve man pages for + xmllitn and xmlcatalog (Daniel Leidert), fixed comments of a few + functions
              • +

              2.6.26: Jun 6 2006

              • portability fixes: Python detection (Joseph Sacco), compilation error(William Brack and Graham Bennett), LynxOS patch (Olli Savia)
              • bug fixes: encoding buffer problem, mix of code and data in xmlIO.c(Kjartan Maraas), entities in XSD validation (Kasimier Buchcik), @@ -22,474 +72,465 @@ base.

                There is the list of public releases:

                2.6.26: Jun 6 2006

                selfdocument.
              • improvements: Xpath optimizations (Kasimier), XPath object cache(Kasimier)
              • -

              2.6.25: Jun 6 2006:

              Do not use or package 2.6.25

              2.6.24: Apr 28 2006

              • Portability fixes: configure on Windows, testapi compile - onwindows(Kasimier Buchcik, venkat naidu), Borland C++ 6 compile - (EricZurcher),HP-UX compiler workaround (Rick Jones), xml2-config - bugfix,gcc-4.1cleanups, Python detection scheme (Joseph Sacco), UTF-8 - file pathsonWindows (Roland Schwingel).
              • -
              • Improvements: xmlDOMWrapReconcileNamespaces - xmlDOMWrapCloneNode(KasimierBuchcik), XML catalog debugging (Rick Jones), - update to Unicode4.01.
              • -
              • Bug fixes: xmlParseChunk() problem in 2.6.23, - xmlParseInNodeContext()onHTML docs, URI behaviour on Windows (Rob - Richards), comment streamingbug,xmlParseComment (with William Brack), - regexp bug fixes (DV &YouriGolovanov), xmlGetNodePath on text/CDATA - (Kasimier),one Relax-NGinterleave bug, xmllint --path and --valid,XSD - bugfixes (Kasimier),remove debugleft in Python bindings (Nic Ferrier), - xmlCatalogAdd bug(Martin Cole),xmlSetProp fixes (Rob Richards), HTML - IDness (RobRichards), a largenumber of cleanups and small fixes based on - Coverityreports, bugin character ranges, Unicode tables const (Aivars - Kalvans),schemasfix (Stefan Kost), xmlRelaxNGParse - errordeallocation,xmlSchemaAddSchemaDoc error deallocation, error - handling onunallowedcode point, ixmllint --nonet to never reach the net - (GaryCoady),line break in writer after end PI (Jason Viers).
              • +

              2.6.25: Jun 6 2006:

              Do not use or package 2.6.25

              2.6.24: Apr 28 2006

              • Portability fixes: configure on Windows, testapi compile on windows + (Kasimier Buchcik, venkat naidu), Borland C++ 6 compile (Eric Zurcher), + HP-UX compiler workaround (Rick Jones), xml2-config bugfix, gcc-4.1 + cleanups, Python detection scheme (Joseph Sacco), UTF-8 file paths on + Windows (Roland Schwingel). +
              • +
              • Improvements: xmlDOMWrapReconcileNamespaces xmlDOMWrapCloneNode (Kasimier + Buchcik), XML catalog debugging (Rick Jones), update to Unicode 4.01.
              • +
              • Bug fixes: xmlParseChunk() problem in 2.6.23, xmlParseInNodeContext() + on HTML docs, URI behaviour on Windows (Rob Richards), comment streaming + bug, xmlParseComment (with William Brack), regexp bug fixes (DV & + Youri Golovanov), xmlGetNodePath on text/CDATA (Kasimier), + one Relax-NG interleave bug, xmllint --path and --valid, + XSD bugfixes (Kasimier), remove debug + left in Python bindings (Nic Ferrier), xmlCatalogAdd bug (Martin Cole), + xmlSetProp fixes (Rob Richards), HTML IDness (Rob Richards), a large + number of cleanups and small fixes based on Coverity reports, bug + in character ranges, Unicode tables const (Aivars Kalvans), schemas + fix (Stefan Kost), xmlRelaxNGParse error deallocation, + xmlSchemaAddSchemaDoc error deallocation, error handling on unallowed + code point, ixmllint --nonet to never reach the net (Gary Coady), + line break in writer after end PI (Jason Viers).
              • Documentation: man pages updates and cleanups (Daniel Leidert).
              • New features: Relax NG structure error handlers.
              • -

              2.6.23: Jan 5 2006

              • portability fixes: Windows (Rob Richards), getaddrinfo on - Windows(KoljaNowak, Rob Richards), icc warnings (Kjartan - Maraas),--with-minimumcompilation fixes (William Brack), error case - handling fixon Solaris(Albert Chin), don't use 'list' as parameter name - reported bySamuel DiazGarcia, more old Unices portability fixes (Albert - Chin),MinGW compilation(Mark Junker), HP-UX compiler warnings - (RickJones),
              • -
              • code cleanup: xmlReportError (Adrian Mouat), removexmlBufferClose(Geert - Jansen), unreachable code (Oleksandr Kononenko),refactoringparsing code - (Bjorn Reese)
              • -
              • bug fixes: xmlBuildRelativeURI and empty path - (WilliamBrack),combinatory explosion and performances in regexp code, - leakinxmlTextReaderReadString(), xmlStringLenDecodeEntities - problem(MassimoMorara), Identity Constraints bugs and a segfault - (KasimierBuchcik),XPath pattern based evaluation bugs (DV - &Kasimier),xmlSchemaContentModelDump() memory leak (Kasimier), - potentialleak inxmlSchemaCheckCSelectorXPath(), xmlTextWriterVSprintf() - misuseofvsnprintf (William Brack), XHTML serialization fix (Rob - Richards),CRLFsplit problem (William), issues with non-namespaced - attributesinxmlAddChild() xmlAddNextSibling() and xmlAddPrevSibling() - (RobRichards),HTML parsing of script, Python must not output to stdout - (NicFerrier),exclusive C14N namespace visibility (Aleksey Sanin), - XSDdataypetotalDigits bug (Kasimier Buchcik), error handling when writing - toanxmlBuffer (Rob Richards), runtest schemas error not - reported(HisashiFujinaka), signed/unsigned problem in date/time code - (AlbertChin), fixXSI driven XSD validation (Kasimier), parsing of - xs:decimal(Kasimier),fix DTD writer output (Rob Richards), leak - inxmlTextReaderReadInnerXml(Gary Coady), regexp bug affecting - schemas(Kasimier), configuration ofruntime debugging - (Kasimier),xmlNodeBufGetContent bug on entity refs(Oleksandr - Kononenko),xmlRegExecPushString2 bug (Sreeni Nair),compilation and build - fixes(Michael Day), removed dependancies onxmlSchemaValidError - (Kasimier), bugwith <xml:foo/>, more XPathpattern based evaluation - fixes(Kasimier)
              • -
              • improvements: XSD Schemas redefinitions/restrictions - (KasimierBuchcik),node copy checks and fix for attribute (Rob Richards), - countedtransitionbug in regexps, ctxt->standalone = -2 to indicate - nostandaloneattribute was found, add - xmlSchemaSetParserStructuredErrors()(KasimierBuchcik), add - xmlTextReaderSchemaValidateCtxt() to API(Kasimier), handlegzipped HTTP - resources (Gary Coady), addhtmlDocDumpMemoryFormat. (RobRichards),
              • -
              • documentation: typo (Michael Day), libxml man page (Albert - Chin),savefunction to XML buffer (Geert Jansen), small doc fix - (AronStansvik),
              • +

              2.6.23: Jan 5 2006

              • portability fixes: Windows (Rob Richards), getaddrinfo on Windows + (Kolja Nowak, Rob Richards), icc warnings (Kjartan Maraas), + --with-minimum compilation fixes (William Brack), error case handling fix + on Solaris (Albert Chin), don't use 'list' as parameter name reported by + Samuel Diaz Garcia, more old Unices portability fixes (Albert Chin), + MinGW compilation (Mark Junker), HP-UX compiler warnings (Rick + Jones),
              • +
              • code cleanup: xmlReportError (Adrian Mouat), remove xmlBufferClose + (Geert Jansen), unreachable code (Oleksandr Kononenko), refactoring + parsing code (Bjorn Reese)
              • +
              • bug fixes: xmlBuildRelativeURI and empty path (William Brack), + combinatory explosion and performances in regexp code, leak in + xmlTextReaderReadString(), xmlStringLenDecodeEntities problem (Massimo + Morara), Identity Constraints bugs and a segfault (Kasimier Buchcik), + XPath pattern based evaluation bugs (DV & Kasimier), + xmlSchemaContentModelDump() memory leak (Kasimier), potential leak in + xmlSchemaCheckCSelectorXPath(), xmlTextWriterVSprintf() misuse of + vsnprintf (William Brack), XHTML serialization fix (Rob Richards), CRLF + split problem (William), issues with non-namespaced attributes in + xmlAddChild() xmlAddNextSibling() and xmlAddPrevSibling() (Rob Richards), + HTML parsing of script, Python must not output to stdout (Nic Ferrier), + exclusive C14N namespace visibility (Aleksey Sanin), XSD dataype + totalDigits bug (Kasimier Buchcik), error handling when writing to an + xmlBuffer (Rob Richards), runtest schemas error not reported (Hisashi + Fujinaka), signed/unsigned problem in date/time code (Albert Chin), fix + XSI driven XSD validation (Kasimier), parsing of xs:decimal (Kasimier), + fix DTD writer output (Rob Richards), leak in xmlTextReaderReadInnerXml + (Gary Coady), regexp bug affecting schemas (Kasimier), configuration of + runtime debugging (Kasimier), xmlNodeBufGetContent bug on entity refs + (Oleksandr Kononenko), xmlRegExecPushString2 bug (Sreeni Nair), + compilation and build fixes (Michael Day), removed dependancies on + xmlSchemaValidError (Kasimier), bug with <xml:foo/>, more XPath + pattern based evaluation fixes (Kasimier)
              • +
              • improvements: XSD Schemas redefinitions/restrictions (Kasimier + Buchcik), node copy checks and fix for attribute (Rob Richards), counted + transition bug in regexps, ctxt->standalone = -2 to indicate no + standalone attribute was found, add xmlSchemaSetParserStructuredErrors() + (Kasimier Buchcik), add xmlTextReaderSchemaValidateCtxt() to API + (Kasimier), handle gzipped HTTP resources (Gary Coady), add + htmlDocDumpMemoryFormat. (Rob Richards),
              • +
              • documentation: typo (Michael Day), libxml man page (Albert Chin), save + function to XML buffer (Geert Jansen), small doc fix (Aron Stansvik),

              2.6.22: Sep 12 2005

              • build fixes: compile without schematron (Stéphane Bidoul)
              • -
              • bug fixes: xmlDebugDumpNode on namespace node (Oleg - Paraschenko)i,CDATApush parser bug, xmlElemDump problem with XHTML1 - doc,XML_FEATURE_xxxclash with expat headers renamed XML_WITH_xxx, fix - someoutput formattingfor meta element (Rob Richards), script and - styleXHTML1 serialization(David Madore), Attribute derivation fixups in - XSD(Kasimier Buchcik),better IDC error reports (Kasimier Buchcik)
              • -
              • improvements: add XML_SAVE_NO_EMPTY xmlSaveOption (Rob - Richards),addXML_SAVE_NO_XHTML xmlSaveOption, XML Schemas improvements - preparingforderive (Kasimier Buchcik).
              • -
              • documentation: generation of gtk-doc like docs, - integrationwithdevhelp.
              • -

              2.6.21: Sep 4 2005

              • build fixes: Cygwin portability fixes (Gerrit P. - Haase),callingconvention problems on Windows (Marcus Boerger), cleanups - based onLinus'sparse tool, update of win32/configure.js (Rob Richards), - removewarningson Windows(Marcus Boerger), compilation without SAX1, - detectionof thePython binary, use $GCC inestad of $CC = 'gcc' (Andrew - W.Nosenko),compilation/link with threads and old gcc, compile problem - byC370 onZ/OS,
              • -
              • bug fixes: http_proxy environments (Peter Breitenlohner), HTML - UTF-8bug(Jiri Netolicky), XPath NaN compare bug (William - Brack),htmlParseScriptpotential bug, Schemas regexp handling of spaces, - Base64Schemascomparisons NIST passes, automata build error - xsd:all,xmlGetNodePath fornamespaced attributes (Alexander Pohoyda), - xmlSchemasforeign namespaceshandling, XML Schemas facet comparison - (KupriyanovAnatolij),xmlSchemaPSimpleTypeErr error report (Kasimier - Buchcik), xml:namespaceahndling in Schemas (Kasimier), empty model group - in Schemas(Kasimier),wilcard in Schemas (Kasimier), URI composition - (William),xs:anyType inSchemas (Kasimier), Python resolver emmitting - errormessages directly,Python xmlAttr.parent (Jakub Piotr Clapa), trying - tofix the file path/URIconversion, xmlTextReaderGetAttribute fix - (RobRichards),xmlSchemaFreeAnnot memleak (Kasimier), HTML - UTF-8serialization, streamingXPath, Schemas determinism detection - problem,XInclude bug, Schemascontext type (Dean Hill), validation fix - (DerekPoon),xmlTextReaderGetAttribute[Ns] namespaces (Rob Richards), - Schemastype fix(Kuba Nowakowski), UTF-8 parser bug, error in - encodinghandling,xmlGetLineNo fixes, bug on entities handling, entity - nameextraction inerror handling with XInclude, text nodes in HTML body - tags(Gary Coady),xml:id and IDness at the treee level fixes, XPath - streamingpatternsbugs.
              • -
              • improvements: structured interfaces for schemas and RNG - errorreports(Marcus Boerger), optimization of the char data inner - loopparsing(thanks to Behdad Esfahbod for the idea), schematron - validationthoughnot finished yet, xmlSaveOption to omit XML declaration, - keyrefmatcherror reports (Kasimier), formal expression handling code - notpluggedyet, more lax mode for the HTML parser, parser - XML_PARSE_COMPACToptionfor text nodes allocation.
              • +
              • bug fixes: xmlDebugDumpNode on namespace node (Oleg Paraschenko)i, + CDATA push parser bug, xmlElemDump problem with XHTML1 doc, + XML_FEATURE_xxx clash with expat headers renamed XML_WITH_xxx, fix some + output formatting for meta element (Rob Richards), script and style + XHTML1 serialization (David Madore), Attribute derivation fixups in XSD + (Kasimier Buchcik), better IDC error reports (Kasimier Buchcik)
              • +
              • improvements: add XML_SAVE_NO_EMPTY xmlSaveOption (Rob Richards), add + XML_SAVE_NO_XHTML xmlSaveOption, XML Schemas improvements preparing for + derive (Kasimier Buchcik).
              • +
              • documentation: generation of gtk-doc like docs, integration with + devhelp.
              • +

              2.6.21: Sep 4 2005

              • build fixes: Cygwin portability fixes (Gerrit P. Haase), calling + convention problems on Windows (Marcus Boerger), cleanups based on Linus' + sparse tool, update of win32/configure.js (Rob Richards), remove warnings + on Windows(Marcus Boerger), compilation without SAX1, detection of the + Python binary, use $GCC inestad of $CC = 'gcc' (Andrew W. Nosenko), + compilation/link with threads and old gcc, compile problem by C370 on + Z/OS,
              • +
              • bug fixes: http_proxy environments (Peter Breitenlohner), HTML UTF-8 + bug (Jiri Netolicky), XPath NaN compare bug (William Brack), + htmlParseScript potential bug, Schemas regexp handling of spaces, Base64 + Schemas comparisons NIST passes, automata build error xsd:all, + xmlGetNodePath for namespaced attributes (Alexander Pohoyda), xmlSchemas + foreign namespaces handling, XML Schemas facet comparison (Kupriyanov + Anatolij), xmlSchemaPSimpleTypeErr error report (Kasimier Buchcik), xml: + namespace ahndling in Schemas (Kasimier), empty model group in Schemas + (Kasimier), wilcard in Schemas (Kasimier), URI composition (William), + xs:anyType in Schemas (Kasimier), Python resolver emmitting error + messages directly, Python xmlAttr.parent (Jakub Piotr Clapa), trying to + fix the file path/URI conversion, xmlTextReaderGetAttribute fix (Rob + Richards), xmlSchemaFreeAnnot memleak (Kasimier), HTML UTF-8 + serialization, streaming XPath, Schemas determinism detection problem, + XInclude bug, Schemas context type (Dean Hill), validation fix (Derek + Poon), xmlTextReaderGetAttribute[Ns] namespaces (Rob Richards), Schemas + type fix (Kuba Nowakowski), UTF-8 parser bug, error in encoding handling, + xmlGetLineNo fixes, bug on entities handling, entity name extraction in + error handling with XInclude, text nodes in HTML body tags (Gary Coady), + xml:id and IDness at the treee level fixes, XPath streaming patterns + bugs.
              • +
              • improvements: structured interfaces for schemas and RNG error reports + (Marcus Boerger), optimization of the char data inner loop parsing + (thanks to Behdad Esfahbod for the idea), schematron validation though + not finished yet, xmlSaveOption to omit XML declaration, keyref match + error reports (Kasimier), formal expression handling code not plugged + yet, more lax mode for the HTML parser, parser XML_PARSE_COMPACT option + for text nodes allocation.
              • documentation: xmllint man page had --nonet duplicated
              • -

              2.6.20: Jul 10 2005

              • build fixes: Windows build (Rob Richards), Mingw - compilation(IgorZlatkovic), Windows Makefile (Igor), gcc warnings - (Kasimierandandriy@google.com), use gcc weak references to pthread to - avoidthepthread dependancy on Linux, compilation problem (Steve - Nairn),compilingof subset (Morten Welinder), IPv6/ss_family compilation - (WilliamBrack),compilation when disabling parts of the library, - standalonetestdistribution.
              • -
              • bug fixes: bug in lang(), memory cleanup on errors (William - Brack),HTTPquery strings (Aron Stansvik), memory leak in DTD - (William),integeroverflow in XPath (William), nanoftp buffer size, - pattern "." apthfixup(Kasimier), leak in tree reported by Malcolm Rowe, - replaceNodepatch(Brent Hendricks), CDATA with NULL content (Mark Vakoc), - xml:basefixupon XInclude (William), pattern fixes (William), attribute - buginexclusive c14n (Aleksey Sanin), xml:space and xml:lang with - SAX2(RobRichards), namespace trouble in complex parsing (Malcolm Rowe), - XSDtypeQNames fixes (Kasimier), XPath streaming fixups (William), - RelaxNGbug(Rob Richards), Schemas for Schemas fixes (Kasimier), removal - of ID(RobRichards), a small RelaxNG leak, HTML parsing in push mode - bug(JamesBursa), failure to detect UTF-8 parsing bugs in - CDATAsections,areBlanks() heuristic failure, duplicate attributes in - DTDbug(William).
              • -
              • improvements: lot of work on Schemas by Kasimier Buchcik - bothonconformance and streaming, Schemas validation messages - (KasimierBuchcik,Matthew Burgess), namespace removal at the python - level(BrentHendricks), Update to new Schemas regression tests - fromW3C/Nist(Kasimier), xmlSchemaValidateFile() (Kasimier), - implementationofxmlTextReaderReadInnerXml and xmlTextReaderReadOuterXml - (JamesWert),standalone test framework and programs, new DOM - importAPIsxmlDOMWrapReconcileNamespaces() - xmlDOMWrapAdoptNode()andxmlDOMWrapRemoveNode(), extension of xmllint - capabilities for SAXandSchemas regression tests, xmlStopParser() - available in pull modetoo,ienhancement to xmllint --shell namespaces - support, Windows port ofthestandalone testing tools (Kasimier - andWilliam),xmlSchemaValidateStream() xmlSchemaSAXPlug() - andxmlSchemaSAXUnplug() SAXSchemas APIs, Schemas xmlReader support.
              • -

              2.6.19: Apr 02 2005

              • build fixes: drop .la from RPMs, --with-minimum build - fix(WilliamBrack), use XML_SOCKLEN_T instead of SOCKLEN_T because it - breakswith AIX5.3 compiler, fixed elfgcchack.h generation and PLT - reductioncode onLinux/ELF/gcc4
              • -
              • bug fixes: schemas type decimal fixups (William Brack), - xmmlintreturncode (Gerry Murphy), small schemas fixes (Matthew Burgess - andGUYFabrice), workaround "DAV:" namespace brokeness in c14n - (AlekseySanin),segfault in Schemas (Kasimier Buchcik), Schemas - attributevalidation(Kasimier), Prop related functions and - xmlNewNodeEatName (RobRichards),HTML serialization of name attribute on a - elements, Pythonerror handlersleaks and improvement (Brent Hendricks), - uninitializedvariable inencoding code, Relax-NG validation bug, potential - crashifgnorableWhitespace is NULL, xmlSAXParseDoc and - xmlParseDocsignatures,switched back to assuming UTF-8 in case no encoding - is givenatserialization time
              • -
              • improvements: lot of work on Schemas by Kasimier Buchcik - onfacetschecking and also mixed handling.
              • +

              2.6.20: Jul 10 2005

              • build fixes: Windows build (Rob Richards), Mingw compilation (Igor + Zlatkovic), Windows Makefile (Igor), gcc warnings (Kasimier and + andriy@google.com), use gcc weak references to pthread to avoid the + pthread dependancy on Linux, compilation problem (Steve Nairn), compiling + of subset (Morten Welinder), IPv6/ss_family compilation (William Brack), + compilation when disabling parts of the library, standalone test + distribution.
              • +
              • bug fixes: bug in lang(), memory cleanup on errors (William Brack), + HTTP query strings (Aron Stansvik), memory leak in DTD (William), integer + overflow in XPath (William), nanoftp buffer size, pattern "." apth fixup + (Kasimier), leak in tree reported by Malcolm Rowe, replaceNode patch + (Brent Hendricks), CDATA with NULL content (Mark Vakoc), xml:base fixup + on XInclude (William), pattern fixes (William), attribute bug in + exclusive c14n (Aleksey Sanin), xml:space and xml:lang with SAX2 (Rob + Richards), namespace trouble in complex parsing (Malcolm Rowe), XSD type + QNames fixes (Kasimier), XPath streaming fixups (William), RelaxNG bug + (Rob Richards), Schemas for Schemas fixes (Kasimier), removal of ID (Rob + Richards), a small RelaxNG leak, HTML parsing in push mode bug (James + Bursa), failure to detect UTF-8 parsing bugs in CDATA sections, + areBlanks() heuristic failure, duplicate attributes in DTD bug + (William).
              • +
              • improvements: lot of work on Schemas by Kasimier Buchcik both on + conformance and streaming, Schemas validation messages (Kasimier Buchcik, + Matthew Burgess), namespace removal at the python level (Brent + Hendricks), Update to new Schemas regression tests from W3C/Nist + (Kasimier), xmlSchemaValidateFile() (Kasimier), implementation of + xmlTextReaderReadInnerXml and xmlTextReaderReadOuterXml (James Wert), + standalone test framework and programs, new DOM import APIs + xmlDOMWrapReconcileNamespaces() xmlDOMWrapAdoptNode() and + xmlDOMWrapRemoveNode(), extension of xmllint capabilities for SAX and + Schemas regression tests, xmlStopParser() available in pull mode too, + ienhancement to xmllint --shell namespaces support, Windows port of the + standalone testing tools (Kasimier and William), + xmlSchemaValidateStream() xmlSchemaSAXPlug() and xmlSchemaSAXUnplug() SAX + Schemas APIs, Schemas xmlReader support.
              • +

              2.6.19: Apr 02 2005

              • build fixes: drop .la from RPMs, --with-minimum build fix (William + Brack), use XML_SOCKLEN_T instead of SOCKLEN_T because it breaks with AIX + 5.3 compiler, fixed elfgcchack.h generation and PLT reduction code on + Linux/ELF/gcc4
              • +
              • bug fixes: schemas type decimal fixups (William Brack), xmmlint return + code (Gerry Murphy), small schemas fixes (Matthew Burgess and GUY + Fabrice), workaround "DAV:" namespace brokeness in c14n (Aleksey Sanin), + segfault in Schemas (Kasimier Buchcik), Schemas attribute validation + (Kasimier), Prop related functions and xmlNewNodeEatName (Rob Richards), + HTML serialization of name attribute on a elements, Python error handlers + leaks and improvement (Brent Hendricks), uninitialized variable in + encoding code, Relax-NG validation bug, potential crash if + gnorableWhitespace is NULL, xmlSAXParseDoc and xmlParseDoc signatures, + switched back to assuming UTF-8 in case no encoding is given at + serialization time
              • +
              • improvements: lot of work on Schemas by Kasimier Buchcik on facets + checking and also mixed handling.
              • -

              2.6.18: Mar 13 2005

              • build fixes: warnings (Peter Breitenlohner), - testapi.cgeneration,Bakefile support (Francesco Montorsi), Windows - compilation(Joel Reed),some gcc4 fixes, HP-UX portability fixes (Rick - Jones).
              • -
              • bug fixes: xmlSchemaElementDump namespace (Kasimier Buchcik), - pushandxmlreader stopping on non-fatal errors, thread support - fordictionnariesreference counting (Gary Coady), internal subset and - pushproblem, URLsaved in xmlCopyDoc, various schemas bug fixes - (Kasimier),Python pathsfixup (Stephane Bidoul), xmlGetNodePath and - namespaces,xmlSetNsProp fix(Mike Hommey), warning should not count as - error (WilliamBrack),xmlCreatePushParser empty chunk, XInclude parser - flags (William),cleanupFTP and HTTP code to reuse the uri parsing and - IPv6(William),xmlTextWriterStartAttributeNS fix (Rob - Richards),XMLLINT_INDENT beingempty (William), xmlWriter bugs (Rob - Richards),multithreading on Windows(Rich Salz), xmlSearchNsByHref fix - (Kasimier),Python binding leak (BrentHendricks), aliasing bug exposed by - gcc4 ons390, xmlTextReaderNext bug(Rob Richards), Schemas decimal type - fixes(William Brack),xmlByteConsumed static buffer (Ben Maurer).
              • -
              • improvement: speedup parsing comments and DTDs, dictionnary - supportforhash tables, Schemas Identity constraints (Kasimier), - streamingXPathsubset, xmlTextReaderReadString added (Bjorn Reese), - Schemascanonicalvalues handling (Kasimier), add - xmlTextReaderByteConsumed(AronStansvik),
              • +

              2.6.18: Mar 13 2005

              • build fixes: warnings (Peter Breitenlohner), testapi.c generation, + Bakefile support (Francesco Montorsi), Windows compilation (Joel Reed), + some gcc4 fixes, HP-UX portability fixes (Rick Jones).
              • +
              • bug fixes: xmlSchemaElementDump namespace (Kasimier Buchcik), push and + xmlreader stopping on non-fatal errors, thread support for dictionnaries + reference counting (Gary Coady), internal subset and push problem, URL + saved in xmlCopyDoc, various schemas bug fixes (Kasimier), Python paths + fixup (Stephane Bidoul), xmlGetNodePath and namespaces, xmlSetNsProp fix + (Mike Hommey), warning should not count as error (William Brack), + xmlCreatePushParser empty chunk, XInclude parser flags (William), cleanup + FTP and HTTP code to reuse the uri parsing and IPv6 (William), + xmlTextWriterStartAttributeNS fix (Rob Richards), XMLLINT_INDENT being + empty (William), xmlWriter bugs (Rob Richards), multithreading on Windows + (Rich Salz), xmlSearchNsByHref fix (Kasimier), Python binding leak (Brent + Hendricks), aliasing bug exposed by gcc4 on s390, xmlTextReaderNext bug + (Rob Richards), Schemas decimal type fixes (William Brack), + xmlByteConsumed static buffer (Ben Maurer).
              • +
              • improvement: speedup parsing comments and DTDs, dictionnary support for + hash tables, Schemas Identity constraints (Kasimier), streaming XPath + subset, xmlTextReaderReadString added (Bjorn Reese), Schemas canonical + values handling (Kasimier), add xmlTextReaderByteConsumed (Aron + Stansvik),
              • Documentation: Wiki support (Joel Reed)
              • -

              2.6.17: Jan 16 2005

              • build fixes: Windows, warnings removal (William - Brack),maintainer-cleandependency(William), build in a different - directory(William), fixing--with-minimum configure build (William), BeOS - build(Marcin Konicki),Python-2.4 detection (William), compilation on AIX - (DanMcNichol)
              • -
              • bug fixes: xmlTextReaderHasAttributes (Rob - Richards),xmlCtxtReadFile()to use the catalog(s), loop on output (William - Brack),XPath memory leak,ID deallocation problem (Steve Shepard), - debugDumpNodecrash (William),warning not using error callback (William), - xmlStopParserbug (William),UTF-16 with BOM on DTDs (William), namespace - bug on emptyelements inpush mode (Rob Richards), line and col - computations fixups(AlekseySanin), xmlURIEscape fix (William), - xmlXPathErr on bad range(William),patterns with too many steps, bug in - RNG choice optimization,line numbersometimes missing.
              • -
              • improvements: XSD Schemas (Kasimier Buchcik), pythongenerator(William), - xmlUTF8Strpos speedup (William), unicode Pythonstrings(William), XSD - error reports (Kasimier Buchcik), Python __str__callserialize().
              • -
              • new APIs: added xmlDictExists(), GetLineNumber and - GetColumnNumberforthe xmlReader (Aleksey Sanin), Dynamic Shared Libraries - APIs (mostlyJoelReed), error extraction API from regexps, new XMLSave - option forformat(Phil Shafer)
              • -
              • documentation: site improvement (John Fleck), FAQ entries(William).
              • -

              2.6.16: Nov 10 2004

              • general hardening and bug fixing crossing all the API based - onnewautomated regression testing
              • +

              2.6.17: Jan 16 2005

              • build fixes: Windows, warnings removal (William Brack), + maintainer-clean dependency(William), build in a different directory + (William), fixing --with-minimum configure build (William), BeOS build + (Marcin Konicki), Python-2.4 detection (William), compilation on AIX (Dan + McNichol)
              • +
              • bug fixes: xmlTextReaderHasAttributes (Rob Richards), xmlCtxtReadFile() + to use the catalog(s), loop on output (William Brack), XPath memory leak, + ID deallocation problem (Steve Shepard), debugDumpNode crash (William), + warning not using error callback (William), xmlStopParser bug (William), + UTF-16 with BOM on DTDs (William), namespace bug on empty elements in + push mode (Rob Richards), line and col computations fixups (Aleksey + Sanin), xmlURIEscape fix (William), xmlXPathErr on bad range (William), + patterns with too many steps, bug in RNG choice optimization, line number + sometimes missing.
              • +
              • improvements: XSD Schemas (Kasimier Buchcik), python generator + (William), xmlUTF8Strpos speedup (William), unicode Python strings + (William), XSD error reports (Kasimier Buchcik), Python __str__ call + serialize().
              • +
              • new APIs: added xmlDictExists(), GetLineNumber and GetColumnNumber for + the xmlReader (Aleksey Sanin), Dynamic Shared Libraries APIs (mostly Joel + Reed), error extraction API from regexps, new XMLSave option for format + (Phil Shafer)
              • +
              • documentation: site improvement (John Fleck), FAQ entries + (William).
              • +

              2.6.16: Nov 10 2004

              • general hardening and bug fixing crossing all the API based on new + automated regression testing
              • build fix: IPv6 build and test on AIX (Dodji Seketeli)
              • -
              • bug fixes: problem with XML::Libxml reported by Petr - Pajas,encodingconversion functions return values, UTF-8 bug affecting - XPathreported byMarkus Bertheau, catalog problem with NULL entries - (WilliamBrack)
              • -
              • documentation: fix to xmllint man page, some API - functiondescritpionwere updated.
              • -
              • improvements: DTD validation APIs provided at the Python - level(BrentHendricks)
              • +
              • bug fixes: problem with XML::Libxml reported by Petr Pajas, encoding + conversion functions return values, UTF-8 bug affecting XPath reported by + Markus Bertheau, catalog problem with NULL entries (William Brack)
              • +
              • documentation: fix to xmllint man page, some API function descritpion + were updated.
              • +
              • improvements: DTD validation APIs provided at the Python level (Brent + Hendricks)

              2.6.15: Oct 27 2004

              • security fixes on the nanoftp and nanohttp modules
              • -
              • build fixes: xmllint detection bug in configure, building - outsidethesource tree (Thomas Fitzsimmons)
              • -
              • bug fixes: HTML parser on broken ASCII chars in names - (William),Pythonpaths (Malcolm Tredinnick), xmlHasNsProp and default - namespace(William),saving to python file objects (Malcolm Tredinnick), - DTD lookupfix(Malcolm), save back <group> in catalogs (William), - treebuildfixes (DV and Rob Richards), Schemas memory bug, structured - errorhandleron Python 64bits, thread local memory deallocation, memory - leakreportedby Volker Roth, xmlValidateDtd in the presence of an - internalsubset,entities and _private problem (William), - xmlBuildRelativeURIerror(William).
              • -
              • improvements: better XInclude error reports (William), - treedebuggingmodule and tests, convenience functions at the Reader - API(GrahamBennett), add support for PI in the HTML parser.
              • -

              2.6.14: Sep 29 2004

              • build fixes: configure paths for xmllint and - xsltproc,compilationwithout HTML parser, compilation warning cleanups - (WilliamBrack &Malcolm Tredinnick), VMS makefile update (Craig - Berry),
              • -
              • bug fixes: xmlGetUTF8Char (William Brack), QName - properties(KasimierBuchcik), XInclude testing, Notation - serialization,UTF8ToISO8859xtranscoding (Mark Itzcovitz), lots of XML - Schemas cleanupand fixes(Kasimier), ChangeLog cleanup (Stepan Kasal), - memory fixes (MarkVakoc),handling of failed realloc(), out of bound array - adressing inSchemasdate handling, Python space/tabs cleanups (Malcolm - Tredinnick),NMTOKENSE20 validation fix (Malcolm),
              • -
              • improvements: added W3C XML Schemas testsuite (Kasimier - Buchcik),addxmlSchemaValidateOneElement (Kasimier), Python - exceptionhierearchy(Malcolm Tredinnick), Python libxml2 driver - improvement(MalcolmTredinnick), Schemas support - forxsi:schemaLocation,xsi:noNamespaceSchemaLocation, xsi:type - (KasimierBuchcik)
              • -

              2.6.13: Aug 31 2004

              • build fixes: Windows and zlib (Igor Zlatkovic), -O flag withgcc,Solaris - compiler warning, fixing RPM BuildRequires,
              • -
              • fixes: DTD loading on Windows (Igor), Schemas error - reportsAPIs(Kasimier Buchcik), Schemas validation crash, xmlCheckUTF8 - (WilliamBrackand Julius Mittenzwei), Schemas facet check (Kasimier), - defaultnamespaceproblem (William), Schemas hexbinary empty values, - encodingerror couldgenrate a serialization loop.
              • -
              • Improvements: Schemas validity improvements (Kasimier), added - --pathand--load-trace options to xmllint
              • +
              • build fixes: xmllint detection bug in configure, building outside the + source tree (Thomas Fitzsimmons)
              • +
              • bug fixes: HTML parser on broken ASCII chars in names (William), Python + paths (Malcolm Tredinnick), xmlHasNsProp and default namespace (William), + saving to python file objects (Malcolm Tredinnick), DTD lookup fix + (Malcolm), save back <group> in catalogs (William), tree build + fixes (DV and Rob Richards), Schemas memory bug, structured error handler + on Python 64bits, thread local memory deallocation, memory leak reported + by Volker Roth, xmlValidateDtd in the presence of an internal subset, + entities and _private problem (William), xmlBuildRelativeURI error + (William).
              • +
              • improvements: better XInclude error reports (William), tree debugging + module and tests, convenience functions at the Reader API (Graham + Bennett), add support for PI in the HTML parser.
              • +

              2.6.14: Sep 29 2004

              • build fixes: configure paths for xmllint and xsltproc, compilation + without HTML parser, compilation warning cleanups (William Brack & + Malcolm Tredinnick), VMS makefile update (Craig Berry),
              • +
              • bug fixes: xmlGetUTF8Char (William Brack), QName properties (Kasimier + Buchcik), XInclude testing, Notation serialization, UTF8ToISO8859x + transcoding (Mark Itzcovitz), lots of XML Schemas cleanup and fixes + (Kasimier), ChangeLog cleanup (Stepan Kasal), memory fixes (Mark Vakoc), + handling of failed realloc(), out of bound array adressing in Schemas + date handling, Python space/tabs cleanups (Malcolm Tredinnick), NMTOKENS + E20 validation fix (Malcolm),
              • +
              • improvements: added W3C XML Schemas testsuite (Kasimier Buchcik), add + xmlSchemaValidateOneElement (Kasimier), Python exception hierearchy + (Malcolm Tredinnick), Python libxml2 driver improvement (Malcolm + Tredinnick), Schemas support for xsi:schemaLocation, + xsi:noNamespaceSchemaLocation, xsi:type (Kasimier Buchcik)
              • +

              2.6.13: Aug 31 2004

              • build fixes: Windows and zlib (Igor Zlatkovic), -O flag with gcc, + Solaris compiler warning, fixing RPM BuildRequires,
              • +
              • fixes: DTD loading on Windows (Igor), Schemas error reports APIs + (Kasimier Buchcik), Schemas validation crash, xmlCheckUTF8 (William Brack + and Julius Mittenzwei), Schemas facet check (Kasimier), default namespace + problem (William), Schemas hexbinary empty values, encoding error could + genrate a serialization loop.
              • +
              • Improvements: Schemas validity improvements (Kasimier), added --path + and --load-trace options to xmllint
              • documentation: tutorial update (John Fleck)
              • -

              2.6.12: Aug 22 2004

              • build fixes: fix --with-minimum, elfgcchack.h - fixes(PeterBreitenlohner), perl path lookup (William), diff on - Solaris(AlbertChin), some 64bits cleanups.
              • -
              • Python: avoid a warning with 2.3 (William Brack), tab and - spacemixes(William), wrapper generator fixes (William), Cygwin support - (GerritP.Haase), node wrapper fix (Marc-Antoine Parent), XML - Schemassupport(Torkel Lyng)
              • +

              2.6.12: Aug 22 2004

              • build fixes: fix --with-minimum, elfgcchack.h fixes (Peter + Breitenlohner), perl path lookup (William), diff on Solaris (Albert + Chin), some 64bits cleanups.
              • +
              • Python: avoid a warning with 2.3 (William Brack), tab and space mixes + (William), wrapper generator fixes (William), Cygwin support (Gerrit P. + Haase), node wrapper fix (Marc-Antoine Parent), XML Schemas support + (Torkel Lyng)
              • Schemas: a lot of bug fixes and improvements from Kasimier Buchcik
              • -
              • fixes: RVT fixes (William), XPath context resets bug - (William),memorydebug (Steve Hay), catalog white space handling - (PeterBreitenlohner),xmlReader state after attribute reading - (William),structured errorhandler (William), XInclude generated xml:base - fixup(William), Windowsmemory reallocation problem (Steve Hay), Out of - Memoryconditionshandling (William and Olivier Andrieu), htmlNewDoc() - charsetbug,htmlReadMemory init (William), a posteriori validation - DTDbase(William), notations serialization missing, - xmlGetNodePath(Dodji),xmlCheckUTF8 (Diego Tartara), missing line numbers - onentity(William)
              • -
              • improvements: DocBook catalog build scrip (William), - xmlcatalogtool(Albert Chin), xmllint --c14n option, no_proxy environment - (MikeHommey),xmlParseInNodeContext() addition, extend xmllint --shell, - allowXIncludeto not generate start/end nodes, extend xmllint --version - toinclude CVStag (William)
              • -
              • documentation: web pages fixes, validity API docs fixes(William)schemas - API fix (Eric Haszlakiewicz), xmllint man page (JohnFleck)
              • -

              2.6.11: July 5 2004

              • Schemas: a lot of changes and improvements by Kasimier - Buchcikforattributes, namespaces and simple types.
              • -
              • build fixes: --with-minimum (William Brack), some gcccleanup(William), - --with-thread-alloc (William)
              • -
              • portability: Windows binary package change (Igor Zlatkovic),Catalogpath - on Windows
              • -
              • documentation: update to the tutorial (John Fleck), xmllint - returncode(John Fleck), man pages (Ville Skytta),
              • -
              • bug fixes: C14N bug serializing namespaces (Aleksey - Sanin),testSAXproperly initialize the library (William), empty node set - inXPath(William), xmlSchemas errors (William), invalid charref - problempointedby Morus Walter, XInclude xml:base generation (William), - Relax-NGbugwith div processing (William), XPointer and - xml:baseproblem(William),Reader and entities, xmllint return code for - schemas(William), readerstreaming problem (Steve Ball), DTD - serializationproblem (William),libxml.m4 fixes (Mike Hommey), do not - providedestructors as methods onPython classes, xmlReader buffer bug, - Pythonbindings memory interfacesimprovement (with Stéphane Bidoul), Fixed - thepush parser to be back tosynchronous behaviour.
              • -
              • improvement: custom per-thread I/O enhancement (Rob - Richards),registernamespace in debug shell (Stefano Debenedetti), Python - basedregressiontest for non-Unix users (William), dynamically increase - thenumber ofXPath extension functions in Python and fix a memory - leak(Marc-AntoineParent and William)
              • -
              • performance: hack done with Arjan van de Ven to reduce ELF - footprintandgenerated code on Linux, plus use gcc runtime profiling to - optimizethecode generated in the RPM packages.
              • +
              • fixes: RVT fixes (William), XPath context resets bug (William), memory + debug (Steve Hay), catalog white space handling (Peter Breitenlohner), + xmlReader state after attribute reading (William), structured error + handler (William), XInclude generated xml:base fixup (William), Windows + memory reallocation problem (Steve Hay), Out of Memory conditions + handling (William and Olivier Andrieu), htmlNewDoc() charset bug, + htmlReadMemory init (William), a posteriori validation DTD base + (William), notations serialization missing, xmlGetNodePath (Dodji), + xmlCheckUTF8 (Diego Tartara), missing line numbers on entity + (William)
              • +
              • improvements: DocBook catalog build scrip (William), xmlcatalog tool + (Albert Chin), xmllint --c14n option, no_proxy environment (Mike Hommey), + xmlParseInNodeContext() addition, extend xmllint --shell, allow XInclude + to not generate start/end nodes, extend xmllint --version to include CVS + tag (William)
              • +
              • documentation: web pages fixes, validity API docs fixes (William) + schemas API fix (Eric Haszlakiewicz), xmllint man page (John Fleck)
              • +

              2.6.11: July 5 2004

              • Schemas: a lot of changes and improvements by Kasimier Buchcik for + attributes, namespaces and simple types.
              • +
              • build fixes: --with-minimum (William Brack), some gcc cleanup + (William), --with-thread-alloc (William)
              • +
              • portability: Windows binary package change (Igor Zlatkovic), Catalog + path on Windows
              • +
              • documentation: update to the tutorial (John Fleck), xmllint return code + (John Fleck), man pages (Ville Skytta),
              • +
              • bug fixes: C14N bug serializing namespaces (Aleksey Sanin), testSAX + properly initialize the library (William), empty node set in XPath + (William), xmlSchemas errors (William), invalid charref problem pointed + by Morus Walter, XInclude xml:base generation (William), Relax-NG bug + with div processing (William), XPointer and xml:base problem(William), + Reader and entities, xmllint return code for schemas (William), reader + streaming problem (Steve Ball), DTD serialization problem (William), + libxml.m4 fixes (Mike Hommey), do not provide destructors as methods on + Python classes, xmlReader buffer bug, Python bindings memory interfaces + improvement (with Stéphane Bidoul), Fixed the push parser to be back to + synchronous behaviour.
              • +
              • improvement: custom per-thread I/O enhancement (Rob Richards), register + namespace in debug shell (Stefano Debenedetti), Python based regression + test for non-Unix users (William), dynamically increase the number of + XPath extension functions in Python and fix a memory leak (Marc-Antoine + Parent and William)
              • +
              • performance: hack done with Arjan van de Ven to reduce ELF footprint + and generated code on Linux, plus use gcc runtime profiling to optimize + the code generated in the RPM packages.

              2.6.10: May 17 2004

              • Web page generated for ChangeLog
              • build fixes: --without-html problems, make check without make all
              • -
              • portability: problem with xpath.c on Windows (MSC and - Borland),memcmpvs. strncmp on Solaris, XPath tests on Windows (Mark - Vakoc), C++ donotuse "list" as parameter name, make tests work with - Python 1.5(EdDavis),
              • -
              • improvements: made xmlTextReaderMode public, small - buffersresizing(Morten Welinder), add --maxmem option to - xmllint,addxmlPopInputCallback() for Matt Sergeant, refactoring - ofserializationescaping, added escaping customization
              • -
              • bugfixes: xsd:extension (Taihei Goi), assorted regexp - bugs(WilliamBrack), xmlReader end of stream problem, node deregistration - withreader,URI escaping and filemanes, XHTML1 formatting (Nick - Wellnhofer),regexptransition reduction (William), various XSD Schemas - fixes(KasimierBuchcik), XInclude fallback problem (William), weird - problemswith DTD(William), structured error handler callback context - (William),reversexmlEncodeSpecialChars() behaviour back to escaping - '"'
              • +
              • portability: problem with xpath.c on Windows (MSC and Borland), memcmp + vs. strncmp on Solaris, XPath tests on Windows (Mark Vakoc), C++ do not + use "list" as parameter name, make tests work with Python 1.5 (Ed + Davis),
              • +
              • improvements: made xmlTextReaderMode public, small buffers resizing + (Morten Welinder), add --maxmem option to xmllint, add + xmlPopInputCallback() for Matt Sergeant, refactoring of serialization + escaping, added escaping customization
              • +
              • bugfixes: xsd:extension (Taihei Goi), assorted regexp bugs (William + Brack), xmlReader end of stream problem, node deregistration with reader, + URI escaping and filemanes, XHTML1 formatting (Nick Wellnhofer), regexp + transition reduction (William), various XSD Schemas fixes (Kasimier + Buchcik), XInclude fallback problem (William), weird problems with DTD + (William), structured error handler callback context (William), reverse + xmlEncodeSpecialChars() behaviour back to escaping '"'

              2.6.9: Apr 18 2004

              • implement xml:id Working Draft, relaxed XPath id() checking
              • -
              • bugfixes: xmlCtxtReset (Brent Hendricks), line number and - CDATA(DaveBeckett), Relax-NG compilation (William Brack), Regexp - patches(withWilliam), xmlUriEscape (Mark Vakoc), a Relax-NG notAllowed - problem(withWilliam), Relax-NG name classes compares (William), - XIncludeduplicatefallback (William), external DTD encoding detection - (William), aDTDvalidation bug (William), xmlReader Close() fix, - recusiveextentionschemas
              • -
              • improvements: use xmlRead* APIs in test tools (Mark - Vakoc),indentingsave optimization, better handle IIS broken HTTP - redirectbehaviour (IanHummel), HTML parser frameset (James Bursa), - libxml2-pythonRPMdependancy, XML Schemas union support (Kasimier - Buchcik), warningremovalclanup (William), keep ChangeLog compressed when - installing fromRPMs
              • -
              • documentation: examples and xmlDocDumpMemory docs (John - Fleck),newexample (load, xpath, modify, save), xmlCatalogDump() - comments,
              • -
              • Windows: Borland C++ builder (Eric Zurcher), work - aroundMicrosoftcompiler NaN handling bug (Mark Vakoc)
              • +
              • bugfixes: xmlCtxtReset (Brent Hendricks), line number and CDATA (Dave + Beckett), Relax-NG compilation (William Brack), Regexp patches (with + William), xmlUriEscape (Mark Vakoc), a Relax-NG notAllowed problem (with + William), Relax-NG name classes compares (William), XInclude duplicate + fallback (William), external DTD encoding detection (William), a DTD + validation bug (William), xmlReader Close() fix, recusive extention + schemas
              • +
              • improvements: use xmlRead* APIs in test tools (Mark Vakoc), indenting + save optimization, better handle IIS broken HTTP redirect behaviour (Ian + Hummel), HTML parser frameset (James Bursa), libxml2-python RPM + dependancy, XML Schemas union support (Kasimier Buchcik), warning removal + clanup (William), keep ChangeLog compressed when installing from RPMs
              • +
              • documentation: examples and xmlDocDumpMemory docs (John Fleck), new + example (load, xpath, modify, save), xmlCatalogDump() comments,
              • +
              • Windows: Borland C++ builder (Eric Zurcher), work around Microsoft + compiler NaN handling bug (Mark Vakoc)

              2.6.8: Mar 23 2004

              • First step of the cleanup of the serialization code and APIs
              • -
              • XML Schemas: mixed content (Adam Dickmeiss), QName handling - fixes(AdamDickmeiss), anyURI for "" (John Belmonte)
              • +
              • XML Schemas: mixed content (Adam Dickmeiss), QName handling fixes (Adam + Dickmeiss), anyURI for "" (John Belmonte)
              • Python: Canonicalization C14N support added (Anthony Carrico)
              • xmlDocCopyNode() extension (William)
              • -
              • Relax-NG: fix when processing XInclude results - (William),externalreference in interleave (William), missing error - on<choice>failure (William), memory leak in schemas - datatypefacets.
              • +
              • Relax-NG: fix when processing XInclude results (William), external + reference in interleave (William), missing error on <choice> + failure (William), memory leak in schemas datatype facets.
              • xmlWriter: patch for better DTD support (Alfred Mickautsch)
              • -
              • bug fixes: xmlXPathLangFunction memory leak (Mike Hommey - andWilliamBrack), no ID errors if using HTML_PARSE_NOERROR, - xmlcatalogfallbacks toURI on SYSTEM lookup failure, XInclude parse - flagsinheritance (William),XInclude and XPointer fixes for entities - (William),XML parser bugreported by Holger Rauch, nanohttp fd leak - (William),regexps chargroups '-' handling (William), dictionnary - reference countingproblems,do not close stderr.
              • +
              • bug fixes: xmlXPathLangFunction memory leak (Mike Hommey and William + Brack), no ID errors if using HTML_PARSE_NOERROR, xmlcatalog fallbacks to + URI on SYSTEM lookup failure, XInclude parse flags inheritance (William), + XInclude and XPointer fixes for entities (William), XML parser bug + reported by Holger Rauch, nanohttp fd leak (William), regexps char + groups '-' handling (William), dictionnary reference counting problems, + do not close stderr.
              • performance patches from Petr Pajas
              • Documentation fixes: XML_CATALOG_FILES in man pages (Mike Hommey)
              • -
              • compilation and portability fixes: --without-valid, - catalogcleanups(Peter Breitenlohner), MingW patch (Roland - Schwingel),cross-compilationto Windows (Christophe de Vienne), - --with-html-dirfixup (Julio MerinoVidal), Windows build (Eric - Zurcher)
              • +
              • compilation and portability fixes: --without-valid, catalog cleanups + (Peter Breitenlohner), MingW patch (Roland Schwingel), cross-compilation + to Windows (Christophe de Vienne), --with-html-dir fixup (Julio Merino + Vidal), Windows build (Eric Zurcher)

              2.6.7: Feb 23 2004

              • documentation: tutorial updates (John Fleck), benchmark results
              • xmlWriter: updates and fixes (Alfred Mickautsch, Lucas Brasilino)
              • XPath optimization (Petr Pajas)
              • DTD ID handling optimization
              • -
              • bugfixes: xpath number with > 19 fractional (William - Brack),pushmode with unescaped '>' characters, fix xmllint --stream - --timing,fixxmllint --memory --stream memory - usage,xmlAttrSerializeTxtContenthandling NULL, trying to fix - Relax-NG/Perlinterface.
              • +
              • bugfixes: xpath number with > 19 fractional (William Brack), push + mode with unescaped '>' characters, fix xmllint --stream --timing, fix + xmllint --memory --stream memory usage, xmlAttrSerializeTxtContent + handling NULL, trying to fix Relax-NG/Perl interface.
              • python: 2.3 compatibility, whitespace fixes (Malcolm Tredinnick)
              • Added relaxng option to xmllint --shell
              • -

              2.6.6: Feb 12 2004

              • nanohttp and nanoftp: buffer overflow error on URI parsing - (IgorandWilliam) reported by Yuuichi Teranishi
              • -
              • bugfixes: make test and path issues, xmlWriter - attributeserialization(William Brack), xmlWriter indentation (William), - schemasvalidation(Eric Haszlakiewicz), XInclude dictionnaries issues - (Williamand OlegParaschenko), XInclude empty fallback (William), HTML - warnings(William),XPointer in XInclude (William), Python - namespaceserialization,isolat1ToUTF8 bound error (Alfred Mickautsch), - output ofparameterentities in internal subset (William), internal subset - bug inpush mode,<xs:all> fix (Alexey Sarytchev)
              • -
              • Build: fix for automake-1.8 (Alexander Winston), warningsremoval(Philip - Ludlam), SOCKLEN_T detection fixes (Daniel Richard),fix--with-minimum - configuration.
              • +

              2.6.6: Feb 12 2004

              • nanohttp and nanoftp: buffer overflow error on URI parsing (Igor and + William) reported by Yuuichi Teranishi
              • +
              • bugfixes: make test and path issues, xmlWriter attribute serialization + (William Brack), xmlWriter indentation (William), schemas validation + (Eric Haszlakiewicz), XInclude dictionnaries issues (William and Oleg + Paraschenko), XInclude empty fallback (William), HTML warnings (William), + XPointer in XInclude (William), Python namespace serialization, + isolat1ToUTF8 bound error (Alfred Mickautsch), output of parameter + entities in internal subset (William), internal subset bug in push mode, + <xs:all> fix (Alexey Sarytchev)
              • +
              • Build: fix for automake-1.8 (Alexander Winston), warnings removal + (Philip Ludlam), SOCKLEN_T detection fixes (Daniel Richard), fix + --with-minimum configuration.
              • XInclude: allow the 2001 namespace without warning.
              • -
              • Documentation: missing example/index.html (John - Fleck),versiondependancies (John Fleck)
              • +
              • Documentation: missing example/index.html (John Fleck), version + dependancies (John Fleck)
              • reader API: structured error reporting (Steve Ball)
              • -
              • Windows compilation: mingw, msys (Mikhail - Grushinskiy),functionprototype (Cameron Johnson), MSVC6 compiler - warnings,_WINSOCKAPI_patch
              • -
              • Parsers: added xmlByteConsumed(ctxt) API to get the byte - offestininput.
              • -

              2.6.5: Jan 25 2004

              • Bugfixes: dictionnaries for schemas (William Brack), - regexpsegfault(William), xs:all problem (William), a number of - XPointerbugfixes(William), xmllint error go to stderr, DTD validation - problemwithnamespace, memory leak (William), SAX1 cleanup and minimal - optionsfixes(Mark Vadoc), parser context reset on error (Shaun McCance), - XPathunionevaluation problem (William) , xmlReallocLoc with NULL - (AlekseySanin),XML Schemas double free (Steve Ball), XInclude with no - href,argumentcallbacks order for XPath callbacks (Frederic Peters)
              • -
              • Documentation: python scripts (William Brack), xslt - stylesheets(JohnFleck), doc (Sven Zimmerman), I/O example.
              • -
              • Python bindings: fixes (William), enum support - (StéphaneBidoul),structured error reporting (Stéphane Bidoul)
              • -
              • XInclude: various fixes for conformance, problem related - todictionnaryreferences (William & me), recursion (William)
              • -
              • xmlWriter: indentation (Lucas Brasilino), memory - leaks(AlfredMickautsch),
              • +
              • Windows compilation: mingw, msys (Mikhail Grushinskiy), function + prototype (Cameron Johnson), MSVC6 compiler warnings, _WINSOCKAPI_ + patch
              • +
              • Parsers: added xmlByteConsumed(ctxt) API to get the byte offest in + input.
              • +

              2.6.5: Jan 25 2004

              • Bugfixes: dictionnaries for schemas (William Brack), regexp segfault + (William), xs:all problem (William), a number of XPointer bugfixes + (William), xmllint error go to stderr, DTD validation problem with + namespace, memory leak (William), SAX1 cleanup and minimal options fixes + (Mark Vadoc), parser context reset on error (Shaun McCance), XPath union + evaluation problem (William) , xmlReallocLoc with NULL (Aleksey Sanin), + XML Schemas double free (Steve Ball), XInclude with no href, argument + callbacks order for XPath callbacks (Frederic Peters)
              • +
              • Documentation: python scripts (William Brack), xslt stylesheets (John + Fleck), doc (Sven Zimmerman), I/O example.
              • +
              • Python bindings: fixes (William), enum support (Stéphane Bidoul), + structured error reporting (Stéphane Bidoul)
              • +
              • XInclude: various fixes for conformance, problem related to dictionnary + references (William & me), recursion (William)
              • +
              • xmlWriter: indentation (Lucas Brasilino), memory leaks (Alfred + Mickautsch),
              • xmlSchemas: normalizedString datatype (John Belmonte)
              • code cleanup for strings functions (William)
              • Windows: compiler patches (Mark Vakoc)
              • -
              • Parser optimizations, a few new XPath and dictionnary APIs - forfutureXSLT optimizations.
              • +
              • Parser optimizations, a few new XPath and dictionnary APIs for future + XSLT optimizations.

              2.6.4: Dec 24 2003

              • Windows build fixes (Igor Zlatkovic)
              • Some serious XInclude problems reported by Oleg Paraschenko and
              • Unix and Makefile packaging fixes (me, William Brack,
              • -
              • Documentation improvements (John Fleck, William Brack), - examplefix(Lucas Brasilino)
              • -
              • bugfixes: xmlTextReaderExpand() with xmlReaderWalker, XPath - handlingofNULL strings (William Brack) , API building reader or - parserfromfiledescriptor should not close it, changed XPath sorting to - bestableagain (William Brack), xmlGetNodePath() generating - '(null)'(WilliamBrack), DTD validation and namespace bug (William Brack), - XMLSchemasdouble inclusion behaviour
              • +
              • Documentation improvements (John Fleck, William Brack), example fix + (Lucas Brasilino)
              • +
              • bugfixes: xmlTextReaderExpand() with xmlReaderWalker, XPath handling of + NULL strings (William Brack) , API building reader or parser from + filedescriptor should not close it, changed XPath sorting to be stable + again (William Brack), xmlGetNodePath() generating '(null)' (William + Brack), DTD validation and namespace bug (William Brack), XML Schemas + double inclusion behaviour

              2.6.3: Dec 10 2003

              • documentation updates and cleanup (DV, William Brack, John Fleck)
              • -
              • added a repository of examples, examples from Aleksey - Sanin,DodjiSeketeli, Alfred Mickautsch
              • -
              • Windows updates: Mark Vakoc, Igor Zlatkovic, Eric Zurcher,Mingw(Kenneth - Haley)
              • +
              • added a repository of examples, examples from Aleksey Sanin, Dodji + Seketeli, Alfred Mickautsch
              • +
              • Windows updates: Mark Vakoc, Igor Zlatkovic, Eric Zurcher, Mingw + (Kenneth Haley)
              • Unicode range checking (William Brack)
              • code cleanup (William Brack)
              • Python bindings: doc (John Fleck), bug fixes
              • UTF-16 cleanup and BOM issues (William Brack)
              • -
              • bug fixes: ID and xmlReader validation, XPath (William - Brack),xmlWriter(Alfred Mickautsch), hash.h inclusion problem, HTML - parser(James Bursa),attribute defaulting and validation, some - serializationcleanups,XML_GET_LINE macro, memory debug when using threads - (WilliamBrack),serialization of attributes and entities content, - xmlWriter(DanielSchulman)
              • -
              • XInclude bugfix, new APIs and update to the last version - includingthenamespace change.
              • -
              • XML Schemas improvements: include (Robert Stepanek), importandnamespace - handling, fixed the regression tests troubles, addedexamplesbased on Eric - van der Vlist book, regexp fixes
              • -
              • preliminary pattern support for streaming (needed - forschemasconstraints), added xmlTextReaderPreservePattern() to - collectsubdocumentwhen streaming.
              • +
              • bug fixes: ID and xmlReader validation, XPath (William Brack), + xmlWriter (Alfred Mickautsch), hash.h inclusion problem, HTML parser + (James Bursa), attribute defaulting and validation, some serialization + cleanups, XML_GET_LINE macro, memory debug when using threads (William + Brack), serialization of attributes and entities content, xmlWriter + (Daniel Schulman)
              • +
              • XInclude bugfix, new APIs and update to the last version including the + namespace change.
              • +
              • XML Schemas improvements: include (Robert Stepanek), import and + namespace handling, fixed the regression tests troubles, added examples + based on Eric van der Vlist book, regexp fixes
              • +
              • preliminary pattern support for streaming (needed for schemas + constraints), added xmlTextReaderPreservePattern() to collect subdocument + when streaming.
              • various fixes in the structured error handling

              2.6.2: Nov 4 2003

              • XPath context unregistration fixes
              • text node coalescing fixes (Mark Lilback)
              • @@ -501,118 +542,117 @@ base.

                There is the list of public releases:

                2.6.26: Jun 6 2006

              • a posteriori DTD validation fixes
              • xmlReader bug fixes: Walker fixes, python bindings
              • fixed xmlStopParser() to really stop the parser and errors
              • -
              • always generate line numbers when using the new xmlReadxxxfunctions
              • +
              • always generate line numbers when using the new xmlReadxxx + functions
              • added XInclude support to the xmlReader interface
              • implemented XML_PARSE_NONET parser option
              • DocBook XSLT processing bug fixed
              • HTML serialization for <p> elements (William Brack and me)
              • XPointer failure in XInclude are now handled as resource errors
              • -
              • fixed xmllint --html to use the HTML serializer on output(added--xmlout - to implement the previous behaviour of saving it using - theXMLserializer)
              • +
              • fixed xmllint --html to use the HTML serializer on output (added + --xmlout to implement the previous behaviour of saving it using the XML + serializer)

              2.6.1: Oct 28 2003

              • Mostly bugfixes after the big 2.6.0 changes
              • -
              • Unix compilation patches: libxml.m4 (Patrick Welche), - warningscleanup(William Brack)
              • -
              • Windows compilation patches (Joachim Bauch, Stephane - Bidoul,IgorZlatkovic)
              • +
              • Unix compilation patches: libxml.m4 (Patrick Welche), warnings cleanup + (William Brack)
              • +
              • Windows compilation patches (Joachim Bauch, Stephane Bidoul, Igor + Zlatkovic)
              • xmlWriter bugfix (Alfred Mickautsch)
              • chvalid.[ch]: couple of fixes from Stephane Bidoul
              • -
              • context reset: error state reset, push parser reset (GrahamBennett)
              • +
              • context reset: error state reset, push parser reset (Graham + Bennett)
              • context reuse: generate errors if file is not readable
              • -
              • defaulted attributes for element coming from internal - entities(StephaneBidoul)
              • +
              • defaulted attributes for element coming from internal entities + (Stephane Bidoul)
              • Python: tab and spaces mix (William Brack)
              • Error handler could crash in DTD validation in 2.6.0
              • xmlReader: do not use the document or element _private field
              • testSAX.c: avoid a problem with some PIs (Massimo Morara)
              • -
              • general bug fixes: mandatory encoding in text decl, - serializingDocumentFragment nodes, xmlSearchNs 2.6.0 problem (Kasimier - Buchcik),XPath errorsnot reported, slow HTML parsing of large - documents.
              • -

              2.6.0: Oct 20 2003

              • Major revision release: should be API and ABI compatible but got alotof - change
              • -
              • Increased the library modularity, far more options can be strippedout,a - --with-minimum configuration will weight around 160KBytes
              • -
              • Use per parser and per document dictionnary, allocate names - andsmalltext nodes from the dictionnary
              • -
              • Switch to a SAX2 like parser rewrote most of the XML - parsercore,provides namespace resolution and defaulted attributes, - minimizememoryallocations and copies, namespace checking and specific - errorhandling,immutable buffers, make predefined entities static - structures,etc...
              • -
              • rewrote all the error handling in the library, all errors - canbeintercepted at a structured level, with - preciseinformationavailable.
              • -
              • New simpler and more generic XML and HTML parser APIs, - allowingtoeasilly modify the parsing options and reuse parser context - formultipleconsecutive documents.
              • -
              • Similar new APIs for the xmlReader, for options and reuse, - providednewfunctions to access content as const strings, use them - forPythonbindings
              • -
              • a lot of other smaller API improvements: xmlStrPrintf - (AlekseySanin),Walker i.e. reader on a document tree based on Alfred - Mickautschcode,make room in nodes for line numbers, reference counting - and futurePSVIextensions, generation of character ranges to be checked - withfasteralgorithm (William), xmlParserMaxDepth (Crutcher - Dunnavant),bufferaccess
              • +
              • general bug fixes: mandatory encoding in text decl, serializing + Document Fragment nodes, xmlSearchNs 2.6.0 problem (Kasimier Buchcik), + XPath errors not reported, slow HTML parsing of large documents.
              • +

              2.6.0: Oct 20 2003

              • Major revision release: should be API and ABI compatible but got a lot + of change
              • +
              • Increased the library modularity, far more options can be stripped out, + a --with-minimum configuration will weight around 160KBytes
              • +
              • Use per parser and per document dictionnary, allocate names and small + text nodes from the dictionnary
              • +
              • Switch to a SAX2 like parser rewrote most of the XML parser core, + provides namespace resolution and defaulted attributes, minimize memory + allocations and copies, namespace checking and specific error handling, + immutable buffers, make predefined entities static structures, etc...
              • +
              • rewrote all the error handling in the library, all errors can be + intercepted at a structured level, with precise information + available.
              • +
              • New simpler and more generic XML and HTML parser APIs, allowing to + easilly modify the parsing options and reuse parser context for multiple + consecutive documents.
              • +
              • Similar new APIs for the xmlReader, for options and reuse, provided new + functions to access content as const strings, use them for Python + bindings
              • +
              • a lot of other smaller API improvements: xmlStrPrintf (Aleksey Sanin), + Walker i.e. reader on a document tree based on Alfred Mickautsch code, + make room in nodes for line numbers, reference counting and future PSVI + extensions, generation of character ranges to be checked with faster + algorithm (William), xmlParserMaxDepth (Crutcher Dunnavant), buffer + access
              • New xmlWriter API provided by Alfred Mickautsch
              • Schemas: base64 support by Anthony Carrico
              • -
              • Parser<->HTTP integration fix, proper processing of - theMime-Typeand charset informations if available.
              • -
              • Relax-NG: bug fixes including the one reported by Martijn - FaassenandzeroOrMore, better error reporting.
              • -
              • Python bindings (Stéphane Bidoul), never use stdout forerrorsoutput
              • -
              • Portability: all the headers have macros for export - andcallingconvention definitions (Igor Zlatkovic), VMS update (Craig - A.Berry),Windows: threads (Jesse Pelton), Borland compiler (Eric - Zurcher,Igor),Mingw (Igor), typos (Mark Vakoc), beta version - (StephaneBidoul),warning cleanups on AIX and MIPS compilers (William - Brack), BeOS(Marcin'Shard' Konicki)
              • -
              • Documentation fixes and README (William Brack), search - fix(William),tutorial updates (John Fleck), namespace docs (Stefan - Kost)
              • -
              • Bug fixes: xmlCleanupParser (Dave Beckett), - threadinguninitializedmutexes, HTML doctype lowercase, SAX/IO - (William),compression detectionand restore (William), attribute - declaration in DTDs(William), namespaceon attribute in HTML output - (William), input filename(Rob Richards),namespace DTD validation, - xmlReplaceNode (Chris Ryland),I/O callbacks(Markus Keim), CDATA - serialization (Shaun McCance),xmlReader (PeterDerr), high codepoint - charref like &#x10FFFF;, bufferaccess in pushmode (Justin Fletcher), - TLS threads on Windows (JessePelton), XPath bug(William), - xmlCleanupParser (Marc Liyanage), CDATAoutput (William), HTTPerror - handling.
              • -
              • xmllint options: --dtdvalidfpi for Tobias Reif, --sax1 - forcompattesting, --nodict for building without tree dictionnary, - --nocdatatoreplace CDATA by text, --nsclean to remove - surperfluousnamespacedeclarations
              • +
              • Parser<->HTTP integration fix, proper processing of the Mime-Type + and charset informations if available.
              • +
              • Relax-NG: bug fixes including the one reported by Martijn Faassen and + zeroOrMore, better error reporting.
              • +
              • Python bindings (Stéphane Bidoul), never use stdout for errors + output
              • +
              • Portability: all the headers have macros for export and calling + convention definitions (Igor Zlatkovic), VMS update (Craig A. Berry), + Windows: threads (Jesse Pelton), Borland compiler (Eric Zurcher, Igor), + Mingw (Igor), typos (Mark Vakoc), beta version (Stephane Bidoul), + warning cleanups on AIX and MIPS compilers (William Brack), BeOS (Marcin + 'Shard' Konicki)
              • +
              • Documentation fixes and README (William Brack), search fix (William), + tutorial updates (John Fleck), namespace docs (Stefan Kost)
              • +
              • Bug fixes: xmlCleanupParser (Dave Beckett), threading uninitialized + mutexes, HTML doctype lowercase, SAX/IO (William), compression detection + and restore (William), attribute declaration in DTDs (William), namespace + on attribute in HTML output (William), input filename (Rob Richards), + namespace DTD validation, xmlReplaceNode (Chris Ryland), I/O callbacks + (Markus Keim), CDATA serialization (Shaun McCance), xmlReader (Peter + Derr), high codepoint charref like &#x10FFFF;, buffer access in push + mode (Justin Fletcher), TLS threads on Windows (Jesse Pelton), XPath bug + (William), xmlCleanupParser (Marc Liyanage), CDATA output (William), HTTP + error handling.
              • +
              • xmllint options: --dtdvalidfpi for Tobias Reif, --sax1 for compat + testing, --nodict for building without tree dictionnary, --nocdata to + replace CDATA by text, --nsclean to remove surperfluous namespace + declarations
              • added xml2-config --libtool-libs option from Kevin P. Fleming
              • -
              • a lot of profiling and tuning of the code, speedup - patchforxmlSearchNs() by Luca Padovani. The xmlReader should do - farlessallocation and it speed should get closer to SAX. Chris - Andersonworkedon speeding and cleaning up repetitive checking code.
              • +
              • a lot of profiling and tuning of the code, speedup patch for + xmlSearchNs() by Luca Padovani. The xmlReader should do far less + allocation and it speed should get closer to SAX. Chris Anderson worked + on speeding and cleaning up repetitive checking code.
              • cleanup of "make tests"
              • libxml-2.0-uninstalled.pc from Malcolm Tredinnick
              • -
              • deactivated the broken docBook SGML parser code and plugged - theXMLparser instead.
              • +
              • deactivated the broken docBook SGML parser code and plugged the XML + parser instead.

              2.5.11: Sep 9 2003

              A bugfix only release:

              • risk of crash in Relax-NG
              • risk of crash when using multithreaded programs

              2.5.10: Aug 15 2003

              A bugfixes only release

              • Windows Makefiles (William Brack)
              • UTF-16 support fixes (Mark Itzcovitz)
              • -
              • Makefile and portability (William Brack) automake, Linux alpha, - MingwonWindows (Mikhail Grushinskiy)
              • +
              • Makefile and portability (William Brack) automake, Linux alpha, Mingw + on Windows (Mikhail Grushinskiy)
              • HTML parser (Oliver Stoeneberg)
              • XInclude performance problem reported by Kevin Ruscoe
              • XML parser performance problem reported by Grant Goodale
              • xmlSAXParseDTD() bug fix from Malcolm Tredinnick
              • and a couple other cleanup
              • -

              2.5.9: Aug 9 2003

              • bugfixes: IPv6 portability, xmlHasNsProp (Markus Keim), - Windowsbuild(Wiliam Brake, Jesse Pelton, Igor), Schemas (Peter - Sobisch),threading(Rob Richards), hexBinary type (), UTF-16 BOM - (DodjiSeketeli),xmlReader, Relax-NG schemas compilation, namespace - handling,EXSLT (SeanGriffin), HTML parsing problem (William Brack), DTD - validationfor mixedcontent + namespaces, HTML serialization, - libraryinitialization,progressive HTML parser
              • +

              2.5.9: Aug 9 2003

              • bugfixes: IPv6 portability, xmlHasNsProp (Markus Keim), Windows build + (Wiliam Brake, Jesse Pelton, Igor), Schemas (Peter Sobisch), threading + (Rob Richards), hexBinary type (), UTF-16 BOM (Dodji Seketeli), + xmlReader, Relax-NG schemas compilation, namespace handling, EXSLT (Sean + Griffin), HTML parsing problem (William Brack), DTD validation for mixed + content + namespaces, HTML serialization, library initialization, + progressive HTML parser
              • better interfaces for Relax-NG error handling (Joachim Bauch, )
              • adding xmlXIncludeProcessTree() for XInclud'ing in a subtree
              • doc fixes and improvements (John Fleck)
              • @@ -620,121 +660,122 @@ base.

                There is the list of public releases:

                2.6.26: Jun 6 2006

              • couple of new UTF-8 helper functions (William Brack)
              • general encoding cleanup + ISO-8859-x without iconv (Peter Jacobi)
              • xmlTextReader cleanup + enum for node types (Bjorn Reese)
              • -
              • general compilation/warning cleanup Solaris/HP-UX/...(WilliamBrack)
              • -

              2.5.8: Jul 6 2003

              • bugfixes: XPath, XInclude, file/URI mapping, UTF-16 - save(MarkItzcovitz), UTF-8 checking, URI saving, error printing - (WilliamBrack),PI related memleak, compilation without schemas or without - xpath(JoergSchmitz-Linneweber/Garry Pennington), xmlUnlinkNode problem - withDTDs,rpm problem on , i86_64, removed a few compilation problems - from2.5.7,xmlIOParseDTD, and xmlSAXParseDTD (Malcolm Tredinnick)
              • +
              • general compilation/warning cleanup Solaris/HP-UX/... (William + Brack)
              • +

              2.5.8: Jul 6 2003

              • bugfixes: XPath, XInclude, file/URI mapping, UTF-16 save (Mark + Itzcovitz), UTF-8 checking, URI saving, error printing (William Brack), + PI related memleak, compilation without schemas or without xpath (Joerg + Schmitz-Linneweber/Garry Pennington), xmlUnlinkNode problem with DTDs, + rpm problem on , i86_64, removed a few compilation problems from 2.5.7, + xmlIOParseDTD, and xmlSAXParseDTD (Malcolm Tredinnick)
              • portability: DJGPP (MsDos) , OpenVMS (Craig A. Berry)
              • William Brack fixed multithreading lock problems
              • IPv6 patch for FTP and HTTP accesses (Archana Shah/Wipro)
              • -
              • Windows fixes (Igor Zlatkovic, Eric Zurcher), - threading(StéphaneBidoul)
              • +
              • Windows fixes (Igor Zlatkovic, Eric Zurcher), threading (Stéphane + Bidoul)
              • A few W3C Schemas Structure improvements
              • W3C Schemas Datatype improvements (Charlie Bozeman)
              • -
              • Python bindings for thread globals (Stéphane Bidoul), - andmethod/classgenerator
              • +
              • Python bindings for thread globals (Stéphane Bidoul), and method/class + generator
              • added --nonet option to xmllint
              • documentation improvements (John Fleck)
              • -

              2.5.7: Apr 25 2003

              • Relax-NG: Compiling to regexp and streaming validation on top - ofthexmlReader interface, added to xmllint --stream
              • +

              2.5.7: Apr 25 2003

              • Relax-NG: Compiling to regexp and streaming validation on top of the + xmlReader interface, added to xmllint --stream
              • xmlReader: Expand(), Next() and DOM access glue, bug fixes
              • Support for large files: RGN validated a 4.5GB instance
              • Thread support is now configured in by default
              • -
              • Fixes: update of the Trio code (Bjorn), WXS Date and - Durationfixes(Charles Bozeman), DTD and namespaces (Brent Hendricks), - HTML pushparserand zero bytes handling, some missing Windows file - pathconversions,behaviour of the parser and validator in the presence of - "outof memory"error conditions
              • -
              • extended the API to be able to plug a garbage - collectingmemoryallocator, added xmlMallocAtomic() and modified - theallocationsaccordingly.
              • -
              • Performances: removed excessive malloc() calls, speedup of the - pushandxmlReader interfaces, removed excessive thread locking
              • +
              • Fixes: update of the Trio code (Bjorn), WXS Date and Duration fixes + (Charles Bozeman), DTD and namespaces (Brent Hendricks), HTML push parser + and zero bytes handling, some missing Windows file path conversions, + behaviour of the parser and validator in the presence of "out of memory" + error conditions
              • +
              • extended the API to be able to plug a garbage collecting memory + allocator, added xmlMallocAtomic() and modified the allocations + accordingly.
              • +
              • Performances: removed excessive malloc() calls, speedup of the push and + xmlReader interfaces, removed excessive thread locking
              • Documentation: man page (John Fleck), xmlReader documentation
              • Python: adding binding for xmlCatalogAddLocal (Brent M Hendricks)
              • -

              2.5.6: Apr 1 2003

              • Fixed W3C XML Schemas datatype, should be compliant now exceptforbinHex - and base64 which are not supported yet.
              • -
              • bug fixes: non-ASCII IDs, HTML output, XInclude on large - docsandXInclude entities handling, encoding detection on external - subsets,XMLSchemas bugs and memory leaks, HTML parser (James Bursa)
              • +

              2.5.6: Apr 1 2003

              • Fixed W3C XML Schemas datatype, should be compliant now except for + binHex and base64 which are not supported yet.
              • +
              • bug fixes: non-ASCII IDs, HTML output, XInclude on large docs and + XInclude entities handling, encoding detection on external subsets, XML + Schemas bugs and memory leaks, HTML parser (James Bursa)
              • portability: python/trio (Albert Chin), Sun compiler warnings
              • documentation: added --relaxng option to xmllint man page (John)
              • -
              • improved error reporting: xml:space, start/end tag mismatches, - RelaxNGerrors
              • -

              2.5.5: Mar 24 2003

              • Lot of fixes on the Relax NG implementation. More - testingincludingDocBook and TEI examples.
              • +
              • improved error reporting: xml:space, start/end tag mismatches, Relax NG + errors
              • +

              2.5.5: Mar 24 2003

              • Lot of fixes on the Relax NG implementation. More testing including + DocBook and TEI examples.
              • Increased the support for W3C XML Schemas datatype
              • Several bug fixes in the URI handling layer
              • -
              • Bug fixes: HTML parser, xmlReader, DTD validation, - XPath,encodingconversion, line counting in the parser.
              • +
              • Bug fixes: HTML parser, xmlReader, DTD validation, XPath, encoding + conversion, line counting in the parser.
              • Added support for $XMLLINT_INDENT environment variable, FTP delete
              • Fixed the RPM spec file name
              • -

              2.5.4: Feb 20 2003

              • Conformance testing and lot of fixes on Relax NG - andXIncludeimplementation
              • +

              2.5.4: Feb 20 2003

              • Conformance testing and lot of fixes on Relax NG and XInclude + implementation
              • Implementation of XPointer element() scheme
              • -
              • Bug fixes: XML parser, XInclude entities merge, validity - checkingonnamespaces, -

                2 serialization bugs, node info generation problems, a - DTDregexpgeneration problem.

                +
              • Bug fixes: XML parser, XInclude entities merge, validity checking on + namespaces, +

                2 serialization bugs, node info generation problems, a DTD regexp + generation problem.

              • Portability: windows updates and path canonicalization (Igor)
              • A few typo fixes (Kjartan Maraas)
              • Python bindings generator fixes (Stephane Bidoul)
              • -

              2.5.3: Feb 10 2003

              • RelaxNG and XML Schemas datatypes improvements, and added afirstversion - of RelaxNG Python bindings
              • -
              • Fixes: XLink (Sean Chittenden), XInclude (Sean Chittenden), API - fixforserializing namespace nodes, encoding conversion - bug,XHTML1serialization
              • +

              2.5.3: Feb 10 2003

              • RelaxNG and XML Schemas datatypes improvements, and added a first + version of RelaxNG Python bindings
              • +
              • Fixes: XLink (Sean Chittenden), XInclude (Sean Chittenden), API fix for + serializing namespace nodes, encoding conversion bug, XHTML1 + serialization
              • Portability fixes: Windows (Igor), AMD 64bits RPM spec file

              2.5.2: Feb 5 2003

              • First implementation of RelaxNG, added --relaxng flag to xmllint
              • Schemas support now compiled in by default.
              • -
              • Bug fixes: DTD validation, namespace checking, XInclude - andentities,delegateURI in XML Catalogs, HTML parser, XML reader - (StéphaneBidoul),XPath parser and evaluation, UTF8ToUTF8 serialization, - XMLreader memoryconsumption, HTML parser, HTML serialization in the - presenceofnamespaces
              • +
              • Bug fixes: DTD validation, namespace checking, XInclude and entities, + delegateURI in XML Catalogs, HTML parser, XML reader (Stéphane Bidoul), + XPath parser and evaluation, UTF8ToUTF8 serialization, XML reader memory + consumption, HTML parser, HTML serialization in the presence of + namespaces
              • added an HTML API to check elements and attributes.
              • -
              • Documentation improvement, PDF for the tutorial (John Fleck),docpatches - (Stefan Kost)
              • +
              • Documentation improvement, PDF for the tutorial (John Fleck), doc + patches (Stefan Kost)
              • Portability fixes: NetBSD (Julio Merino), Windows (Igor Zlatkovic)
              • -
              • Added python bindings for XPointer, contextual error - reporting(StéphaneBidoul)
              • +
              • Added python bindings for XPointer, contextual error reporting + (Stéphane Bidoul)
              • URI/file escaping problems (Stefano Zacchiroli)

              2.5.1: Jan 8 2003

              • Fixes a memory leak and configuration/compilation problems in 2.5.0
              • documentation updates (John)
              • a couple of XmlTextReader fixes
              • -

              2.5.0: Jan 6 2003

              2.5.0: Jan 6 2003

              • New XmltextReader interface based on C# + API (with help of Stéphane Bidoul)
              • Windows: more exports, including the new API (Igor)
              • XInclude fallback fix
              • -
              • Python: bindings for the new API, packaging - (StéphaneBidoul),drv_libxml2.py Python xml.sax driver (Stéphane Bidoul), - fixes,speedupand iterators for Python-2.2 (Hannu Krosing)
              • -
              • Tutorial fixes (john Fleck and Niraj Tolia) xmllint manupdate(John)
              • +
              • Python: bindings for the new API, packaging (Stéphane Bidoul), + drv_libxml2.py Python xml.sax driver (Stéphane Bidoul), fixes, speedup + and iterators for Python-2.2 (Hannu Krosing)
              • +
              • Tutorial fixes (john Fleck and Niraj Tolia) xmllint man update + (John)
              • Fix an XML parser bug raised by Vyacheslav Pindyura
              • Fix for VMS serialization (Nigel Hall) and config (Craig A. Berry)
              • Entities handling fixes
              • -
              • new API to optionally track node creation and - deletion(LukasSchroeder)
              • +
              • new API to optionally track node creation and deletion (Lukas + Schroeder)
              • Added documentation for the XmltextReader interface and some XML guidelines

              2.4.30: Dec 12 2002

              • 2.4.29 broke the python bindings, rereleasing
              • -
              • Improvement/fixes of the XML API generator, and couple of - minorcodefixes.
              • -

              2.4.29: Dec 11 2002

              • Windows fixes (Igor): Windows CE port, pthread linking, - pythonbindings(Stéphane Bidoul), Mingw (Magnus Henoch), and export - listupdates
              • +
              • Improvement/fixes of the XML API generator, and couple of minor code + fixes.
              • +

              2.4.29: Dec 11 2002

              • Windows fixes (Igor): Windows CE port, pthread linking, python bindings + (Stéphane Bidoul), Mingw (Magnus Henoch), and export list updates
              • Fix for prev in python bindings (ERDI Gergo)
              • Fix for entities handling (Marcus Clarke)
              • -
              • Refactored the XML and HTML dumps to a single code path, - fixedXHTML1dump
              • +
              • Refactored the XML and HTML dumps to a single code path, fixed XHTML1 + dump
              • Fix for URI parsing when handling URNs with fragment identifiers
              • Fix for HTTP URL escaping problem
              • added an TextXmlReader (C#) like API (work in progress)
              • -
              • Rewrote the API in XML generation script, includes a C parser - andsavesmore informations needed for C# bindings
              • +
              • Rewrote the API in XML generation script, includes a C parser and saves + more informations needed for C# bindings

              2.4.28: Nov 22 2002

              • a couple of python binding fixes
              • 2 bug fixes in the XML push parser
              • potential memory leak removed (Martin Stoilov)
              • @@ -743,41 +784,41 @@ base.

                There is the list of public releases:

                2.6.26: Jun 6 2006

              • autodetection of XHTML1 and specific serialization rules added
              • nasty threading bug fixed (William Brack)

              2.4.27: Nov 17 2002

              • fixes for the Python bindings
              • -
              • a number of bug fixes: SGML catalogs,xmlParseBalancedChunkMemory(),HTML - parser, Schemas (Charles Bozeman),document fragment support(Christian - Glahn), xmlReconciliateNs (BrianStafford), XPointer,xmlFreeNode(), - xmlSAXParseMemory (Peter Jones),xmlGetNodePath (PetrPajas), entities - processing
              • +
              • a number of bug fixes: SGML catalogs, xmlParseBalancedChunkMemory(), + HTML parser, Schemas (Charles Bozeman), document fragment support + (Christian Glahn), xmlReconciliateNs (Brian Stafford), XPointer, + xmlFreeNode(), xmlSAXParseMemory (Peter Jones), xmlGetNodePath (Petr + Pajas), entities processing
              • added grep to xmllint --shell
              • VMS update patch from Craig A. Berry
              • -
              • cleanup of the Windows build with support for more - compilers(Igor),better thread support on Windows
              • +
              • cleanup of the Windows build with support for more compilers (Igor), + better thread support on Windows
              • cleanup of Unix Makefiles and spec file
              • Improvements to the documentation (John Fleck)

              2.4.26: Oct 18 2002

              • Patches for Windows CE port, improvements on Windows paths handling
              • -
              • Fixes to the validation code (DTD and Schemas), xmlNodeGetPath() - ,HTMLserialization, Namespace compliance, and a number of - smallproblems
              • -

              2.4.25: Sep 26 2002

              • A number of bug fixes: XPath, validation, Python bindings, DOM - andtree,xmlI/O, Html
              • +
              • Fixes to the validation code (DTD and Schemas), xmlNodeGetPath() , + HTML serialization, Namespace compliance, and a number of small + problems
              • +

              2.4.25: Sep 26 2002

              • A number of bug fixes: XPath, validation, Python bindings, DOM and + tree, xmlI/O, Html
              • Serious rewrite of XInclude
              • -
              • Made XML Schemas regexp part of the default build and APIs, smallfixand - improvement of the regexp core
              • +
              • Made XML Schemas regexp part of the default build and APIs, small fix + and improvement of the regexp core
              • Changed the validation code to reuse XML Schemas regexp APIs
              • -
              • Better handling of Windows file paths, improvement of - Makefiles(Igor,Daniel Gehriger, Mark Vakoc)
              • -
              • Improved the python I/O bindings, the tests, added resolver - andregexpAPIs
              • +
              • Better handling of Windows file paths, improvement of Makefiles (Igor, + Daniel Gehriger, Mark Vakoc)
              • +
              • Improved the python I/O bindings, the tests, added resolver and regexp + APIs
              • New logos from Marc Liyanage
              • Tutorial improvements: John Fleck, Christopher Harris
              • -
              • Makefile: Fixes for AMD x86_64 (Mandrake), - DESTDIR(ChristopheMerlet)
              • +
              • Makefile: Fixes for AMD x86_64 (Mandrake), DESTDIR (Christophe + Merlet)
              • removal of all stderr/perror use for error reporting
              • Better error reporting: XPath and DTD validation
              • update of the trio portability layer (Bjorn Reese)

              2.4.24: Aug 22 2002

              • XPath fixes (William), xf:escape-uri() (Wesley Terpstra)
              • -
              • Python binding fixes: makefiles (William), generator, rpm - build,x86-64(fcrozat)
              • +
              • Python binding fixes: makefiles (William), generator, rpm build, x86-64 + (fcrozat)
              • HTML <style> and boolean attributes serializer fixes
              • C14N improvements by Aleksey
              • doc cleanups: Rick Jones
              • @@ -787,98 +828,96 @@ base.

                There is the list of public releases:

                2.6.26: Jun 6 2006

              • c14n fixes, testsuite and performances: Aleksey Sanin
              • added xmlDocFormatDump: Chema Celorio
              • new tutorial: John Fleck
              • -
              • new hash functions and performances: Sander Vesik, portability - fixfromPeter Jacobi
              • -
              • a number of bug fixes: XPath (William Brack, Richard Jinks), XMLandHTML - parsers, ID lookup function
              • +
              • new hash functions and performances: Sander Vesik, portability fix from + Peter Jacobi
              • +
              • a number of bug fixes: XPath (William Brack, Richard Jinks), XML and + HTML parsers, ID lookup function
              • removal of all remaining sprintf: Aleksey Sanin
              • -

              2.4.22: May 27 2002

              • a number of bug fixes: configure scripts, base handling, - parser,memoryusage, HTML parser, XPath, documentation - (ChristianCornelssen),indentation, URI parsing
              • -
              • Optimizations for XMLSec, fixing and making public some of - thenetworkprotocol handlers (Aleksey)
              • +

              2.4.22: May 27 2002

              • a number of bug fixes: configure scripts, base handling, parser, memory + usage, HTML parser, XPath, documentation (Christian Cornelssen), + indentation, URI parsing
              • +
              • Optimizations for XMLSec, fixing and making public some of the network + protocol handlers (Aleksey)
              • performance patch from Gary Pennington
              • -
              • Charles Bozeman provided date and time support for - XMLSchemasdatatypes
              • -

              2.4.21: Apr 29 2002

              This release is both a bug fix release and also contains the -earlyXMLSchemas structuresand -datatypescode, -beware,allinterfaces are likely to change, there is huge holes, it is clearly -a workinprogress and don't even think of putting this code in a -productionsystem,it's actually not compiled in by default. The real fixes -are:

              • a couple of bugs or limitations introduced in 2.4.20
              • +
              • Charles Bozeman provided date and time support for XML Schemas + datatypes
              • +

              2.4.21: Apr 29 2002

              This release is both a bug fix release and also contains the early XML +Schemas structures and datatypes code, beware, all +interfaces are likely to change, there is huge holes, it is clearly a work in +progress and don't even think of putting this code in a production system, +it's actually not compiled in by default. The real fixes are:

              • a couple of bugs or limitations introduced in 2.4.20
              • patches for Borland C++ and MSC by Igor
              • -
              • some fixes on XPath strings and conformance patches by RichardJinks
              • +
              • some fixes on XPath strings and conformance patches by Richard + Jinks
              • patch from Aleksey for the ExcC14N specification
              • OSF/1 bug fix by Bjorn

              2.4.20: Apr 15 2002

              • bug fixes: file descriptor leak, XPath, HTML output, DTD validation
              • XPath conformance testing by Richard Jinks
              • -
              • Portability fixes: Solaris, MPE/iX, Windows, OSF/1, - pythonbindings,libxml.m4
              • -

              2.4.19: Mar 25 2002

              • bug fixes: half a dozen XPath bugs, Validation, ISO-Latin - toUTF8encoder
              • +
              • Portability fixes: Solaris, MPE/iX, Windows, OSF/1, python bindings, + libxml.m4
              • +

              2.4.19: Mar 25 2002

              • bug fixes: half a dozen XPath bugs, Validation, ISO-Latin to UTF8 + encoder
              • portability fixes in the HTTP code
              • memory allocation checks using valgrind, and profiling tests
              • revamp of the Windows build and Makefiles
              • -

              2.4.18: Mar 18 2002

              • bug fixes: tree, SAX, canonicalization, - validation,portability,XPath
              • +

              2.4.18: Mar 18 2002

              • bug fixes: tree, SAX, canonicalization, validation, portability, + XPath
              • removed the --with-buffer option it was becoming unmaintainable
              • serious cleanup of the Python makefiles
              • speedup patch to XPath very effective for DocBook stylesheets
              • Fixes for Windows build, cleanup of the documentation
              • -

              2.4.17: Mar 8 2002

              • a lot of bug fixes, including "namespace nodes have no - parentsinXPath"
              • -
              • fixed/improved the Python wrappers, added more examples - andmoreregression tests, XPath extension functions can now - returnnode-sets
              • +

              2.4.17: Mar 8 2002

              • a lot of bug fixes, including "namespace nodes have no parents in + XPath"
              • +
              • fixed/improved the Python wrappers, added more examples and more + regression tests, XPath extension functions can now return node-sets
              • added the XML Canonicalization support from Aleksey Sanin
              • -

              2.4.16: Feb 20 2002

              • a lot of bug fixes, most of them were triggered by the XMLTestsuitefrom - OASIS and W3C. Compliance has been significantlyimproved.
              • +

              2.4.16: Feb 20 2002

              • a lot of bug fixes, most of them were triggered by the XML Testsuite + from OASIS and W3C. Compliance has been significantly improved.
              • a couple of portability fixes too.

              2.4.15: Feb 11 2002

              • Fixed the Makefiles, especially the python module ones
              • A few bug fixes and cleanup
              • Includes cleanup
              • -

              2.4.14: Feb 8 2002

              • Change of License to the MITLicensebasicallyfor - integration in XFree86 codebase, and removingconfusion around theprevious - dual-licensing
              • -
              • added Python bindings, beta software but should already - bequitecomplete
              • -
              • a large number of fixes and cleanups, especially for - alltreemanipulations
              • -
              • cleanup of the headers, generation of a reference API - definitioninXML
              • +

              2.4.14: Feb 8 2002

              • Change of License to the MIT + License basically for integration in XFree86 codebase, and removing + confusion around the previous dual-licensing
              • +
              • added Python bindings, beta software but should already be quite + complete
              • +
              • a large number of fixes and cleanups, especially for all tree + manipulations
              • +
              • cleanup of the headers, generation of a reference API definition in + XML

              2.4.13: Jan 14 2002

              • update of the documentation: John Fleck and Charlie Bozeman
              • cleanup of timing code from Justin Fletcher
              • -
              • fixes for Windows and initial thread support on Win32: Igor - andSergueiNarojnyi
              • +
              • fixes for Windows and initial thread support on Win32: Igor and Serguei + Narojnyi
              • Cygwin patch from Robert Collins
              • added xmlSetEntityReferenceFunc() for Keith Isdale work on xsldbg
              • -

              2.4.12: Dec 7 2001

              • a few bug fixes: thread (Gary Pennington), xmllint - (GeertKloosterman),XML parser (Robin Berjon), XPointer (Danny Jamshy), - I/Ocleanups(robert)
              • +

              2.4.12: Dec 7 2001

              • a few bug fixes: thread (Gary Pennington), xmllint (Geert Kloosterman), + XML parser (Robin Berjon), XPointer (Danny Jamshy), I/O cleanups + (robert)
              • Eric Lavigne contributed project files for MacOS
              • some makefiles cleanups
              • -

              2.4.11: Nov 26 2001

              • fixed a couple of errors in the includes, fixed a few bugs, - somecodecleanups
              • +

              2.4.11: Nov 26 2001

              • fixed a couple of errors in the includes, fixed a few bugs, some code + cleanups
              • xmllint man pages improvement by Heiko Rupp
              • updated VMS build instructions from John A Fotheringham
              • Windows Makefiles updates from Igor

              2.4.10: Nov 10 2001

              • URI escaping fix (Joel Young)
              • added xmlGetNodePath() (for paths or XPointers generation)
              • Fixes namespace handling problems when using DTD and validation
              • -
              • improvements on xmllint: Morus Walter patches for --format - and--encode,Stefan Kost and Heiko Rupp improvements on the --shell
              • +
              • improvements on xmllint: Morus Walter patches for --format and + --encode, Stefan Kost and Heiko Rupp improvements on the --shell
              • fixes for xmlcatalog linking pointed by Weiqi Gao
              • fixes to the HTML parser

              2.4.9: Nov 6 2001

              • fixes more catalog bugs
              • avoid a compilation problem, improve xmlGetLineNo()
              • -

              2.4.8: Nov 4 2001

              • fixed SGML catalogs broken in previous release, - updatedxmlcatalogtool
              • +

              2.4.8: Nov 4 2001

              • fixed SGML catalogs broken in previous release, updated xmlcatalog + tool
              • fixed a compile errors and some includes troubles.

              2.4.7: Oct 30 2001

              • exported some debugging interfaces
              • serious rewrite of the catalog code
              • -
              • integrated Gary Pennington thread safety patch, added - configureoptionand regression tests
              • +
              • integrated Gary Pennington thread safety patch, added configure option + and regression tests
              • removed an HTML parser bug
              • fixed a couple of potentially serious validation bugs
              • integrated the SGML DocBook support in xmllint
              • @@ -894,11 +933,12 @@ are:

                • a couple of bugs or limitations introduced in 2.4.20
                • fixed half a dozen bugs reported for libxml or libxslt
                • updated xmlcatalog to be able to modify SGML super catalogs

                2.4.5: Sep 14 2001

                • Remove a few annoying bugs in 2.4.4
                • -
                • forces the HTML serializer to output decimal charrefs since - someversionof Netscape can't handle hexadecimal ones
                • -

                1.8.16: Sep 14 2001

                • maintenance release of the old libxml1 branch, couple of - bugandportability fixes
                • -

                2.4.4: Sep 12 2001

                • added --convert to xmlcatalog, bug fixes and cleanups of XMLCatalog
                • +
                • forces the HTML serializer to output decimal charrefs since some + version of Netscape can't handle hexadecimal ones
                • +

                1.8.16: Sep 14 2001

                • maintenance release of the old libxml1 branch, couple of bug and + portability fixes
                • +

                2.4.4: Sep 12 2001

                • added --convert to xmlcatalog, bug fixes and cleanups of XML + Catalog
                • a few bug fixes and some portability changes
                • some documentation cleanups

                2.4.3: Aug 23 2001

                • XML Catalog support see the doc
                • @@ -916,13 +956,13 @@ are:

                  • a couple of bugs or limitations introduced in 2.4.20
                  • cleanup for alpha and ia64 targets
                  • patch to allow saving through HTTP PUT or POST

                  2.4.0: July 10 2001

                  • Fixed a few bugs in XPath, validation, and tree handling.
                  • -
                  • Fixed XML Base implementation, added a couple of examples - totheregression tests
                  • +
                  • Fixed XML Base implementation, added a couple of examples to the + regression tests
                  • A bit of cleanup
                  • -

                  2.3.14: July 5 2001

                  • fixed some entities problems and reduce memory - requirementwhensubstituting them
                  • -
                  • lots of improvements in the XPath queries interpreter - canbesubstantially faster
                  • +

                  2.3.14: July 5 2001

                  • fixed some entities problems and reduce memory requirement when + substituting them
                  • +
                  • lots of improvements in the XPath queries interpreter can be + substantially faster
                  • Makefiles and configure cleanups
                  • Fixes to XPath variable eval, and compare on empty node set
                  • HTML tag closing bug fixed
                  • @@ -936,38 +976,37 @@ are:

                    • a couple of bugs or limitations introduced in 2.4.20
                    • fixed line number counting
                    • fixed serious problems in the XInclude processing
                    • added support for UTF8 BOM at beginning of entities
                    • -
                    • fixed a strange gcc optimizer bugs in xpath handling of - float,gcc-3.0miscompile uri.c (William), Thomas Leitner provided a fix - fortheoptimizer on Tru64
                    • -
                    • incorporated Yon Derek and Igor Zlatkovic fixes and - improvementsforcompilation on Windows MSC
                    • +
                    • fixed a strange gcc optimizer bugs in xpath handling of float, gcc-3.0 + miscompile uri.c (William), Thomas Leitner provided a fix for the + optimizer on Tru64
                    • +
                    • incorporated Yon Derek and Igor Zlatkovic fixes and improvements for + compilation on Windows MSC
                    • update of libxml-doc.el (Felix Natter)
                    • fixed 2 bugs in URI normalization code
                    • -

                    2.3.11: June 17 2001

                    • updates to trio, Makefiles and configure should fix - someportabilityproblems (alpha)
                    • -
                    • fixed some HTML serialization problems (pre, script, - andblock/inlinehandling), added encoding aware APIs, cleanup of - thiscode
                    • +

                    2.3.11: June 17 2001

                    • updates to trio, Makefiles and configure should fix some portability + problems (alpha)
                    • +
                    • fixed some HTML serialization problems (pre, script, and block/inline + handling), added encoding aware APIs, cleanup of this code
                    • added xmlHasNsProp()
                    • -
                    • implemented a specific PI for encoding support in the - DocBookSGMLparser
                    • -
                    • some XPath fixes (-Infinity, / as a function parameter - andnamespacesnode selection)
                    • +
                    • implemented a specific PI for encoding support in the DocBook SGML + parser
                    • +
                    • some XPath fixes (-Infinity, / as a function parameter and namespaces + node selection)
                    • fixed a performance problem and an error in the validation code
                    • fixed XInclude routine to implement the recursive behaviour
                    • fixed xmlFreeNode problem when libxml is included statically twice
                    • added --version to xmllint for bug reports

                    2.3.10: June 1 2001

                    • fixed the SGML catalog support
                    • -
                    • a number of reported bugs got fixed, in XPath, iconv - detection,XIncludeprocessing
                    • +
                    • a number of reported bugs got fixed, in XPath, iconv detection, + XInclude processing
                    • XPath string function should now handle unicode correctly

                    2.3.9: May 19 2001

                    Lots of bugfixes, and added a basic SGML catalog support:

                    • HTML push bugfix #54891 and another patch from Jonas Borgström
                    • some serious speed optimization again
                    • some documentation cleanups
                    • trying to get better linking on Solaris (-R)
                    • XPath API cleanup from Thomas Broyer
                    • -
                    • Validation bug fixed #54631, added a patch from Gary - Pennington,fixedxmlValidGetValidElements()
                    • +
                    • Validation bug fixed #54631, added a patch from Gary Pennington, fixed + xmlValidGetValidElements()
                    • Added an INSTALL file
                    • Attribute removal added to API: #54433
                    • added a basic support for SGML catalogs
                    • @@ -978,10 +1017,10 @@ are:

                      • a couple of bugs or limitations introduced in 2.4.20

                      1.8.13: May 14 2001

                      • bugfixes release of the old libxml1 branch used by Gnome

                      2.3.8: May 3 2001

                      • Integrated an SGML DocBook parser for the Gnome project
                      • Fixed a few things in the HTML parser
                      • -
                      • Fixed some XPath bugs raised by XSLT use, tried to fix thefloatingpoint - portability issue
                      • -
                      • Speed improvement (8M/s for SAX, 3M/s for DOM, 1.5M/s - forDOM+validationusing the XML REC as input and a 700MHz celeron).
                      • +
                      • Fixed some XPath bugs raised by XSLT use, tried to fix the floating + point portability issue
                      • +
                      • Speed improvement (8M/s for SAX, 3M/s for DOM, 1.5M/s for + DOM+validation using the XML REC as input and a 700MHz celeron).
                      • incorporated more Windows cleanup
                      • added xmlSaveFormatFile()
                      • fixed problems in copying nodes with entities references (gdome)
                      • @@ -996,33 +1035,32 @@ are:

                        • a couple of bugs or limitations introduced in 2.4.20
                        • Improved validation speed sensible for DocBook
                        • fixed a big bug with ID declared in external parsed entities
                        • portability fixes, update of Trio from Bjorn Reese
                        • -

                        2.3.6: April 8 2001

                        • Code cleanup using extreme gcc compiler warning options, - foundandcleared half a dozen potential problem
                        • +

                        2.3.6: April 8 2001

                        • Code cleanup using extreme gcc compiler warning options, found and + cleared half a dozen potential problem
                        • the Eazel team found an XML parser bug
                        • -
                        • cleaned up the user of some of the string formatting function. - usedthetrio library code to provide the one needed when the platform - ismissingthem
                        • -
                        • xpath: removed a memory leak and fixed the predicate - evaluationproblem,extended the testsuite and cleaned up the result. - XPointer seemsbroken...
                        • -

                        2.3.5: Mar 23 2001

                        • Biggest change is separate parsing and evaluation of - XPathexpressions,there is some new APIs for this too
                        • -
                        • included a number of bug fixes(XML push parser, - 51876,notations,52299)
                        • +
                        • cleaned up the user of some of the string formatting function. used the + trio library code to provide the one needed when the platform is missing + them
                        • +
                        • xpath: removed a memory leak and fixed the predicate evaluation + problem, extended the testsuite and cleaned up the result. XPointer seems + broken ...
                        • +

                        2.3.5: Mar 23 2001

                        • Biggest change is separate parsing and evaluation of XPath expressions, + there is some new APIs for this too
                        • +
                        • included a number of bug fixes(XML push parser, 51876, notations, + 52299)
                        • Fixed some portability issues

                        2.3.4: Mar 10 2001

                        • Fixed bugs #51860 and #51861
                        • -
                        • Added a global variable xmlDefaultBufferSize to allow defaultbuffersize - to be application tunable.
                        • -
                        • Some cleanup in the validation code, still a bug left and - thispartshould probably be rewritten to support ambiguous content - model:-\
                        • -
                        • Fix a couple of serious bugs introduced or raised by changes - in2.3.3parser
                        • +
                        • Added a global variable xmlDefaultBufferSize to allow default buffer + size to be application tunable.
                        • +
                        • Some cleanup in the validation code, still a bug left and this part + should probably be rewritten to support ambiguous content model :-\
                        • +
                        • Fix a couple of serious bugs introduced or raised by changes in 2.3.3 + parser
                        • Fixed another bug in xmlNodeGetContent()
                        • Bjorn fixed XPath node collection and Number formatting
                        • Fixed a loop reported in the HTML parsing
                        • -
                        • blank space are reported even if the Dtd content model proves - thattheyare formatting spaces, this is for XML conformance
                        • +
                        • blank space are reported even if the Dtd content model proves that they + are formatting spaces, this is for XML conformance

                        2.3.3: Mar 1 2001

                        • small change in XPath for XSLT
                        • documentation cleanups
                        • fix in validation by Gary Pennington
                        • @@ -1032,17 +1070,18 @@ are:

                          • a couple of bugs or limitations introduced in 2.4.20
                          • fixed a bug in xmlNodeGetContent
                          • ID/IDREF support partly rewritten by Gary Pennington

                          2.3.1: Feb 15 2001

                          • some XPath and HTML bug fixes for XSLT
                          • -
                          • small extension of the hash table interfaces for - DOMgdome2implementation
                          • +
                          • small extension of the hash table interfaces for DOM gdome2 + implementation
                          • A few bug fixes

                          2.3.0: Feb 8 2001 (2.2.12 was on 25 Jan but I didn't kept track)

                          • Lots of XPath bug fixes
                          • -
                          • Add a mode with Dtd lookup but without validation error - reportingforXSLT
                          • +
                          • Add a mode with Dtd lookup but without validation error reporting for + XSLT
                          • Add support for text node without escaping (XSLT)
                          • bug fixes for xmlCheckFilename
                          • validation code bug fixes from Gary Pennington
                          • Patch from Paul D. Smith correcting URI path normalization
                          • -
                          • Patch to allow simultaneous install of libxml-develandlibxml2-devel
                          • +
                          • Patch to allow simultaneous install of libxml-devel and + libxml2-devel
                          • the example Makefile is now fixed
                          • added HTML to the RPM packages
                          • tree copying bugfixes
                          • @@ -1059,7 +1098,8 @@ are:

                            • a couple of bugs or limitations introduced in 2.4.20
                            • Improved the XPointer implementation
                            • integrate a number of provided patches

                            2.2.9: Nov 25 2000

                            • erroneous release :-(
                            • -

                            2.2.8: Nov 13 2000

                            2.2.8: Nov 13 2000

                            • First version of XInclude + support
                            • Patch in conditional section handling
                            • updated MS compiler project
                            • fixed some XPath problems
                            • @@ -1070,19 +1110,19 @@ are:

                              • a couple of bugs or limitations introduced in 2.4.20
                              • xmlIOParseDTD() added
                              • various small fixes in the HTML, URI, HTTP and XPointer support
                              • some cleanup of the Makefile, autoconf and the distribution content
                              • -

                              2.2.6: Oct 25 2000:

                              • Added an hash table module, migrated a number of internal - structuretothose
                              • +

                              2.2.6: Oct 25 2000:

                              • Added an hash table module, migrated a number of internal structure to + those
                              • Fixed a posteriori validation problems
                              • HTTP module cleanups
                              • -
                              • HTML parser improvements (tag errors, script/style - handling,attributenormalization)
                              • +
                              • HTML parser improvements (tag errors, script/style handling, attribute + normalization)
                              • coalescing of adjacent text nodes
                              • couple of XPath bug fixes, exported the internal API

                              2.2.5: Oct 15 2000:

                              • XPointer implementation and testsuite
                              • -
                              • Lot of XPath fixes, added variable and functions - registration,moretests
                              • -
                              • Portability fixes, lots of enhancements toward an easy Windows - buildandrelease
                              • +
                              • Lot of XPath fixes, added variable and functions registration, more + tests
                              • +
                              • Portability fixes, lots of enhancements toward an easy Windows build + and release
                              • Late validation fixes
                              • Integrated a lot of contributed patches
                              • added memory management docs
                              • @@ -1092,113 +1132,115 @@ are:

                                • a couple of bugs or limitations introduced in 2.4.20
                                • Serious bug fixes on the URI and HTML code

                                2.2.3: Sep 17 2000

                                • bug fixes
                                • cleanup of entity handling code
                                • -
                                • overall review of all loops in the parsers, all sprintf usage - hasbeenchecked too
                                • -
                                • Far better handling of larges Dtd. Validating against DocBook - XMLDtdworks smoothly now.
                                • +
                                • overall review of all loops in the parsers, all sprintf usage has been + checked too
                                • +
                                • Far better handling of larges Dtd. Validating against DocBook XML Dtd + works smoothly now.

                                1.8.10: Sep 6 2000

                                • bug fix release for some Gnome projects

                                2.2.2: August 12 2000

                                • mostly bug fixes
                                • started adding routines to access xml parser context options

                                2.2.1: July 21 2000

                                • a purely bug fixes release
                                • fixed an encoding support problem when parsing from a memory block
                                • fixed a DOCTYPE parsing problem
                                • -
                                • removed a bug in the function allowing to override the - memoryallocationroutines
                                • +
                                • removed a bug in the function allowing to override the memory + allocation routines

                                2.2.0: July 14 2000

                                • applied a lot of portability fixes
                                • -
                                • better encoding support/cleanup and saving (content is nowalwaysencoded - in UTF-8)
                                • +
                                • better encoding support/cleanup and saving (content is now always + encoded in UTF-8)
                                • the HTML parser now correctly handles encodings
                                • added xmlHasProp()
                                • fixed a serious problem with &#38;
                                • propagated the fix to FTP client
                                • cleanup, bugfixes, etc ...
                                • -
                                • Added a page about libxmlInternationalizationsupport
                                • +
                                • Added a page about libxml Internationalization + support

                                1.8.9: July 9 2000

                                • fixed the spec the RPMs should be better
                                • -
                                • fixed a serious bug in the FTP implementation, released 1.8.9 - tosolverpmfind users problem
                                • +
                                • fixed a serious bug in the FTP implementation, released 1.8.9 to solve + rpmfind users problem

                                2.1.1: July 1 2000

                                • fixes a couple of bugs in the 2.1.0 packaging
                                • improvements on the HTML parser
                                • -

                                2.1.0 and 1.8.8: June 29 2000

                                • 1.8.8 is mostly a commodity package for upgrading to libxml2accordingto - new instructions. It fixes a nastyproblemabout - &#38; charref parsing
                                • -
                                • 2.1.0 also ease the upgrade from libxml v1 to the recent version.italso - contains numerous fixes and enhancements: +

                                2.1.0 and 1.8.8: June 29 2000

                                • 1.8.8 is mostly a commodity package for upgrading to libxml2 according + to new instructions. It fixes a nasty problem + about &#38; charref parsing
                                • +
                                • 2.1.0 also ease the upgrade from libxml v1 to the recent version. it + also contains numerous fixes and enhancements:
                                  • added xmlStopParser() to stop parsing
                                  • improved a lot parsing speed when there is large CDATA blocs
                                  • includes XPath patches provided by Picdar Technology
                                  • -
                                  • tried to fix as much as possible DTD validation andnamespacerelated - problems
                                  • +
                                  • tried to fix as much as possible DTD validation and namespace + related problems
                                  • output to a given encoding has been added/tested
                                  • lot of various fixes
                                • -

                                2.0.0: Apr 12 2000

                                • First public release of libxml2. If you are using libxml, it's - agoodidea to check the 1.x to 2.x upgrade instructions. NOTE: - whileinitiallyscheduled for Apr 3 the release occurred only on Apr 12 due - tomassiveworkload.
                                • -
                                • The include are now located under $prefix/include/libxml - (insteadof$prefix/include/gnome-xml), they also are referenced by +

                                2.0.0: Apr 12 2000

                                • First public release of libxml2. If you are using libxml, it's a good + idea to check the 1.x to 2.x upgrade instructions. NOTE: while initially + scheduled for Apr 3 the release occurred only on Apr 12 due to massive + workload.
                                • +
                                • The include are now located under $prefix/include/libxml (instead of + $prefix/include/gnome-xml), they also are referenced by
                                  #include <libxml/xxx.h>

                                  instead of

                                  #include "xxx.h"
                                • a new URI module for parsing URIs and following strictly RFC 2396
                                • -
                                • the memory allocation routines used by libxml can now - beoverloadeddynamically by using xmlMemSetup()
                                • -
                                • The previously CVS only tool tester has - beenrenamedxmllintand is now installed as part of - thelibxml2package
                                • -
                                • The I/O interface has been revamped. There is now ways to - pluginspecific I/O modules, either at the URI scheme detection - levelusingxmlRegisterInputCallbacks() or by passing I/O functions - whencreating aparser context using xmlCreateIOParserCtxt()
                                • -
                                • there is a C preprocessor macro LIBXML_VERSION providing - theversionnumber of the libxml module in use
                                • -
                                • a number of optional features of libxml can now be excluded - atconfiguretime (FTP/HTTP/HTML/XPath/Debug)
                                • +
                                • the memory allocation routines used by libxml can now be overloaded + dynamically by using xmlMemSetup()
                                • +
                                • The previously CVS only tool tester has been renamed + xmllint and is now installed as part of the libxml2 + package
                                • +
                                • The I/O interface has been revamped. There is now ways to plug in + specific I/O modules, either at the URI scheme detection level using + xmlRegisterInputCallbacks() or by passing I/O functions when creating a + parser context using xmlCreateIOParserCtxt()
                                • +
                                • there is a C preprocessor macro LIBXML_VERSION providing the version + number of the libxml module in use
                                • +
                                • a number of optional features of libxml can now be excluded at + configure time (FTP/HTTP/HTML/XPath/Debug)

                                2.0.0beta: Mar 14 2000

                                • This is a first Beta release of libxml version 2
                                • -
                                • It's available only fromxmlsoft.orgFTP, it's packaged - aslibxml2-2.0.0beta and available as tar andRPMs
                                • -
                                • This version is now the head in the Gnome CVS base, the old - oneisavailable under the tag LIB_XML_1_X
                                • -
                                • This includes a very large set of changes. From a programmatic - pointofview applications should not have to be modified too much, check - theupgrade page
                                • +
                                • It's available only fromxmlsoft.org + FTP, it's packaged as libxml2-2.0.0beta and available as tar and + RPMs
                                • +
                                • This version is now the head in the Gnome CVS base, the old one is + available under the tag LIB_XML_1_X
                                • +
                                • This includes a very large set of changes. From a programmatic point + of view applications should not have to be modified too much, check the + upgrade page
                                • Some interfaces may changes (especially a bit about encoding).
                                • the updates includes: -
                                  • fix I18N support. ISO-Latin-x/UTF-8/UTF-16 (nearly) - seemscorrectlyhandled now
                                  • -
                                  • Better handling of entities, especially well-formedness - checkingandproper PEref extensions in external subsets
                                  • + -
                                  • Serious progress were made toward compliance, here are the result of the - testagainsttheOASIS testsuite (except the Japanese tests since I - don't supportthatencoding yet). This URL is rebuilt every couple of hours - using theCVShead version.
                                  • +
                                  • Serious progress were made toward compliance, here are the result of the test against the + OASIS testsuite (except the Japanese tests since I don't support that + encoding yet). This URL is rebuilt every couple of hours using the CVS + head version.

                                  1.8.7: Mar 6 2000

                                  • This is a bug fix release:
                                  • -
                                  • It is possible to disable the ignorable blanks heuristic - usedbylibxml-1.x, a new function xmlKeepBlanksDefault(0) will allow - this.Notethat for adherence to XML spec, this behaviour will be - disabledbydefault in 2.x . The same function will allow to keep - compatibilityforold code.
                                  • -
                                  • Blanks in <a> </a> constructs are not - ignoredanymore,avoiding heuristic is really the Right Way :-\
                                  • -
                                  • The unchecked use of snprintf which was breakinglibxml-1.8.6compilation - on some platforms has been fixed
                                  • -
                                  • nanoftp.c nanohttp.c: Fixed '#' and '?' stripping - whenprocessingURIs
                                  • -

                                  1.8.6: Jan 31 2000

                                  • added a nanoFTP transport module, debugged until the new version of rpmfindcanuseit - without troubles
                                  • -

                                  1.8.5: Jan 21 2000

                                  • adding APIs to parse a well balanced chunk of XML (production [43] contentof - theXMLspec)
                                  • +
                                  • It is possible to disable the ignorable blanks heuristic used by + libxml-1.x, a new function xmlKeepBlanksDefault(0) will allow this. Note + that for adherence to XML spec, this behaviour will be disabled by + default in 2.x . The same function will allow to keep compatibility for + old code.
                                  • +
                                  • Blanks in <a> </a> constructs are not ignored anymore, + avoiding heuristic is really the Right Way :-\
                                  • +
                                  • The unchecked use of snprintf which was breaking libxml-1.8.6 + compilation on some platforms has been fixed
                                  • +
                                  • nanoftp.c nanohttp.c: Fixed '#' and '?' stripping when processing + URIs
                                  • +

                                  1.8.6: Jan 31 2000

                                  • added a nanoFTP transport module, debugged until the new version of rpmfind can use + it without troubles
                                  • +

                                  1.8.5: Jan 21 2000

                                  • adding APIs to parse a well balanced chunk of XML (production [43] content of the + XML spec)
                                  • fixed a hideous bug in xmlGetProp pointed by Rune.Djurhuus@fast.no
                                  • -
                                  • Jody Goldberg <jgoldberg@home.com> provided another patchtryingto - solve the zlib checks problems
                                  • -
                                  • The current state in gnome CVS base is expected to ship as - 1.8.5withgnumeric soon
                                  • +
                                  • Jody Goldberg <jgoldberg@home.com> provided another patch trying + to solve the zlib checks problems
                                  • +
                                  • The current state in gnome CVS base is expected to ship as 1.8.5 with + gnumeric soon

                                  1.8.4: Jan 13 2000

                                  • bug fixes, reintroduced xmlNewGlobalNs(), fixed xmlNewNs()
                                  • all exit() call should have been removed from libxml
                                  • fixed a problem with INCLUDE_WINSOCK on WIN32 platform
                                  • @@ -1209,52 +1251,52 @@ are:

                                    • a couple of bugs or limitations introduced in 2.4.20
                                    • fixed the DTD parsing code to work with the xhtml DTD
                                    • added xmlRemoveProp(), xmlRemoveID() and xmlRemoveRef()
                                    • Fixed bugs in xmlNewNs()
                                    • -
                                    • External entity loading code has been revamped, now - itusesxmlLoadExternalEntity(), some fix on entities processing - wereadded
                                    • +
                                    • External entity loading code has been revamped, now it uses + xmlLoadExternalEntity(), some fix on entities processing were added
                                    • cleaned up WIN32 includes of socket stuff
                                    • -

                                    1.8.2: Dec 21 1999

                                    • I got another problem with includes and C++, I hope this issue - isfixedfor good this time
                                    • -
                                    • Added a few tree modification - functions:xmlReplaceNode,xmlAddPrevSibling, xmlAddNextSibling, - xmlNodeSetNameandxmlDocSetRootElement
                                    • +

                                    1.8.2: Dec 21 1999

                                    • I got another problem with includes and C++, I hope this issue is fixed + for good this time
                                    • +
                                    • Added a few tree modification functions: xmlReplaceNode, + xmlAddPrevSibling, xmlAddNextSibling, xmlNodeSetName and + xmlDocSetRootElement
                                    • Tried to improve the HTML output with help from Chris Lahey
                                    • -

                                    1.8.1: Dec 18 1999

                                    • various patches to avoid troubles when using libxml with - C++compilersthe "namespace" keyword and C escaping in include files
                                    • +

                                    1.8.1: Dec 18 1999

                                    • various patches to avoid troubles when using libxml with C++ compilers + the "namespace" keyword and C escaping in include files
                                    • a problem in one of the core macros IS_CHAR was corrected
                                    • -
                                    • fixed a bug introduced in 1.8.0 breaking default - namespaceprocessing,and more specifically the Dia application
                                    • -
                                    • fixed a posteriori validation (validation after parsing, or by - usingaDtd not specified in the original document)
                                    • +
                                    • fixed a bug introduced in 1.8.0 breaking default namespace processing, + and more specifically the Dia application
                                    • +
                                    • fixed a posteriori validation (validation after parsing, or by using a + Dtd not specified in the original document)
                                    • fixed a bug in

                                    1.8.0: Dec 12 1999

                                    • cleanup, especially memory wise
                                    • -
                                    • the parser should be more reliable, especially the HTML one, - itshouldnot crash, whatever the input !
                                    • -
                                    • Integrated various patches, especially a speedup improvement - forlargedataset from CarlNygard,configure with - --with-buffers to enable them.
                                    • +
                                    • the parser should be more reliable, especially the HTML one, it should + not crash, whatever the input !
                                    • +
                                    • Integrated various patches, especially a speedup improvement for large + dataset from Carl Nygard, + configure with --with-buffers to enable them.
                                    • attribute normalization, oops should have been added long ago !
                                    • -
                                    • attributes defaulted from DTDs should be available, xmlSetProp()nowdoes - entities escaping by default.
                                    • +
                                    • attributes defaulted from DTDs should be available, xmlSetProp() now + does entities escaping by default.

                                    1.7.4: Oct 25 1999

                                    • Lots of HTML improvement
                                    • Fixed some errors when saving both XML and HTML
                                    • More examples, the regression tests should now look clean
                                    • Fixed a bug with contiguous charref

                                    1.7.3: Sep 29 1999

                                    • portability problems fixed
                                    • -
                                    • snprintf was used unconditionally, leading to link problems - onsystemwere it's not available, fixed
                                    • -

                                    1.7.1: Sep 24 1999

                                    • The basic type for strings manipulated by libxml has been - renamedin1.7.1 from CHARto xmlChar. - Thereasonis that CHAR was conflicting with a predefined type on - Windows.Howeveron non WIN32 environment, compatibility is provided by the - way ofa#define .
                                    • -
                                    • Changed another error : the use of a structure field called - errno,andleading to troubles on platforms where it's a macro
                                    • -

                                    1.7.0: Sep 23 1999

                                    • Added the ability to fetch remote DTD or parsed entities, see the nanohttpmodule.
                                    • -
                                    • Added an errno to report errors by another mean than a simpleprintflike - callback
                                    • +
                                    • snprintf was used unconditionally, leading to link problems on system + were it's not available, fixed
                                    • +

                                    1.7.1: Sep 24 1999

                                    • The basic type for strings manipulated by libxml has been renamed in + 1.7.1 from CHAR to xmlChar. The reason + is that CHAR was conflicting with a predefined type on Windows. However + on non WIN32 environment, compatibility is provided by the way of a + #define .
                                    • +
                                    • Changed another error : the use of a structure field called errno, and + leading to troubles on platforms where it's a macro
                                    • +

                                    1.7.0: Sep 23 1999

                                    • Added the ability to fetch remote DTD or parsed entities, see the nanohttp module.
                                    • +
                                    • Added an errno to report errors by another mean than a simple printf + like callback
                                    • Finished ID/IDREF support and checking when validation
                                    • -
                                    • Serious memory leaks fixed (there is now a memory wrappermodule)
                                    • -
                                    • Improvement of XPathimplementation
                                    • +
                                    • Serious memory leaks fixed (there is now a memory wrapper module)
                                    • +
                                    • Improvement of XPath + implementation
                                    • Added an HTML parser front-end

                                    Daniel Veillard

              diff --git a/doc/python.html b/doc/python.html index adb3d36..5910766 100644 --- a/doc/python.html +++ b/doc/python.html @@ -7,66 +7,73 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -Python and bindings
              Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
              Made with Libxml2 Logo

              The XML C parser and toolkit of Gnome

              Python and bindings

              Developer Menu
              API Indexes
              Related links

              There are a number of language bindings and wrappers available -forlibxml2,the list below is not exhaustive. Please contact the xml-bindings@gnome.org(archives) inorder -toget updates to this list or to discuss the specific topic of -libxml2orlibxslt wrappers or bindings:

              • Libxml++seemsthemost - up-to-date C++ bindings for libxml2, check the documentationandthe - examples.
              • -
              • There is another C++wrapperbased on the gdome2 - bindingsmaintained by Tobias Peters.
              • +Python and bindings
                Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
                Made with Libxml2 Logo

                The XML C parser and toolkit of Gnome

                Python and bindings

                Developer Menu
                API Indexes
                Related links

                There are a number of language bindings and wrappers available for +libxml2, the list below is not exhaustive. Please contact the xml-bindings@gnome.org +(archives) in +order to get updates to this list or to discuss the specific topic of libxml2 +or libxslt wrappers or bindings:

                The distribution includes a set of Python bindings, which are -guaranteedtobe maintained as part of the library in the future, though -thePythoninterface have not yet reached the completeness of the C API.

                Note that some of the Python purist dislike the default set -ofPythonbindings, rather than complaining I suggest they have a look at lxml the more pythonic bindings -forlibxml2and libxsltand helpMartijnFaassencomplete -those.

                StéphaneBidoulmaintains aWindows portof the Python -bindings.

                Note to people interested in building bindings, the API is formalized asan XML API description filewhich allows -toautomatea large part of the Python bindings, this includes -functiondescriptions,enums, structures, typedefs, etc... The Python script -used tobuild thebindings is python/generator.py in the source -distribution.

                To install the Python bindings there are 2 options:

                • If you use an RPM based distribution, simply install the libxml2-pythonRPM(andif - needed the libxslt-pythonRPM).
                • -
                • Otherwise use the libxml2-pythonmoduledistributioncorresponding - to your installed version oflibxml2 andlibxslt. Note that to install it - you will need both libxml2and libxsltinstalled and run "python setup.py - build install" in themodule tree.
                • -

                The distribution includes a set of examples and regression tests -forthepython bindings in the python/testsdirectory. Here -aresomeexcerpts from those tests:

                tst.py:

                This is a basic test of the file interface and DOM navigation:

                import libxml2, sys
                +  
              • LibxmlJ is + an effort to create a 100% JAXP-compatible Java wrapper for libxml2 and + libxslt as part of GNU ClasspathX project.
              • +
              • Patrick McPhee provides Rexx bindings fof libxml2 and libxslt, look for + RexxXML.
              • +
              • Satimage + provides XMLLib + osax. This is an osax for Mac OS X with a set of commands to + implement in AppleScript the XML DOM, XPATH and XSLT. Also includes + commands for Property-lists (Apple's fast lookup table XML format.)
              • +
              • Francesco Montorsi developped wxXml2 + wrappers that interface libxml2, allowing wxWidgets applications to + load/save/edit XML instances.
              • +

                The distribution includes a set of Python bindings, which are guaranteed +to be maintained as part of the library in the future, though the Python +interface have not yet reached the completeness of the C API.

                Note that some of the Python purist dislike the default set of Python +bindings, rather than complaining I suggest they have a look at lxml the more pythonic bindings for libxml2 +and libxslt and help Martijn +Faassen complete those.

                Stéphane Bidoul +maintains a Windows port +of the Python bindings.

                Note to people interested in building bindings, the API is formalized as +an XML API description file which allows to +automate a large part of the Python bindings, this includes function +descriptions, enums, structures, typedefs, etc... The Python script used to +build the bindings is python/generator.py in the source distribution.

                To install the Python bindings there are 2 options:

                • If you use an RPM based distribution, simply install the libxml2-python + RPM (and if needed the libxslt-python + RPM).
                • +
                • Otherwise use the libxml2-python + module distribution corresponding to your installed version of + libxml2 and libxslt. Note that to install it you will need both libxml2 + and libxslt installed and run "python setup.py build install" in the + module tree.
                • +

                The distribution includes a set of examples and regression tests for the +python bindings in the python/tests directory. Here are some +excerpts from those tests:

                tst.py:

                This is a basic test of the file interface and DOM navigation:

                import libxml2, sys
                 
                 doc = libxml2.parseFile("tst.xml")
                 if doc.name != "tst.xml":
                @@ -80,25 +87,24 @@ child = root.children
                 if child.name != "foo":
                     print "child.name failed"
                     sys.exit(1)
                -doc.freeDoc()

                The Python module is called libxml2; parseFile is the -equivalentofxmlParseFile (most of the bindings are automatically generated, -and thexmlprefix is removed and the casing convention are kept). All node -seen atthebinding level share the same subset of accessors:

                • name: returns the node name
                • -
                • type: returns a string indicating the node type
                • -
                • content: returns the content of the node, it is - basedonxmlNodeGetContent() and hence is recursive.
                • -
                • parent, - children,last,next, - prev,doc,properties: pointing to - the associatedelement in the tree,those may return None in case no such - linkexists.
                • -

                Also note the need to explicitly deallocate documents with -freeDoc().Reference counting for libxml2 trees would need quite a lot of -worktofunction properly, and rather than risk memory leaks if -notimplementedcorrectly it sounds safer to have an explicit function to free -atree. Thewrapper python objects like doc, root or child are -themautomatically garbagecollected.

                validate.py:

                This test check the validation interfaces and redirection -oferrormessages:

                import libxml2
                +doc.freeDoc()

                The Python module is called libxml2; parseFile is the equivalent of +xmlParseFile (most of the bindings are automatically generated, and the xml +prefix is removed and the casing convention are kept). All node seen at the +binding level share the same subset of accessors:

                • name : returns the node name
                • +
                • type : returns a string indicating the node type
                • +
                • content : returns the content of the node, it is based on + xmlNodeGetContent() and hence is recursive.
                • +
                • parent , children, last, + next, prev, doc, + properties: pointing to the associated element in the tree, + those may return None in case no such link exists.
                • +

                Also note the need to explicitly deallocate documents with freeDoc() . +Reference counting for libxml2 trees would need quite a lot of work to +function properly, and rather than risk memory leaks if not implemented +correctly it sounds safer to have an explicit function to free a tree. The +wrapper python objects like doc, root or child are them automatically garbage +collected.

                validate.py:

                This test check the validation interfaces and redirection of error +messages:

                import libxml2
                 
                 #deactivate error messages from the validation
                 def noerr(ctx, str):
                @@ -113,29 +119,27 @@ doc = ctxt.doc()
                 valid = ctxt.isValid()
                 doc.freeDoc()
                 if valid != 0:
                -    print "validity check failed"

                The first thing to notice is the call to registerErrorHandler(), -itdefinesa new error handler global to the library. It is used to avoid -seeingtheerror messages when trying to validate the invalid document.

                The main interest of that test is the creation of a parser -contextwithcreateFileParserCtxt() and how the behaviour can be changed -beforecallingparseDocument() . Similarly the informations resulting from -theparsing phaseare also available using context methods.

                Contexts like nodes are defined as class and the libxml2 wrappers mapstheC -function interfaces in terms of objects method as much as possible.Thebest to -get a complete view of what methods are supported is to look atthelibxml2.py -module containing all the wrappers.

                push.py:

                This test show how to activate the push parser interface:

                import libxml2
                +    print "validity check failed"

                The first thing to notice is the call to registerErrorHandler(), it +defines a new error handler global to the library. It is used to avoid seeing +the error messages when trying to validate the invalid document.

                The main interest of that test is the creation of a parser context with +createFileParserCtxt() and how the behaviour can be changed before calling +parseDocument() . Similarly the informations resulting from the parsing phase +are also available using context methods.

                Contexts like nodes are defined as class and the libxml2 wrappers maps the +C function interfaces in terms of objects method as much as possible. The +best to get a complete view of what methods are supported is to look at the +libxml2.py module containing all the wrappers.

                push.py:

                This test show how to activate the push parser interface:

                import libxml2
                 
                 ctxt = libxml2.createPushParser(None, "<foo", 4, "test.xml")
                 ctxt.parseChunk("/>", 2, 1)
                 doc = ctxt.doc()
                 
                -doc.freeDoc()

                The context is created with a special call based -onthexmlCreatePushParser() from the C library. The first argument is -anoptionalSAX callback object, then the initial set of data, the length and -thename ofthe resource in case URI-References need to be computed by -theparser.

                Then the data are pushed using the parseChunk() method, the -lastcallsetting the third argument terminate to 1.

                pushSAX.py:

                this test show the use of the event based parsing interfaces. In -thiscasethe parser does not build a document, but provides callback -informationasthe parser makes progresses analyzing the data being -provided:

                import libxml2
                +doc.freeDoc()

                The context is created with a special call based on the +xmlCreatePushParser() from the C library. The first argument is an optional +SAX callback object, then the initial set of data, the length and the name of +the resource in case URI-References need to be computed by the parser.

                Then the data are pushed using the parseChunk() method, the last call +setting the third argument terminate to 1.

                pushSAX.py:

                this test show the use of the event based parsing interfaces. In this case +the parser does not build a document, but provides callback information as +the parser makes progresses analyzing the data being provided:

                import libxml2
                 log = ""
                 
                 class callback:
                @@ -183,16 +187,15 @@ reference = "startDocument:startElement foo {'url': 'tst'}:" + \
                             "characters: bar:endElement foo:endDocument:"
                 if log != reference:
                     print "Error got: %s" % log
                -    print "Expected: %s" % reference

                The key object in that test is the handler, it provides a number -ofentrypoints which can be called by the parser as it makes progresses -toindicatethe information set obtained. The full set of callback is larger -thanwhatthe callback class in that specific example implements (see -theSAXdefinition for a complete list). The wrapper will only call those -suppliedbythe object when activated. The startElement receives the names of -theelementand a dictionary containing the attributes carried by this -element.

                Also note that the reference string generated from the callback -showsasingle character call even though the string "bar" is passed to -theparserfrom 2 different call to parseChunk()

                xpath.py:

                This is a basic test of XPath wrappers support

                import libxml2
                +    print "Expected: %s" % reference

                The key object in that test is the handler, it provides a number of entry +points which can be called by the parser as it makes progresses to indicate +the information set obtained. The full set of callback is larger than what +the callback class in that specific example implements (see the SAX +definition for a complete list). The wrapper will only call those supplied by +the object when activated. The startElement receives the names of the element +and a dictionary containing the attributes carried by this element.

                Also note that the reference string generated from the callback shows a +single character call even though the string "bar" is passed to the parser +from 2 different call to parseChunk()

                xpath.py:

                This is a basic test of XPath wrappers support

                import libxml2
                 
                 doc = libxml2.parseFile("tst.xml")
                 ctxt = doc.xpathNewContext()
                @@ -204,15 +207,14 @@ if res[0].name != "doc" or res[1].name != "foo":
                     print "xpath query: wrong node set value"
                     sys.exit(1)
                 doc.freeDoc()
                -ctxt.xpathFreeContext()

                This test parses a file, then create an XPath context to -evaluateXPathexpression on it. The xpathEval() method execute an XPath query -andreturnsthe result mapped in a Python way. String and numbers are -nativelyconverted,and node sets are returned as a tuple of libxml2 Python -nodeswrappers. Likethe document, the XPath context need to be freed -explicitly,also not thatthe result of the XPath query may point back to the -documenttree and hencethe document must be freed after the result of the -query isused.

                xpathext.py:

                This test shows how to extend the XPath engine with functions -writteninpython:

                import libxml2
                +ctxt.xpathFreeContext()

                This test parses a file, then create an XPath context to evaluate XPath +expression on it. The xpathEval() method execute an XPath query and returns +the result mapped in a Python way. String and numbers are natively converted, +and node sets are returned as a tuple of libxml2 Python nodes wrappers. Like +the document, the XPath context need to be freed explicitly, also not that +the result of the XPath query may point back to the document tree and hence +the document must be freed after the result of the query is used.

                xpathext.py:

                This test shows how to extend the XPath engine with functions written in +python:

                import libxml2
                 
                 def foo(ctx, x):
                     return x + 1
                @@ -224,10 +226,9 @@ res = ctxt.xpathEval("foo(1)")
                 if res != 2:
                     print "xpath extension failure"
                 doc.freeDoc()
                -ctxt.xpathFreeContext()

                Note how the extension function is registered with the context -(butthatpart is not yet finalized, this may change slightly in the -future).

                tstxpath.py:

                This test is similar to the previous one but shows how -theextensionfunction can access the XPath evaluation context:

                def foo(ctx, x):
                +ctxt.xpathFreeContext()

                Note how the extension function is registered with the context (but that +part is not yet finalized, this may change slightly in the future).

                tstxpath.py:

                This test is similar to the previous one but shows how the extension +function can access the XPath evaluation context:

                def foo(ctx, x):
                     global called
                 
                     #
                @@ -236,16 +237,16 @@ theextensionfunction can access the XPath evaluation context:

                def foo(ct
                     pctxt = libxml2.xpathParserContext(_obj=ctx)
                     ctxt = pctxt.context()
                     called = ctxt.function()
                -    return x + 1

                All the interfaces around the XPath parser(or rather evaluation)contextare -not finalized, but it should be sufficient to do contextual workat -theevaluation point.

                Memory debugging:

                last but not least, all tests starts with the following prologue:

                #memory debug specific
                +    return x + 1

                All the interfaces around the XPath parser(or rather evaluation) context +are not finalized, but it should be sufficient to do contextual work at the +evaluation point.

                Memory debugging:

                last but not least, all tests starts with the following prologue:

                #memory debug specific
                 libxml2.debugMemory(1)

                and ends with the following epilogue:

                #memory debug specific
                 libxml2.cleanupParser()
                 if libxml2.debugMemory(1) == 0:
                     print "OK"
                 else:
                     print "Memory leak %d bytes" % (libxml2.debugMemory(1))
                -    libxml2.dumpMemory()

                Those activate the memory debugging interface of libxml2 whereallallocated -block in the library are tracked. The prologue then cleans upthelibrary state -and checks that all allocated memory has been freed. If notitcalls -dumpMemory() which saves that list in a .memdumpfile.

                Daniel Veillard

                + libxml2.dumpMemory()

                Those activate the memory debugging interface of libxml2 where all +allocated block in the library are tracked. The prologue then cleans up the +library state and checks that all allocated memory has been freed. If not it +calls dumpMemory() which saves that list in a .memdump file.

                Daniel Veillard

              diff --git a/doc/threads.html b/doc/threads.html index e6fe497..8082dbd 100644 --- a/doc/threads.html +++ b/doc/threads.html @@ -7,16 +7,15 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -Thread safety
              Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
              Made with Libxml2 Logo

              The XML C parser and toolkit of Gnome

              Thread safety

              Developer Menu
              API Indexes
              Related links

              Starting with 2.4.7, libxml2 makes provisions to ensure -thatconcurrentthreads can safely work in parallel parsing different -documents.There ishowever a couple of things to do to ensure it:

              • configure the library accordingly using the --with-threads options
              • -
              • call xmlInitParser() in the "main" thread before using any ofthelibxml2 - API (except possibly selecting a different memoryallocator)
              • -

              Note that the thread safety cannot be ensured for multiple -threadssharingthe same document, the locking must be done at the application -level,libxmlexports a basic mutex and reentrant mutexes API -in<libxml/threads.h>.The parts of the library checked for thread -safetyare:

              XPath is supposed to be thread safe now, but this wasn't tested +seriously.

              Daniel Veillard

              diff --git a/doc/tree.html b/doc/tree.html index 238cd6d..6556637 100644 --- a/doc/tree.html +++ b/doc/tree.html @@ -7,22 +7,22 @@ H1 {font-family: Verdana,Arial,Helvetica} H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } -The tree output
              Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
              Made with Libxml2 Logo

              The XML C parser and toolkit of Gnome

              The tree output

              Developer Menu
              API Indexes
              Related links

              The parser returns a tree built during the document analysis. -Thevaluereturned is an xmlDocPtr(i.e., a pointer -toanxmlDocstructure). This structure contains -informationsuchas the file name, the document type, and -achildrenpointerwhich is the root of the document (or -moreexactly the first child under theroot which is the document). The tree -ismade of xmlNodes,chained in double-linked lists of -siblingsand with a children<->parentrelationship. An xmlNode can also -carryproperties (a chain of xmlAttrstructures). An attribute may have a -valuewhich is a list of TEXT orENTITY_REF nodes.

              Here is an example (erroneous with respect to the XML spec -sincethereshould be only one ELEMENT under the root):

               structure.gif

              In the source package there is a small program (not installed -bydefault)called xmllintwhich parses XML files given -asargument andprints them back as parsed. This is useful for detecting -errorsboth in XMLcode and in the XML parser itself. It has an -option--debugwhich prints the actual in-memory structure of -thedocument; here is theresult with the examplegivenbefore:

              DOCUMENT
              +The tree output
              Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
              Made with Libxml2 Logo

              The XML C parser and toolkit of Gnome

              The tree output

              Developer Menu
              API Indexes
              Related links

              The parser returns a tree built during the document analysis. The value +returned is an xmlDocPtr (i.e., a pointer to an +xmlDoc structure). This structure contains information such +as the file name, the document type, and a children pointer +which is the root of the document (or more exactly the first child under the +root which is the document). The tree is made of xmlNodes, +chained in double-linked lists of siblings and with a children<->parent +relationship. An xmlNode can also carry properties (a chain of xmlAttr +structures). An attribute may have a value which is a list of TEXT or +ENTITY_REF nodes.

              Here is an example (erroneous with respect to the XML spec since there +should be only one ELEMENT under the root):

               structure.gif

              In the source package there is a small program (not installed by default) +called xmllint which parses XML files given as argument and +prints them back as parsed. This is useful for detecting errors both in XML +code and in the XML parser itself. It has an option --debug +which prints the actual in-memory structure of the document; here is the +result with the example given before:

              DOCUMENT
               version=1.0
               standalone=true
                 ELEMENT EXAMPLE
              diff --git a/doc/upgrade.html b/doc/upgrade.html
              index 590b8a4..59815ba 100644
              --- a/doc/upgrade.html
              +++ b/doc/upgrade.html
              @@ -7,102 +7,100 @@ H1 {font-family: Verdana,Arial,Helvetica}
               H2 {font-family: Verdana,Arial,Helvetica}
               H3 {font-family: Verdana,Arial,Helvetica}
               A:link, A:visited, A:active { text-decoration: underline }
              -Upgrading 1.x code
              Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
              Made with Libxml2 Logo

              The XML C parser and toolkit of Gnome

              Upgrading 1.x code

              Developer Menu
              API Indexes
              Related links

              Incompatible changes:

              Version 2 of libxml2 is the first version introducing -seriousbackwardincompatible changes. The main goals were:

              • a general cleanup. A number of mistakes inherited from the - veryearlyversions couldn't be changed due to compatibility - constraints.Examplethe "childs" element in the nodes.
              • -
              • Uniformization of the various nodes, at least for their header - andlinkparts (doc, parent, children, prev, next), the goal is - asimplerprogramming model and simplifying the task of the - DOMimplementors.
              • -
              • better conformances to the XML specification, for example version1.xhad - an heuristic to try to detect ignorable white spaces. As a resulttheSAX - event generated were ignorableWhitespace() while the - specrequirescharacter() in that case. This also mean that a number of - DOMnodecontaining blank text may populate the DOM tree which were - notpresentbefore.
              • -

              How to fix libxml-1.x code:

              So client code of libxml designed to run with version 1.x may have -tobechanged to compile against version 2.x of libxml. Here is a list -ofchangesthat I have collected, they may not be sufficient, so in case you -findotherchange which are required, dropme amail:

              1. The package name have changed from libxml to libxml2, the librarynameis - now -lxml2 . There is a new xml2-config script which should beused - toselect the right parameters libxml2
              2. -
              3. Node childsfield has - beenrenamedchildrenso s/childs/children/g should - beapplied(probability of having "childs" anywhere else is close to 0+
              4. -
              5. The document don't have anymore a rootelement - ithasbeen replaced by childrenand usually you will - getalist of element here. For example a Dtd element for the - internalsubsetand it's declaration may be found in that list, as well - asprocessinginstructions or comments found before or after the - documentroot element.Use xmlDocGetRootElement(doc)to get - theroot element ofa document. Alternatively if you are sure to not - referenceDTDs nor havePIs or comments before or after the - rootelements/->root/->children/g will probably do it.
              6. -
              7. The white space issue, this one is more complex, unless special - caseofvalidating parsing, the line breaks and spaces usually used - forindentingand formatting the document content becomes significant. So - theyarereported by SAX and if your using the DOM tree, corresponding - nodesaregenerated. Too approach can be taken: -
                1. lazy one, use the - compatibilitycallxmlKeepBlanksDefault(0)but be aware - that youarerelying on a special (and possibly broken) set of - heuristicsoflibxml to detect ignorable blanks. Don't complain if it - breaksormake your application not 100% clean w.r.t. to it's - input.
                2. -
                3. the Right Way: change you code to accept - possiblyinsignificantblanks characters, or have your tree populated - withweird blank textnodes. You can spot them using the - commodityfunctionxmlIsBlankNode(node)returning 1 for - suchblanknodes.
                4. -

                Note also that with the new default the output functions don't - addanyextra indentation when saving a tree in order to be able to - roundtrip(read and save) without inflating the document with - extraformattingchars.

                +Upgrading 1.x code
                Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
                Made with Libxml2 Logo

                The XML C parser and toolkit of Gnome

                Upgrading 1.x code

                Developer Menu
                API Indexes
                Related links

                Incompatible changes:

                Version 2 of libxml2 is the first version introducing serious backward +incompatible changes. The main goals were:

                • a general cleanup. A number of mistakes inherited from the very early + versions couldn't be changed due to compatibility constraints. Example + the "childs" element in the nodes.
                • +
                • Uniformization of the various nodes, at least for their header and link + parts (doc, parent, children, prev, next), the goal is a simpler + programming model and simplifying the task of the DOM implementors.
                • +
                • better conformances to the XML specification, for example version 1.x + had an heuristic to try to detect ignorable white spaces. As a result the + SAX event generated were ignorableWhitespace() while the spec requires + character() in that case. This also mean that a number of DOM node + containing blank text may populate the DOM tree which were not present + before.
                • +

                How to fix libxml-1.x code:

                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, drop me a +mail:

                1. 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
                2. +
                3. Node childs field has been renamed + children so s/childs/children/g should be applied + (probability of having "childs" anywhere else is close to 0+
                4. +
                5. The document don't have anymore a root element it has + been replaced by children and usually you will get a + list of element here. For example a Dtd element for the internal subset + and it's declaration may be found in that list, as well as processing + instructions or comments found before or after the document root element. + Use xmlDocGetRootElement(doc) to get the root element of + a document. Alternatively if you are sure to not reference DTDs nor have + PIs or comments before or after the root element + s/->root/->children/g will probably do it.
                6. +
                7. The white space issue, this one is more complex, unless special case of + validating parsing, the line breaks and spaces usually used for indenting + and formatting the document content becomes significant. So they are + reported by SAX and if your using the DOM tree, corresponding nodes are + generated. Too approach can be taken: +
                  1. lazy one, use the compatibility call + xmlKeepBlanksDefault(0) but be aware that you are + relying on a special (and possibly broken) set of heuristics of + libxml to detect ignorable blanks. Don't complain if it breaks or + make your application not 100% clean w.r.t. to it's input.
                  2. +
                  3. the Right Way: change you code to accept possibly insignificant + blanks characters, or have your tree populated with weird blank text + nodes. You can spot them using the commodity function + xmlIsBlankNode(node) returning 1 for such blank + nodes.
                  4. +

                  Note also that with the new default the output functions don't add any + extra indentation when saving a tree in order to be able to round trip + (read and save) without inflating the document with extra formatting + chars.

                8. -
                9. The include path has changed to $prefix/libxml/ and - theincludesthemselves uses this new prefix in includes instructions... - Ifyou areusing (as expected) the +
                10. The include path has changed to $prefix/libxml/ and the includes + themselves uses this new prefix in includes instructions... If you are + using (as expected) the
                  xml2-config --cflags
                  -

                  output to generate you compile commands this will probably work - outofthe box

                  +

                  output to generate you compile commands this will probably work out of + the box

                11. -
                12. xmlDetectCharEncoding takes an extra argument indicating the - lengthinbyte of the head of the document available for character - detection.
                13. -

                Ensuring both libxml-1.x and libxml-2.x compatibility

                Two new version of libxml (1.8.11) and libxml2 (2.3.4) have beenreleasedto -allow smooth upgrade of existing libxml v1code whileretainingcompatibility. -They offers the following:

                1. similar include naming, one - shoulduse#include<libxml/...>in both cases.
                2. -
                3. similar identifiers defined via macros for the child and - rootfields:respectivelyxmlChildrenNodeandxmlRootNode
                4. -
                5. a new macro LIBXML_TEST_VERSIONwhich should - beinsertedonce in the client code
                6. -

                So the roadmap to upgrade your existing libxml applications -isthefollowing:

                1. install the libxml-1.8.8 (and libxml-devel-1.8.8) packages
                2. -
                3. find all occurrences where the xmlDoc rootfield - isusedand change it to xmlRootNode
                4. -
                5. similarly find all occurrences where - thexmlNodechildsfield is used and change - ittoxmlChildrenNode
                6. -
                7. add a LIBXML_TEST_VERSIONmacro somewhere - inyourmain()or in the library init entry point
                8. +
                9. xmlDetectCharEncoding takes an extra argument indicating the length in + byte of the head of the document available for character detection.
                10. +

                Ensuring both libxml-1.x and libxml-2.x compatibility

                Two new version of libxml (1.8.11) and libxml2 (2.3.4) have been released +to allow smooth upgrade of existing libxml v1code while retaining +compatibility. They offers the following:

                1. similar include naming, one should use + #include<libxml/...> in both cases.
                2. +
                3. similar identifiers defined via macros for the child and root fields: + respectively xmlChildrenNode and + xmlRootNode
                4. +
                5. a new macro LIBXML_TEST_VERSION which should be + inserted once in the client code
                6. +

                So the roadmap to upgrade your existing libxml applications is the +following:

                1. install the libxml-1.8.8 (and libxml-devel-1.8.8) packages
                2. +
                3. find all occurrences where the xmlDoc root field is + used and change it to xmlRootNode
                4. +
                5. similarly find all occurrences where the xmlNode + childs field is used and change it to + xmlChildrenNode
                6. +
                7. add a LIBXML_TEST_VERSION macro somewhere in your + main() or in the library init entry point
                8. Recompile, check compatibility, it should still work
                9. -
                10. Change your configure script to look first for xml2-config and - fallbackusing xml-config . Use the --cflags and --libs output of the - commandasthe Include and Linking parameters needed to use libxml.
                11. -
                12. install libxml2-2.3.x and libxml2-devel-2.3.x - (libxml-1.8.yandlibxml-devel-1.8.y can be kept simultaneously)
                13. -
                14. remove your config.cache, relaunch your configuration - mechanism,andrecompile, if steps 2 and 3 were done right it should - compileas-is
                15. -
                16. Test that your application is still running correctly, if not thismaybe - due to extra empty nodes due to formating spaces being kept - inlibxml2contrary to libxml1, in that case insert - xmlKeepBlanksDefault(1)in yourcode before calling the parser - (nexttoLIBXML_TEST_VERSIONis a fine place).
                17. -

                Following those steps should work. It worked for some of my own code.

                Let me put some emphasis on the fact that there is far more -changesfromlibxml 1.x to 2.x than the ones you may have to patch for. The -overallcodehas been considerably cleaned up and the conformance to the -XMLspecificationhas been drastically improved too. Don't take those changes -asan excuse tonot upgrade, it may cost a lot on the long term ...

                Daniel Veillard

                +
              8. Change your configure script to look first for xml2-config and fall + back using xml-config . Use the --cflags and --libs output of the command + as the Include and Linking parameters needed to use libxml.
              9. +
              10. install libxml2-2.3.x and libxml2-devel-2.3.x (libxml-1.8.y and + libxml-devel-1.8.y can be kept simultaneously)
              11. +
              12. remove your config.cache, relaunch your configuration mechanism, and + recompile, if steps 2 and 3 were done right it should compile as-is
              13. +
              14. Test that your application is still running correctly, if not this may + be due to extra empty nodes due to formating spaces being kept in libxml2 + contrary to libxml1, in that case insert xmlKeepBlanksDefault(1) in your + code before calling the parser (next to + LIBXML_TEST_VERSION is a fine place).
              15. +

              Following those steps should work. It worked for some of my own code.

              Let me put some emphasis on the fact that there is far more changes from +libxml 1.x to 2.x than the ones you may have to patch for. The overall code +has been considerably cleaned up and the conformance to the XML specification +has been drastically improved too. Don't take those changes as an excuse to +not upgrade, it may cost a lot on the long term ...

              Daniel Veillard

              diff --git a/doc/xml.html b/doc/xml.html index 72a0a9c..a25b8d0 100644 --- a/doc/xml.html +++ b/doc/xml.html @@ -3,42 +3,42 @@ The XML C parser and toolkit of Gnome - - + +

              The XML C parser and toolkit of Gnome

              -

              Note: this is the flat content of the website

              +

              Note: this is the flat content of the web +site

              libxml, a.k.a. gnome-xml

              "Programmingwithlibxml2 -is like the thrilling embrace of an exotic stranger." MarkPilgrim

              - -

              Libxml2 is the XML C parser and toolkit developed for the Gnomeproject(but -usable outside of the Gnome platform), it is free softwareavailableunder the -MITLicense.XML -itself is a metalanguage to design markup languages, i.e.text languagewhere -semantic and structure are added to the content usingextra -"markup"information enclosed between angle brackets. HTML is the -mostwell-knownmarkup language. Though the library is written in C avariety of language bindingsmake it available inother -environments.

              - -

              Libxml2 is known to be very portable, the library should build -andworkwithout serious troubles on a variety of systems (Linux, -Unix,Windows,CygWin, MacOS, MacOS X, RISC Os, OS/2, VMS, QNX, MVS, ...)

              - -

              Libxml2 implements a number of existing standards related -tomarkuplanguages:

              +style="text-align: right; font-style: italic; font-size: 10pt">"Programming +with libxml2 is like the thrilling embrace of an exotic stranger." Mark +Pilgrim

              + +

              Libxml2 is the XML C parser and toolkit developed for the Gnome project +(but usable outside of the Gnome platform), it is free software available +under the MIT +License. XML itself is a metalanguage to design markup languages, i.e. +text language where semantic and structure are added to the content using +extra "markup" information enclosed between angle brackets. HTML is the most +well-known markup language. Though the library is written in C a variety of language bindings make it available in +other environments.

              + +

              Libxml2 is known to be very portable, the library should build and work +without serious troubles on a variety of systems (Linux, Unix, Windows, +CygWin, MacOS, MacOS X, RISC Os, OS/2, VMS, QNX, MVS, ...)

              + +

              Libxml2 implements a number of existing standards related to markup +languages:

              -

              In most cases libxml2 tries to implement the specifications in -arelativelystrictly compliant way. As of release 2.4.16, libxml2 passed -all1800+ testsfrom the OASIS -XMLTestsSuite.

              +

              In most cases libxml2 tries to implement the specifications in a +relatively strictly compliant way. As of release 2.4.16, libxml2 passed all +1800+ tests from the OASIS XML Tests +Suite.

              -

              To some extent libxml2 provides support for the -followingadditionalspecifications but doesn't claim to implement them -completely:

              +

              To some extent libxml2 provides support for the following additional +specifications but doesn't claim to implement them completely:

              • Document Object Model (DOM) http://www.w3.org/TR/DOM-Level-2-Core/thedocument - model, but it doesn't implement the API itself, gdome2 doesthison top of - libxml2
              • -
              • RFC959:libxml2 - implements a basic FTP client code
              • -
              • RFC1945:HTTP/1.0, - again a basic HTTP client code
              • -
              • SAX: a SAX2 like interface and a minimal SAX1 - implementationcompatiblewith early expat versions
              • + href="http://www.w3.org/TR/DOM-Level-2-Core/">http://www.w3.org/TR/DOM-Level-2-Core/ + the document model, but it doesn't implement the API itself, gdome2 does + this on top of libxml2 +
              • RFC 959 : + libxml2 implements a basic FTP client code
              • +
              • RFC 1945 : + HTTP/1.0, again a basic HTTP client code
              • +
              • SAX: a SAX2 like interface and a minimal SAX1 implementation compatible + with early expat versions

              A partial implementation of XML Schemas -Part1:Structureis being worked on but it would be far too early to -makeanyconformance statement about it at the moment.

              +href="http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/">XML Schemas Part +1: Structure is being worked on but it would be far too early to make any +conformance statement about it at the moment.

              Separate documents:

              - 2006-03-05 + $Date: 2006/08/21 08:34:11 $ @@ -94,35 +94,6 @@ or it can perform multiple functions in interactive mode. It can operate on both XML and SGML files. - More information can be found at - - - - libxml - 3 - web page - - - - - libxml - 3 - catalog support web page - at - - - - James Clark's SGML catalog - page - - - - OASIS XML catalog specification - - - - - @@ -340,7 +311,7 @@ - Execute a public identifier lookup of the catalog entry + Execute a Formal Public Identifier look-up of the catalog entry for PUBLIC-ID. The corresponding entry will be output to the command line. @@ -358,7 +329,7 @@ - Execute a public identifier lookup of the catalog entry + Execute a Formal Public Identifier look-up of the catalog entry for SYSTEM-ID. The corresponding entry will be output to the command line. @@ -375,12 +346,11 @@ XML_CATALOG_FILES - - Catalog behavior can be changed by redirecting queries to the user's - own set of catalogs. This can be done by setting + XML catalog behavior can be changed by redirecting + queries to the user's own set of catalogs. This can be done by setting the XML_CATALOG_FILES environment variable to a list of catalogs. An empty one should deactivate loading the - default /etc/xml/catalog default catalog. + default /etc/xml/catalog catalog. @@ -391,7 +361,7 @@ DIAGNOSTICS - &xmlcatalog;'s return codes provide information that can be used when + &xmlcatalog; return codes provide information that can be used when calling it from scripts. @@ -427,7 +397,7 @@ 4 - Failed to lookup an entry in the catalog + Failed to look up an entry in the catalog @@ -436,12 +406,41 @@ SEE ALSO - - + libxml 3 + + More information can be found at + + + + libxml + 3 + web page + + + + + libxml + 3 + catalog support web page + at + + + + James Clark's SGML catalog + page + + + + OASIS XML catalog specification + + + + + diff --git a/doc/xmldtd.html b/doc/xmldtd.html index 3f5a797..c5541d6 100644 --- a/doc/xmldtd.html +++ b/doc/xmldtd.html @@ -17,84 +17,84 @@ A:link, A:visited, A:active { text-decoration: underline }
            • Some examples
            • How to validate
            • Other resources
            • -

              General overview

              Well what is validation and what is a DTD ?

              DTD is the acronym for Document Type Definition. This is a -descriptionofthe content for a family of XML files. This is part of the -XML1.0specification, and allows one to describe and verify that a -givendocumentinstance conforms to the set of rules detailing its structure -andcontent.

              Validation is the process of checking a document against a -DTD(moregenerally against a set of construction rules).

              The validation process and building DTDs are the two most difficultpartsof -the XML life cycle. Briefly a DTD defines all the possible elementsto befound -within your document, what is the formal shape of your documenttree(by -defining the allowed content of an element; either text, aregularexpression -for the allowed list of children, or mixed content i.e.both textand -children). The DTD also defines the valid attributes for allelements andthe -types of those attributes.

              The definition

              The W3C XML Recommendation(Tim Bray's annotated -versionofRev1):

              (unfortunately) all this is inherited from the SGML world, the -syntaxisancient...

              Simple rules

              Writing DTDs can be done in many ways. The rules to build them if -youneedsomething permanent or something which can evolve over time can -beradicallydifferent. Really complex DTDs like DocBook ones are flexible -butquiteharder to design. I will just focus on DTDs for a formats with a -fixedsimplestructure. It is just a set of basic rules, and definitely -notexhaustive norusable for complex DTD design.

              How to reference a DTD from a document:

              Assuming the top element of the document is specand the -dtdisplaced in the file mydtdin the -subdirectorydtdsofthe directory from where the document were -loaded:

              <!DOCTYPE spec SYSTEM "dtds/mydtd">

              Notes:

              • The system string is actually an URI-Reference (as defined in RFC 2396) so you can - useafull URL string indicating the location of your DTD on the Web. This - isareally good thing to do if you want others to validate - yourdocument.
              • -
              • It is also possible to associate a PUBLICidentifier(amagic - string) so that the DTD is looked up in catalogs on the clientsidewithout - having to locate it on the web.
              • -
              • A DTD contains a set of element and attribute declarations, - buttheydon't define what the root of the document should be. This - isexplicitlytold to the parser/validator as the first element - oftheDOCTYPEdeclaration.
              • -

              Declaring elements:

              The following declares an element spec:

              <!ELEMENT spec (front, body, back?)>

              It also expresses that the spec element contains onefront,one -bodyand one optionalbackchildren elements inthis -order. The declaration of oneelement of the structure and its contentare done -in a single declaration.Similarly the following -declaresdiv1elements:

              <!ELEMENT div1 (head, (p | list | note)*, div2?)>

              which means div1 contains one headthen a series -ofoptionalp, lists and notes and -thenanoptional div2. And last but not least an element -cancontaintext:

              <!ELEMENT b (#PCDATA)>

              bcontains text or being of mixed content (text and -elementsinno particular order):

              <!ELEMENT p (#PCDATA|a|ul|b|i|em)*>

              p can contain text or -a,ul,b, i or -emelements inno particularorder.

              Declaring attributes:

              Again the attributes declaration includes their content definition:

              <!ATTLIST termdef name CDATA #IMPLIED>

              means that the element termdefcan have -anameattribute containing text (CDATA) and which -isoptional(#IMPLIED). The attribute value can also be -definedwithin aset:

              <!ATTLIST list -type(bullets|ordered|glossary)"ordered">

              means listelement have a typeattribute -with3allowed values "bullets", "ordered" or "glossary" and which -defaultto"ordered" if the attribute is not explicitly specified.

              The content type of an attribute can be -text(CDATA),anchor/reference/references(ID/IDREF/IDREFS),entity(ies)(ENTITY/ENTITIES) -orname(s)(NMTOKEN/NMTOKENS). The following -definesthat achapterelement can have an -optionalidattributeof type ID, usable for reference -fromattribute of typeIDREF:

              <!ATTLIST chapter id ID #IMPLIED>

              The last value of an attribute definition can -be#REQUIREDmeaning that the attribute has to be -given,#IMPLIEDmeaning that it is optional, or the default -value(possibly prefixed by#FIXEDif it is the only allowed).

              Notes:

              • Usually the attributes pertaining to a given element are declared - inasingle expression, but it is just a convention adopted by a lot - ofDTDwriters: +

                General overview

                Well what is validation and what is a DTD ?

                DTD is the acronym for Document Type Definition. This is a description of +the content for a family of XML files. This is part of the XML 1.0 +specification, and allows one to describe and verify that a given document +instance conforms to the set of rules detailing its structure and content.

                Validation is the process of checking a document against a DTD (more +generally against a set of construction rules).

                The validation process and building DTDs are the two most difficult parts +of the XML life cycle. Briefly a DTD defines all the possible elements to be +found within your document, what is the formal shape of your document tree +(by defining the allowed content of an element; either text, a regular +expression for the allowed list of children, or mixed content i.e. both text +and children). The DTD also defines the valid attributes for all elements and +the types of those attributes.

                The definition

                The W3C XML Recommendation (Tim Bray's annotated version of +Rev1):

                (unfortunately) all this is inherited from the SGML world, the syntax is +ancient...

                Simple rules

                Writing DTDs can be done in many ways. The rules to build them if you need +something permanent or something which can evolve over time can be radically +different. Really complex DTDs like DocBook ones are flexible but quite +harder to design. I will just focus on DTDs for a formats with a fixed simple +structure. It is just a set of basic rules, and definitely not exhaustive nor +usable for complex DTD design.

                How to reference a DTD from a document:

                Assuming the top element of the document is spec and the dtd +is placed in the file mydtd in the subdirectory +dtds of the directory from where the document were loaded:

                <!DOCTYPE spec SYSTEM "dtds/mydtd">

                Notes:

                • The system string is actually an URI-Reference (as defined in RFC 2396) so you can use a + full URL string indicating the location of your DTD on the Web. This is a + really good thing to do if you want others to validate your document.
                • +
                • It is also possible to associate a PUBLIC identifier (a + magic string) so that the DTD is looked up in catalogs on the client side + without having to locate it on the web.
                • +
                • A DTD contains a set of element and attribute declarations, but they + don't define what the root of the document should be. This is explicitly + told to the parser/validator as the first element of the + DOCTYPE declaration.
                • +

                Declaring elements:

                The following declares an element spec:

                <!ELEMENT spec (front, body, back?)>

                It also expresses that the spec element contains one front, +one body and one optional back children elements in +this order. The declaration of one element of the structure and its content +are done in a single declaration. Similarly the following declares +div1 elements:

                <!ELEMENT div1 (head, (p | list | note)*, div2?)>

                which means div1 contains one head then a series of optional +p, lists and notes and then an +optional div2. And last but not least an element can contain +text:

                <!ELEMENT b (#PCDATA)>

                b contains text or being of mixed content (text and elements +in no particular order):

                <!ELEMENT p (#PCDATA|a|ul|b|i|em)*>

                p can contain text or a, ul, +b, i or em elements in no particular +order.

                Declaring attributes:

                Again the attributes declaration includes their content definition:

                <!ATTLIST termdef name CDATA #IMPLIED>

                means that the element termdef can have a name +attribute containing text (CDATA) and which is optional +(#IMPLIED). The attribute value can also be defined within a +set:

                <!ATTLIST list type (bullets|ordered|glossary) +"ordered">

                means list element have a type attribute with 3 +allowed values "bullets", "ordered" or "glossary" and which default to +"ordered" if the attribute is not explicitly specified.

                The content type of an attribute can be text (CDATA), +anchor/reference/references +(ID/IDREF/IDREFS), entity(ies) +(ENTITY/ENTITIES) or name(s) +(NMTOKEN/NMTOKENS). The following defines that a +chapter element can have an optional id attribute +of type ID, usable for reference from attribute of type +IDREF:

                <!ATTLIST chapter id ID #IMPLIED>

                The last value of an attribute definition can be #REQUIRED +meaning that the attribute has to be given, #IMPLIED +meaning that it is optional, or the default value (possibly prefixed by +#FIXED if it is the only allowed).

                Notes:

                • Usually the attributes pertaining to a given element are declared in a + single expression, but it is just a convention adopted by a lot of DTD + writers:
                  <!ATTLIST termdef
                             id      ID      #REQUIRED
                             name    CDATA   #IMPLIED>
                  -

                  The previous construct defines - bothidandnameattributes for the - elementtermdef.

                  +

                  The previous construct defines both id and + name attributes for the element termdef.

                • -

                Some examples

                The directory test/valid/dtds/in the -libxml2distributioncontains some complex DTD examples. The example in -thefiletest/valid/dia.xmlshows an XML file where the simple -DTDisdirectly included within the document.

                How to validate

                The simplest way is to use the xmllint program included with -libxml.The--validoption turns-on validation of the files given -asinput.For example the following validates a copy of the first revision of -theXML1.0 specification:

                xmllint --valid --noout test/valid/REC-xml-19980210.xml

                the -- noout is used to disable output of the resulting tree.

                The --dtdvalid dtdallows validation of the -document(s)againsta given DTD.

                Libxml2 exports an API to handle DTDs and validation, check the associateddescription.

                Other resources

                DTDs are as old as SGML. So there may be a number of examples -on-line,Iwill just list one for now, others pointers welcome:

                I suggest looking at the examples found under test/valid/dtd and any -ofthelarge number of books available on XML. The dia example in -test/validshouldbe both simple and complete enough to allow you to build your -own.

                Daniel Veillard

              +

              Some examples

              The directory test/valid/dtds/ in the libxml2 distribution +contains some complex DTD examples. The example in the file +test/valid/dia.xml shows an XML file where the simple DTD is +directly included within the document.

              How to validate

              The simplest way is to use the xmllint program included with libxml. The +--valid option turns-on validation of the files given as input. +For example the following validates a copy of the first revision of the XML +1.0 specification:

              xmllint --valid --noout test/valid/REC-xml-19980210.xml

              the -- noout is used to disable output of the resulting tree.

              The --dtdvalid dtd allows validation of the document(s) +against a given DTD.

              Libxml2 exports an API to handle DTDs and validation, check the associated +description.

              Other resources

              DTDs are as old as SGML. So there may be a number of examples on-line, I +will just list one for now, others pointers welcome:

              I suggest looking at the examples found under test/valid/dtd and any of +the large number of books available on XML. The dia example in test/valid +should be both simple and complete enough to allow you to build your own.

              Daniel Veillard

              diff --git a/doc/xmlio.html b/doc/xmlio.html index ae71ba1..60188df 100644 --- a/doc/xmlio.html +++ b/doc/xmlio.html @@ -13,64 +13,64 @@ A:link, A:visited, A:active { text-decoration: underline }
            • Output I/O handlers
            • The entities loader
            • Example of customized I/O
            • -

              General overview

              The module xmlIO.hprovidestheinterfaces -to the libxml2 I/O system. This consists of 4 main parts:

              • Entities loader, this is a routine which tries to fetch - theentities(files) based on their PUBLIC and SYSTEM identifiers. The - defaultloaderdon't look at the public identifier since libxml2 do not - maintainacatalog. You can redefine you own entity loader - byusingxmlGetExternalEntityLoader()andxmlSetExternalEntityLoader().Check theexample.
              • -
              • Input I/O buffers which are a commodity structure used by - theparser(s)input layer to handle fetching the informations to feed - theparser. Thisprovides buffering and is also a placeholder where - theencodingconverters to UTF8 are piggy-backed.
              • -
              • Output I/O buffers are similar to the Input ones and fulfillsimilartask - but when generating a serialization from a tree.
              • -
              • A mechanism to register sets of I/O callbacks and associate - themwithspecific naming schemes like the protocol part of the URIs. -

                This affect the default I/O operations and allows to use - specificI/Ohandlers for certain names.

                +

                General overview

                The module xmlIO.h provides +the interfaces to the libxml2 I/O system. This consists of 4 main parts:

                • Entities loader, this is a routine which tries to fetch the entities + (files) based on their PUBLIC and SYSTEM identifiers. The default loader + don't look at the public identifier since libxml2 do not maintain a + catalog. You can redefine you own entity loader by using + xmlGetExternalEntityLoader() and + xmlSetExternalEntityLoader(). Check the + example.
                • +
                • Input I/O buffers which are a commodity structure used by the parser(s) + input layer to handle fetching the informations to feed the parser. This + provides buffering and is also a placeholder where the encoding + converters to UTF8 are piggy-backed.
                • +
                • Output I/O buffers are similar to the Input ones and fulfill similar + task but when generating a serialization from a tree.
                • +
                • A mechanism to register sets of I/O callbacks and associate them with + specific naming schemes like the protocol part of the URIs. +

                  This affect the default I/O operations and allows to use specific I/O + handlers for certain names.

                • -

                The general mechanism used when loading -http://rpmfind.net/xml.htmlforexample in the HTML parser is the following:

                1. The default entity loader - callsxmlNewInputFromFile()withthe parsing context and the - URIstring.
                2. -
                3. the URI string is checked against the existing registered - handlersusingtheir match() callback function, if the HTTP module was - compiledin, it isregistered and its match() function will succeeds
                4. -
                5. the open() function of the handler is called and if - successfulwillreturn an I/O Input buffer
                6. -
                7. the parser will the start reading from this buffer - andprogressivelyfetch information from the resource, calling the - read()function of thehandler until the resource is exhausted
                8. -
                9. if an encoding change is detected it will be installed on - theinputbuffer, providing buffering and efficient use of - theconversionroutines
                10. -
                11. once the parser has finished, the close() function of the - handleriscalled once and the Input buffer and associated - resourcesaredeallocated.
                12. -

                The user defined callbacks are checked first to allow overriding -ofthedefault libxml2 I/O routines.

                The basic buffer type

                All the buffer manipulation handling is done -usingthexmlBuffertype define in tree.hwhich -isaresizable memory buffer. The buffer allocation strategy can be selected -tobeeither best-fit or use an exponential doubling one (CPU vs. -memoryusetrade-off). The values -areXML_BUFFER_ALLOC_EXACTandXML_BUFFER_ALLOC_DOUBLEIT,and -can be set individually or on asystem wide basis -usingxmlBufferSetAllocationScheme(). A numberof functions allows -tomanipulate buffers with names starting -withthexmlBuffer...prefix.

                Input I/O handlers

                An Input I/O handler is a -simplestructurexmlParserInputBuffercontaining a context -associated totheresource (file descriptor, or pointer to a protocol handler), -the read()andclose() callbacks to use and an xmlBuffer. And extra xmlBuffer -and acharsetencoding handler are also present to support charset -conversionwhenneeded.

                Output I/O handlers

                An Output handler xmlOutputBufferis completely similar -toanInput one except the callbacks are write() and close().

                The entities loader

                The entity loader resolves requests for new entities and create -inputsforthe parser. Creating an input from a filename or an URI string -isdonethrough the xmlNewInputFromFile() routine. The default entity loader -donothandle the PUBLIC identifier associated with an entity (if any). So -itjustcalls xmlNewInputFromFile() with the SYSTEM identifier (which -ismandatory inXML).

                If you want to hook up a catalog mechanism then you simply need -tooverridethe default entity loader, here is an example:

                #include <libxml/xmlIO.h>
                +

              The general mechanism used when loading http://rpmfind.net/xml.html for +example in the HTML parser is the following:

              1. The default entity loader calls xmlNewInputFromFile() with + the parsing context and the URI string.
              2. +
              3. the URI string is checked against the existing registered handlers + using their match() callback function, if the HTTP module was compiled + in, it is registered and its match() function will succeeds
              4. +
              5. the open() function of the handler is called and if successful will + return an I/O Input buffer
              6. +
              7. the parser will the start reading from this buffer and progressively + fetch information from the resource, calling the read() function of the + handler until the resource is exhausted
              8. +
              9. if an encoding change is detected it will be installed on the input + buffer, providing buffering and efficient use of the conversion + routines
              10. +
              11. once the parser has finished, the close() function of the handler is + called once and the Input buffer and associated resources are + deallocated.
              12. +

              The user defined callbacks are checked first to allow overriding of the +default libxml2 I/O routines.

              The basic buffer type

              All the buffer manipulation handling is done using the +xmlBuffer type define in tree.h which is a +resizable memory buffer. The buffer allocation strategy can be selected to be +either best-fit or use an exponential doubling one (CPU vs. memory use +trade-off). The values are XML_BUFFER_ALLOC_EXACT and +XML_BUFFER_ALLOC_DOUBLEIT, and can be set individually or on a +system wide basis using xmlBufferSetAllocationScheme(). A number +of functions allows to manipulate buffers with names starting with the +xmlBuffer... prefix.

              Input I/O handlers

              An Input I/O handler is a simple structure +xmlParserInputBuffer containing a context associated to the +resource (file descriptor, or pointer to a protocol handler), the read() and +close() callbacks to use and an xmlBuffer. And extra xmlBuffer and a charset +encoding handler are also present to support charset conversion when +needed.

              Output I/O handlers

              An Output handler xmlOutputBuffer is completely similar to an +Input one except the callbacks are write() and close().

              The entities loader

              The entity loader resolves requests for new entities and create inputs for +the parser. Creating an input from a filename or an URI string is done +through the xmlNewInputFromFile() routine. The default entity loader do not +handle the PUBLIC identifier associated with an entity (if any). So it just +calls xmlNewInputFromFile() with the SYSTEM identifier (which is mandatory in +XML).

              If you want to hook up a catalog mechanism then you simply need to +override the default entity loader, here is an example:

              #include <libxml/xmlIO.h>
               
               xmlExternalEntityLoader defaultLoader = NULL;
               
              @@ -99,10 +99,11 @@ int main(..) {
                   xmlSetExternalEntityLoader(xmlMyExternalEntityLoader);
               
                   ...
              -}

              Example of customized I/O

              This example come from areal use case,xmlDocDump() -closes the FILE * passed by the applicationand this was aproblem. The solutionwasto redefine anew -output handler with the closing call deactivated:

              1. First define a new I/O output allocator where the output don't - closethefile: +}

                Example of customized I/O

                This example come from a +real use case, xmlDocDump() closes the FILE * passed by the application +and this was a problem. The solution was to redefine a +new output handler with the closing call deactivated:

                1. First define a new I/O output allocator where the output don't close + the file:
                  xmlOutputBufferPtr
                   xmlOutputBufferCreateOwn(FILE *file, xmlCharEncodingHandlerPtr encoder) {
                       xmlOutputBufferPtr ret;
                  diff --git a/doc/xmllint.1 b/doc/xmllint.1
                  index 13e38f5..18ef917 100644
                  --- a/doc/xmllint.1
                  +++ b/doc/xmllint.1
                  @@ -2,7 +2,7 @@
                   .\" It was generated using the DocBook XSL Stylesheets (version 1.69.1).
                   .\" Instead of manually editing it, you probably should edit the DocBook XML
                   .\" source for it and then use the DocBook XSL Stylesheets to regenerate it.
                  -.TH "XMLLINT" "1" "2006\-03\-05" "libxml2" ""
                  +.TH "XMLLINT" "1" "$Date: 2006/08/21 08:34:11 $" "libxml2" ""
                   .\" disable hyphenation
                   .nh
                   .\" disable justification (adjust text to left margin only)
                  @@ -18,7 +18,9 @@ xmllint \- command line XML tool
                   .PP
                   The
                   \fBxmllint\fR
                  -program parses one or more XML files, specified on the command line as
                  +program parses one or more
                  +XML
                  +files, specified on the command line as
                   \fIXML\-FILE\fR
                   (or the standard input if the filename provided is
                   \fB\-\fR
                  @@ -31,19 +33,6 @@ parser itself.
                   \fBxmllint\fR
                   is included in
                   \fBlibxml\fR(3).
                  -.PP
                  -More information can be found at
                  -.TP 3
                  -\(bu
                  -\fBlibxml\fR(3)
                  -web page
                  -\fI\%http://www.xmlsoft.org/\fR
                  -.TP
                  -\(bu
                  -W3C
                  -XSLT
                  -page
                  -\fI\%http://www.w3.org/TR/xslt\fR
                   .SH "OPTIONS"
                   .PP
                   \fBxmllint\fR
                  @@ -53,10 +42,14 @@ accepts the following options (in alphabetical order):
                   Generate a small document for testing purposes.
                   .TP
                   \fB\-\-catalogs\fR
                  -Use the catalogs from
                  +Use the
                  +SGML
                  +catalog(s) from
                   \fBSGML_CATALOG_FILES\fR. Otherwise
                  +XML
                  +catalogs starting from
                   \fI/etc/xml/catalog\fR
                  -is used by default.
                  +are used by default.
                   .TP
                   \fB\-\-chkregister\fR
                   Turn on node registration. Useful for developers testing
                  @@ -65,14 +58,16 @@ node tracking code.
                   .TP
                   \fB\-\-compress\fR
                   Turn on
                  -gzip
                  +\fBgzip\fR(1)
                   compression of output.
                   .TP
                   \fB\-\-copy\fR
                   Test the internal copy implementation.
                   .TP
                   \fB\-\-c14n\fR
                  -Use the W3C XML Canonicalisation (C14N) to serialize the result of parsing to
                  +Use the W3C
                  +XML
                  +Canonicalisation (C14N) to serialize the result of parsing to
                   \fIstdout\fR. It keeps comments in the result.
                   .TP
                   \fB\-\-dtdvalid \fR\fB\fIURL\fR\fR
                  @@ -85,9 +80,9 @@ for validation.
                   \fB\-\-dtdvalidfpi \fR\fB\fIFPI\fR\fR
                   Use the
                   DTD
                  -specified by a Public Identifier
                  +specified by a Formal Public Identifier
                   \fIFPI\fR
                  -for validation, note that this will require a Catalog exporting that Public Identifier to work.
                  +for validation, note that this will require a catalog exporting that Formal Public Identifier to work.
                   .TP
                   \fB\-\-debug\fR
                   Parse a file and output an annotated tree of the in\-memory version of the document.
                  @@ -111,7 +106,7 @@ Output in the given encoding.
                   \fB\-\-format\fR
                   Reformat and reindent the output. The
                   \fBXMLLINT_INDENT\fR
                  -environment variable controls the indentation (default value is two spaces " ").
                  +environment variable controls the indentation. The default value is two spaces " ").
                   .TP
                   \fB\-\-help\fR
                   Print out a short usage summary for
                  @@ -135,7 +130,7 @@ tags surrounding the result tree output so the results can be displayed/viewed i
                   Test for valid insertions.
                   .TP
                   \fB\-\-loaddtd\fR
                  -Fetch external
                  +Fetch an external
                   DTD.
                   .TP
                   \fB\-\-load\-trace\fR
                  @@ -207,7 +202,7 @@ DTDs or entities. Enclose space\-separated lists by quotation marks.
                   Used to exercise the pattern recognition engine, which can be used with the reader interface to the parser. It allows to select some nodes in the document based on an XPath (subset) expression. Used for debugging.
                   .TP
                   \fB\-\-postvalid\fR
                  -Validate after parsing is completed.
                  +Validate after parsing has completed.
                   .TP
                   \fB\-\-push\fR
                   Use the push mode of the parser.
                  @@ -224,7 +219,9 @@ for validation.
                   Repeat 100 times, for timing or profiling.
                   .TP
                   \fB\-\-schema \fR\fB\fISCHEMA\fR\fR
                  -Use a W3C XML Schema file named
                  +Use a W3C
                  +XML
                  +Schema file named
                   \fISCHEMA\fR
                   for validation.
                   .TP
                  @@ -233,7 +230,9 @@ Run a navigating shell. Details on available commands in shell mode are below (s
                   the section called \(lqSHELL COMMANDS\(rq).
                   .TP
                   \fB\-\-stream\fR
                  -Use streaming API \- useful when used in combination with
                  +Use streaming
                  +API
                  +\- useful when used in combination with
                   \fB\-\-relaxng\fR
                   or
                   \fB\-\-valid\fR
                  @@ -264,7 +263,7 @@ used.
                   \fB\-\-walker\fR
                   Test the walker module, which is a reader interface but for a document tree, instead of using the reader
                   API
                  -on an unparsed document it works on a existing in\-memory tree. Used in debugging.
                  +on an unparsed document it works on an existing in\-memory tree. Used for debugging.
                   .TP
                   \fB\-\-xinclude\fR
                   Do XInclude processing.
                  @@ -275,7 +274,7 @@ Used in conjunction with
                   HTML
                   is parsed the document is saved with the
                   HTML
                  -serializer, but with this option the resulting document is saved with the
                  +serializer. But with this option the resulting document is saved with the
                   XML
                   serializer. This is primarily used to generate
                   XHTML
                  @@ -341,29 +340,38 @@ Write the current node to the given filename.
                   .SH "ENVIRONMENT"
                   .TP
                   \fBSGML_CATALOG_FILES\fR
                  -to be written ...
                  +SGML
                  +catalog behavior can be changed by redirecting queries to the user's own set of catalogs. This can be done by setting the
                  +\fBSGML_CATALOG_FILES\fR
                  +environment variable to a list of catalogs. An empty one should deactivate loading the default
                  +\fI/etc/sgml/catalog\fR
                  +catalog.
                   .TP
                   \fBXML_CATALOG_FILES\fR
                  -Catalog behavior can be changed by redirecting queries to the user's own set of catalogs. This can be done by setting the
                  +XML
                  +catalog behavior can be changed by redirecting queries to the user's own set of catalogs. This can be done by setting the
                   \fBXML_CATALOG_FILES\fR
                   environment variable to a list of catalogs. An empty one should deactivate loading the default
                   \fI/etc/xml/catalog\fR
                  -default catalog.
                  +catalog.
                   .TP
                   \fBXML_DEBUG_CATALOG\fR
                   Setting the environment variable
                   \fBXML_DEBUG_CATALOG\fR
                  +to
                  +\fInon\-zero\fR
                   using the
                   \fBexport\fR
                   command outputs debugging information related to catalog operations.
                   .TP
                   \fBXMLLINT_INDENT\fR
                  -to be written ...
                  +Setting the environment variable
                  +\fBXMLLINT_INDENT\fR
                  +controls the indentation. The default value is two spaces " ".
                   .SH "DIAGNOSTICS"
                   .PP
                  -On the completion of execution,
                   \fBxmllint\fR
                  -returns the following error codes:
                  +return codes provide information that can be used when calling it from scripts.
                   .TP
                   \fB0\fR
                   No error
                  @@ -402,5 +410,18 @@ Out of memory error
                   .SH "SEE ALSO"
                   .PP
                   \fBlibxml\fR(3)
                  +.PP
                  +More information can be found at
                  +.TP 3
                  +\(bu
                  +\fBlibxml\fR(3)
                  +web page
                  +\fI\%http://www.xmlsoft.org/\fR
                  +.TP
                  +\(bu
                  +W3C
                  +XSLT
                  +page
                  +\fI\%http://www.w3.org/TR/xslt\fR
                   .SH "AUTHOR"
                   John Fleck , Ziying Sherwin , Heiko Rupp . 
                  diff --git a/doc/xmllint.xml b/doc/xmllint.xml
                  index 904e706..9757675 100644
                  --- a/doc/xmllint.xml
                  +++ b/doc/xmllint.xml
                  @@ -46,7 +46,7 @@
                   		
                   	
                   	
                  -	2006-03-05
                  +	$Date: 2006/08/21 08:34:11 $
                   	
                   	
                   	
                  @@ -130,34 +130,18 @@
                   
                   	DESCRIPTION
                   	
                  -		The &xmllint; program parses one or more XML files, specified on the
                  -		command line as XML-FILE (or the standard
                  -		input if the filename provided is - ).
                  -		It prints various types of output, depending upon the options selected.
                  -		It is useful for detecting errors both
                  -		in XML code and in the XML parser
                  -		itself.
                  +		The &xmllint; program parses one or more XML files,
                  +		specified on the command line as XML-FILE
                  +		(or the standard input if the filename provided
                  +		is - ). It prints various types of
                  +		output, depending upon the options selected. It is useful for detecting
                  +		errors both in XML code and in
                  +		the XML parser itself.
                   	
                   	&xmllint; is included in 
                   		libxml
                   		3
                   	.
                  -	More information can be found at
                  -		
                  -			
                  -				
                  -						libxml
                  -						3
                  -					 web page 
                  -				
                  -			
                  -			
                  -				
                  -					W3C XSLT page 
                  -				
                  -			
                  -		
                  -	
                   
                   
                   
                  @@ -179,8 +163,9 @@
                   	
                   	
                   		
                  -			Use the catalogs from SGML_CATALOG_FILES.
                  -			Otherwise /etc/xml/catalog is used by default.
                  +			Use the SGML catalog(s) from SGML_CATALOG_FILES.
                  +			Otherwise XML catalogs starting
                  +			from /etc/xml/catalog are used by default.
                   		
                   	
                   		
                  @@ -201,7 +186,10 @@
                   	
                   	
                   		
                  -			Turn on gzip compression of output.
                  +			Turn on 
                  +		gzip
                  +		1
                  +	 compression of output.
                   		
                   	
                   		
                  @@ -217,8 +205,8 @@
                   	
                   	
                   		
                  -			Use the W3C XML Canonicalisation (C14N) to serialize
                  -			the result of parsing to stdout.
                  +			Use the W3C XML Canonicalisation (C14N) to
                  +			serialize the result of parsing to stdout.
                   			It keeps comments in the result.
                   		
                   	
                  @@ -238,9 +226,9 @@
                   	
                   	
                   		
                  -			Use the DTD specified by a Public
                  +			Use the DTD specified by a Formal Public
                   			Identifier FPI for validation, note that this
                  -			will require a Catalog exporting that Public Identifier to work.
                  +			will require a catalog exporting that Formal Public Identifier to work.
                   		
                   	
                   		
                  @@ -291,7 +279,7 @@
                   	
                   		
                   			Reformat and reindent the output. The XMLLINT_INDENT
                  -			environment variable controls the indentation (default value is two
                  +			environment variable controls the indentation. The default value is two
                   			spaces "  ").
                   		
                   	
                  @@ -333,7 +321,7 @@
                   		
                   	
                   	
                  -		Fetch external DTD.
                  +		Fetch an external DTD.
                   	
                   		
                   
                  @@ -484,7 +472,7 @@
                   		
                   	
                   	
                  -		Validate after parsing is completed.
                  +		Validate after parsing has completed.
                   	
                   		
                   
                  @@ -523,8 +511,8 @@
                   	
                   	
                   		
                  -			Use a W3C XML Schema file named SCHEMA
                  -			for validation.
                  +			Use a W3C XML Schema file
                  +			named SCHEMA for validation.
                   		
                   	
                   		
                  @@ -543,7 +531,7 @@
                   	
                   	
                   		
                  -			Use streaming API - useful when  used  in combination
                  +			Use streaming API - useful when used in combination
                   			with  or  options
                   			for validation of files that are too large to be held in memory.
                   		
                  @@ -599,7 +587,7 @@
                   		
                   			Test the walker module, which is a reader interface but for a
                   			document tree, instead of using the reader API on
                  -			an unparsed document it works on a existing in-memory tree. Used in
                  +			an unparsed document it works on an existing in-memory tree. Used for
                   			debugging.
                   		
                   	
                  @@ -618,11 +606,10 @@
                   		
                   			Used in conjunction with . Usually
                   			when HTML is parsed the document is saved with
                  -			the HTML serializer, but with this option the
                  +			the HTML serializer. But with this option the
                   			resulting document is saved with the XML
                   			serializer. This is primarily used to
                  -			generate XHTML
                  -			from HTML input.
                  +			generate XHTML from HTML input.
                   		
                   	
                   		
                  @@ -770,19 +757,23 @@
                   		
                   	SGML_CATALOG_FILES
                   	
                  -		to be written ...
                  +		SGML catalog behavior can be changed by redirecting
                  +			queries to the user's own set of catalogs. This can be done by setting
                  +			the SGML_CATALOG_FILES environment variable to a list
                  +			of catalogs. An empty one should deactivate loading the
                  +			default /etc/sgml/catalog catalog.
                  +		
                   	
                   		
                   
                   		
                   	XML_CATALOG_FILES
                   	
                  -		
                  -			Catalog behavior can be changed by redirecting queries to the user's
                  -			own set of catalogs. This can be done by setting
                  +		XML catalog behavior can be changed by redirecting
                  +			queries to the user's own set of catalogs. This can be done by setting
                   			the XML_CATALOG_FILES environment variable to a list
                   			of catalogs. An empty one should deactivate loading the
                  -			default /etc/xml/catalog default catalog.
                  +			default /etc/xml/catalog catalog.
                   		
                   	
                   		
                  @@ -790,10 +781,9 @@
                   		
                   	XML_DEBUG_CATALOG
                   	
                  -		
                  -			Setting the environment variable XML_DEBUG_CATALOG
                  -			using the export command outputs debugging information
                  -			related to catalog operations.
                  +		Setting the environment variable XML_DEBUG_CATALOG
                  +			to non-zero using the export
                  +			command outputs debugging information related to catalog operations.
                   		
                   	
                   		
                  @@ -801,7 +791,9 @@
                   		
                   	XMLLINT_INDENT
                   	
                  -		to be written ...
                  +		Setting the environment variable XMLLINT_INDENT
                  +			controls the indentation. The default value is two spaces "  ".
                  +		
                   	
                   		
                   		
                  @@ -811,7 +803,8 @@
                   
                   	DIAGNOSTICS
                   	
                  -		On the completion of execution, &xmllint; returns the following error codes:
                  +		&xmllint; return codes provide information that can be used when
                  +		calling it from scripts.
                   	
                   	
                  @@ -897,12 +890,27 @@
                   
                   
                   	SEE ALSO
                  -	
                  -		
                  +	
                   			libxml
                   			3
                   		
                   	
                  +	
                  +		More information can be found at
                  +		
                  +			
                  +				
                  +						libxml
                  +						3
                  +					 web page 
                  +				
                  +			
                  +			
                  +				W3C XSLT page 
                  +				
                  +			
                  +		
                  +	
                   
                   
                   
                  diff --git a/doc/xmlmem.html b/doc/xmlmem.html
                  index 40dc4cb..58c2987 100644
                  --- a/doc/xmlmem.html
                  +++ b/doc/xmlmem.html
                  @@ -12,91 +12,91 @@ A:link, A:visited, A:active { text-decoration: underline }
                     
                2. Cleaning up after parsing
                3. Debugging routines
                4. General memory requirements
                5. -

                General overview

                The module xmlmemory.hprovidesthe -interfaces to the libxml2 memory system:

                • libxml2 does not use the libc memory allocator directly - butxmlFree(),xmlMalloc() and xmlRealloc()
                • -
                • those routines can be reallocated to a specific set of - routine,bydefault the libc ones i.e. free(), malloc() and realloc()
                • +

              General overview

              The module xmlmemory.h +provides the interfaces to the libxml2 memory system:

              • libxml2 does not use the libc memory allocator directly but xmlFree(), + xmlMalloc() and xmlRealloc()
              • +
              • those routines can be reallocated to a specific set of routine, by + default the libc ones i.e. free(), malloc() and realloc()
              • the xmlmemory.c module includes a set of debugging routine
              • -

              Setting libxml2 set of memory routines

              It is sometimes useful to not use the default memory allocator, -eitherfordebugging, analysis or to implement a specific behaviour on -memorymanagement(like on embedded systems). Two function calls are available -to doso:

              • xmlMemGet()whichreturn - the current set of functions in use by the parser
              • -
              • xmlMemSetup()whichallow - to set up a new set of memory allocation functions
              • -

              Of course a call to xmlMemSetup() should probably be done beforecallingany -other libxml2 routines (unless you are sure your allocationsroutines -arecompatibles).

              Cleaning up after parsing

              Libxml2 is not stateless, there is a few set of memory -structuresneedingallocation before the parser is fully functional (some -encodingstructuresfor example). This also mean that once parsing is finished -there isa tinyamount of memory (a few hundred bytes) which can be recollected -if youdon'treuse the parser immediately:

              • xmlCleanupParser()isa - centralized routine to free the parsing states. Note that - itwon'tdeallocate any produced tree if any (use the xmlFreeDoc() - andrelatedroutines for this).
              • -
              • xmlInitParser()isthe - dual routine allowing to preallocate the parsing statewhich can beuseful - for example to avoid initialization reentrancyproblems when usinglibxml2 - in multithreaded applications
              • -

              Generally xmlCleanupParser() is safe, if needed the state will berebuildat -the next invocation of parser routines, but be careful of theconsequencesin -multithreaded applications.

              Debugging routines

              When configured using --with-mem-debug flag (off by default), libxml2usesa -set of memory allocation debugging routines keeping track of -allallocatedblocks and the location in the code where the routine was called. -Acouple ofother debugging routines allow to dump the memory allocated infos -toa fileor call a specific routine when a given block number is allocated:

              When developing libxml2 memory debug is enabled, the tests -programscallxmlMemoryDump () and the "make test" regression tests will check -foranymemory leak during the full regression test sequence, this helps -alotensuring that libxml2 does not leak memory and bullet -proofmemoryallocations use (some libc implementations are known to be far -toopermissiveresulting in major portability problems!).

              If the .memdump reports a leak, it displays the allocation functionandalso -tries to give some informations about the content and structure -oftheallocated blocks left. This is sufficient in most cases to find -theculprit,but not always. Assuming the allocation problem is reproducible, -itispossible to find more easily:

              1. write down the block number xxxx not allocated
              2. -
              3. export the environment variable XML_MEM_BREAKPOINT=xxxx , - theeasiestwhen using GDB is to simply give the command +

            Setting libxml2 set of memory routines

            It is sometimes useful to not use the default memory allocator, either for +debugging, analysis or to implement a specific behaviour on memory management +(like on embedded systems). Two function calls are available to do so:

            • xmlMemGet + () which return the current set of functions in use by the parser
            • +
            • xmlMemSetup() + which allow to set up a new set of memory allocation functions
            • +

            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).

            Cleaning up after parsing

            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:

            • xmlCleanupParser + () 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).
            • +
            • xmlInitParser + () 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
            • +

            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.

            Debugging routines

            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 +or call a specific routine when a given block number is allocated:

            When developing libxml2 memory debug is enabled, the tests programs call +xmlMemoryDump () and the "make test" regression tests will check for any +memory leak during the full regression test sequence, this helps a lot +ensuring that libxml2 does not leak memory and bullet proof memory +allocations use (some libc implementations are known to be far too permissive +resulting in major portability problems!).

            If the .memdump reports a leak, it displays the allocation function and +also tries to give some informations about the content and structure of the +allocated blocks left. This is sufficient in most cases to find the culprit, +but not always. Assuming the allocation problem is reproducible, it is +possible to find more easily:

            1. write down the block number xxxx not allocated
            2. +
            3. export the environment variable XML_MEM_BREAKPOINT=xxxx , the easiest + when using GDB is to simply give the command

              set environment XML_MEM_BREAKPOINT xxxx

              before running the program.

            4. -
            5. run the program under a debugger and set a - breakpointonxmlMallocBreakpoint() a specific function called when this - preciseblockis allocated
            6. -
            7. when the breakpoint is reached you can then do a fine analysis - oftheallocation an step to see the condition resulting in - themissingdeallocation.
            8. -

            I used to use a commercial tool to debug libxml2 memory problems -butafternoticing that it was not detecting memory leaks that simple -mechanismwasused and proved extremely efficient until now. Lately I have also -used valgrindwith quite -somesuccess,it is tied to the i386 architecture since it works by emulating -theprocessorand instruction set, it is slow but extremely efficient, i.e. -itspot memoryusage errors in a very precise way.

            General memory requirements

            How much libxml2 memory require ? It's hard to tell in average itdependsof -a number of things:

            • the parser itself should work in a fixed amount of memory, - exceptforinformation maintained about the stacks of names and - entitieslocations.The I/O and encoding handlers will probably account for - a fewKBytes.This is true for both the XML and HTML parser (though the - HTMLparserneed more state).
            • -
            • If you are generating the DOM tree then memory requirements - willgrownearly linear with the size of the data. In general for - abalancedtextual document the internal memory requirement is about 4 - timesthesize of the UTF8 serialization of this document (example - theXML-1.0recommendation is a bit more of 150KBytes and takes 650KBytes - ofmainmemory when parsed). Validation will add a amount of memory - requiredformaintaining the external Dtd state which should be linear - withthecomplexity of the content model defined by the Dtd
            • -
            • If you need to work with fixed memory requirements or don't needthefull - DOM tree then using the xmlReaderinterfaceis - probably the best way toproceed, it still allows tovalidate or operate on - subset of the tree ifneeded.
            • -
            • If you don't care about the advanced features of libxml2likevalidation, - DOM, XPath or XPointer, don't use entities, need to workwithfixed memory - requirements, and try to get the fastest parsingpossiblethen the SAX - interface should be used, but it has knownrestrictions.
            • +
            • run the program under a debugger and set a breakpoint on + xmlMallocBreakpoint() a specific function called when this precise block + is allocated
            • +
            • when the breakpoint is reached you can then do a fine analysis of the + allocation an step to see the condition resulting in the missing + deallocation.
            • +

              I used to use a commercial tool to debug libxml2 memory problems but after +noticing that it was not detecting memory leaks that simple mechanism was +used and proved extremely efficient until now. Lately I have also used valgrind with quite some +success, it is tied to the i386 architecture since it works by emulating the +processor and instruction set, it is slow but extremely efficient, i.e. it +spot memory usage errors in a very precise way.

              General memory requirements

              How much libxml2 memory require ? It's hard to tell in average it depends +of a number of things:

              • the parser itself should work in a fixed amount of memory, except for + information maintained about the stacks of names and entities locations. + The I/O and encoding handlers will probably account for a few KBytes. + This is true for both the XML and HTML parser (though the HTML parser + need more state).
              • +
              • If you are generating the DOM tree then memory requirements will grow + nearly linear with the size of the data. In general for a balanced + textual document the internal memory requirement is about 4 times the + size of the UTF8 serialization of this document (example the XML-1.0 + recommendation is a bit more of 150KBytes and takes 650KBytes of main + memory when parsed). Validation will add a amount of memory required for + maintaining the external Dtd state which should be linear with the + complexity of the content model defined by the Dtd
              • +
              • If you need to work with fixed memory requirements or don't need the + full DOM tree then using the xmlReader + interface is probably the best way to proceed, it still allows to + validate or operate on subset of the tree if needed.
              • +
              • If you don't care about the advanced features of libxml2 like + validation, DOM, XPath or XPointer, don't use entities, need to work with + fixed memory requirements, and try to get the fastest parsing possible + then the SAX interface should be used, but it has known restrictions.

              Daniel Veillard

            diff --git a/encoding.c b/encoding.c index 6dee212..ee33df1 100644 --- a/encoding.c +++ b/encoding.c @@ -1613,6 +1613,12 @@ xmlFindCharEncodingHandler(const char *name) { /* check whether iconv can handle this */ icv_in = iconv_open("UTF-8", name); icv_out = iconv_open(name, "UTF-8"); + if (icv_in == (iconv_t) -1) { + icv_in = iconv_open("UTF-8", upper); + } + if (icv_out == (iconv_t) -1) { + icv_out = iconv_open(upper, "UTF-8"); + } if ((icv_in != (iconv_t) -1) && (icv_out != (iconv_t) -1)) { enc = (xmlCharEncodingHandlerPtr) xmlMalloc(sizeof(xmlCharEncodingHandler)); diff --git a/entities.c b/entities.c index 6a0e38d..91a3978 100644 --- a/entities.c +++ b/entities.c @@ -31,35 +31,35 @@ static xmlEntity xmlEntityLt = { NULL, NULL, NULL, NULL, NULL, NULL, BAD_CAST "<", BAD_CAST "<", 1, XML_INTERNAL_PREDEFINED_ENTITY, - NULL, NULL, NULL, NULL, 0 + NULL, NULL, NULL, NULL, 0, 1 }; static xmlEntity xmlEntityGt = { NULL, XML_ENTITY_DECL, BAD_CAST "gt", NULL, NULL, NULL, NULL, NULL, NULL, BAD_CAST ">", BAD_CAST ">", 1, XML_INTERNAL_PREDEFINED_ENTITY, - NULL, NULL, NULL, NULL, 0 + NULL, NULL, NULL, NULL, 0, 1 }; static xmlEntity xmlEntityAmp = { NULL, XML_ENTITY_DECL, BAD_CAST "amp", NULL, NULL, NULL, NULL, NULL, NULL, BAD_CAST "&", BAD_CAST "&", 1, XML_INTERNAL_PREDEFINED_ENTITY, - NULL, NULL, NULL, NULL, 0 + NULL, NULL, NULL, NULL, 0, 1 }; static xmlEntity xmlEntityQuot = { NULL, XML_ENTITY_DECL, BAD_CAST "quot", NULL, NULL, NULL, NULL, NULL, NULL, BAD_CAST "\"", BAD_CAST "\"", 1, XML_INTERNAL_PREDEFINED_ENTITY, - NULL, NULL, NULL, NULL, 0 + NULL, NULL, NULL, NULL, 0, 1 }; static xmlEntity xmlEntityApos = { NULL, XML_ENTITY_DECL, BAD_CAST "apos", NULL, NULL, NULL, NULL, NULL, NULL, BAD_CAST "'", BAD_CAST "'", 1, XML_INTERNAL_PREDEFINED_ENTITY, - NULL, NULL, NULL, NULL, 0 + NULL, NULL, NULL, NULL, 0, 1 }; /** @@ -182,6 +182,7 @@ xmlAddEntity(xmlDtdPtr dtd, const xmlChar *name, int type, } memset(ret, 0, sizeof(xmlEntity)); ret->type = XML_ENTITY_DECL; + ret->checked = 0; /* * fill the structure. diff --git a/example/Makefile.in b/example/Makefile.in index d1ac9ef..42681b2 100644 --- a/example/Makefile.in +++ b/example/Makefile.in @@ -156,6 +156,7 @@ RDL_LIBS = @RDL_LIBS@ READER_TEST = @READER_TEST@ RELDATE = @RELDATE@ RM = @RM@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STATIC_BINARIES = @STATIC_BINARIES@ @@ -184,6 +185,7 @@ THREAD_CFLAGS = @THREAD_CFLAGS@ THREAD_LIBS = @THREAD_LIBS@ U = @U@ VERSION = @VERSION@ +WGET = @WGET@ WIN32_EXTRA_LDFLAGS = @WIN32_EXTRA_LDFLAGS@ WIN32_EXTRA_LIBADD = @WIN32_EXTRA_LIBADD@ WITH_C14N = @WITH_C14N@ @@ -219,6 +221,7 @@ WITH_WRITER = @WITH_WRITER@ WITH_XINCLUDE = @WITH_XINCLUDE@ WITH_XPATH = @WITH_XPATH@ WITH_XPTR = @WITH_XPTR@ +WITH_ZLIB = @WITH_ZLIB@ XINCLUDE_OBJ = @XINCLUDE_OBJ@ XMLLINT = @XMLLINT@ XML_CFLAGS = @XML_CFLAGS@ diff --git a/include/Makefile.in b/include/Makefile.in index e4897bc..1ed9f8a 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -145,6 +145,7 @@ RDL_LIBS = @RDL_LIBS@ READER_TEST = @READER_TEST@ RELDATE = @RELDATE@ RM = @RM@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STATIC_BINARIES = @STATIC_BINARIES@ @@ -173,6 +174,7 @@ THREAD_CFLAGS = @THREAD_CFLAGS@ THREAD_LIBS = @THREAD_LIBS@ U = @U@ VERSION = @VERSION@ +WGET = @WGET@ WIN32_EXTRA_LDFLAGS = @WIN32_EXTRA_LDFLAGS@ WIN32_EXTRA_LIBADD = @WIN32_EXTRA_LIBADD@ WITH_C14N = @WITH_C14N@ @@ -208,6 +210,7 @@ WITH_WRITER = @WITH_WRITER@ WITH_XINCLUDE = @WITH_XINCLUDE@ WITH_XPATH = @WITH_XPATH@ WITH_XPTR = @WITH_XPTR@ +WITH_ZLIB = @WITH_ZLIB@ XINCLUDE_OBJ = @XINCLUDE_OBJ@ XMLLINT = @XMLLINT@ XML_CFLAGS = @XML_CFLAGS@ diff --git a/include/libxml/HTMLparser.h b/include/libxml/HTMLparser.h index 8477efb..05905e4 100644 --- a/include/libxml/HTMLparser.h +++ b/include/libxml/HTMLparser.h @@ -105,6 +105,9 @@ XMLPUBFUN int XMLCALL XMLPUBFUN void XMLCALL htmlParseElement(htmlParserCtxtPtr ctxt); +XMLPUBFUN htmlParserCtxtPtr XMLCALL + htmlNewParserCtxt(void); + XMLPUBFUN htmlParserCtxtPtr XMLCALL htmlCreateMemoryParserCtxt(const char *buffer, int size); diff --git a/include/libxml/Makefile.in b/include/libxml/Makefile.in index f273b82..a63f77f 100644 --- a/include/libxml/Makefile.in +++ b/include/libxml/Makefile.in @@ -149,6 +149,7 @@ RDL_LIBS = @RDL_LIBS@ READER_TEST = @READER_TEST@ RELDATE = @RELDATE@ RM = @RM@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STATIC_BINARIES = @STATIC_BINARIES@ @@ -177,6 +178,7 @@ THREAD_CFLAGS = @THREAD_CFLAGS@ THREAD_LIBS = @THREAD_LIBS@ U = @U@ VERSION = @VERSION@ +WGET = @WGET@ WIN32_EXTRA_LDFLAGS = @WIN32_EXTRA_LDFLAGS@ WIN32_EXTRA_LIBADD = @WIN32_EXTRA_LIBADD@ WITH_C14N = @WITH_C14N@ @@ -212,6 +214,7 @@ WITH_WRITER = @WITH_WRITER@ WITH_XINCLUDE = @WITH_XINCLUDE@ WITH_XPATH = @WITH_XPATH@ WITH_XPTR = @WITH_XPTR@ +WITH_ZLIB = @WITH_ZLIB@ XINCLUDE_OBJ = @XINCLUDE_OBJ@ XMLLINT = @XMLLINT@ XML_CFLAGS = @XML_CFLAGS@ diff --git a/include/libxml/entities.h b/include/libxml/entities.h index 0bb28a0..fdd7222 100644 --- a/include/libxml/entities.h +++ b/include/libxml/entities.h @@ -56,6 +56,7 @@ struct _xmlEntity { struct _xmlEntity *nexte; /* unused */ const xmlChar *URI; /* the full URI as computed */ int owner; /* does the entity own the childrens */ + int checked; /* was the entity content checked */ }; /* diff --git a/include/libxml/parser.h b/include/libxml/parser.h index 46377ff..fe63bda 100644 --- a/include/libxml/parser.h +++ b/include/libxml/parser.h @@ -1089,7 +1089,9 @@ typedef enum { XML_PARSE_NSCLEAN = 1<<13,/* remove redundant namespaces declarations */ XML_PARSE_NOCDATA = 1<<14,/* merge CDATA as text nodes */ XML_PARSE_NOXINCNODE= 1<<15,/* do not generate XINCLUDE START/END nodes */ - XML_PARSE_COMPACT = 1<<16 /* compact small text nodes */ + XML_PARSE_COMPACT = 1<<16 /* compact small text nodes; no modification of + the tree allowed afterwards (will possibly + crash if you try to modify the tree) */ } xmlParserOption; XMLPUBFUN void XMLCALL @@ -1204,6 +1206,7 @@ typedef enum { XML_WITH_DEBUG = 28, XML_WITH_DEBUG_MEM = 29, XML_WITH_DEBUG_RUN = 30, + XML_WITH_ZLIB = 31, XML_WITH_NONE = 99999 /* just to be sure of allocation size */ } xmlFeature; diff --git a/include/libxml/tree.h b/include/libxml/tree.h index b162574..321280e 100644 --- a/include/libxml/tree.h +++ b/include/libxml/tree.h @@ -54,6 +54,15 @@ typedef xmlEntity *xmlEntityPtr; */ #define BASE_BUFFER_SIZE 4096 +/** + * LIBXML_NAMESPACE_DICT: + * + * Defines experimental behaviour: + * 1) xmlNs gets an additional field @context (a xmlDoc) + * 2) when creating a tree, xmlNs->href is stored in the dict of xmlDoc. + */ +/* #define LIBXML_NAMESPACE_DICT */ + /** * xmlBufferAllocationScheme: * @@ -342,6 +351,7 @@ struct _xmlNs { const xmlChar *href; /* URL for the namespace */ const xmlChar *prefix; /* prefix for the namespace */ void *_private; /* application data */ + struct _xmlDoc *context; /* normally an xmlDoc */ }; /** @@ -508,10 +518,47 @@ struct _xmlDoc { void *psvi; /* for type/PSVI informations */ }; + typedef struct _xmlDOMWrapCtxt xmlDOMWrapCtxt; typedef xmlDOMWrapCtxt *xmlDOMWrapCtxtPtr; + +/** + * xmlDOMWrapAcquireNsFunction: + * @ctxt: a DOM wrapper context + * @node: the context node (element or attribute) + * @nsName: the requested namespace name + * @nsPrefix: the requested namespace prefix + * + * A function called to acquire namespaces (xmlNs) from the wrapper. + * + * Returns an xmlNsPtr or NULL in case of an error. + */ +typedef xmlNsPtr (*xmlDOMWrapAcquireNsFunction) (xmlDOMWrapCtxtPtr ctxt, + xmlNodePtr node, + const xmlChar *nsName, + const xmlChar *nsPrefix); + +/** + * xmlDOMWrapCtxt: + * + * Context for DOM wrapper-operations. + */ struct _xmlDOMWrapCtxt { void * _private; + /* + * The type of this context, just in case we need specialized + * contexts in the future. + */ + int type; + /* + * Internal namespace map used for various operations. + */ + void * namespaceMap; + /* + * Use this one to acquire an xmlNsPtr intended for node->ns. + * (Note that this is not intended for elem->nsDef). + */ + xmlDOMWrapAcquireNsFunction getNsForNodeFunc; }; /** @@ -541,7 +588,7 @@ struct _xmlDOMWrapCtxt { /* * Some helper functions */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) XMLPUBFUN int XMLCALL xmlValidateNCName (const xmlChar *value, int space); @@ -871,7 +918,7 @@ XMLPUBFUN xmlNsPtr XMLCALL xmlSearchNsByHref (xmlDocPtr doc, xmlNodePtr node, const xmlChar *href); -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) XMLPUBFUN xmlNsPtr * XMLCALL xmlGetNsList (xmlDocPtr doc, xmlNodePtr node); diff --git a/include/libxml/uri.h b/include/libxml/uri.h index 89e3653..5e29671 100644 --- a/include/libxml/uri.h +++ b/include/libxml/uri.h @@ -80,6 +80,8 @@ XMLPUBFUN void XMLCALL xmlFreeURI (xmlURIPtr uri); XMLPUBFUN xmlChar* XMLCALL xmlCanonicPath (const xmlChar *path); +XMLPUBFUN xmlChar* XMLCALL + xmlPathToURI (const xmlChar *path); #ifdef __cplusplus } diff --git a/include/libxml/xinclude.h b/include/libxml/xinclude.h index 4bb0aab..ba9c9b5 100644 --- a/include/libxml/xinclude.h +++ b/include/libxml/xinclude.h @@ -94,6 +94,10 @@ XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL xmlXIncludeProcessFlags (xmlDocPtr doc, int flags); +XMLPUBFUN int XMLCALL + xmlXIncludeProcessFlagsData(xmlDocPtr doc, + int flags, + void *data); XMLPUBFUN int XMLCALL xmlXIncludeProcessTree (xmlNodePtr tree); XMLPUBFUN int XMLCALL diff --git a/include/libxml/xmlversion.h b/include/libxml/xmlversion.h index cc75dc0..bacbe1d 100644 --- a/include/libxml/xmlversion.h +++ b/include/libxml/xmlversion.h @@ -29,28 +29,28 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * * the version string like "1.2.3" */ -#define LIBXML_DOTTED_VERSION "2.6.26" +#define LIBXML_DOTTED_VERSION "2.6.27" /** * LIBXML_VERSION: * - * the version number: 1.2.3 value is 1002003 + * the version number: 1.2.3 value is 10203 */ -#define LIBXML_VERSION 20626 +#define LIBXML_VERSION 20627 /** * LIBXML_VERSION_STRING: * - * the version number string, 1.2.3 value is "1002003" + * the version number string, 1.2.3 value is "10203" */ -#define LIBXML_VERSION_STRING "20626" +#define LIBXML_VERSION_STRING "20627" /** * LIBXML_VERSION_EXTRA: * * extra version information, used to show a CVS compilation */ -#define LIBXML_VERSION_EXTRA "-CVS2798" +#define LIBXML_VERSION_EXTRA "-CVS2872" /** * LIBXML_TEST_VERSION: @@ -58,7 +58,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * Macro to check that the libxml version in use is compatible with * the version the software has been compiled against */ -#define LIBXML_TEST_VERSION xmlCheckVersion(20626); +#define LIBXML_TEST_VERSION xmlCheckVersion(20627); #ifndef VMS #if 0 @@ -372,6 +372,15 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); #define LIBXML_MODULE_EXTENSION ".so" #endif +/** + * LIBXML_ZLIB_ENABLED: + * + * Whether the Zlib support is compiled in + */ +#if 1 +#define LIBXML_ZLIB_ENABLED +#endif + /** * ATTRIBUTE_UNUSED: * diff --git a/include/libxml/xmlversion.h.in b/include/libxml/xmlversion.h.in index cf547dd..0967913 100644 --- a/include/libxml/xmlversion.h.in +++ b/include/libxml/xmlversion.h.in @@ -34,14 +34,14 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); /** * LIBXML_VERSION: * - * the version number: 1.2.3 value is 1002003 + * the version number: 1.2.3 value is 10203 */ #define LIBXML_VERSION @LIBXML_VERSION_NUMBER@ /** * LIBXML_VERSION_STRING: * - * the version number string, 1.2.3 value is "1002003" + * the version number string, 1.2.3 value is "10203" */ #define LIBXML_VERSION_STRING "@LIBXML_VERSION_NUMBER@" @@ -372,6 +372,15 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); #define LIBXML_MODULE_EXTENSION "@MODULE_EXTENSION@" #endif +/** + * LIBXML_ZLIB_ENABLED: + * + * Whether the Zlib support is compiled in + */ +#if @WITH_ZLIB@ +#define LIBXML_ZLIB_ENABLED +#endif + /** * ATTRIBUTE_UNUSED: * diff --git a/include/libxml/xpath.h b/include/libxml/xpath.h index febbf78..89008fc 100644 --- a/include/libxml/xpath.h +++ b/include/libxml/xpath.h @@ -343,7 +343,8 @@ struct _xmlXPathContext { /* dictionnary */ xmlDictPtr dict; /* dictionnary if any */ - int flags; /* flags to control compilation */ + int flags; /* flags to control compilation */ + /* Cache for reusal of XPath objects */ void *cache; }; @@ -520,6 +521,9 @@ XMLPUBFUN xmlXPathCompExprPtr XMLCALL XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathCompiledEval (xmlXPathCompExprPtr comp, xmlXPathContextPtr ctx); +XMLPUBFUN int XMLCALL + xmlXPathCompiledEvalToBoolean(xmlXPathCompExprPtr comp, + xmlXPathContextPtr ctxt); XMLPUBFUN void XMLCALL xmlXPathFreeCompExpr (xmlXPathCompExprPtr comp); #endif /* LIBXML_XPATH_ENABLED */ diff --git a/libxml-2.0.pc.in b/libxml-2.0.pc.in index c66f82b..075848c 100644 --- a/libxml-2.0.pc.in +++ b/libxml-2.0.pc.in @@ -8,5 +8,6 @@ Name: libXML Version: @VERSION@ Description: libXML library version2. Requires: -Libs: -L${libdir} -lxml2 @THREAD_LIBS@ @Z_LIBS@ @ICONV_LIBS@ @M_LIBS@ @LIBS@ +Libs: -L${libdir} -lxml2 +Libs.private: @THREAD_LIBS@ @Z_LIBS@ @ICONV_LIBS@ @M_LIBS@ @LIBS@ Cflags: @XML_INCLUDEDIR@ @XML_CFLAGS@ diff --git a/libxml2.spec b/libxml2.spec index 5604bb9..9cf0f73 100644 --- a/libxml2.spec +++ b/libxml2.spec @@ -1,6 +1,6 @@ Summary: Library providing XML and HTML support Name: libxml2 -Version: 2.6.26 +Version: 2.6.27 Release: 1 License: MIT Group: Development/Libraries @@ -128,6 +128,6 @@ rm -fr %{buildroot} %doc doc/python.html %changelog -* Tue Jun 6 2006 Daniel Veillard -- upstream release 2.6.26 see http://xmlsoft.org/news.html +* Wed Oct 25 2006 Daniel Veillard +- upstream release 2.6.27 see http://xmlsoft.org/news.html diff --git a/ltmain.sh b/ltmain.sh index 06823e0..0223495 100644 --- a/ltmain.sh +++ b/ltmain.sh @@ -46,10 +46,16 @@ PACKAGE=libtool VERSION=1.5.22 TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" -# See if we are running on zsh, and set the options which allow our -# commands through without removal of \ escapes. -if test -n "${ZSH_VERSION+set}" ; then +# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi # Check that we have a working $echo. @@ -105,12 +111,14 @@ esac # These must not be set unconditionally because not all systems understand # e.g. LANG=C (notably SCO). # We save the old values to restore during execute mode. -if test "${LC_ALL+set}" = set; then - save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL -fi -if test "${LANG+set}" = set; then - save_LANG="$LANG"; LANG=C; export LANG -fi +for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES +do + eval "if test \"\${$lt_var+set}\" = set; then + save_$lt_var=\$$lt_var + $lt_var=C + export $lt_var + fi" +done # Make sure IFS has a sensible default lt_nl=' @@ -136,6 +144,8 @@ duplicate_deps=no preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" +extracted_archives= +extracted_serial=0 ##################################### # Shell function definitions: @@ -327,7 +337,17 @@ func_extract_archives () *) my_xabs=`pwd`"/$my_xlib" ;; esac my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` - my_xdir="$my_gentop/$my_xlib" + my_xlib_u=$my_xlib + while :; do + case " $extracted_archives " in + *" $my_xlib_u "*) + extracted_serial=`expr $extracted_serial + 1` + my_xlib_u=lt$extracted_serial-$my_xlib ;; + *) break ;; + esac + done + extracted_archives="$extracted_archives $my_xlib_u" + my_xdir="$my_gentop/$my_xlib_u" $show "${rm}r $my_xdir" $run ${rm}r "$my_xdir" @@ -758,6 +778,7 @@ if test -z "$show_help"; then *.f90) xform=f90 ;; *.for) xform=for ;; *.java) xform=java ;; + *.obj) xform=obj ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` @@ -1138,8 +1159,9 @@ EOF for arg do case $arg in - -all-static | -static) - if test "X$arg" = "X-all-static"; then + -all-static | -static | -static-libtool-libs) + case $arg in + -all-static) if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 fi @@ -1147,12 +1169,20 @@ EOF dlopen_self=$dlopen_self_static fi prefer_static_libs=yes - else + ;; + -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built - fi + ;; + -static-libtool-libs) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + esac build_libtool_libs=no build_old_libs=yes break @@ -1712,7 +1742,7 @@ EOF continue ;; - -static) + -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects @@ -2490,7 +2520,9 @@ EOF if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + { { test "$prefer_static_libs" = no || + test "$prefer_static_libs,$installed" = "built,yes"; } || + test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. @@ -3186,7 +3218,7 @@ EOF # which has an extra 1 added just for fun # case $version_type in - darwin|linux|osf|windows) + darwin|linux|osf|windows|none) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_revision" @@ -3410,11 +3442,11 @@ EOF fi # Eliminate all temporary directories. - for path in $notinst_path; do - lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` - deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` - dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` - done +# for path in $notinst_path; do +# lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` +# deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` +# dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` +# done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. @@ -3515,13 +3547,12 @@ EOF int main() { return 0; } EOF $rm conftest - $LTCC $LTCFLAGS -o conftest conftest.c $deplibs - if test "$?" -eq 0 ; then + if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then ldd_output=`ldd conftest` for i in $deplibs; do name=`expr $i : '-l\(.*\)'` # If $name is empty we are operating on a -L argument. - if test "$name" != "" && test "$name" -ne "0"; then + if test "$name" != "" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $i "*) @@ -3560,9 +3591,7 @@ EOF # If $name is empty we are operating on a -L argument. if test "$name" != "" && test "$name" != "0"; then $rm conftest - $LTCC $LTCFLAGS -o conftest conftest.c $i - # Did it work? - if test "$?" -eq 0 ; then + if $LTCC $LTCFLAGS -o conftest conftest.c $i; then ldd_output=`ldd conftest` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in @@ -3594,7 +3623,7 @@ EOF droppeddeps=yes $echo $echo "*** Warning! Library $i is needed by this library but I was not able to" - $echo "*** make it link in! You will probably need to install it or some" + $echo "*** make it link in! You will probably need to install it or some" $echo "*** library that it depends on before this library will be fully" $echo "*** functional. Installing it before continuing would be even better." fi @@ -4239,12 +4268,14 @@ EOF reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of - # -Wl from whole_archive_flag_spec + # -Wl from whole_archive_flag_spec and hope we can get by with + # turning comma into space.. wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then - eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" + eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" + reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` else gentop="$output_objdir/${obj}x" generated="$generated $gentop" @@ -4692,16 +4723,16 @@ static const void *lt_preloaded_setup() { case $host in *cygwin* | *mingw* ) if test -f "$output_objdir/${outputname}.def" ; then - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` else - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` fi ;; * ) - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` ;; esac ;; @@ -4716,13 +4747,13 @@ static const void *lt_preloaded_setup() { # really was required. # Nullify the symbol file. - compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` fi if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. - compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. @@ -4809,7 +4840,7 @@ static const void *lt_preloaded_setup() { if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then - relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP` else # fast_install is set to needless relink_command= @@ -4846,7 +4877,7 @@ static const void *lt_preloaded_setup() { fi done relink_command="(cd `pwd`; $relink_command)" - relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` fi # Quote $echo for shipping. @@ -5253,6 +5284,18 @@ EOF Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' +# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). +if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac +fi + # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH @@ -5395,7 +5438,7 @@ else ;; esac $echo >> $output "\ - \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" + \$echo \"\$0: cannot exec \$program \$*\" exit $EXIT_FAILURE fi else @@ -5581,7 +5624,7 @@ fi\ done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` if test "$hardcode_automatic" = yes ; then relink_command= fi @@ -5926,9 +5969,9 @@ relink_command=\"$relink_command\"" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP` else - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP` fi $echo "$modename: warning: relinking \`$file'" 1>&2 @@ -6137,7 +6180,7 @@ relink_command=\"$relink_command\"" file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. - relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP` $show "$relink_command" if $run eval "$relink_command"; then : @@ -6413,12 +6456,15 @@ relink_command=\"$relink_command\"" fi # Restore saved environment variables - if test "${save_LC_ALL+set}" = set; then - LC_ALL="$save_LC_ALL"; export LC_ALL - fi - if test "${save_LANG+set}" = set; then - LANG="$save_LANG"; export LANG - fi + for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES + do + eval "if test \"\${save_$lt_var+set}\" = set; then + $lt_var=\$save_$lt_var; export $lt_var + else + $lt_unset $lt_var + fi" + done + # Now prepare to actually exec the command. exec_cmd="\$cmd$args" @@ -6775,9 +6821,9 @@ The following components of LINK-COMMAND are treated specially: -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE - try to export only the symbols listed in SYMFILE + try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX - try to export only the symbols matching REGEX + try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened @@ -6791,9 +6837,11 @@ The following components of LINK-COMMAND are treated specially: -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries - -static do not do any dynamic linking of libtool libraries + -static do not do any dynamic linking of uninstalled libtool libraries + -static-libtool-libs + do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] - specify library version info [each variable defaults to 0] + specify library version info [each variable defaults to 0] All other options (arguments beginning with \`-') are ignored. diff --git a/parser.c b/parser.c index 12b2d7f..bd44585 100644 --- a/parser.c +++ b/parser.c @@ -807,6 +807,12 @@ xmlHasFeature(xmlFeature feature) #else return(0); #endif + case XML_WITH_ZLIB: +#ifdef LIBXML_ZLIB_ENABLED + return(1); +#else + return(0); +#endif default: break; } @@ -1442,7 +1448,7 @@ static int spacePop(xmlParserCtxtPtr ctxt) { if (ctxt->spaceNr > 0) ctxt->space = &ctxt->spaceTab[ctxt->spaceNr - 1]; else - ctxt->space = NULL; + ctxt->space = &ctxt->spaceTab[0]; ret = ctxt->spaceTab[ctxt->spaceNr]; ctxt->spaceTab[ctxt->spaceNr] = -1; return(ret); @@ -2356,7 +2362,8 @@ static int areBlanks(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, /* * Check for xml:space value. */ - if (*(ctxt->space) == 1) + if ((ctxt->space == NULL) || (*(ctxt->space) == 1) || + (*(ctxt->space) == -2)) return(0); /* @@ -2485,10 +2492,12 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) { buffer[len] = 0; } - /* nasty but well=formed if ((c == ':') && (*cur == 0)) { + if (buffer != NULL) + xmlFree(buffer); + *prefix = NULL; return(xmlStrdup(name)); - } */ + } if (buffer == NULL) ret = xmlStrndup(buf, len); @@ -3500,9 +3509,13 @@ get_more_space: if (ctxt->sax->ignorableWhitespace != NULL) ctxt->sax->ignorableWhitespace(ctxt->userData, tmp, nbchar); - } else if (ctxt->sax->characters != NULL) - ctxt->sax->characters(ctxt->userData, - tmp, nbchar); + } else { + if (ctxt->sax->characters != NULL) + ctxt->sax->characters(ctxt->userData, + tmp, nbchar); + if (*ctxt->space == -1) + *ctxt->space = -2; + } } else if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL)) { ctxt->sax->characters(ctxt->userData, @@ -3549,9 +3562,13 @@ get_more: if (ctxt->sax->ignorableWhitespace != NULL) ctxt->sax->ignorableWhitespace(ctxt->userData, tmp, nbchar); - } else if (ctxt->sax->characters != NULL) - ctxt->sax->characters(ctxt->userData, - tmp, nbchar); + } else { + if (ctxt->sax->characters != NULL) + ctxt->sax->characters(ctxt->userData, + tmp, nbchar); + if (*ctxt->space == -1) + *ctxt->space = -2; + } line = ctxt->input->line; col = ctxt->input->col; } else if (ctxt->sax != NULL) { @@ -3634,6 +3651,10 @@ xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int cdata) { } else { if (ctxt->sax->characters != NULL) ctxt->sax->characters(ctxt->userData, buf, nbchar); + if ((ctxt->sax->characters != + ctxt->sax->ignorableWhitespace) && + (*ctxt->space == -1)) + *ctxt->space = -2; } } nbchar = 0; @@ -3658,6 +3679,9 @@ xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int cdata) { } else { if (ctxt->sax->characters != NULL) ctxt->sax->characters(ctxt->userData, buf, nbchar); + if ((ctxt->sax->characters != ctxt->sax->ignorableWhitespace) && + (*ctxt->space == -1)) + *ctxt->space = -2; } } } @@ -5923,10 +5947,13 @@ xmlParseReference(xmlParserCtxtPtr ctxt) { ctxt->sax->characters(ctxt->userData, out, i); } } else { + int was_checked; + ent = xmlParseEntityRef(ctxt); if (ent == NULL) return; if (!ctxt->wellFormed) return; + was_checked = ent->checked; if ((ent->name != NULL) && (ent->etype != XML_INTERNAL_PREDEFINED_ENTITY)) { xmlNodePtr list = NULL; @@ -5938,8 +5965,9 @@ xmlParseReference(xmlParserCtxtPtr ctxt) { * where the ent->children is filled with the result from * the parsing. */ - if (ent->children == NULL) { + if (ent->checked == 0) { xmlChar *value; + value = ent->content; /* @@ -6074,15 +6102,69 @@ xmlParseReference(xmlParserCtxtPtr ctxt) { list = NULL; } } + ent->checked = 1; + } + + if (ent->children == NULL) { + /* + * Probably running in SAX mode and the callbacks don't + * build the entity content. So unless we already went + * though parsing for first checking go though the entity + * content to generate callbacks associated to the entity + */ + if (was_checked == 1) { + void *user_data; + /* + * This is a bit hackish but this seems the best + * way to make sure both SAX and DOM entity support + * behaves okay. + */ + if (ctxt->userData == ctxt) + user_data = NULL; + else + user_data = ctxt->userData; + + if (ent->etype == XML_INTERNAL_GENERAL_ENTITY) { + ctxt->depth++; + ret = xmlParseBalancedChunkMemoryInternal(ctxt, + ent->content, user_data, NULL); + ctxt->depth--; + } else if (ent->etype == + XML_EXTERNAL_GENERAL_PARSED_ENTITY) { + ctxt->depth++; + ret = xmlParseExternalEntityPrivate(ctxt->myDoc, ctxt, + ctxt->sax, user_data, ctxt->depth, + ent->URI, ent->ExternalID, NULL); + ctxt->depth--; + } else { + ret = XML_ERR_ENTITY_PE_INTERNAL; + xmlErrMsgStr(ctxt, XML_ERR_INTERNAL_ERROR, + "invalid entity type found\n", NULL); + } + if (ret == XML_ERR_ENTITY_LOOP) { + xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL); + return; + } + } + if ((ctxt->sax != NULL) && (ctxt->sax->reference != NULL) && + (ctxt->replaceEntities == 0) && (!ctxt->disableSAX)) { + /* + * Entity reference callback comes second, it's somewhat + * superfluous but a compatibility to historical behaviour + */ + ctxt->sax->reference(ctxt->userData, ent->name); + } + return; } if ((ctxt->sax != NULL) && (ctxt->sax->reference != NULL) && - (ctxt->replaceEntities == 0) && (!ctxt->disableSAX)) { + (ctxt->replaceEntities == 0) && (!ctxt->disableSAX)) { /* * Create a node. */ ctxt->sax->reference(ctxt->userData, ent->name); return; - } else if (ctxt->replaceEntities) { + } + if ((ctxt->replaceEntities) || (ent->children == NULL)) { /* * There is a problem on the handling of _private for entities * (bug 155816): Should we copy the content of the field from @@ -6206,31 +6288,6 @@ xmlParseReference(xmlParserCtxtPtr ctxt) { ctxt->nodemem = 0; ctxt->nodelen = 0; return; - } else { - /* - * Probably running in SAX mode - */ - xmlParserInputPtr input; - - input = xmlNewEntityInputStream(ctxt, ent); - xmlPushInput(ctxt, input); - if ((ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY) && - (CMP5(CUR_PTR, '<', '?', 'x', 'm', 'l')) && - (IS_BLANK_CH(NXT(5)))) { - xmlParseTextDecl(ctxt); - if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) { - /* - * The XML REC instructs us to stop parsing right here - */ - ctxt->instate = XML_PARSER_EOF; - return; - } - if (input->standalone == 1) { - xmlFatalErr(ctxt, XML_ERR_EXT_ENTITY_STANDALONE, - NULL); - } - } - return; } } } else { @@ -6337,7 +6394,7 @@ xmlParseEntityRef(xmlParserCtxtPtr ctxt) { if ((ctxt->inSubset == 0) && (ctxt->sax != NULL) && (ctxt->sax->reference != NULL)) { - ctxt->sax->reference(ctxt, name); + ctxt->sax->reference(ctxt->userData, name); } } ctxt->valid = 0; @@ -7808,7 +7865,7 @@ xmlParseStartTag2(xmlParserCtxtPtr ctxt, const xmlChar **pref, const xmlChar **atts = ctxt->atts; int maxatts = ctxt->maxatts; int nratts, nbatts, nbdef; - int i, j, nbNs, attval; + int i, j, nbNs, attval, oldline, oldcol; const xmlChar *base; unsigned long cur; int nsNr = ctxt->nsNr; @@ -7827,6 +7884,8 @@ reparse: SHRINK; base = ctxt->input->base; cur = ctxt->input->cur - ctxt->input->base; + oldline = ctxt->input->line; + oldcol = ctxt->input->col; nbatts = 0; nratts = 0; nbdef = 0; @@ -7861,6 +7920,12 @@ reparse: attname = xmlParseAttribute2(ctxt, prefix, localname, &aprefix, &attvalue, &len, &alloc); + if (ctxt->input->base != base) { + if ((attvalue != NULL) && (alloc != 0)) + xmlFree(attvalue); + attvalue = NULL; + goto base_changed; + } if ((attname != NULL) && (attvalue != NULL)) { if (len < 0) len = xmlStrlen(attvalue); if ((attname == ctxt->str_xmlns) && (aprefix == NULL)) { @@ -8152,6 +8217,8 @@ base_changed: xmlFree((xmlChar *) atts[i]); } ctxt->input->cur = ctxt->input->base + cur; + ctxt->input->line = oldline; + ctxt->input->col = oldcol; if (ctxt->wellFormed == 1) { goto reparse; } @@ -8349,7 +8416,8 @@ void xmlParseContent(xmlParserCtxtPtr ctxt) { GROW; while ((RAW != 0) && - ((RAW != '<') || (NXT(1) != '/'))) { + ((RAW != '<') || (NXT(1) != '/')) && + (ctxt->instate != XML_PARSER_EOF)) { const xmlChar *test = CUR_PTR; unsigned int cons = ctxt->input->consumed; const xmlChar *cur = ctxt->input->cur; @@ -8442,6 +8510,14 @@ xmlParseElement(xmlParserCtxtPtr ctxt) { xmlNodePtr ret; int nsNr = ctxt->nsNr; + if ((unsigned int) ctxt->nameNr > xmlParserMaxDepth) { + xmlFatalErrMsgInt(ctxt, XML_ERR_INTERNAL_ERROR, + "Excessive depth in document: change xmlParserMaxDepth = %d\n", + xmlParserMaxDepth); + ctxt->instate = XML_PARSER_EOF; + return; + } + /* Capture start position */ if (ctxt->record_info) { node_info.begin_pos = ctxt->input->consumed + @@ -8451,6 +8527,8 @@ xmlParseElement(xmlParserCtxtPtr ctxt) { if (ctxt->spaceNr == 0) spacePush(ctxt, -1); + else if (*ctxt->space == -2) + spacePush(ctxt, -1); else spacePush(ctxt, *ctxt->space); @@ -9767,6 +9845,8 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) { } if (ctxt->spaceNr == 0) spacePush(ctxt, -1); + else if (*ctxt->space == -2) + spacePush(ctxt, -1); else spacePush(ctxt, *ctxt->space); #ifdef LIBXML_SAX1_ENABLED @@ -10759,7 +10839,7 @@ xmlCreateIOParserCtxt(xmlSAXHandlerPtr sax, void *user_data, * Load and parse a DTD * * Returns the resulting xmlDtdPtr or NULL in case of error. - * @input will be freed at parsing end. + * @input will be freed by the function in any case. */ xmlDtdPtr @@ -10775,6 +10855,7 @@ xmlIOParseDTD(xmlSAXHandlerPtr sax, xmlParserInputBufferPtr input, ctxt = xmlNewParserCtxt(); if (ctxt == NULL) { + xmlFreeParserInputBuffer(input); return(NULL); } @@ -10796,6 +10877,7 @@ xmlIOParseDTD(xmlSAXHandlerPtr sax, xmlParserInputBufferPtr input, pinput = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE); if (pinput == NULL) { if (sax != NULL) ctxt->sax = NULL; + xmlFreeParserInputBuffer(input); xmlFreeParserCtxt(ctxt); return(NULL); } @@ -10919,7 +11001,8 @@ xmlSAXParseDTD(xmlSAXHandlerPtr sax, const xmlChar *ExternalID, */ if ((ctxt->sax != NULL) && (ctxt->sax->resolveEntity != NULL)) - input = ctxt->sax->resolveEntity(ctxt, ExternalID, systemIdCanonic); + input = ctxt->sax->resolveEntity(ctxt->userData, ExternalID, + systemIdCanonic); if (input == NULL) { if (sax != NULL) ctxt->sax = NULL; xmlFreeParserCtxt(ctxt); @@ -11032,6 +11115,8 @@ xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, const xmlChar *URL, int ret = 0; xmlChar start[4]; xmlCharEncoding enc; + xmlParserInputPtr inputStream; + char *directory = NULL; if (ctx == NULL) return(-1); @@ -11046,11 +11131,27 @@ xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, const xmlChar *URL, if (ctx->myDoc == NULL) /* @@ relax but check for dereferences */ return(-1); - - ctxt = xmlCreateEntityParserCtxt(URL, ID, NULL); - if (ctxt == NULL) return(-1); + ctxt = xmlNewParserCtxt(); + if (ctxt == NULL) { + return(-1); + } + ctxt->userData = ctxt; ctxt->_private = ctx->_private; + + inputStream = xmlLoadExternalEntity((char *)URL, (char *)ID, ctxt); + if (inputStream == NULL) { + xmlFreeParserCtxt(ctxt); + return(-1); + } + + inputPush(ctxt, inputStream); + + if ((ctxt->directory == NULL) && (directory == NULL)) + directory = xmlParserGetDirectory((char *)URL); + if ((ctxt->directory == NULL) && (directory != NULL)) + ctxt->directory = directory; + oldsax = ctxt->sax; ctxt->sax = ctx->sax; xmlDetectSAX2(ctxt); @@ -11897,6 +11998,9 @@ xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, xmlSAXHandlerPtr sax, } else { ctxt->myDoc = newDoc; newDoc->children->doc = doc; + /* Ensure that doc has XML spec namespace */ + xmlSearchNsByHref(doc, (xmlNodePtr)doc, XML_XML_NAMESPACE); + newDoc->oldNs = doc->oldNs; } ctxt->instate = XML_PARSER_CONTENT; ctxt->depth = depth; @@ -11957,6 +12061,7 @@ xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, xmlSAXHandlerPtr sax, xmlFreeParserCtxt(ctxt); newDoc->intSubset = NULL; newDoc->extSubset = NULL; + newDoc->oldNs = NULL; xmlFreeDoc(newDoc); return(ret); diff --git a/parserInternals.c b/parserInternals.c index 5706299..f4da58d 100644 --- a/parserInternals.c +++ b/parserInternals.c @@ -1473,6 +1473,7 @@ xmlNewInputFromFile(xmlParserCtxtPtr ctxt, const char *filename) { else URI = xmlStrdup((xmlChar *) inputStream->filename); directory = xmlParserGetDirectory((const char *) URI); + if (inputStream->filename != NULL) xmlFree((char *)inputStream->filename); inputStream->filename = (char *) xmlCanonicPath((const xmlChar *) URI); if (URI != NULL) xmlFree((char *) URI); inputStream->directory = directory; diff --git a/python/Makefile.am b/python/Makefile.am index c37c0c2..6c0bffa 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -25,7 +25,7 @@ EXTRA_DIST = \ libxml2-python-api.xml \ $(DOCS) -libxml2mod_la_LDFLAGS = @CYGWIN_EXTRA_LDFLAGS@ @WIN32_EXTRA_LDFLAGS@ -module -avoid-version -L$(top_builddir)/.libs +libxml2mod_la_LDFLAGS = @CYGWIN_EXTRA_LDFLAGS@ @WIN32_EXTRA_LDFLAGS@ -module -avoid-version if WITH_PYTHON mylibs = \ diff --git a/python/Makefile.in b/python/Makefile.in index 9451aaf..9f3a13e 100644 --- a/python/Makefile.in +++ b/python/Makefile.in @@ -174,6 +174,7 @@ RDL_LIBS = @RDL_LIBS@ READER_TEST = @READER_TEST@ RELDATE = @RELDATE@ RM = @RM@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STATIC_BINARIES = @STATIC_BINARIES@ @@ -202,6 +203,7 @@ THREAD_CFLAGS = @THREAD_CFLAGS@ THREAD_LIBS = @THREAD_LIBS@ U = @U@ VERSION = @VERSION@ +WGET = @WGET@ WIN32_EXTRA_LDFLAGS = @WIN32_EXTRA_LDFLAGS@ WIN32_EXTRA_LIBADD = @WIN32_EXTRA_LIBADD@ WITH_C14N = @WITH_C14N@ @@ -237,6 +239,7 @@ WITH_WRITER = @WITH_WRITER@ WITH_XINCLUDE = @WITH_XINCLUDE@ WITH_XPATH = @WITH_XPATH@ WITH_XPTR = @WITH_XPTR@ +WITH_ZLIB = @WITH_ZLIB@ XINCLUDE_OBJ = @XINCLUDE_OBJ@ XMLLINT = @XMLLINT@ XML_CFLAGS = @XML_CFLAGS@ @@ -321,7 +324,7 @@ EXTRA_DIST = \ libxml2-python-api.xml \ $(DOCS) -libxml2mod_la_LDFLAGS = @CYGWIN_EXTRA_LDFLAGS@ @WIN32_EXTRA_LDFLAGS@ -module -avoid-version -L$(top_builddir)/.libs +libxml2mod_la_LDFLAGS = @CYGWIN_EXTRA_LDFLAGS@ @WIN32_EXTRA_LDFLAGS@ -module -avoid-version @WITH_PYTHON_TRUE@mylibs = \ @WITH_PYTHON_TRUE@ $(top_builddir)/libxml2.la diff --git a/python/generator.py b/python/generator.py index 642b8d1..f116f8a 100755 --- a/python/generator.py +++ b/python/generator.py @@ -231,7 +231,7 @@ skipped_types = { py_types = { 'void': (None, None, None, None), 'int': ('i', None, "int", "int"), - 'long': ('i', None, "int", "int"), + 'long': ('l', None, "long", "long"), 'double': ('d', None, "double", "double"), 'unsigned int': ('i', None, "int", "int"), 'xmlChar': ('c', None, "int", "int"), diff --git a/python/libxml.c b/python/libxml.c index 88b29cf..6e9a78e 100644 --- a/python/libxml.c +++ b/python/libxml.c @@ -3677,6 +3677,40 @@ libxml_getObjDesc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { return Py_BuildValue((char *)"s", str); } +static PyObject * +libxml_compareNodesEqual(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + + PyObject *py_node1, *py_node2; + xmlNodePtr node1, node2; + + if (!PyArg_ParseTuple(args, (char *)"OO:compareNodesEqual", + &py_node1, &py_node2)) + return NULL; + /* To compare two node objects, we compare their pointer addresses */ + node1 = PyxmlNode_Get(py_node1); + node2 = PyxmlNode_Get(py_node2); + if ( node1 == node2 ) + return Py_BuildValue((char *)"i", 1); + else + return Py_BuildValue((char *)"i", 0); + +} + +static PyObject * +libxml_nodeHash(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + + PyObject *py_node1; + xmlNodePtr node1; + + if (!PyArg_ParseTuple(args, (char *)"O:nodeHash", &py_node1)) + return NULL; + /* For simplicity, we use the node pointer address as a hash value */ + node1 = PyxmlNode_Get(py_node1); + + return PyLong_FromVoidPtr(node1); + +} + /************************************************************************ * * * The registration stuff * @@ -3730,6 +3764,8 @@ static PyMethodDef libxmlMethods[] = { #endif #endif {(char *) "getObjDesc", libxml_getObjDesc, METH_VARARGS, NULL}, + {(char *) "compareNodesEqual", libxml_compareNodesEqual, METH_VARARGS, NULL}, + {(char *) "nodeHash", libxml_nodeHash, METH_VARARGS, NULL}, {NULL, NULL, 0, NULL} }; diff --git a/python/libxml.py b/python/libxml.py index 997e15f..4c9fe92 100644 --- a/python/libxml.py +++ b/python/libxml.py @@ -232,6 +232,23 @@ class xmlCore: self._o = _obj; return self._o = None + + def __eq__(self, other): + if other == None: + return False + ret = libxml2mod.compareNodesEqual(self._o, other._o) + if ret == None: + return False + return ret == True + def __ne__(self, other): + if other == None: + return True + ret = libxml2mod.compareNodesEqual(self._o, other._o) + return not ret + def __hash__(self): + ret = libxml2mod.nodeHash(self._o) + return ret + def __str__(self): return self.serialize() def get_parent(self): @@ -535,10 +552,17 @@ def nodeWrap(o): return xmlNode(_obj=o) def xpathObjectRet(o): - if type(o) == type([]) or type(o) == type(()): - ret = map(lambda x: nodeWrap(x), o) + otype = type(o) + if otype == type([]): + ret = map(xpathObjectRet, o) return ret - return o + elif otype == type(()): + ret = map(xpathObjectRet, o) + return tuple(ret) + elif otype == type('') or otype == type(0) or otype == type(0.0): + return o + else: + return nodeWrap(o) # # register an XPath function diff --git a/python/libxml2-py.c b/python/libxml2-py.c index e0559a0..853a894 100644 --- a/python/libxml2-py.c +++ b/python/libxml2-py.c @@ -2411,6 +2411,20 @@ libxml_xmlSaveFormatFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { } #endif /* defined(LIBXML_OUTPUT_ENABLED) */ +PyObject * +libxml_xmlPathToURI(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + PyObject *py_retval; + xmlChar * c_retval; + xmlChar * path; + + if (!PyArg_ParseTuple(args, (char *)"z:xmlPathToURI", &path)) + return(NULL); + + c_retval = xmlPathToURI(path); + py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); + return(py_retval); +} + PyObject * libxml_xmlParseXMLDecl(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { xmlParserCtxtPtr ctxt; @@ -2535,7 +2549,7 @@ libxml_xmlXPathOrderDocElems(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); c_retval = xmlXPathOrderDocElems(doc); - py_retval = libxml_intWrap((int) c_retval); + py_retval = libxml_longWrap((long) c_retval); return(py_retval); } @@ -4253,7 +4267,7 @@ libxml_xmlByteConsumed(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); c_retval = xmlByteConsumed(ctxt); - py_retval = libxml_intWrap((int) c_retval); + py_retval = libxml_longWrap((long) c_retval); return(py_retval); } @@ -7001,7 +7015,7 @@ libxml_xmlClearParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { return(Py_None); } -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) PyObject * libxml_xmlValidateNCName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; @@ -7017,7 +7031,7 @@ libxml_xmlValidateNCName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { return(py_retval); } -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) */ +#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) */ PyObject * libxml_xmlStrlen(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; @@ -7365,7 +7379,7 @@ libxml_xmlTextReaderByteConsumed(PyObject *self ATTRIBUTE_UNUSED, PyObject *args reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); c_retval = xmlTextReaderByteConsumed(reader); - py_retval = libxml_intWrap((int) c_retval); + py_retval = libxml_longWrap((long) c_retval); return(py_retval); } @@ -10291,6 +10305,18 @@ libxml_xmlXPtrNewRangeNodes(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { } #endif /* defined(LIBXML_XPTR_ENABLED) */ +#if defined(LIBXML_HTML_ENABLED) +PyObject * +libxml_htmlNewParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { + PyObject *py_retval; + htmlParserCtxtPtr c_retval; + + c_retval = htmlNewParserCtxt(); + py_retval = libxml_xmlParserCtxtPtrWrap((xmlParserCtxtPtr) c_retval); + return(py_retval); +} + +#endif /* defined(LIBXML_HTML_ENABLED) */ PyObject * libxml_xmlStringDecodeEntities(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; @@ -14082,7 +14108,7 @@ libxml_xmlGetLineNo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); c_retval = xmlGetLineNo(node); - py_retval = libxml_intWrap((int) c_retval); + py_retval = libxml_longWrap((long) c_retval); return(py_retval); } diff --git a/python/setup.py b/python/setup.py index 99def88..9e3300b 100755 --- a/python/setup.py +++ b/python/setup.py @@ -226,7 +226,7 @@ else: setup (name = "libxml2-python", # On *nix, the version number is created from setup.py.in # On windows, it is set by configure.js - version = "2.6.26", + version = "2.6.27", description = descr, author = "Daniel Veillard", author_email = "veillard@redhat.com", diff --git a/python/tests/Makefile.am b/python/tests/Makefile.am index 3571abf..39950f6 100644 --- a/python/tests/Makefile.am +++ b/python/tests/Makefile.am @@ -43,7 +43,8 @@ PYTESTS= \ tstmem.py \ validDTD.py \ validSchemas.py \ - validRNG.py + validRNG.py \ + compareNodes.py XMLS= \ tst.xml \ diff --git a/python/tests/Makefile.in b/python/tests/Makefile.in index 5b84cc2..bd49790 100644 --- a/python/tests/Makefile.in +++ b/python/tests/Makefile.in @@ -136,6 +136,7 @@ RDL_LIBS = @RDL_LIBS@ READER_TEST = @READER_TEST@ RELDATE = @RELDATE@ RM = @RM@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STATIC_BINARIES = @STATIC_BINARIES@ @@ -164,6 +165,7 @@ THREAD_CFLAGS = @THREAD_CFLAGS@ THREAD_LIBS = @THREAD_LIBS@ U = @U@ VERSION = @VERSION@ +WGET = @WGET@ WIN32_EXTRA_LDFLAGS = @WIN32_EXTRA_LDFLAGS@ WIN32_EXTRA_LIBADD = @WIN32_EXTRA_LIBADD@ WITH_C14N = @WITH_C14N@ @@ -199,6 +201,7 @@ WITH_WRITER = @WITH_WRITER@ WITH_XINCLUDE = @WITH_XINCLUDE@ WITH_XPATH = @WITH_XPATH@ WITH_XPTR = @WITH_XPTR@ +WITH_ZLIB = @WITH_ZLIB@ XINCLUDE_OBJ = @XINCLUDE_OBJ@ XMLLINT = @XMLLINT@ XML_CFLAGS = @XML_CFLAGS@ @@ -302,7 +305,8 @@ PYTESTS = \ tstmem.py \ validDTD.py \ validSchemas.py \ - validRNG.py + validRNG.py \ + compareNodes.py XMLS = \ tst.xml \ diff --git a/python/tests/compareNodes.py b/python/tests/compareNodes.py new file mode 100755 index 0000000..ec04323 --- /dev/null +++ b/python/tests/compareNodes.py @@ -0,0 +1,50 @@ +#!/usr/bin/python -u +import sys +import libxml2 + +# Memory debug specific +libxml2.debugMemory(1) + +# +# Testing XML Node comparison and Node hash-value +# +doc = libxml2.parseDoc("""""") +root = doc.getRootElement() + +# Create two different objects which point to foo +foonode1 = root.children +foonode2 = root.children + +# Now check that [in]equality tests work ok +if not ( foonode1 == foonode2 ): + print "Error comparing nodes with ==, nodes should be equal but are unequal" + sys.exit(1) +if not ( foonode1 != root ): + print "Error comparing nodes with ==, nodes should not be equal but are equal" + sys.exit(1) +if not ( foonode1 != root ): + print "Error comparing nodes with !=, nodes should not be equal but are equal" +if ( foonode1 != foonode2 ): + print "Error comparing nodes with !=, nodes should be equal but are unequal" + +# Next check that the hash function for the objects also works ok +if not (hash(foonode1) == hash(foonode2)): + print "Error hash values for two equal nodes are different" + sys.exit(1) +if not (hash(foonode1) != hash(root)): + print "Error hash values for two unequal nodes are not different" + sys.exit(1) +if hash(foonode1) == hash(root): + print "Error hash values for two unequal nodes are equal" + sys.exit(1) + +# Basic tests successful +doc.freeDoc() + +# Memory debug specific +libxml2.cleanupParser() +if libxml2.debugMemory(1) == 0: + print "OK" +else: + print "Memory leak %d bytes" % (libxml2.debugMemory(1)) + libxml2.dumpMemory() diff --git a/python/types.c b/python/types.c index 8a6a9a0..5c5dcca 100644 --- a/python/types.c +++ b/python/types.c @@ -395,8 +395,106 @@ libxml_xmlXPathObjectPtrWrap(xmlXPathObjectPtr obj) ret = PyString_FromString((char *) obj->stringval); break; case XPATH_POINT: + { + PyObject *node; + PyObject *indexIntoNode; + PyObject *tuple; + + node = libxml_xmlNodePtrWrap(obj->user); + indexIntoNode = PyInt_FromLong((long) obj->index); + + tuple = PyTuple_New(2); + PyTuple_SetItem(tuple, 0, node); + PyTuple_SetItem(tuple, 1, indexIntoNode); + + ret = tuple; + break; + } case XPATH_RANGE: + { + unsigned short bCollapsedRange; + + bCollapsedRange = ( (obj->user2 == NULL) || + ((obj->user2 == obj->user) && (obj->index == obj->index2)) ); + if ( bCollapsedRange ) { + PyObject *node; + PyObject *indexIntoNode; + PyObject *tuple; + PyObject *list; + + list = PyList_New(1); + + node = libxml_xmlNodePtrWrap(obj->user); + indexIntoNode = PyInt_FromLong((long) obj->index); + + tuple = PyTuple_New(2); + PyTuple_SetItem(tuple, 0, node); + PyTuple_SetItem(tuple, 1, indexIntoNode); + + PyList_SetItem(list, 0, tuple); + + ret = list; + } else { + PyObject *node; + PyObject *indexIntoNode; + PyObject *tuple; + PyObject *list; + + list = PyList_New(2); + + node = libxml_xmlNodePtrWrap(obj->user); + indexIntoNode = PyInt_FromLong((long) obj->index); + + tuple = PyTuple_New(2); + PyTuple_SetItem(tuple, 0, node); + PyTuple_SetItem(tuple, 1, indexIntoNode); + + PyList_SetItem(list, 0, tuple); + + node = libxml_xmlNodePtrWrap(obj->user2); + indexIntoNode = PyInt_FromLong((long) obj->index2); + + tuple = PyTuple_New(2); + PyTuple_SetItem(tuple, 0, node); + PyTuple_SetItem(tuple, 1, indexIntoNode); + + PyList_SetItem(list, 1, tuple); + + ret = list; + } + break; + } case XPATH_LOCATIONSET: + { + xmlLocationSetPtr set; + + set = obj->user; + if ( set && set->locNr > 0 ) { + int i; + PyObject *list; + + list = PyList_New(set->locNr); + + for (i=0; ilocNr; i++) { + xmlXPathObjectPtr setobj; + PyObject *pyobj; + + setobj = set->locTab[i]; /*xmlXPathObjectPtr setobj*/ + + pyobj = libxml_xmlXPathObjectPtrWrap(setobj); + /* xmlXPathFreeObject(setobj) is called */ + set->locTab[i] = NULL; + + PyList_SetItem(list, i, pyobj); + } + set->locNr = 0; + ret = list; + } else { + Py_INCREF(Py_None); + ret = Py_None; + } + break; + } default: #ifdef DEBUG printf("Unable to convert XPath object type %d\n", obj->type); @@ -422,6 +520,20 @@ libxml_xmlXPathObjectPtrConvert(PyObject * obj) if PyFloat_Check (obj) { ret = xmlXPathNewFloat((double) PyFloat_AS_DOUBLE(obj)); + + } else if PyInt_Check(obj) { + + ret = xmlXPathNewFloat((double) PyInt_AS_LONG(obj)); + + } else if PyBool_Check (obj) { + + if (obj == Py_True) { + ret = xmlXPathNewBoolean(1); + } + else { + ret = xmlXPathNewBoolean(0); + } + } else if PyString_Check (obj) { xmlChar *str; diff --git a/relaxng.c b/relaxng.c index dd8b6cd..16527cc 100644 --- a/relaxng.c +++ b/relaxng.c @@ -9899,8 +9899,10 @@ xmlRelaxNGValidateState(xmlRelaxNGValidCtxtPtr ctxt, if ((ctxt->flags & FLAGS_IGNORABLE) == 0) { xmlRelaxNGDumpValidError(ctxt); ret = 0; +#if 0 } else { ret = -2; +#endif } } else { if (ctxt->errNr > errNr) diff --git a/runtest.c b/runtest.c index cf0fb63..b694d56 100644 --- a/runtest.c +++ b/runtest.c @@ -565,6 +565,7 @@ static char *resultFilename(const char *filename, const char *out, const char *suffix) { const char *base; char res[500]; + char suffixbuff[500]; /************* if ((filename[0] == 't') && (filename[1] == 'e') && @@ -578,7 +579,14 @@ static char *resultFilename(const char *filename, const char *out, suffix = ".tmp"; if (out == NULL) out = ""; - snprintf(res, 499, "%s%s%s", out, base, suffix); + + strncpy(suffixbuff,suffix,499); +#ifdef VMS + if(strstr(base,".") && suffixbuff[0]=='.') + suffixbuff[0]='_'; +#endif + + snprintf(res, 499, "%s%s%s", out, base, suffixbuff); res[499] = 0; return(strdup(res)); } @@ -2881,6 +2889,7 @@ schemasOneTest(const char *sch, xmlDocPtr doc; xmlSchemaValidCtxtPtr ctxt; int ret = 0; + int validResult = 0; char *temp; FILE *schemasOutput; @@ -2908,10 +2917,10 @@ schemasOneTest(const char *sch, (xmlSchemaValidityErrorFunc) testErrorHandler, (xmlSchemaValidityWarningFunc) testErrorHandler, ctxt); - ret = xmlSchemaValidateDoc(ctxt, doc); - if (ret == 0) { + validResult = xmlSchemaValidateDoc(ctxt, doc); + if (validResult == 0) { fprintf(schemasOutput, "%s validates\n", filename); - } else if (ret > 0) { + } else if (validResult > 0) { fprintf(schemasOutput, "%s fails to validate\n", filename); } else { fprintf(schemasOutput, "%s validation generated an internal error\n", @@ -2927,12 +2936,10 @@ schemasOneTest(const char *sch, unlink(temp); free(temp); - if ((ret != 0) && (err != NULL)) { + if ((validResult != 0) && (err != NULL)) { if (compareFileMem(err, testErrors, testErrorsSize)) { fprintf(stderr, "Error for %s on %s failed\n", filename, sch); ret = 1; - } else { - ret = 0; } } diff --git a/testapi.c b/testapi.c index 4629bc2..01a4184 100644 --- a/testapi.c +++ b/testapi.c @@ -14,6 +14,7 @@ #include #endif +#include /* for putenv() */ #include #include #include @@ -126,6 +127,9 @@ int main(int argc, char **argv) { int ret; int blocks, mem; + /* access to the proxy can slow up regression tests a lot */ + putenv("http_proxy="); + memset(chartab, 0, sizeof(chartab)); strncpy((char *) chartab, " chartab\n", 20); memset(inttab, 0, sizeof(inttab)); @@ -2124,6 +2128,33 @@ test_htmlIsScriptAttribute(void) { } +static int +test_htmlNewParserCtxt(void) { + int test_ret = 0; + +#if defined(LIBXML_HTML_ENABLED) + int mem_base; + htmlParserCtxtPtr ret_val; + + mem_base = xmlMemBlocks(); + + ret_val = htmlNewParserCtxt(); + desret_htmlParserCtxtPtr(ret_val); + call_tests++; + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlNewParserCtxt", + xmlMemBlocks() - mem_base); + test_ret++; + printf("\n"); + } + function_tests++; +#endif + + return(test_ret); +} + + static int test_htmlNodeStatus(void) { int test_ret = 0; @@ -2723,7 +2754,7 @@ static int test_HTMLparser(void) { int test_ret = 0; - if (quiet == 0) printf("Testing HTMLparser : 31 of 37 functions ...\n"); + if (quiet == 0) printf("Testing HTMLparser : 32 of 38 functions ...\n"); test_ret += test_UTF8ToHtml(); test_ret += test_htmlAttrAllowed(); test_ret += test_htmlAutoCloseTag(); @@ -2742,6 +2773,7 @@ test_HTMLparser(void) { test_ret += test_htmlHandleOmittedElem(); test_ret += test_htmlIsAutoClosed(); test_ret += test_htmlIsScriptAttribute(); + test_ret += test_htmlNewParserCtxt(); test_ret += test_htmlNodeStatus(); test_ret += test_htmlParseCharRef(); test_ret += test_htmlParseChunk(); @@ -19978,7 +20010,7 @@ test_xmlDocSetRootElement(void) { xmlNodePtr ret_val; xmlDocPtr doc; /* the document */ int n_doc; - xmlNodePtr root; /* the new document root element */ + xmlNodePtr root; /* the new document root element, if root is NULL no action is taken, to remove a node from a document use xmlUnlinkNode(root) instead. */ int n_root; for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { @@ -23561,7 +23593,7 @@ static int test_xmlValidateNCName(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) #ifdef LIBXML_TREE_ENABLED int mem_base; int ret_val; @@ -24094,6 +24126,38 @@ test_xmlParseURIReference(void) { } +static int +test_xmlPathToURI(void) { + int test_ret = 0; + + int mem_base; + xmlChar * ret_val; + xmlChar * path; /* the resource locator in a filesystem notation */ + int n_path; + + for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) { + mem_base = xmlMemBlocks(); + path = gen_const_xmlChar_ptr(n_path, 0); + + ret_val = xmlPathToURI((const xmlChar *)path); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlPathToURI", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_path); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + static int test_xmlPrintURI(void) { int test_ret = 0; @@ -24247,7 +24311,7 @@ static int test_uri(void) { int test_ret = 0; - if (quiet == 0) printf("Testing uri : 9 of 14 functions ...\n"); + if (quiet == 0) printf("Testing uri : 10 of 15 functions ...\n"); test_ret += test_xmlBuildRelativeURI(); test_ret += test_xmlBuildURI(); test_ret += test_xmlCanonicPath(); @@ -24256,6 +24320,7 @@ test_uri(void) { test_ret += test_xmlParseURI(); test_ret += test_xmlParseURIRaw(); test_ret += test_xmlParseURIReference(); + test_ret += test_xmlPathToURI(); test_ret += test_xmlPrintURI(); test_ret += test_xmlSaveUri(); test_ret += test_xmlURIEscape(); @@ -26889,6 +26954,54 @@ test_xmlXIncludeProcessFlags(void) { return(test_ret); } + +static int +test_xmlXIncludeProcessFlagsData(void) { + int test_ret = 0; + +#if defined(LIBXML_XINCLUDE_ENABLED) + int mem_base; + int ret_val; + xmlDocPtr doc; /* an XML document */ + int n_doc; + int flags; /* a set of xmlParserOption used for parsing XML includes */ + int n_flags; + void * data; /* application data that will be passed to the parser context in the _private field of the parser context(s) */ + int n_data; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_flags = 0;n_flags < gen_nb_int;n_flags++) { + for (n_data = 0;n_data < gen_nb_userdata;n_data++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + flags = gen_int(n_flags, 1); + data = gen_userdata(n_data, 2); + + ret_val = xmlXIncludeProcessFlagsData(doc, flags, data); + desret_int(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_int(n_flags, flags, 1); + des_userdata(n_data, data, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXIncludeProcessFlagsData", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_flags); + printf(" %d", n_data); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + #ifdef LIBXML_XINCLUDE_ENABLED #define gen_nb_xmlXIncludeCtxtPtr 1 @@ -27060,10 +27173,11 @@ static int test_xinclude(void) { int test_ret = 0; - if (quiet == 0) printf("Testing xinclude : 6 of 8 functions ...\n"); + if (quiet == 0) printf("Testing xinclude : 7 of 9 functions ...\n"); test_ret += test_xmlXIncludeNewContext(); test_ret += test_xmlXIncludeProcess(); test_ret += test_xmlXIncludeProcessFlags(); + test_ret += test_xmlXIncludeProcessFlagsData(); test_ret += test_xmlXIncludeProcessNode(); test_ret += test_xmlXIncludeProcessTree(); test_ret += test_xmlXIncludeProcessTreeFlags(); @@ -33356,7 +33470,7 @@ test_xmlSaveTree(void) { long ret_val; xmlSaveCtxtPtr ctxt; /* a document saving context */ int n_ctxt; - xmlNodePtr node; /* a document */ + xmlNodePtr node; /* the top node of the subtree to save */ int n_node; for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) { @@ -45558,6 +45672,47 @@ test_xmlXPathCompiledEval(void) { } +static int +test_xmlXPathCompiledEvalToBoolean(void) { + int test_ret = 0; + +#if defined(LIBXML_XPATH_ENABLED) + int mem_base; + int ret_val; + xmlXPathCompExprPtr comp; /* the compiled XPath expression */ + int n_comp; + xmlXPathContextPtr ctxt; /* the XPath context */ + int n_ctxt; + + for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) { + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + comp = gen_xmlXPathCompExprPtr(n_comp, 0); + ctxt = gen_xmlXPathContextPtr(n_ctxt, 1); + + ret_val = xmlXPathCompiledEvalToBoolean(comp, ctxt); + desret_int(ret_val); + call_tests++; + des_xmlXPathCompExprPtr(n_comp, comp, 0); + des_xmlXPathContextPtr(n_ctxt, ctxt, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathCompiledEvalToBoolean", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_comp); + printf(" %d", n_ctxt); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + static int test_xmlXPathContextSetCache(void) { int test_ret = 0; @@ -46059,7 +46214,7 @@ static int test_xpath(void) { int test_ret = 0; - if (quiet == 0) printf("Testing xpath : 29 of 37 functions ...\n"); + if (quiet == 0) printf("Testing xpath : 30 of 38 functions ...\n"); test_ret += test_xmlXPathCastBooleanToNumber(); test_ret += test_xmlXPathCastBooleanToString(); test_ret += test_xmlXPathCastNodeSetToBoolean(); @@ -46077,6 +46232,7 @@ test_xpath(void) { test_ret += test_xmlXPathCmpNodes(); test_ret += test_xmlXPathCompile(); test_ret += test_xmlXPathCompiledEval(); + test_ret += test_xmlXPathCompiledEvalToBoolean(); test_ret += test_xmlXPathContextSetCache(); test_ret += test_xmlXPathConvertBoolean(); test_ret += test_xmlXPathConvertNumber(); diff --git a/threads.c b/threads.c index 90a461a..7124bca 100644 --- a/threads.c +++ b/threads.c @@ -319,8 +319,10 @@ xmlFreeRMutex(xmlRMutexPtr tok ATTRIBUTE_UNUSED) if (tok == NULL) return; #ifdef HAVE_PTHREAD_H - if (libxml_is_threaded != 0) + if (libxml_is_threaded != 0) { pthread_mutex_destroy(&tok->lock); + pthread_cond_destroy(&tok->cv); + } #elif defined HAVE_WIN32_THREADS DeleteCriticalSection(&tok->cs); #elif defined HAVE_BEOS_THREADS diff --git a/tree.c b/tree.c index d382e29..d5b9fec 100644 --- a/tree.c +++ b/tree.c @@ -43,8 +43,16 @@ int __xmlRegisterCallbacks = 0; +/************************************************************************ + * * + * Forward declarations * + * * + ************************************************************************/ + xmlNsPtr xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns); +static xmlChar* xmlGetPropNodeValueInternal(xmlAttrPtr prop); + /************************************************************************ * * * Tree memory error handler * @@ -337,7 +345,7 @@ xmlSplitQName3(const xmlChar *name, int *len) { #define CUR_SCHAR(s, l) xmlStringCurrentChar(NULL, s, &l) -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) /** * xmlValidateNCName: * @value: the value to check @@ -1015,6 +1023,42 @@ xmlCreateIntSubset(xmlDocPtr doc, const xmlChar *name, (xmlDictOwns(dict, (const xmlChar *)(str)) == 0))) \ xmlFree((char *)(str)); + +/** + * DICT_COPY: + * @str: a string + * + * Copy a string using a "dict" dictionnary in the current scope, + * if availabe. + */ +#define DICT_COPY(str, cpy) \ + if (str) { \ + if (dict) { \ + if (xmlDictOwns(dict, (const xmlChar *)(str))) \ + cpy = (xmlChar *) (str); \ + else \ + cpy = (xmlChar *) xmlDictLookup((dict), (const xmlChar *)(str), -1); \ + } else \ + cpy = xmlStrdup((const xmlChar *)(str)); } + +/** + * DICT_CONST_COPY: + * @str: a string + * + * Copy a string using a "dict" dictionnary in the current scope, + * if availabe. + */ +#define DICT_CONST_COPY(str, cpy) \ + if (str) { \ + if (dict) { \ + if (xmlDictOwns(dict, (const xmlChar *)(str))) \ + cpy = (const xmlChar *) (str); \ + else \ + cpy = xmlDictLookup((dict), (const xmlChar *)(str), -1); \ + } else \ + cpy = (const xmlChar *) xmlStrdup((const xmlChar *)(str)); } + + /** * xmlFreeDtd: * @cur: the DTD structure to free up @@ -4236,7 +4280,7 @@ xmlGetNodePath(xmlNodePtr node) const char *sep; const char *name; char nametemp[100]; - int occur = 0; + int occur = 0, generic; if (node == NULL) return (NULL); @@ -4267,17 +4311,23 @@ xmlGetNodePath(xmlNodePtr node) sep = "/"; next = NULL; } else if (cur->type == XML_ELEMENT_NODE) { + generic = 0; sep = "/"; name = (const char *) cur->name; if (cur->ns) { - if (cur->ns->prefix != NULL) + if (cur->ns->prefix != NULL) { snprintf(nametemp, sizeof(nametemp) - 1, "%s:%s", (char *)cur->ns->prefix, (char *)cur->name); - else - snprintf(nametemp, sizeof(nametemp) - 1, "%s", - (char *)cur->name); - nametemp[sizeof(nametemp) - 1] = 0; - name = nametemp; + nametemp[sizeof(nametemp) - 1] = 0; + name = nametemp; + } else { + /* + * We cannot express named elements in the default + * namespace, so use "*". + */ + generic = 1; + name = "*"; + } } next = cur->parent; @@ -4288,10 +4338,11 @@ xmlGetNodePath(xmlNodePtr node) tmp = cur->prev; while (tmp != NULL) { if ((tmp->type == XML_ELEMENT_NODE) && - (xmlStrEqual(cur->name, tmp->name)) && - ((tmp->ns == cur->ns) || - ((tmp->ns != NULL) && (cur->ns != NULL) && - (xmlStrEqual(cur->ns->prefix, tmp->ns->prefix))))) + (generic || + (xmlStrEqual(cur->name, tmp->name) && + ((tmp->ns == cur->ns) || + ((tmp->ns != NULL) && (cur->ns != NULL) && + (xmlStrEqual(cur->ns->prefix, tmp->ns->prefix))))))) occur++; tmp = tmp->prev; } @@ -4299,10 +4350,11 @@ xmlGetNodePath(xmlNodePtr node) tmp = cur->next; while (tmp != NULL && occur == 0) { if ((tmp->type == XML_ELEMENT_NODE) && - (xmlStrEqual(cur->name, tmp->name)) && - ((tmp->ns == cur->ns) || - ((tmp->ns != NULL) && (cur->ns != NULL) && - (xmlStrEqual(cur->ns->prefix, tmp->ns->prefix))))) + (generic || + (xmlStrEqual(cur->name, tmp->name) && + ((tmp->ns == cur->ns) || + ((tmp->ns != NULL) && (cur->ns != NULL) && + (xmlStrEqual(cur->ns->prefix, tmp->ns->prefix))))))) occur++; tmp = tmp->next; } @@ -4482,12 +4534,13 @@ xmlDocGetRootElement(xmlDocPtr doc) { /** * xmlDocSetRootElement: * @doc: the document - * @root: the new document root element + * @root: the new document root element, if root is NULL no action is taken, + * to remove a node from a document use xmlUnlinkNode(root) instead. * * Set the root element of the document (doc->children is a list * containing possibly comments, PIs, etc ...). * - * Returns the old root element if any was found + * Returns the old root element if any was found, NULL if root was NULL */ xmlNodePtr xmlDocSetRootElement(xmlDocPtr doc, xmlNodePtr root) { @@ -4748,6 +4801,7 @@ xmlNodeSetName(xmlNodePtr cur, const xmlChar *name) { void xmlNodeSetBase(xmlNodePtr cur, const xmlChar* uri) { xmlNsPtr ns; + const xmlChar* fixed; if (cur == NULL) return; switch(cur->type) { @@ -4783,7 +4837,7 @@ xmlNodeSetBase(xmlNodePtr cur, const xmlChar* uri) { if (uri == NULL) doc->URL = NULL; else - doc->URL = xmlStrdup(uri); + doc->URL = xmlPathToURI(uri); return; } } @@ -4791,7 +4845,13 @@ xmlNodeSetBase(xmlNodePtr cur, const xmlChar* uri) { ns = xmlSearchNsByHref(cur->doc, cur, XML_XML_NAMESPACE); if (ns == NULL) return; - xmlSetNsProp(cur, ns, BAD_CAST "base", uri); + fixed = xmlPathToURI(uri); + if (fixed != NULL) { + xmlSetNsProp(cur, ns, BAD_CAST "base", fixed); + xmlFree(fixed); + } else { + xmlSetNsProp(cur, ns, BAD_CAST "base", uri); + } } #endif /* LIBXML_TREE_ENABLED */ @@ -5055,16 +5115,8 @@ xmlNodeGetContent(xmlNodePtr cur) xmlBufferFree(buffer); return (ret); } - case XML_ATTRIBUTE_NODE:{ - xmlAttrPtr attr = (xmlAttrPtr) cur; - - if (attr->parent != NULL) - return (xmlNodeListGetString - (attr->parent->doc, attr->children, 1)); - else - return (xmlNodeListGetString(NULL, attr->children, 1)); - break; - } + case XML_ATTRIBUTE_NODE: + return(xmlGetPropNodeValueInternal((xmlAttrPtr) cur)); case XML_COMMENT_NODE: case XML_PI_NODE: if (cur->content != NULL) @@ -5403,7 +5455,7 @@ xmlTextMerge(xmlNodePtr first, xmlNodePtr second) { return(first); } -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) /** * xmlGetNsList: * @doc: the document @@ -5467,6 +5519,38 @@ xmlGetNsList(xmlDocPtr doc ATTRIBUTE_UNUSED, xmlNodePtr node) } #endif /* LIBXML_TREE_ENABLED */ +/* +* xmlTreeEnsureXMLDecl: +* @doc: the doc +* +* Ensures that there is an XML namespace declaration on the doc. +* +* Returns the XML ns-struct or NULL on API and internal errors. +*/ +static xmlNsPtr +xmlTreeEnsureXMLDecl(xmlDocPtr doc) +{ + if (doc == NULL) + return (NULL); + if (doc->oldNs != NULL) + return (doc->oldNs); + { + xmlNsPtr ns; + ns = (xmlNsPtr) xmlMalloc(sizeof(xmlNs)); + if (ns == NULL) { + xmlTreeErrMemory( + "allocating the XML namespace"); + return (NULL); + } + memset(ns, 0, sizeof(xmlNs)); + ns->type = XML_LOCAL_NAMESPACE; + ns->href = xmlStrdup(XML_XML_NAMESPACE); + ns->prefix = xmlStrdup((const xmlChar *)"xml"); + doc->oldNs = ns; + return (ns); + } +} + /** * xmlSearchNs: * @doc: the document @@ -5516,22 +5600,13 @@ xmlSearchNs(xmlDocPtr doc, xmlNodePtr node, const xmlChar *nameSpace) { if (doc == NULL) return(NULL); } - if (doc->oldNs == NULL) { - /* - * Allocate a new Namespace and fill the fields. - */ - doc->oldNs = (xmlNsPtr) xmlMalloc(sizeof(xmlNs)); - if (doc->oldNs == NULL) { - xmlTreeErrMemory("searching namespace"); - return(NULL); - } - memset(doc->oldNs, 0, sizeof(xmlNs)); - doc->oldNs->type = XML_LOCAL_NAMESPACE; - - doc->oldNs->href = xmlStrdup(XML_XML_NAMESPACE); - doc->oldNs->prefix = xmlStrdup((const xmlChar *)"xml"); - } - return(doc->oldNs); + /* + * Return the XML namespace declaration held by the doc. + */ + if (doc->oldNs == NULL) + return(xmlTreeEnsureXMLDecl(doc)); + else + return(doc->oldNs); } while (node != NULL) { if ((node->type == XML_ENTITY_REF_NODE) || @@ -5658,22 +5733,13 @@ xmlSearchNsByHref(xmlDocPtr doc, xmlNodePtr node, const xmlChar * href) if (doc == NULL) return(NULL); } - if (doc->oldNs == NULL) { - /* - * Allocate a new Namespace and fill the fields. - */ - doc->oldNs = (xmlNsPtr) xmlMalloc(sizeof(xmlNs)); - if (doc->oldNs == NULL) { - xmlTreeErrMemory("searching namespace"); - return (NULL); - } - memset(doc->oldNs, 0, sizeof(xmlNs)); - doc->oldNs->type = XML_LOCAL_NAMESPACE; - - doc->oldNs->href = xmlStrdup(XML_XML_NAMESPACE); - doc->oldNs->prefix = xmlStrdup((const xmlChar *) "xml"); - } - return (doc->oldNs); + /* + * Return the XML namespace declaration held by the doc. + */ + if (doc->oldNs == NULL) + return(xmlTreeEnsureXMLDecl(doc)); + else + return(doc->oldNs); } is_attr = (node->type == XML_ATTRIBUTE_NODE); while (node != NULL) { @@ -5871,73 +5937,75 @@ xmlReconciliateNs(xmlDocPtr doc, xmlNodePtr tree) { /* * now check for namespace hold by attributes on the node. */ - attr = node->properties; - while (attr != NULL) { - if (attr->ns != NULL) { - /* - * initialize the cache if needed - */ - if (sizeCache == 0) { - sizeCache = 10; - oldNs = (xmlNsPtr *) xmlMalloc(sizeCache * - sizeof(xmlNsPtr)); - if (oldNs == NULL) { - xmlTreeErrMemory("fixing namespaces"); - return(-1); - } - newNs = (xmlNsPtr *) xmlMalloc(sizeCache * - sizeof(xmlNsPtr)); - if (newNs == NULL) { - xmlTreeErrMemory("fixing namespaces"); - xmlFree(oldNs); - return(-1); - } - } - for (i = 0;i < nbCache;i++) { - if (oldNs[i] == attr->ns) { - attr->ns = newNs[i]; - break; - } - } - if (i == nbCache) { + if (node->type == XML_ELEMENT_NODE) { + attr = node->properties; + while (attr != NULL) { + if (attr->ns != NULL) { /* - * OK we need to recreate a new namespace definition + * initialize the cache if needed */ - n = xmlNewReconciliedNs(doc, tree, attr->ns); - if (n != NULL) { /* :-( what if else ??? */ + if (sizeCache == 0) { + sizeCache = 10; + oldNs = (xmlNsPtr *) xmlMalloc(sizeCache * + sizeof(xmlNsPtr)); + if (oldNs == NULL) { + xmlTreeErrMemory("fixing namespaces"); + return(-1); + } + newNs = (xmlNsPtr *) xmlMalloc(sizeCache * + sizeof(xmlNsPtr)); + if (newNs == NULL) { + xmlTreeErrMemory("fixing namespaces"); + xmlFree(oldNs); + return(-1); + } + } + for (i = 0;i < nbCache;i++) { + if (oldNs[i] == attr->ns) { + attr->ns = newNs[i]; + break; + } + } + if (i == nbCache) { /* - * check if we need to grow the cache buffers. + * OK we need to recreate a new namespace definition */ - if (sizeCache <= nbCache) { - sizeCache *= 2; - oldNs = (xmlNsPtr *) xmlRealloc(oldNs, sizeCache * - sizeof(xmlNsPtr)); - if (oldNs == NULL) { - xmlTreeErrMemory("fixing namespaces"); - xmlFree(newNs); - return(-1); - } - newNs = (xmlNsPtr *) xmlRealloc(newNs, sizeCache * - sizeof(xmlNsPtr)); - if (newNs == NULL) { - xmlTreeErrMemory("fixing namespaces"); - xmlFree(oldNs); - return(-1); + n = xmlNewReconciliedNs(doc, tree, attr->ns); + if (n != NULL) { /* :-( what if else ??? */ + /* + * check if we need to grow the cache buffers. + */ + if (sizeCache <= nbCache) { + sizeCache *= 2; + oldNs = (xmlNsPtr *) xmlRealloc(oldNs, + sizeCache * sizeof(xmlNsPtr)); + if (oldNs == NULL) { + xmlTreeErrMemory("fixing namespaces"); + xmlFree(newNs); + return(-1); + } + newNs = (xmlNsPtr *) xmlRealloc(newNs, + sizeCache * sizeof(xmlNsPtr)); + if (newNs == NULL) { + xmlTreeErrMemory("fixing namespaces"); + xmlFree(oldNs); + return(-1); + } } + newNs[nbCache] = n; + oldNs[nbCache++] = attr->ns; + attr->ns = n; } - newNs[nbCache] = n; - oldNs[nbCache++] = attr->ns; - attr->ns = n; } } + attr = attr->next; } - attr = attr->next; } /* * Browse the full subtree, deep first */ - if (node->children != NULL && node->type != XML_ENTITY_REF_NODE) { + if ((node->children != NULL) && (node->type != XML_ENTITY_REF_NODE)) { /* deep first */ node = node->children; } else if ((node != tree) && (node->next != NULL)) { @@ -6096,7 +6164,7 @@ xmlGetPropNodeValueInternal(xmlAttrPtr prop) * TODO: Do we really always want that? */ if (prop->children != NULL) { - if ((prop->children == prop->last) && + if ((prop->children->next == NULL) && ((prop->children->type == XML_TEXT_NODE) || (prop->children->type == XML_CDATA_SECTION_NODE))) { @@ -6471,7 +6539,9 @@ xmlTextConcat(xmlNodePtr node, const xmlChar *content, int len) { if (node == NULL) return(-1); if ((node->type != XML_TEXT_NODE) && - (node->type != XML_CDATA_SECTION_NODE)) { + (node->type != XML_CDATA_SECTION_NODE) && + (node->type != XML_COMMENT_NODE) && + (node->type != XML_PI_NODE)) { #ifdef DEBUG_TREE xmlGenericError(xmlGenericErrorContext, "xmlTextConcat: node is not text nor CDATA\n"); @@ -7153,41 +7223,6 @@ xmlSetCompressMode(int mode) { else xmlCompressMode = mode; } -/* -* xmlDOMWrapNewCtxt: -* -* Allocates and initializes a new DOM-wrapper context. -* -* Returns the xmlDOMWrapCtxtPtr or NULL in case of an internal errror. -*/ -xmlDOMWrapCtxtPtr -xmlDOMWrapNewCtxt(void) -{ - xmlDOMWrapCtxtPtr ret; - - ret = xmlMalloc(sizeof(xmlDOMWrapCtxt)); - if (ret == NULL) { - xmlTreeErrMemory("allocating DOM-wrapper context"); - return (NULL); - } - memset(ret, 0, sizeof(xmlDOMWrapCtxt)); - return (ret); -} - -/* -* xmlDOMWrapFreeCtxt: -* @ctxt: the DOM-wrapper context -* -* Frees the DOM-wrapper context. -*/ -void -xmlDOMWrapFreeCtxt(xmlDOMWrapCtxtPtr ctxt) -{ - if (ctxt == NULL) - return; - xmlFree(ctxt); -} - #define XML_TREE_NSMAP_PARENT -1 #define XML_TREE_NSMAP_XML -2 #define XML_TREE_NSMAP_DOC -3 @@ -7261,7 +7296,6 @@ xmlDOMWrapNsMapFree(xmlNsMapPtr nsmap) /* * xmlDOMWrapNsMapAddItem: * @map: the ns-map -* @cur: the current map entry to append a new entry to * @oldNs: the old ns-struct * @newNs: the new ns-struct * @depth: depth and ns-kind information @@ -7269,7 +7303,7 @@ xmlDOMWrapNsMapFree(xmlNsMapPtr nsmap) * Adds an ns-mapping item. */ static xmlNsMapItemPtr -xmlDOMWrapNsMapAddItem(xmlNsMapPtr *nsmap, int position, /* xmlNsMapItemPtr *cur, */ +xmlDOMWrapNsMapAddItem(xmlNsMapPtr *nsmap, int position, xmlNsPtr oldNs, xmlNsPtr newNs, int depth) { xmlNsMapItemPtr ret; @@ -7343,38 +7377,6 @@ xmlDOMWrapNsMapAddItem(xmlNsMapPtr *nsmap, int position, /* xmlNsMapItemPtr *cur return (ret); } -/* -* xmlTreeEnsureXMLDecl: -* @doc: the doc -* -* Ensures that there is an XML namespace declaration on the doc. -* -* Returns the XML ns-struct or NULL on API and internal errors. -*/ -static xmlNsPtr -xmlTreeEnsureXMLDecl(xmlDocPtr doc) -{ - if (doc == NULL) - return (NULL); - if (doc->oldNs != NULL) - return (doc->oldNs); - { - xmlNsPtr ns; - ns = (xmlNsPtr) xmlMalloc(sizeof(xmlNs)); - if (ns == NULL) { - xmlTreeErrMemory( - "allocating the XML namespace"); - return (NULL); - } - memset(ns, 0, sizeof(xmlNs)); - ns->type = XML_LOCAL_NAMESPACE; - ns->href = xmlStrdup(XML_XML_NAMESPACE); - ns->prefix = xmlStrdup((const xmlChar *)"xml"); - doc->oldNs = ns; - return (ns); - } -} - /* * xmlDOMWrapStoreNs: * @doc: the doc @@ -7418,6 +7420,46 @@ xmlDOMWrapStoreNs(xmlDocPtr doc, return (ns->next); } +/* +* xmlDOMWrapNewCtxt: +* +* Allocates and initializes a new DOM-wrapper context. +* +* Returns the xmlDOMWrapCtxtPtr or NULL in case of an internal errror. +*/ +xmlDOMWrapCtxtPtr +xmlDOMWrapNewCtxt(void) +{ + xmlDOMWrapCtxtPtr ret; + + ret = xmlMalloc(sizeof(xmlDOMWrapCtxt)); + if (ret == NULL) { + xmlTreeErrMemory("allocating DOM-wrapper context"); + return (NULL); + } + memset(ret, 0, sizeof(xmlDOMWrapCtxt)); + return (ret); +} + +/* +* xmlDOMWrapFreeCtxt: +* @ctxt: the DOM-wrapper context +* +* Frees the DOM-wrapper context. +*/ +void +xmlDOMWrapFreeCtxt(xmlDOMWrapCtxtPtr ctxt) +{ + if (ctxt == NULL) + return; + if (ctxt->namespaceMap != NULL) + xmlDOMWrapNsMapFree((xmlNsMapPtr) ctxt->namespaceMap); + /* + * TODO: Store the namespace map in the context. + */ + xmlFree(ctxt); +} + /* * xmlTreeLookupNsListByPrefix: * @nsList: a list of ns-structs @@ -7586,7 +7628,8 @@ xmlDOMWrapNSNormAddNsMapItem2(xmlNsPtr **list, int *size, int *number, * This will substitute ns-references to node->nsDef for * ns-references to doc->oldNs, thus ensuring the removed * branch to be autark wrt ns-references. -* WARNING: This function is in a experimental state. +* +* NOTE: This function was not intensively tested. * * Returns 0 on success, 1 if the node is not supported, * -1 on API and internal errors. @@ -7817,7 +7860,6 @@ xmlSearchNsByNamespaceStrict(xmlDocPtr doc, xmlNodePtr node, * @node: the start node * @prefix: the searched namespace prefix * @retNs: the resulting ns-decl -* @prefixed: if the found ns-decl must have a prefix (for attributes) * * Dynamically searches for a ns-declaration which matches * the given @nsName in the ancestor-or-self axis of @node. @@ -7939,10 +7981,10 @@ ns_next_prefix: return (NULL); if (prefix == NULL) { snprintf((char *) buf, sizeof(buf), - "default%d", counter); + "ns_%d", counter); } else snprintf((char *) buf, sizeof(buf), - "%.30s%d", (char *)prefix, counter); + "%.30s_%d", (char *)prefix, counter); pref = BAD_CAST buf; } } @@ -7954,7 +7996,6 @@ ns_next_prefix: * @ns: the ns-struct to use for the search * @retNs: the found/created ns-struct * @nsMap: the ns-map -* @topmi: the last ns-map entry * @depth: the current tree depth * @ancestorsOnly: search in ancestor ns-decls only * @prefixed: if the searched ns-decl must have a prefix (for attributes) @@ -8001,7 +8042,8 @@ xmlDOMWrapNSNormAquireNormalizedNs(xmlDocPtr doc, * If the search should be done in ancestors only and no * @elem (the first ancestor) was specified, then skip the search. */ - if ((! (ancestorsOnly && (elem == NULL))) && (XML_NSMAP_NOTEMPTY(*nsMap))) + if ((XML_NSMAP_NOTEMPTY(*nsMap)) && + (! (ancestorsOnly && (elem == NULL)))) { /* * Try to find an equal ns-name in in-scope ns-decls. @@ -8102,7 +8144,8 @@ typedef enum { * ns-decls where needed. Note that, since prefixes of already existent * ns-decls can be shadowed by this process, it could break QNames in * attribute values or element content. -* WARNING: This function is in a experimental state. +* +* NOTE: This function was not intensively tested. * * Returns 0 if succeeded, -1 otherwise and on API/internal errors. */ @@ -8120,7 +8163,7 @@ xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt ATTRIBUTE_UNUSED, xmlNsMapItemPtr /* topmi = NULL, */ mi; /* @ancestorsOnly should be set by an option flag. */ int ancestorsOnly = 0; - int optRemoveDedundantNS = + int optRemoveRedundantNS = ((xmlDOMReconcileNSOptions) options & XML_DOM_RECONNS_REMOVEREDUND) ? 1 : 0; xmlNsPtr *listRedund = NULL; int sizeRedund = 0, nbRedund = 0, ret, i, j; @@ -8160,7 +8203,7 @@ xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt ATTRIBUTE_UNUSED, /* * Lookup the ns ancestor-axis for equal ns-decls in scope. */ - if (optRemoveDedundantNS && XML_NSMAP_NOTEMPTY(nsMap)) { + if (optRemoveRedundantNS && XML_NSMAP_NOTEMPTY(nsMap)) { XML_NSMAP_FOREACH(nsMap, mi) { if ((mi->depth >= XML_TREE_NSMAP_PARENT) && (mi->shadowDepth == -1) && @@ -8366,6 +8409,8 @@ exit: * shadowed by this process, it could break QNames in attribute * values or element content. * +* NOTE: This function was not intensively tested. +* * Returns 0 if succeeded, -1 otherwise and on API/internal errors. */ static int @@ -8383,7 +8428,7 @@ xmlDOMWrapAdoptBranch(xmlDOMWrapCtxtPtr ctxt, xmlNsPtr ns = NULL; int depth = -1, adoptStr = 1; /* gather @parent's ns-decls. */ - int parnsdone = 0; + int parnsdone; /* @ancestorsOnly should be set per option. */ int ancestorsOnly = 0; @@ -8396,8 +8441,29 @@ xmlDOMWrapAdoptBranch(xmlDOMWrapCtxtPtr ctxt, else adoptStr = 1; + /* + * Get the ns-map from the context if available. + */ + if (ctxt) + nsMap = (xmlNsMapPtr) ctxt->namespaceMap; + /* + * Disable search for ns-decls in the parent-axis of the + * desination element, if: + * 1) there's no destination parent + * 2) custom ns-reference handling is used + */ + if ((destParent == NULL) || + (ctxt && ctxt->getNsForNodeFunc)) + { + parnsdone = 1; + } else + parnsdone = 0; + cur = node; while (cur != NULL) { + /* + * Paranoid source-doc sanity check. + */ if (cur->doc != sourceDoc) { /* * We'll assume XIncluded nodes if the doc differs. @@ -8429,23 +8495,28 @@ xmlDOMWrapAdoptBranch(xmlDOMWrapCtxtPtr ctxt, curElem = cur; depth++; /* - * Namespace declarations. + * Namespace declarations. + * - ns->href and ns->prefix are never in the dict, so + * we need not move the values over to the destination dict. + * - Note that for custom handling of ns-references, + * the ns-decls need not be stored in the ns-map, + * since they won't be referenced by node->ns. */ - if ((ctxt == NULL) && (cur->nsDef != NULL)) { + if ((cur->nsDef) && + ((ctxt == NULL) || (ctxt->getNsForNodeFunc == NULL))) + { if (! parnsdone) { - if (destParent && (ctxt == NULL)) { - /* - * Gather @parent's in-scope ns-decls. - */ - if (xmlDOMWrapNSNormGatherInScopeNs(&nsMap, - destParent) == -1) - goto internal_error; - } + /* + * Gather @parent's in-scope ns-decls. + */ + if (xmlDOMWrapNSNormGatherInScopeNs(&nsMap, + destParent) == -1) + goto internal_error; parnsdone = 1; } for (ns = cur->nsDef; ns != NULL; ns = ns->next) { /* - * ns->prefix and ns->href seem not to be in the dict. + * NOTE: ns->prefix and ns->href are never in the dict. * XML_TREE_ADOPT_STR(ns->prefix) * XML_TREE_ADOPT_STR(ns->href) */ @@ -8453,7 +8524,7 @@ xmlDOMWrapAdoptBranch(xmlDOMWrapCtxtPtr ctxt, * Does it shadow any ns-decl? */ if (XML_NSMAP_NOTEMPTY(nsMap)) { - XML_NSMAP_FOREACH(nsMap, mi) { + XML_NSMAP_FOREACH(nsMap, mi) { if ((mi->depth >= XML_TREE_NSMAP_PARENT) && (mi->shadowDepth == -1) && ((ns->prefix == mi->newNs->prefix) || @@ -8472,27 +8543,26 @@ xmlDOMWrapAdoptBranch(xmlDOMWrapCtxtPtr ctxt, goto internal_error; } } - /* No break on purpose. */ + /* No break on purpose. */ case XML_ATTRIBUTE_NODE: - + /* No namespace, no fun. */ if (cur->ns == NULL) goto ns_end; + if (! parnsdone) { - if (destParent && (ctxt == NULL)) { - if (xmlDOMWrapNSNormGatherInScopeNs(&nsMap, - destParent) == -1) - goto internal_error; - } + if (xmlDOMWrapNSNormGatherInScopeNs(&nsMap, + destParent) == -1) + goto internal_error; parnsdone = 1; } /* * Adopt ns-references. */ - if (XML_NSMAP_NOTEMPTY(nsMap)) { + if (XML_NSMAP_NOTEMPTY(nsMap)) { /* * Search for a mapping. */ - XML_NSMAP_FOREACH(nsMap, mi) { + XML_NSMAP_FOREACH(nsMap, mi) { if ((mi->shadowDepth == -1) && (cur->ns == mi->oldNs)) { @@ -8502,21 +8572,20 @@ xmlDOMWrapAdoptBranch(xmlDOMWrapCtxtPtr ctxt, } } /* - * Start searching for an in-scope ns-decl. - */ - if (ctxt != NULL) { + * No matching namespace in scope. We need a new one. + */ + if ((ctxt) && (ctxt->getNsForNodeFunc)) { /* * User-defined behaviour. */ -#if 0 - ctxt->aquireNsDecl(ctxt, cur->ns, &ns); -#endif + ns = ctxt->getNsForNodeFunc(ctxt, cur, + cur->ns->href, cur->ns->prefix); /* * Insert mapping if ns is available; it's the users fault * if not. */ if (xmlDOMWrapNsMapAddItem(&nsMap, -1, - ns, ns, XML_TREE_NSMAP_CUSTOM) == NULL) + cur->ns, ns, XML_TREE_NSMAP_CUSTOM) == NULL) goto internal_error; cur->ns = ns; } else { @@ -8560,7 +8629,9 @@ ns_end: */ if ((sourceDoc != NULL) && (((xmlAttrPtr) cur)->atype == XML_ATTRIBUTE_ID)) + { xmlRemoveID(sourceDoc, (xmlAttrPtr) cur); + } ((xmlAttrPtr) cur)->atype = 0; ((xmlAttrPtr) cur)->psvi = NULL; } @@ -8615,7 +8686,8 @@ leave_node: break; if ((cur->type == XML_ELEMENT_NODE) || (cur->type == XML_XINCLUDE_START) || - (cur->type == XML_XINCLUDE_END)) { + (cur->type == XML_XINCLUDE_END)) + { /* * TODO: Do we expect nsDefs on XML_XINCLUDE_START? */ @@ -8640,7 +8712,11 @@ leave_node: } if (cur->next != NULL) cur = cur->next; - else { + else if ((cur->type == XML_ATTRIBUTE_NODE) && + (cur->parent->children != NULL)) + { + cur = cur->parent->children; + } else { cur = cur->parent; goto leave_node; } @@ -8655,8 +8731,20 @@ exit: /* * Cleanup. */ - if (nsMap != NULL) - xmlDOMWrapNsMapFree(nsMap); + if (nsMap != NULL) { + if ((ctxt) && (ctxt->namespaceMap == nsMap)) { + /* + * Just cleanup the map but don't free. + */ + if (nsMap->first) { + if (nsMap->pool) + nsMap->last->next = nsMap->pool; + nsMap->pool = nsMap->first; + nsMap->first = NULL; + } + } else + xmlDOMWrapNsMapFree(nsMap); + } return(ret); } @@ -8673,9 +8761,9 @@ exit: * * References of out-of scope ns-decls are remapped to point to @destDoc: * 1) If @destParent is given, then nsDef entries on element-nodes are used -* 2) If *no* @destParent is given, then @destDoc->oldNs entries are used -* This is the case when you have an unliked node and just want to move it -* to the context of +* 2) If *no* @destParent is given, then @destDoc->oldNs entries are used. +* This is the case when you don't know already where the cloned branch +* will be added to. * * If @destParent is given, it ensures that the tree is namespace * wellformed by creating additional ns-decls where needed. @@ -8683,11 +8771,7 @@ exit: * shadowed by this process, it could break QNames in attribute * values or element content. * TODO: -* 1) Support dicts -* Optimize string adoption for equal or none dicts. -* 2) XInclude -* WARNING: This function is in a experimental state and should only be currently -* only be used to test it. +* 1) What to do with XInclude? Currently this returns an error for XInclude. * * Returns 0 if the operation succeeded, * 1 if a node of unsupported (or not yet supported) type was given, @@ -8713,10 +8797,15 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt, /* int adoptStr = 1; */ /* gather @parent's ns-decls. */ int parnsdone = 0; - /* @ancestorsOnly should be set per option. */ + /* + * @ancestorsOnly: + * TODO: @ancestorsOnly should be set per option. + * + */ int ancestorsOnly = 0; xmlNodePtr resultClone = NULL, clone = NULL, parentClone = NULL, prevClone = NULL; - xmlNsPtr cloneNs = NULL, *cloneNsDefSlot = NULL; + xmlNsPtr cloneNs = NULL, *cloneNsDefSlot = NULL; + xmlDictPtr dict; /* The destination dict */ if ((node == NULL) || (resNode == NULL) || (destDoc == NULL)) return(-1); @@ -8740,6 +8829,13 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt, if (sourceDoc == NULL) return (-1); + dict = destDoc->dict; + /* + * Reuse the namespace map of the context. + */ + if (ctxt) + nsMap = (xmlNsMapPtr) ctxt->namespaceMap; + *resNode = NULL; cur = node; @@ -8758,23 +8854,25 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt, switch (cur->type) { case XML_XINCLUDE_START: case XML_XINCLUDE_END: - /* TODO: What to do with XInclude? */ + /* + * TODO: What to do with XInclude? + */ goto internal_error; break; - case XML_TEXT_NODE: - case XML_CDATA_SECTION_NODE: case XML_ELEMENT_NODE: + case XML_TEXT_NODE: + case XML_CDATA_SECTION_NODE: + case XML_COMMENT_NODE: + case XML_PI_NODE: case XML_DOCUMENT_FRAG_NODE: case XML_ENTITY_REF_NODE: case XML_ENTITY_NODE: - case XML_PI_NODE: - case XML_COMMENT_NODE: /* * Nodes of xmlNode structure. */ clone = (xmlNodePtr) xmlMalloc(sizeof(xmlNode)); if (clone == NULL) { - xmlTreeErrMemory("xmlDOMWrapCloneBranch(): allocating a node"); + xmlTreeErrMemory("xmlDOMWrapCloneNode(): allocating a node"); goto internal_error; } memset(clone, 0, sizeof(xmlNode)); @@ -8798,12 +8896,13 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt, */ clone = (xmlNodePtr) xmlMalloc(sizeof(xmlAttr)); if (clone == NULL) { - xmlTreeErrMemory("xmlDOMWrapCloneBranch(): allocating an attr-node"); + xmlTreeErrMemory("xmlDOMWrapCloneNode(): allocating an attr-node"); goto internal_error; } memset(clone, 0, sizeof(xmlAttr)); /* * Set hierachical links. + * TODO: Change this to add to the end of attributes. */ if (resultClone != NULL) { clone->parent = parentClone; @@ -8816,28 +8915,31 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt, resultClone = clone; break; default: - /* TODO */ + /* + * TODO QUESTION: Any other nodes expected? + */ goto internal_error; } clone->type = cur->type; clone->doc = destDoc; - + + /* + * Clone the name of the node if any. + */ if (cur->name == xmlStringText) clone->name = xmlStringText; else if (cur->name == xmlStringTextNoenc) /* - * TODO: xmlStringTextNoenc is never assigned to a node - * in tree.c. + * NOTE: Although xmlStringTextNoenc is never assigned to a node + * in tree.c, it might be set in Libxslt via + * "xsl:disable-output-escaping". */ clone->name = xmlStringTextNoenc; else if (cur->name == xmlStringComment) clone->name = xmlStringComment; else if (cur->name != NULL) { - if ((destDoc != NULL) && (destDoc->dict != NULL)) - clone->name = xmlDictLookup(destDoc->dict, cur->name, -1); - else - clone->name = xmlStrdup(cur->name); + DICT_CONST_COPY(cur->name, clone->name); } switch (cur->type) { @@ -8875,7 +8977,7 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt, */ cloneNs = (xmlNsPtr) xmlMalloc(sizeof(xmlNs)); if (cloneNs == NULL) { - xmlTreeErrMemory("xmlDOMWrapCloneBranch(): " + xmlTreeErrMemory("xmlDOMWrapCloneNode(): " "allocating namespace"); return(-1); } @@ -8890,7 +8992,14 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt, *cloneNsDefSlot = cloneNs; cloneNsDefSlot = &(cloneNs->next); - if (ctxt == NULL) { + /* + * Note that for custom handling of ns-references, + * the ns-decls need not be stored in the ns-map, + * since they won't be referenced by node->ns. + */ + if ((ctxt == NULL) || + (ctxt->getNsForNodeFunc == NULL)) + { /* * Does it shadow any ns-decl? */ @@ -8926,8 +9035,10 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt, break; case XML_TEXT_NODE: case XML_CDATA_SECTION_NODE: - if (cur->content) - clone->content = xmlStrdup(cur->content); + /* + * Note that this will also cover the values of attributes. + */ + DICT_COPY(cur->content, clone->content); goto leave_node; case XML_ENTITY_NODE: /* TODO: What to do here? */ @@ -8954,15 +9065,13 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt, clone->content = cur->content; clone->children = cur->children; clone->last = cur->last; - } + } goto leave_node; case XML_PI_NODE: - if (cur->content) - clone->content = xmlStrdup(cur->content); + DICT_COPY(cur->content, clone->content); goto leave_node; case XML_COMMENT_NODE: - if (cur->content) - clone->content = xmlStrdup(cur->content); + DICT_COPY(cur->content, clone->content); goto leave_node; default: goto internal_error; @@ -9003,15 +9112,14 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt, } } /* - * Start searching for an in-scope ns-decl. + * No matching namespace in scope. We need a new one. */ - if (ctxt != NULL) { + if ((ctxt != NULL) && (ctxt->getNsForNodeFunc != NULL)) { /* * User-defined behaviour. */ -#if 0 - ctxt->aquireNsDecl(ctxt, cur->ns, &ns); -#endif + ns = ctxt->getNsForNodeFunc(ctxt, cur, + cur->ns->href, cur->ns->prefix); /* * Add user's mapping. */ @@ -9028,6 +9136,7 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt, destParent ? curElem : NULL, cur->ns, &ns, &nsMap, depth, + /* if we need to search only in the ancestor-axis */ ancestorsOnly, /* ns-decls must be prefixed for attributes. */ (cur->type == XML_ATTRIBUTE_NODE) ? 1 : 0) == -1) @@ -9043,7 +9152,8 @@ end_ns_reference: * Handle ID attributes. */ if ((clone->type == XML_ATTRIBUTE_NODE) && - (clone->parent != NULL)) { + (clone->parent != NULL)) + { if (xmlIsID(destDoc, clone->parent, (xmlAttrPtr) clone)) { xmlChar *idVal; @@ -9061,7 +9171,7 @@ end_ns_reference: } /* ** - ** The following will traversing the tree ************************ + ** The following will traverse the tree ************************** ** * * Walk the element's attributes before descending into child-nodes. @@ -9153,8 +9263,20 @@ exit: /* * Cleanup. */ - if (nsMap != NULL) - xmlDOMWrapNsMapFree(nsMap); + if (nsMap != NULL) { + if ((ctxt) && (ctxt->namespaceMap == nsMap)) { + /* + * Just cleanup the map but don't free. + */ + if (nsMap->first) { + if (nsMap->pool) + nsMap->last->next = nsMap->pool; + nsMap->pool = nsMap->first; + nsMap->first = NULL; + } + } else + xmlDOMWrapNsMapFree(nsMap); + } /* * TODO: Should we try a cleanup of the cloned node in case of a * fatal error? @@ -9303,7 +9425,7 @@ internal_error: * Note that, since prefixes of already existent ns-decls can be * shadowed by this process, it could break QNames in attribute * values or element content. -* WARNING: This function is in a experimental state. +* NOTE: This function was not intensively tested. * * Returns 0 if the operation succeeded, * 1 if a node of unsupported type was given, diff --git a/uri.c b/uri.c index 7d60ffe..1e29223 100644 --- a/uri.c +++ b/uri.c @@ -2343,7 +2343,7 @@ done: (((p[0] >= 'a') && (p[0] <= 'z')) || \ ((p[0] >= 'A') && (p[0] <= 'Z'))) && \ (p[1] == ':') && ((p[2] == '/') || (p[2] == '\\'))) -xmlChar* +xmlChar * xmlCanonicPath(const xmlChar *path) { #if defined(_WIN32) && !defined(__CYGWIN__) @@ -2406,12 +2406,20 @@ path_processing: len = xmlStrlen(path); if ((len > 2) && IS_WINDOWS_PATH(path)) { uri->scheme = xmlStrdup(BAD_CAST "file"); - uri->path = xmlMallocAtomic(len + 2); /* FIXME - check alloc! */ + uri->path = xmlMallocAtomic(len + 2); + if (uri->path == NULL) { + xmlFreeURI(uri); + return(NULL); + } uri->path[0] = '/'; p = uri->path + 1; strncpy(p, path, len + 1); } else { - uri->path = xmlStrdup(path); /* FIXME - check alloc! */ + uri->path = xmlStrdup(path); + if (uri->path == NULL) { + xmlFreeURI(uri); + return(NULL); + } p = uri->path; } while (*p != '\0') { @@ -2424,11 +2432,11 @@ path_processing: return(NULL); } - if (uri->scheme == NULL) { - ret = xmlStrdup((const xmlChar *) path); - } else { - ret = xmlSaveUri(uri); - } + if (uri->scheme == NULL) { + ret = xmlStrdup((const xmlChar *) path); + } else { + ret = xmlSaveUri(uri); + } xmlFreeURI(uri); #else @@ -2437,5 +2445,39 @@ path_processing: return(ret); } +/** + * xmlPathToURI: + * @path: the resource locator in a filesystem notation + * + * Constructs an URI expressing the existing path + * + * Returns a new URI, or a duplicate of the path parameter if the + * construction fails. The caller is responsible for freeing the memory + * occupied by the returned string. If there is insufficient memory available, + * or the argument is NULL, the function returns NULL. + */ +xmlChar * +xmlPathToURI(const xmlChar *path) +{ + xmlURIPtr uri; + xmlURI temp; + xmlChar *ret, *cal; + + if (path == NULL) + return(NULL); + + if ((uri = xmlParseURI((const char *) path)) != NULL) { + xmlFreeURI(uri); + return xmlStrdup(path); + } + cal = xmlCanonicPath(path); + if (cal == NULL) + return(NULL); + memset(&temp, 0, sizeof(temp)); + temp.path = (char *) cal; + ret = xmlSaveUri(&temp); + xmlFree(cal); + return(ret); +} #define bottom_uri #include "elfgcchack.h" diff --git a/valid.c b/valid.c index edf5426..a239e68 100644 --- a/valid.c +++ b/valid.c @@ -63,7 +63,9 @@ xmlVErrMemory(xmlValidCtxtPtr ctxt, const char *extra) context */ if ((ctxt->finishDtd == XML_CTXT_FINISH_DTD_0) || (ctxt->finishDtd == XML_CTXT_FINISH_DTD_1)) { - pctxt = ctxt->userData; + long delta = (char *) ctxt - (char *) ctxt->userData; + if ((delta > 0) && (delta < 250)) + pctxt = ctxt->userData; } } if (extra) @@ -101,7 +103,9 @@ xmlErrValid(xmlValidCtxtPtr ctxt, xmlParserErrors error, context */ if ((ctxt->finishDtd == XML_CTXT_FINISH_DTD_0) || (ctxt->finishDtd == XML_CTXT_FINISH_DTD_1)) { - pctxt = ctxt->userData; + long delta = (char *) ctxt - (char *) ctxt->userData; + if ((delta > 0) && (delta < 250)) + pctxt = ctxt->userData; } } if (extra) @@ -146,7 +150,9 @@ xmlErrValidNode(xmlValidCtxtPtr ctxt, context */ if ((ctxt->finishDtd == XML_CTXT_FINISH_DTD_0) || (ctxt->finishDtd == XML_CTXT_FINISH_DTD_1)) { - pctxt = ctxt->userData; + long delta = (char *) ctxt - (char *) ctxt->userData; + if ((delta > 0) && (delta < 250)) + pctxt = ctxt->userData; } } __xmlRaiseError(schannel, channel, data, pctxt, node, XML_FROM_VALID, error, @@ -187,7 +193,9 @@ xmlErrValidNodeNr(xmlValidCtxtPtr ctxt, context */ if ((ctxt->finishDtd == XML_CTXT_FINISH_DTD_0) || (ctxt->finishDtd == XML_CTXT_FINISH_DTD_1)) { - pctxt = ctxt->userData; + long delta = (char *) ctxt - (char *) ctxt->userData; + if ((delta > 0) && (delta < 250)) + pctxt = ctxt->userData; } } __xmlRaiseError(schannel, channel, data, pctxt, node, XML_FROM_VALID, error, @@ -226,7 +234,9 @@ xmlErrValidWarning(xmlValidCtxtPtr ctxt, context */ if ((ctxt->finishDtd == XML_CTXT_FINISH_DTD_0) || (ctxt->finishDtd == XML_CTXT_FINISH_DTD_1)) { - pctxt = ctxt->userData; + long delta = (char *) ctxt - (char *) ctxt->userData; + if ((delta > 0) && (delta < 250)) + pctxt = ctxt->userData; } } __xmlRaiseError(schannel, channel, data, pctxt, node, XML_FROM_VALID, error, @@ -5340,7 +5350,7 @@ fail: } #endif /* LIBXML_REGEXP_ENABLED */ if ((warn) && ((ret != 1) && (ret != -3))) { - if ((ctxt != NULL) && (ctxt->warning != NULL)) { + if (ctxt != NULL) { char expr[5000]; char list[5000]; diff --git a/xinclude.c b/xinclude.c index d5bba6e..c58bbcf 100644 --- a/xinclude.c +++ b/xinclude.c @@ -82,6 +82,8 @@ struct _xmlXIncludeCtxt { int legacy; /* using XINCLUDE_OLD_NS */ int parseFlags; /* the flags used for parsing XML documents */ xmlChar * base; /* the current xml:base */ + + void *_private; /* application data */ }; static int @@ -427,6 +429,12 @@ xmlXIncludeParseFile(xmlXIncludeCtxtPtr ctxt, const char *URL) { xmlXIncludeErrMemory(ctxt, NULL, "cannot allocate parser context"); return(NULL); } + + /* + * pass in the application data to the parser context. + */ + pctxt->_private = ctxt->_private; + /* * try to ensure that new documents included are actually * built with the same dictionary as the including document. @@ -2409,9 +2417,11 @@ xmlXIncludeSetFlags(xmlXIncludeCtxtPtr ctxt, int flags) { } /** - * xmlXIncludeProcessFlags: + * xmlXIncludeProcessFlagsData: * @doc: an XML document * @flags: a set of xmlParserOption used for parsing XML includes + * @data: application data that will be passed to the parser context + * in the _private field of the parser context(s) * * Implement the XInclude substitution on the XML document @doc * @@ -2419,7 +2429,7 @@ xmlXIncludeSetFlags(xmlXIncludeCtxtPtr ctxt, int flags) { * or the number of substitutions done. */ int -xmlXIncludeProcessFlags(xmlDocPtr doc, int flags) { +xmlXIncludeProcessFlagsData(xmlDocPtr doc, int flags, void *data) { xmlXIncludeCtxtPtr ctxt; xmlNodePtr tree; int ret = 0; @@ -2432,6 +2442,7 @@ xmlXIncludeProcessFlags(xmlDocPtr doc, int flags) { ctxt = xmlXIncludeNewContext(doc); if (ctxt == NULL) return(-1); + ctxt->_private = data; ctxt->base = xmlStrdup((xmlChar *)doc->URL); xmlXIncludeSetFlags(ctxt, flags); ret = xmlXIncludeDoProcess(ctxt, doc, tree); @@ -2442,6 +2453,21 @@ xmlXIncludeProcessFlags(xmlDocPtr doc, int flags) { return(ret); } +/** + * xmlXIncludeProcessFlags: + * @doc: an XML document + * @flags: a set of xmlParserOption used for parsing XML includes + * + * Implement the XInclude substitution on the XML document @doc + * + * Returns 0 if no substitution were done, -1 if some processing failed + * or the number of substitutions done. + */ +int +xmlXIncludeProcessFlags(xmlDocPtr doc, int flags) { + return xmlXIncludeProcessFlagsData(doc, flags, NULL); +} + /** * xmlXIncludeProcess: * @doc: an XML document diff --git a/xmlIO.c b/xmlIO.c index 60e0a50..90db848 100644 --- a/xmlIO.c +++ b/xmlIO.c @@ -50,6 +50,12 @@ # endif # define HAVE_STAT # endif +#else +# ifdef HAVE__STAT +# if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) +# define stat _stat +# endif +# endif #endif #ifdef HAVE_STAT # ifndef S_ISDIR @@ -193,7 +199,7 @@ static const char *IOerr[] = { "unknown address familly", /* EAFNOSUPPORT */ }; -#if defined(WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) +#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) /** * __xmlIOWin32UTF8ToWChar: * @u8String: uft-8 string @@ -203,26 +209,25 @@ static const char *IOerr[] = { static wchar_t * __xmlIOWin32UTF8ToWChar(const char *u8String) { - wchar_t *wString = NULL; + wchar_t *wString = NULL; + + if (u8String) { + int wLen = + MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, u8String, + -1, NULL, 0); + if (wLen) { + wString = xmlMalloc(wLen * sizeof(wchar_t)); + if (wString) { + if (MultiByteToWideChar + (CP_UTF8, 0, u8String, -1, wString, wLen) == 0) { + xmlFree(wString); + wString = NULL; + } + } + } + } - if (u8String) - { - int wLen = MultiByteToWideChar(CP_UTF8,0,u8String,-1,NULL,0); - if (wLen) - { - wString = malloc((wLen+1) * sizeof(wchar_t)); - if (wString) - { - if (MultiByteToWideChar(CP_UTF8,0,u8String,-1,wString,wLen+1) == 0) - { - free(wString); - wString = NULL; - } - } - } - } - - return wString; + return wString; } #endif @@ -572,6 +577,132 @@ xmlCleanupOutputCallbacks(void) * * ************************************************************************/ +#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) + +/** + * xmlWrapOpenUtf8: + * @path: the path in utf-8 encoding + * @mode: type of access (0 - read, 1 - write) + * + * function opens the file specified by @path + * + */ +static FILE* +xmlWrapOpenUtf8(const char *path,int mode) +{ + FILE *fd = NULL; + wchar_t *wPath; + + wPath = __xmlIOWin32UTF8ToWChar(path); + if(wPath) + { + fd = _wfopen(wPath, mode ? L"wb" : L"rb"); + xmlFree(wPath); + } + /* maybe path in native encoding */ + if(fd == NULL) + fd = fopen(path, mode ? "wb" : "rb"); + + return fd; +} + +/** + * xmlWrapStatUtf8: + * @path: the path in utf-8 encoding + * @info: structure that stores results + * + * function obtains information about the file or directory + * + */ +static int +xmlWrapStatUtf8(const char *path,struct stat *info) +{ +#ifdef HAVE_STAT + int retval = -1; + wchar_t *wPath; + + wPath = __xmlIOWin32UTF8ToWChar(path); + if (wPath) + { + retval = _wstat(wPath,info); + xmlFree(wPath); + } + /* maybe path in native encoding */ + if(retval < 0) + retval = stat(path,info); + return retval; +#else + return -1; +#endif +} + +/** + * xmlWrapOpenNative: + * @path: the path + * @mode: type of access (0 - read, 1 - write) + * + * function opens the file specified by @path + * + */ +static FILE* +xmlWrapOpenNative(const char *path,int mode) +{ + return fopen(path,mode ? "wb" : "rb"); +} + +/** + * xmlWrapStatNative: + * @path: the path + * @info: structure that stores results + * + * function obtains information about the file or directory + * + */ +static int +xmlWrapStatNative(const char *path,struct stat *info) +{ +#ifdef HAVE_STAT + return stat(path,info); +#else + return -1; +#endif +} + +typedef int (* xmlWrapStatFunc) (const char *f, struct stat *s); +static xmlWrapStatFunc xmlWrapStat = xmlWrapStatNative; +typedef FILE* (* xmlWrapOpenFunc)(const char *f,int mode); +static xmlWrapOpenFunc xmlWrapOpen = xmlWrapOpenNative; + +/** + * xmlInitPlatformSpecificIo: + * + * Initialize platform specific features. + */ +static void +xmlInitPlatformSpecificIo(void) +{ + static int xmlPlatformIoInitialized = 0; + OSVERSIONINFO osvi; + + if(xmlPlatformIoInitialized) + return; + + osvi.dwOSVersionInfoSize = sizeof(osvi); + + if(GetVersionEx(&osvi) && (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT)) { + xmlWrapStat = xmlWrapStatUtf8; + xmlWrapOpen = xmlWrapOpenUtf8; + } else { + xmlWrapStat = xmlWrapStatNative; + xmlWrapOpen = xmlWrapOpenNative; + } + + xmlPlatformIoInitialized = 1; + return; +} + +#endif + /** * xmlCheckFilename: * @path: the path to check @@ -594,41 +725,20 @@ xmlCheckFilename (const char *path) #endif if (path == NULL) return(0); - -#if defined(WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) - { - int retval = 0; - - wchar_t *wPath = __xmlIOWin32UTF8ToWChar(path); - if (wPath) - { - struct _stat stat_buffer; - - if (_wstat(wPath,&stat_buffer) == 0) - { - retval = 1; - - if (((stat_buffer.st_mode & S_IFDIR) == S_IFDIR)) - retval = 2; - } - - free(wPath); - } - return retval; - } -#else #ifdef HAVE_STAT +#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) + if (xmlWrapStat(path, &stat_buffer) == -1) + return 0; +#else if (stat(path, &stat_buffer) == -1) return 0; - +#endif #ifdef S_ISDIR if (S_ISDIR(stat_buffer.st_mode)) return 2; -#endif /* S_ISDIR */ +#endif #endif /* HAVE_STAT */ -#endif /* WIN32 */ - return 1; } @@ -750,19 +860,8 @@ xmlFileOpen_real (const char *filename) { if (!xmlCheckFilename(path)) return(NULL); -#if defined(WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) - { - wchar_t *wPath = __xmlIOWin32UTF8ToWChar(path); - if (wPath) - { - fd = _wfopen(wPath, L"rb"); - free(wPath); - } - else - { - fd = fopen(path, "rb"); - } - } +#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) + fd = xmlWrapOpen(path, 0); #else fd = fopen(path, "r"); #endif /* WIN32 */ @@ -832,19 +931,8 @@ xmlFileOpenW (const char *filename) { if (path == NULL) return(NULL); -#if defined(WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) - { - wchar_t *wPath = __xmlIOWin32UTF8ToWChar(path); - if (wPath) - { - fd = _wfopen(wPath, L"wb"); - free(wPath); - } - else - { - fd = fopen(path, "wb"); - } - } +#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) + fd = xmlWrapOpen(path, 1); #else fd = fopen(path, "wb"); #endif /* WIN32 */ @@ -2018,11 +2106,14 @@ xmlRegisterOutputCallbacks(xmlOutputMatchCallback matchFunc, * Registers the default compiled-in I/O handlers. */ void -xmlRegisterDefaultInputCallbacks -(void) { +xmlRegisterDefaultInputCallbacks(void) { if (xmlInputCallbackInitialized) return; +#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) + xmlInitPlatformSpecificIo(); +#endif + xmlRegisterInputCallbacks(xmlFileMatch, xmlFileOpen, xmlFileRead, xmlFileClose); #ifdef HAVE_ZLIB_H @@ -2049,11 +2140,14 @@ xmlRegisterDefaultInputCallbacks * Registers the default compiled-in I/O handlers. */ void -xmlRegisterDefaultOutputCallbacks -(void) { +xmlRegisterDefaultOutputCallbacks (void) { if (xmlOutputCallbackInitialized) return; +#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) + xmlInitPlatformSpecificIo(); +#endif + xmlRegisterOutputCallbacks(xmlFileMatch, xmlFileOpenW, xmlFileWrite, xmlFileClose); @@ -2368,7 +2462,8 @@ __xmlOutputBufferCreateFilename(const char *URI, /* * try to limit the damages of the URI unescaping code. */ - if (puri->scheme != NULL) + if ((puri->scheme == NULL) || + (xmlStrEqual(BAD_CAST puri->scheme, BAD_CAST "file"))) unescaped = xmlURIUnescapeString(URI, 0, NULL); xmlFreeURI(puri); } @@ -3499,10 +3594,7 @@ xmlCheckHTTPInput(xmlParserCtxtPtr ctxt, xmlParserInputPtr ret) { return(ret); } -static int xmlSysIDExists(const char *URL) { -#ifdef HAVE_STAT - int ret; - struct stat info; +static int xmlNoNetExists(const char *URL) { const char *path; if (URL == NULL) @@ -3522,13 +3614,88 @@ static int xmlSysIDExists(const char *URL) { #endif } else path = URL; - ret = stat(path, &info); - if (ret == 0) - return(1); -#endif - return(0); + + return xmlCheckFilename(path); } +#ifdef LIBXML_CATALOG_ENABLED + +/** + * xmlResolveResourceFromCatalog: + * @URL: the URL for the entity to load + * @ID: the System ID for the entity to load + * @ctxt: the context in which the entity is called or NULL + * + * Resolves the URL and ID against the appropriate catalog. + * This function is used by xmlDefaultExternalEntityLoader and + * xmlNoNetExternalEntityLoader. + * + * Returns a new allocated URL, or NULL. + */ +xmlChar * +xmlResolveResourceFromCatalog(const char *URL, const char *ID, + xmlParserCtxtPtr ctxt) { + xmlChar *resource = NULL; + xmlCatalogAllow pref; + + /* + * If the resource doesn't exists as a file, + * try to load it from the resource pointed in the catalogs + */ + pref = xmlCatalogGetDefaults(); + + if ((pref != XML_CATA_ALLOW_NONE) && (!xmlNoNetExists(URL))) { + /* + * Do a local lookup + */ + if ((ctxt != NULL) && (ctxt->catalogs != NULL) && + ((pref == XML_CATA_ALLOW_ALL) || + (pref == XML_CATA_ALLOW_DOCUMENT))) { + resource = xmlCatalogLocalResolve(ctxt->catalogs, + (const xmlChar *)ID, + (const xmlChar *)URL); + } + /* + * Try a global lookup + */ + if ((resource == NULL) && + ((pref == XML_CATA_ALLOW_ALL) || + (pref == XML_CATA_ALLOW_GLOBAL))) { + resource = xmlCatalogResolve((const xmlChar *)ID, + (const xmlChar *)URL); + } + if ((resource == NULL) && (URL != NULL)) + resource = xmlStrdup((const xmlChar *) URL); + + /* + * TODO: do an URI lookup on the reference + */ + if ((resource != NULL) && (!xmlNoNetExists((const char *)resource))) { + xmlChar *tmp = NULL; + + if ((ctxt != NULL) && (ctxt->catalogs != NULL) && + ((pref == XML_CATA_ALLOW_ALL) || + (pref == XML_CATA_ALLOW_DOCUMENT))) { + tmp = xmlCatalogLocalResolveURI(ctxt->catalogs, resource); + } + if ((tmp == NULL) && + ((pref == XML_CATA_ALLOW_ALL) || + (pref == XML_CATA_ALLOW_GLOBAL))) { + tmp = xmlCatalogResolveURI(resource); + } + + if (tmp != NULL) { + xmlFree(resource); + resource = tmp; + } + } + } + + return resource; +} + +#endif + /** * xmlDefaultExternalEntityLoader: * @URL: the URL for the entity to load @@ -3546,15 +3713,10 @@ xmlDefaultExternalEntityLoader(const char *URL, const char *ID, xmlParserInputPtr ret = NULL; xmlChar *resource = NULL; -#ifdef LIBXML_CATALOG_ENABLED - xmlCatalogAllow pref; -#endif - #ifdef DEBUG_EXTERNAL_ENTITIES xmlGenericError(xmlGenericErrorContext, "xmlDefaultExternalEntityLoader(%s, xxx)\n", URL); #endif -#ifdef LIBXML_CATALOG_ENABLED if ((ctxt != NULL) && (ctxt->options & XML_PARSE_NONET)) { int options = ctxt->options; @@ -3563,60 +3725,8 @@ xmlDefaultExternalEntityLoader(const char *URL, const char *ID, ctxt->options = options; return(ret); } - - /* - * If the resource doesn't exists as a file, - * try to load it from the resource pointed in the catalogs - */ - pref = xmlCatalogGetDefaults(); - - if ((pref != XML_CATA_ALLOW_NONE) && (!xmlSysIDExists(URL))) { - /* - * Do a local lookup - */ - if ((ctxt != NULL) && (ctxt->catalogs != NULL) && - ((pref == XML_CATA_ALLOW_ALL) || - (pref == XML_CATA_ALLOW_DOCUMENT))) { - resource = xmlCatalogLocalResolve(ctxt->catalogs, - (const xmlChar *) ID, - (const xmlChar *) URL); - } - /* - * Try a global lookup - */ - if ((resource == NULL) && - ((pref == XML_CATA_ALLOW_ALL) || - (pref == XML_CATA_ALLOW_GLOBAL))) { - resource = xmlCatalogResolve((const xmlChar *) ID, - (const xmlChar *) URL); - } - if ((resource == NULL) && (URL != NULL)) - resource = xmlStrdup((const xmlChar *) URL); - - /* - * TODO: do an URI lookup on the reference - */ - if ((resource != NULL) - && (!xmlSysIDExists((const char *) resource))) { - xmlChar *tmp = NULL; - - if ((ctxt != NULL) && (ctxt->catalogs != NULL) && - ((pref == XML_CATA_ALLOW_ALL) || - (pref == XML_CATA_ALLOW_DOCUMENT))) { - tmp = xmlCatalogLocalResolveURI(ctxt->catalogs, resource); - } - if ((tmp == NULL) && - ((pref == XML_CATA_ALLOW_ALL) || - (pref == XML_CATA_ALLOW_GLOBAL))) { - tmp = xmlCatalogResolveURI(resource); - } - - if (tmp != NULL) { - xmlFree(resource); - resource = tmp; - } - } - } +#ifdef LIBXML_CATALOG_ENABLED + resource = xmlResolveResourceFromCatalog(URL, ID, ctxt); #endif if (resource == NULL) @@ -3674,7 +3784,7 @@ xmlGetExternalEntityLoader(void) { xmlParserInputPtr xmlLoadExternalEntity(const char *URL, const char *ID, xmlParserCtxtPtr ctxt) { - if ((URL != NULL) && (xmlSysIDExists(URL) == 0)) { + if ((URL != NULL) && (xmlNoNetExists(URL) == 0)) { char *canonicFilename; xmlParserInputPtr ret; @@ -3697,40 +3807,6 @@ xmlLoadExternalEntity(const char *URL, const char *ID, * * ************************************************************************/ -#ifdef LIBXML_CATALOG_ENABLED -static int -xmlNoNetExists(const char *URL) -{ -#ifdef HAVE_STAT - int ret; - struct stat info; - const char *path; - - if (URL == NULL) - return (0); - - if (!xmlStrncasecmp(BAD_CAST URL, BAD_CAST "file://localhost/", 17)) -#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__) - path = &URL[17]; -#else - path = &URL[16]; -#endif - else if (!xmlStrncasecmp(BAD_CAST URL, BAD_CAST "file:///", 8)) { -#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__) - path = &URL[8]; -#else - path = &URL[7]; -#endif - } else - path = URL; - ret = stat(path, &info); - if (ret == 0) - return (1); -#endif - return (0); -} -#endif - /** * xmlNoNetExternalEntityLoader: * @URL: the URL for the entity to load @@ -3749,61 +3825,9 @@ xmlNoNetExternalEntityLoader(const char *URL, const char *ID, xmlChar *resource = NULL; #ifdef LIBXML_CATALOG_ENABLED - xmlCatalogAllow pref; - - /* - * If the resource doesn't exists as a file, - * try to load it from the resource pointed in the catalogs - */ - pref = xmlCatalogGetDefaults(); - - if ((pref != XML_CATA_ALLOW_NONE) && (!xmlNoNetExists(URL))) { - /* - * Do a local lookup - */ - if ((ctxt != NULL) && (ctxt->catalogs != NULL) && - ((pref == XML_CATA_ALLOW_ALL) || - (pref == XML_CATA_ALLOW_DOCUMENT))) { - resource = xmlCatalogLocalResolve(ctxt->catalogs, - (const xmlChar *)ID, - (const xmlChar *)URL); - } - /* - * Try a global lookup - */ - if ((resource == NULL) && - ((pref == XML_CATA_ALLOW_ALL) || - (pref == XML_CATA_ALLOW_GLOBAL))) { - resource = xmlCatalogResolve((const xmlChar *)ID, - (const xmlChar *)URL); - } - if ((resource == NULL) && (URL != NULL)) - resource = xmlStrdup((const xmlChar *) URL); - - /* - * TODO: do an URI lookup on the reference - */ - if ((resource != NULL) && (!xmlNoNetExists((const char *)resource))) { - xmlChar *tmp = NULL; - - if ((ctxt != NULL) && (ctxt->catalogs != NULL) && - ((pref == XML_CATA_ALLOW_ALL) || - (pref == XML_CATA_ALLOW_DOCUMENT))) { - tmp = xmlCatalogLocalResolveURI(ctxt->catalogs, resource); - } - if ((tmp == NULL) && - ((pref == XML_CATA_ALLOW_ALL) || - (pref == XML_CATA_ALLOW_GLOBAL))) { - tmp = xmlCatalogResolveURI(resource); - } - - if (tmp != NULL) { - xmlFree(resource); - resource = tmp; - } - } - } + resource = xmlResolveResourceFromCatalog(URL, ID, ctxt); #endif + if (resource == NULL) resource = (xmlChar *) URL; diff --git a/xmllint.c b/xmllint.c index 79025f1..5e1bfd7 100644 --- a/xmllint.c +++ b/xmllint.c @@ -98,6 +98,9 @@ #ifdef LIBXML_C14N_ENABLED #include #endif +#ifdef LIBXML_OUTPUT_ENABLED +#include +#endif #ifndef XML_XML_DEFAULT_CATALOG #define XML_XML_DEFAULT_CATALOG "file:///etc/xml/catalog" @@ -133,6 +136,7 @@ static int nowrap = 0; static int format = 0; static const char *output = NULL; static int compress = 0; +static int oldout = 0; #endif /* LIBXML_OUTPUT_ENABLED */ #ifdef LIBXML_VALID_ENABLED static int valid = 0; @@ -2089,6 +2093,26 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) { } } #endif /* LIBXML_PUSH_ENABLED */ +#ifdef HAVE_SYS_MMAN_H + else if ((html) && (memory)) { + int fd; + struct stat info; + const char *base; + if (stat(filename, &info) < 0) + return; + if ((fd = open(filename, O_RDONLY)) < 0) + return; + base = mmap(NULL, info.st_size, PROT_READ, MAP_SHARED, fd, 0) ; + if (base == (void *) MAP_FAILED) + return; + + doc = htmlReadMemory((char *) base, info.st_size, filename, + NULL, options); + + munmap((char *) base, info.st_size); + close(fd); + } +#endif else if (html) { doc = htmlReadFile(filename, NULL, options); } @@ -2203,6 +2227,7 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) { filename, NULL, options); munmap((char *) base, info.st_size); + close(fd); #endif #ifdef LIBXML_VALID_ENABLED } else if (valid) { @@ -2280,8 +2305,10 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) { /* * shell interaction */ - if (shell) + if (shell) { + xmlXPathOrderDocElems(doc); xmlShell(doc, filename, xmlShellReadline, stdout); + } #endif #endif @@ -2443,48 +2470,71 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) { write(1, result, len); xmlFree(result); } + } else #endif /* HAVE_SYS_MMAN_H */ if (compress) { xmlSaveFile(output ? output : "-", doc); - } - else if (encoding != NULL) { - if ( format ) { - ret = xmlSaveFormatFileEnc(output ? output : "-", doc, - encoding, 1); - } - else { - ret = xmlSaveFileEnc(output ? output : "-", doc, encoding); - } - if (ret < 0) { - fprintf(stderr, "failed save to %s\n", - output ? output : "-"); - progresult = XMLLINT_ERR_OUT; - } - } - else if (format) { - ret = xmlSaveFormatFile(output ? output : "-", doc, 1); - if (ret < 0) { - fprintf(stderr, "failed save to %s\n", - output ? output : "-"); - progresult = XMLLINT_ERR_OUT; + } else if (oldout) { + if (encoding != NULL) { + if ( format ) { + ret = xmlSaveFormatFileEnc(output ? output : "-", doc, + encoding, 1); + } + else { + ret = xmlSaveFileEnc(output ? output : "-", doc, + encoding); + } + if (ret < 0) { + fprintf(stderr, "failed save to %s\n", + output ? output : "-"); + progresult = XMLLINT_ERR_OUT; + } + } else if (format) { + ret = xmlSaveFormatFile(output ? output : "-", doc, 1); + if (ret < 0) { + fprintf(stderr, "failed save to %s\n", + output ? output : "-"); + progresult = XMLLINT_ERR_OUT; + } + } else { + FILE *out; + if (output == NULL) + out = stdout; + else { + out = fopen(output,"wb"); + } + if (out != NULL) { + if (xmlDocDump(out, doc) < 0) + progresult = XMLLINT_ERR_OUT; + + if (output != NULL) + fclose(out); + } else { + fprintf(stderr, "failed to open %s\n", output); + progresult = XMLLINT_ERR_OUT; + } } - } - else { - FILE *out; + } else { + xmlSaveCtxtPtr ctxt; + int saveOpts = 0; + + if (format) + saveOpts |= XML_SAVE_FORMAT; + if (output == NULL) - out = stdout; - else { - out = fopen(output,"wb"); - } - if (out != NULL) { - if (xmlDocDump(out, doc) < 0) - progresult = XMLLINT_ERR_OUT; + ctxt = xmlSaveToFd(1, encoding, saveOpts); + else + ctxt = xmlSaveToFilename(output, encoding, saveOpts); - if (output != NULL) - fclose(out); + if (ctxt != NULL) { + if (xmlSaveDoc(ctxt, doc) < 0) { + fprintf(stderr, "failed save to %s\n", + output ? output : "-"); + progresult = XMLLINT_ERR_OUT; + } + xmlSaveClose(ctxt); } else { - fprintf(stderr, "failed to open %s\n", output); progresult = XMLLINT_ERR_OUT; } } @@ -2752,6 +2802,7 @@ static void showVersion(const char *name) { if (xmlHasFeature(XML_WITH_DEBUG)) fprintf(stderr, "Debug "); if (xmlHasFeature(XML_WITH_DEBUG_MEM)) fprintf(stderr, "MemDebug "); if (xmlHasFeature(XML_WITH_DEBUG_RUN)) fprintf(stderr, "RunDebug "); + if (xmlHasFeature(XML_WITH_ZLIB)) fprintf(stderr, "Zlib "); fprintf(stderr, "\n"); } diff --git a/xmlmemory.c b/xmlmemory.c index 18e0ff1..362a0b0 100644 --- a/xmlmemory.c +++ b/xmlmemory.c @@ -577,7 +577,7 @@ xmlMemBlocks(void) { static void xmlMemContentShow(FILE *fp, MEMHDR *p) { - int i,j,len = p->mh_size; + int i,j,k,len = p->mh_size; const char *buf = (const char *) HDR_2_CLIENT(p); if (p == NULL) { @@ -594,13 +594,15 @@ xmlMemContentShow(FILE *fp, MEMHDR *p) MEMHDR *q; void *cur; - for (j = 0;j < len -3;j += 4) { + for (j = 0;(j < len -3) && (j < 40);j += 4) { cur = *((void **) &buf[j]); q = CLIENT_2_HDR(cur); p = memlist; + k = 0; while (p != NULL) { if (p == q) break; p = p->mh_next; + if (k++ > 100) break; } if ((p != NULL) && (p == q)) { fprintf(fp, " pointer to #%lu at index %d", diff --git a/xmlregexp.c b/xmlregexp.c index 58f480d..e7d519e 100644 --- a/xmlregexp.c +++ b/xmlregexp.c @@ -4807,6 +4807,11 @@ xmlFAParseCharRange(xmlRegParserCtxtPtr ctxt) { int start = -1; int end = -1; + if (CUR == '\0') { + ERROR("Expecting ']'"); + return; + } + if ((CUR == '&') && (NXT(1) == '#')) { end = start = xmlFAParseCharRef(ctxt); xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg, @@ -4897,7 +4902,7 @@ xmlFAParsePosCharGroup(xmlRegParserCtxtPtr ctxt) { xmlFAParseCharRange(ctxt); } } while ((CUR != ']') && (CUR != '^') && (CUR != '-') && - (ctxt->error == 0)); + (CUR != 0) && (ctxt->error == 0)); } /** diff --git a/xmlsave.c b/xmlsave.c index ba35f32..6963e7b 100644 --- a/xmlsave.c +++ b/xmlsave.c @@ -122,19 +122,19 @@ xmlSaveErr(int code, xmlNodePtr node, const char *extra) switch(code) { case XML_SAVE_NOT_UTF8: - msg = "string is not in UTF-8"; + msg = "string is not in UTF-8\n"; break; case XML_SAVE_CHAR_INVALID: - msg = "invalid character value"; + msg = "invalid character value\n"; break; case XML_SAVE_UNKNOWN_ENCODING: - msg = "unknown encoding %s"; + msg = "unknown encoding %s\n"; break; case XML_SAVE_NO_DOCTYPE: - msg = "document has no DOCTYPE"; + msg = "document has no DOCTYPE\n"; break; default: - msg = "unexpected error number"; + msg = "unexpected error number\n"; } __xmlSimpleError(XML_FROM_OUTPUT, code, node, msg, extra); } @@ -392,7 +392,7 @@ xmlNewSaveCtxt(const char *encoding, int options) return(NULL); } ret->encoding = xmlStrdup((const xmlChar *)encoding); - ret->escape = xmlEscapeEntities; + ret->escape = NULL; } xmlSaveCtxtInit(ret); @@ -464,7 +464,7 @@ xhtmlNodeDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur); static void xmlNodeListDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur); static void xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur); void xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur); -static void xmlDocContentDumpOutput(xmlSaveCtxtPtr ctxt, xmlDocPtr cur); +static int xmlDocContentDumpOutput(xmlSaveCtxtPtr ctxt, xmlDocPtr cur); /** * xmlNsDumpOutput: @@ -820,35 +820,77 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) { * * Dump an XML document. */ -static void +static int xmlDocContentDumpOutput(xmlSaveCtxtPtr ctxt, xmlDocPtr cur) { #ifdef LIBXML_HTML_ENABLED xmlDtdPtr dtd; int is_xhtml = 0; #endif const xmlChar *oldenc = cur->encoding; + const xmlChar *oldctxtenc = ctxt->encoding; const xmlChar *encoding = ctxt->encoding; - xmlOutputBufferPtr buf; + xmlCharEncodingOutputFunc oldescape = ctxt->escape; + xmlCharEncodingOutputFunc oldescapeAttr = ctxt->escapeAttr; + xmlOutputBufferPtr buf = ctxt->buf; + xmlCharEncodingHandlerPtr handler = NULL; + xmlCharEncoding enc; xmlInitParser(); - if (ctxt->encoding != NULL) + if (ctxt->encoding != NULL) { cur->encoding = BAD_CAST ctxt->encoding; + } else if (cur->encoding != NULL) { + encoding = cur->encoding; + } else if (cur->charset != XML_CHAR_ENCODING_UTF8) { + encoding = (const xmlChar *) + xmlGetCharEncodingName((xmlCharEncoding) cur->charset); + } - buf = ctxt->buf; + enc = xmlParseCharEncoding((const char*) encoding); + if ((encoding != NULL) && (oldctxtenc == NULL) && + (buf->encoder == NULL) && (buf->conv == NULL) && + ((ctxt->options & XML_SAVE_NO_DECL) == 0)) { + if ((enc != XML_CHAR_ENCODING_UTF8) && + (enc != XML_CHAR_ENCODING_NONE) && + (enc != XML_CHAR_ENCODING_ASCII)) { + /* + * we need to switch to this encoding but just for this document + * since we output the XMLDecl the conversion must be done to not + * generate not well formed documents. + */ + buf->encoder = xmlFindCharEncodingHandler((const char *)encoding); + if (buf->encoder == NULL) { + xmlSaveErr(XML_SAVE_UNKNOWN_ENCODING, NULL, + (const char *)encoding); + return(-1); + } + buf->conv = xmlBufferCreate(); + if (buf->conv == NULL) { + xmlCharEncCloseFunc(buf->encoder); + xmlSaveErrMemory("creating encoding buffer"); + return(-1); + } + /* + * initialize the state, e.g. if outputting a BOM + */ + xmlCharEncOutFunc(buf->encoder, buf->conv, NULL); + } + if (ctxt->escape == xmlEscapeEntities) + ctxt->escape = NULL; + if (ctxt->escapeAttr == xmlEscapeEntities) + ctxt->escapeAttr = NULL; + } + + + /* + * Save the XML declaration + */ if ((ctxt->options & XML_SAVE_NO_DECL) == 0) { xmlOutputBufferWrite(buf, 14, "version != NULL) xmlBufferWriteQuotedString(buf->buffer, cur->version); else xmlOutputBufferWrite(buf, 5, "\"1.0\""); - if (ctxt->encoding == NULL) { - if (cur->encoding != NULL) - encoding = cur->encoding; - else if (cur->charset != XML_CHAR_ENCODING_UTF8) - encoding = (const xmlChar *) - xmlGetCharEncodingName((xmlCharEncoding) cur->charset); - } if (encoding != NULL) { xmlOutputBufferWrite(buf, 10, " encoding="); xmlBufferWriteQuotedString(buf->buffer, (xmlChar *) encoding); @@ -890,6 +932,25 @@ xmlDocContentDumpOutput(xmlSaveCtxtPtr ctxt, xmlDocPtr cur) { } if (ctxt->encoding != NULL) cur->encoding = oldenc; + + /* + * Restore the state of the saving context at the end of the document + */ + if ((encoding != NULL) && (oldctxtenc == NULL) && + ((ctxt->options & XML_SAVE_NO_DECL) == 0)) { + if ((enc != XML_CHAR_ENCODING_UTF8) && + (enc != XML_CHAR_ENCODING_NONE) && + (enc != XML_CHAR_ENCODING_ASCII)) { + xmlOutputBufferFlush(buf); + xmlCharEncCloseFunc(buf->encoder); + xmlBufferFree(buf->conv); + buf->encoder = NULL; + buf->conv = NULL; + } + ctxt->escape = oldescape; + ctxt->escapeAttr = oldescapeAttr; + } + return(0); } #ifdef LIBXML_HTML_ENABLED @@ -1316,6 +1377,11 @@ xhtmlNodeDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) { xmlOutputBufferWriteEscape(buf, cur->content, ctxt->escape); } +#if 0 + /* + * This was removed due to problems with HTML processors. + * See bug #345147. + */ /* * 4.8. Script and Style elements */ @@ -1380,7 +1446,10 @@ xhtmlNodeDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) { } child = child->next; } - } else if (cur->children != NULL) { + } +#endif + + if (cur->children != NULL) { int indent = ctxt->format; if (format) xmlOutputBufferWrite(buf, 1, "\n"); @@ -1555,14 +1624,15 @@ xmlSaveDoc(xmlSaveCtxtPtr ctxt, xmlDocPtr doc) long ret = 0; if ((ctxt == NULL) || (doc == NULL)) return(-1); - xmlDocContentDumpOutput(ctxt, doc); + if (xmlDocContentDumpOutput(ctxt, doc) < 0) + return(-1); return(ret); } /** * xmlSaveTree: * @ctxt: a document saving context - * @node: a document + * @node: the top node of the subtree to save * * Save a subtree starting at the node parameter to a saving context * TODO: The function is not fully implemented yet as it does not return the diff --git a/xmlschemas.c b/xmlschemas.c index ff89e2c..11e3eac 100644 --- a/xmlschemas.c +++ b/xmlschemas.c @@ -84,6 +84,8 @@ /* #define DEBUG_IDC_NODE_TABLE */ +/* #define WXS_ELEM_DECL_CONS_ENABLED */ + #ifdef DEBUG_IDC #ifndef DEBUG_IDC_NODE_TABLE #define DEBUG_IDC_NODE_TABLE @@ -183,6 +185,8 @@ static const xmlChar *xmlNamespaceNs = (const xmlChar *) #define WXS_PARTICLE_TERM(p) (WXS_PARTICLE(p))->children +#define WXS_PARTICLE_TERM_AS_ELEM(p) (WXS_ELEM_CAST WXS_PARTICLE_TERM(p)) + #define WXS_PARTICLE_MODEL(p) WXS_MODEL_GROUP_CAST WXS_PARTICLE(p)->children /* * Macros for model groups definitions. @@ -242,6 +246,10 @@ static const xmlChar *xmlNamespaceNs = (const xmlChar *) #define WXS_IS_TYPE_NOT_FIXED_1(item) \ (((item)->type != XML_SCHEMA_TYPE_BASIC) && \ (((item)->flags & XML_SCHEMAS_TYPE_FIXUP_1) == 0)) + +#define WXS_TYPE_IS_GLOBAL(t) ((t)->flags & XML_SCHEMAS_TYPE_GLOBAL) + +#define WXS_TYPE_IS_LOCAL(t) (((t)->flags & XML_SCHEMAS_TYPE_GLOBAL) == 0) /* * Macros for exclusively for complex types. */ @@ -836,12 +844,12 @@ struct _xmlSchemaIDCMatcher { int type; int depth; /* the tree depth at creation time */ xmlSchemaIDCMatcherPtr next; /* next in the list */ + xmlSchemaIDCMatcherPtr nextCached; /* next in the cache list */ xmlSchemaIDCAugPtr aidc; /* the augmented IDC item */ int idcType; xmlSchemaPSVIIDCKeyPtr **keySeqs; /* the key-sequences of the target elements */ int sizeKeySeqs; - int targetDepth; xmlSchemaItemListPtr targets; /* list of target-node (xmlSchemaPSVIIDCNodePtr) entries */ }; @@ -993,6 +1001,7 @@ struct _xmlSchemaValidCtxt { xmlSchemaIDCStateObjPtr xpathStates; /* first active state object. */ xmlSchemaIDCStateObjPtr xpathStatePool; /* first stored state object. */ + xmlSchemaIDCMatcherPtr idcMatcherCache; /* Cache for IDC matcher objects. */ xmlSchemaPSVIIDCNodePtr *idcNodes; /* list of all IDC node-table entries*/ int nbIdcNodes; @@ -18287,10 +18296,18 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, if (type->contentType == XML_SCHEMA_CONTENT_EMPTY) { /* * SPEC (3.2.1) + * "If the ·effective content· is empty, then the + * {content type} of the [...] base ..." */ type->contentType = baseType->contentType; type->subtypes = baseType->subtypes; /* + * Fixes bug #347316: + * This is the case when the base type has a simple + * type definition as content. + */ + type->contentTypeDef = baseType->contentTypeDef; + /* * NOTE that the effective mixed is ignored here. */ } else if (baseType->contentType == XML_SCHEMA_CONTENT_EMPTY) { @@ -19736,6 +19753,123 @@ add_member: } } +#ifdef WXS_ELEM_DECL_CONS_ENABLED /* enable when finished */ +/** + * xmlSchemaCheckElementDeclComponent + * @pctxt: the schema parser context + * @ctxtComponent: the context component (an element declaration) + * @ctxtParticle: the first particle of the context component + * @searchParticle: the element declaration particle to be analysed + * + * Schema Component Constraint: Element Declarations Consistent + */ +static int +xmlSchemaCheckElementDeclConsistent(xmlSchemaParserCtxtPtr pctxt, + xmlSchemaBasicItemPtr ctxtComponent, + xmlSchemaParticlePtr ctxtParticle, + xmlSchemaParticlePtr searchParticle, + xmlSchemaParticlePtr curParticle, + int search) +{ + return(0); + + int ret = 0; + xmlSchemaParticlePtr cur = curParticle; + if (curParticle == NULL) { + return(0); + } + if (WXS_PARTICLE_TERM(curParticle) == NULL) { + /* + * Just return in this case. A missing "term" of the particle + * might arise due to an invalid "term" component. + */ + return(0); + } + while (cur != NULL) { + switch (WXS_PARTICLE_TERM(cur)->type) { + case XML_SCHEMA_TYPE_ANY: + break; + case XML_SCHEMA_TYPE_ELEMENT: + if (search == 0) { + ret = xmlSchemaCheckElementDeclConsistent(pctxt, + ctxtComponent, ctxtParticle, cur, ctxtParticle, 1); + if (ret != 0) + return(ret); + } else { + xmlSchemaElementPtr elem = + WXS_ELEM_CAST(WXS_PARTICLE_TERM(cur)); + /* + * SPEC Element Declarations Consistent: + * "If the {particles} contains, either directly, + * indirectly (that is, within the {particles} of a + * contained model group, recursively) or ·implicitly· + * two or more element declaration particles with + * the same {name} and {target namespace}, then + * all their type definitions must be the same + * top-level definition [...]" + */ + if (xmlStrEqual(WXS_PARTICLE_TERM_AS_ELEM(cur)->name, + WXS_PARTICLE_TERM_AS_ELEM(searchParticle)->name) && + xmlStrEqual(WXS_PARTICLE_TERM_AS_ELEM(cur)->targetNamespace, + WXS_PARTICLE_TERM_AS_ELEM(searchParticle)->targetNamespace)) + { + xmlChar *strA = NULL, *strB = NULL; + + xmlSchemaCustomErr(ACTXT_CAST pctxt, + /* TODO: error code */ + XML_SCHEMAP_COS_NONAMBIG, + WXS_ITEM_NODE(cur), NULL, + "In the content model of %s, there are multiple " + "element declarations for '%s' with different " + "type definitions", + xmlSchemaGetComponentDesignation(&strA, + ctxtComponent), + xmlSchemaFormatQName(&strB, + WXS_PARTICLE_TERM_AS_ELEM(cur)->targetNamespace, + WXS_PARTICLE_TERM_AS_ELEM(cur)->name)); + FREE_AND_NULL(strA); + FREE_AND_NULL(strB); + return(XML_SCHEMAP_COS_NONAMBIG); + } + } + break; + case XML_SCHEMA_TYPE_SEQUENCE: { + break; + } + case XML_SCHEMA_TYPE_CHOICE:{ + /* + xmlSchemaTreeItemPtr sub; + + sub = WXS_PARTICLE_TERM(particle)->children; (xmlSchemaParticlePtr) + while (sub != NULL) { + ret = xmlSchemaCheckElementDeclConsistent(pctxt, ctxtComponent, + ctxtParticle, ctxtElem); + if (ret != 0) + return(ret); + sub = sub->next; + } + */ + break; + } + case XML_SCHEMA_TYPE_ALL: + break; + case XML_SCHEMA_TYPE_GROUP: + break; + default: + xmlSchemaInternalErr2(ACTXT_CAST pctxt, + "xmlSchemaCheckElementDeclConsistent", + "found unexpected term of type '%s' in content model", + WXS_ITEM_TYPE_NAME(WXS_PARTICLE_TERM(cur)), NULL); + return(-1); + } + cur = (xmlSchemaParticlePtr) cur->next; + } + +exit: + return(ret); +} +#endif + /** * xmlSchemaCheckElementDeclComponent * @item: an schema element declaration/particle @@ -19743,8 +19877,7 @@ add_member: * @name: the name of the attribute * * Validates the value constraints of an element declaration. - * - * Fixes finish doing the computations on the element declarations. + * Adds substitution group members. */ static void xmlSchemaCheckElementDeclComponent(xmlSchemaElementPtr elemDecl, @@ -19755,8 +19888,12 @@ xmlSchemaCheckElementDeclComponent(xmlSchemaElementPtr elemDecl, if (elemDecl->flags & XML_SCHEMAS_ELEM_INTERNAL_CHECKED) return; elemDecl->flags |= XML_SCHEMAS_ELEM_INTERNAL_CHECKED; - if (xmlSchemaCheckElemPropsCorrect(ctxt, elemDecl) == 0) - xmlSchemaCheckElemSubstGroup(ctxt, elemDecl); + if (xmlSchemaCheckElemPropsCorrect(ctxt, elemDecl) == 0) { + /* + * Adds substitution group members. + */ + xmlSchemaCheckElemSubstGroup(ctxt, elemDecl); + } } /** @@ -20579,6 +20716,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, xmlSchemaTreeItemPtr item, *items; int nbItems, i, ret = 0; xmlSchemaBucketPtr oldbucket = con->bucket; + xmlSchemaElementPtr elemDecl; #define FIXHFAILURE if (pctxt->err == XML_SCHEMAP_INTERNAL) goto exit_failure; @@ -20852,7 +20990,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, if (pctxt->nberrors != 0) goto exit_error; /* - * At this point we need all simple types to be builded and checked. + * At this point we need build and check all simple types. */ /* * Apply contraints for attribute declarations. @@ -20919,8 +21057,8 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, if (pctxt->nberrors != 0) goto exit_error; - /* - * Fixup complex types. + /* + * Complex types are builded and checked. */ for (i = 0; i < nbItems; i++) { item = con->pending->items[i]; @@ -20943,11 +21081,8 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, * will create particles and model groups in some cases. */ items = (xmlSchemaTreeItemPtr *) con->pending->items; - nbItems = con->pending->nbItems; - - /* - * At this point all complex types need to be builded and checked. - */ + nbItems = con->pending->nbItems; + /* * Apply some constraints for element declarations. */ @@ -20955,13 +21090,30 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, item = items[i]; switch (item->type) { case XML_SCHEMA_TYPE_ELEMENT: + elemDecl = (xmlSchemaElementPtr) item; - if ((((xmlSchemaElementPtr) item)->flags & - XML_SCHEMAS_ELEM_INTERNAL_CHECKED) == 0) { + if ((elemDecl->flags & XML_SCHEMAS_ELEM_INTERNAL_CHECKED) == 0) + { xmlSchemaCheckElementDeclComponent( - (xmlSchemaElementPtr) item, pctxt); + (xmlSchemaElementPtr) elemDecl, pctxt); FIXHFAILURE; } + +#ifdef WXS_ELEM_DECL_CONS_ENABLED + /* + * Schema Component Constraint: Element Declarations Consistent + * Apply this constraint to local types of element declarations. + */ + if ((WXS_ELEM_TYPEDEF(elemDecl) != NULL) && + (WXS_IS_COMPLEX(WXS_ELEM_TYPEDEF(elemDecl))) && + (WXS_TYPE_IS_LOCAL(WXS_ELEM_TYPEDEF(elemDecl)))) + { + xmlSchemaCheckElementDeclConsistent(pctxt, + WXS_BASIC_CAST elemDecl, + WXS_TYPE_PARTICLE(WXS_ELEM_TYPEDEF(elemDecl)), + NULL, NULL, 0); + } +#endif break; default: break; @@ -20969,6 +21121,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, } if (pctxt->nberrors != 0) goto exit_error; + /* * Finally we can build the automaton from the content model of * complex types. @@ -22005,7 +22158,7 @@ xmlSchemaIDCFreeMatcherList(xmlSchemaIDCMatcherPtr matcher) while (matcher != NULL) { next = matcher->next; - if (matcher->keySeqs != NULL) { + if (matcher->keySeqs != NULL) { int i; for (i = 0; i < matcher->sizeKeySeqs; i++) if (matcher->keySeqs[i] != NULL) @@ -22035,6 +22188,63 @@ xmlSchemaIDCFreeMatcherList(xmlSchemaIDCMatcherPtr matcher) } } +/** + * xmlSchemaIDCReleaseMatcherList: + * @vctxt: the WXS validation context + * @matcher: the first IDC matcher in the list + * + * Caches a list of IDC matchers for reuse. + */ +static void +xmlSchemaIDCReleaseMatcherList(xmlSchemaValidCtxtPtr vctxt, + xmlSchemaIDCMatcherPtr matcher) +{ + xmlSchemaIDCMatcherPtr next; + + while (matcher != NULL) { + next = matcher->next; + if (matcher->keySeqs != NULL) { + int i; + /* + * Don't free the array, but only the content. + */ + for (i = 0; i < matcher->sizeKeySeqs; i++) + if (matcher->keySeqs[i] != NULL) { + xmlFree(matcher->keySeqs[i]); + matcher->keySeqs[i] = NULL; + } + } + if (matcher->targets) { + if (matcher->idcType == XML_SCHEMA_TYPE_IDC_KEYREF) { + int i; + xmlSchemaPSVIIDCNodePtr idcNode; + /* + * Node-table items for keyrefs are not stored globally + * to the validation context, since they are not bubbled. + * We need to free them here. + */ + for (i = 0; i < matcher->targets->nbItems; i++) { + idcNode = + (xmlSchemaPSVIIDCNodePtr) matcher->targets->items[i]; + xmlFree(idcNode->keys); + xmlFree(idcNode); + } + } + xmlSchemaItemListFree(matcher->targets); + matcher->targets = NULL; + } + matcher->next = NULL; + /* + * Cache the matcher. + */ + if (vctxt->idcMatcherCache != NULL) + matcher->nextCached = vctxt->idcMatcherCache; + vctxt->idcMatcherCache = matcher; + + matcher = next; + } +} + /** * xmlSchemaIDCAddStateObject: * @vctxt: the WXS validation context @@ -22189,7 +22399,7 @@ xmlSchemaXPathEvaluate(xmlSchemaValidCtxtPtr vctxt, "allocating the state object history", NULL); return(-1); } - sto->sizeHistory = 10; + sto->sizeHistory = 5; } else if (sto->sizeHistory <= sto->nbHistory) { sto->sizeHistory *= 2; sto->history = (int *) xmlRealloc(sto->history, @@ -22815,7 +23025,7 @@ deregister_check: /* * Link it to the pool of reusable state objects. */ - vctxt->xpathStatePool = sto; + vctxt->xpathStatePool = sto; sto = nextsto; } else sto = sto->next; @@ -22912,14 +23122,23 @@ xmlSchemaIDCRegisterMatchers(xmlSchemaValidCtxtPtr vctxt, /* * Create an IDC matcher for every IDC definition. */ - matcher = (xmlSchemaIDCMatcherPtr) - xmlMalloc(sizeof(xmlSchemaIDCMatcher)); - if (matcher == NULL) { - xmlSchemaVErrMemory(vctxt, - "allocating an IDC matcher", NULL); - return (-1); + if (vctxt->idcMatcherCache != NULL) { + /* + * Reuse a cached matcher. + */ + matcher = vctxt->idcMatcherCache; + vctxt->idcMatcherCache = matcher->nextCached; + matcher->nextCached = NULL; + } else { + matcher = (xmlSchemaIDCMatcherPtr) + xmlMalloc(sizeof(xmlSchemaIDCMatcher)); + if (matcher == NULL) { + xmlSchemaVErrMemory(vctxt, + "allocating an IDC matcher", NULL); + return (-1); + } + memset(matcher, 0, sizeof(xmlSchemaIDCMatcher)); } - memset(matcher, 0, sizeof(xmlSchemaIDCMatcher)); if (last == NULL) vctxt->inode->idcMatchers = matcher; else @@ -23665,8 +23884,14 @@ xmlSchemaValidatorPushAttribute(xmlSchemaValidCtxtPtr vctxt, return (0); } +/** + * xmlSchemaClearElemInfo: + * @vctxt: the WXS validation context + * @ielem: the element information item + */ static void -xmlSchemaClearElemInfo(xmlSchemaNodeInfoPtr ielem) +xmlSchemaClearElemInfo(xmlSchemaValidCtxtPtr vctxt, + xmlSchemaNodeInfoPtr ielem) { ielem->hasKeyrefs = 0; ielem->appliedXPath = 0; @@ -23692,9 +23917,13 @@ xmlSchemaClearElemInfo(xmlSchemaNodeInfoPtr ielem) } if (ielem->idcMatchers != NULL) { /* - * URGENT OPTIMIZE TODO: Use a pool of IDC matchers. + * REVISIT OPTIMIZE TODO: Use a pool of IDC matchers. + * Does it work? */ + xmlSchemaIDCReleaseMatcherList(vctxt, ielem->idcMatchers); +#if 0 xmlSchemaIDCFreeMatcherList(ielem->idcMatchers); +#endif ielem->idcMatchers = NULL; } if (ielem->idcTable != NULL) { @@ -26060,7 +26289,7 @@ end_elem: * VAL TODO: Don't free the PSVI IDC tables if they are * requested for the PSVI. */ - xmlSchemaClearElemInfo(inode); + xmlSchemaClearElemInfo(vctxt, inode); /* * Skip further processing if we are on the validation root. */ @@ -27160,6 +27389,18 @@ xmlSchemaClearValidCtxt(xmlSchemaValidCtxtPtr vctxt) } while (cur != NULL); vctxt->aidcs = NULL; } + if (vctxt->idcMatcherCache != NULL) { + xmlSchemaIDCMatcherPtr matcher = vctxt->idcMatcherCache, tmp; + + while (matcher) { + tmp = matcher; + matcher = matcher->nextCached; + xmlSchemaIDCFreeMatcherList(tmp); + } + vctxt->idcMatcherCache = NULL; + } + + if (vctxt->idcNodes != NULL) { int i; xmlSchemaPSVIIDCNodePtr item; @@ -27171,6 +27412,8 @@ xmlSchemaClearValidCtxt(xmlSchemaValidCtxtPtr vctxt) } xmlFree(vctxt->idcNodes); vctxt->idcNodes = NULL; + vctxt->nbIdcNodes = 0; + vctxt->sizeIdcNodes = 0; } /* * Note that we won't delete the XPath state pool here. @@ -27196,7 +27439,7 @@ xmlSchemaClearValidCtxt(xmlSchemaValidCtxtPtr vctxt) ei = vctxt->elemInfos[i]; if (ei == NULL) break; - xmlSchemaClearElemInfo(ei); + xmlSchemaClearElemInfo(vctxt, ei); } } xmlSchemaItemListClear(vctxt->nodeQNames); @@ -27242,10 +27485,14 @@ xmlSchemaFreeValidCtxt(xmlSchemaValidCtxtPtr ctxt) xmlFree(ctxt->idcKeys); } - if (ctxt->xpathStates != NULL) + if (ctxt->xpathStates != NULL) { xmlSchemaFreeIDCStateObjList(ctxt->xpathStates); - if (ctxt->xpathStatePool != NULL) + ctxt->xpathStates = NULL; + } + if (ctxt->xpathStatePool != NULL) { xmlSchemaFreeIDCStateObjList(ctxt->xpathStatePool); + ctxt->xpathStatePool = NULL; + } /* * Augmented IDC information. @@ -27279,7 +27526,7 @@ xmlSchemaFreeValidCtxt(xmlSchemaValidCtxtPtr ctxt) ei = ctxt->elemInfos[i]; if (ei == NULL) break; - xmlSchemaClearElemInfo(ei); + xmlSchemaClearElemInfo(ctxt, ei); xmlFree(ei); } xmlFree(ctxt->elemInfos); diff --git a/xmlschemastypes.c b/xmlschemastypes.c index 987f85f..a35c539 100644 --- a/xmlschemastypes.c +++ b/xmlschemastypes.c @@ -5715,6 +5715,8 @@ xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlChar **retValue) if ((dec.frac == 0) || (dec.frac == dec.total)) bufsize++; buf = xmlMalloc(bufsize); + if (buf == NULL) + return(-1); offs = buf; if (dec.sign) *offs++ = '-'; @@ -5788,6 +5790,8 @@ xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlChar **retValue) if (dec.sign) bufsize++; *retValue = xmlMalloc(bufsize); + if (*retValue == NULL) + return(-1); if (dec.hi != 0) { if (dec.sign) snprintf((char *) *retValue, bufsize, @@ -5863,7 +5867,9 @@ xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlChar **retValue) case XML_SCHEMAS_GMONTH: { /* TODO: Unclear in XML Schema 1.0 */ /* TODO: What to do with the timezone? */ - *retValue = xmlMalloc(5); + *retValue = xmlMalloc(6); + if (*retValue == NULL) + return(-1); snprintf((char *) *retValue, 6, "--%02u", val->value.date.mon); } @@ -5872,6 +5878,8 @@ xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlChar **retValue) /* TODO: Unclear in XML Schema 1.0 */ /* TODO: What to do with the timezone? */ *retValue = xmlMalloc(6); + if (*retValue == NULL) + return(-1); snprintf((char *) *retValue, 6, "---%02u", val->value.date.day); } @@ -5880,6 +5888,8 @@ xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlChar **retValue) /* TODO: Unclear in XML Schema 1.0 */ /* TODO: What to do with the timezone? */ *retValue = xmlMalloc(8); + if (*retValue == NULL) + return(-1); snprintf((char *) *retValue, 8, "--%02u-%02u", val->value.date.mon, val->value.date.day); } @@ -6024,6 +6034,8 @@ xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlChar **retValue) *retValue = BAD_CAST xmlStrdup(BAD_CAST "???"); return (1); } + if (*retValue == NULL) + return(-1); return (0); } diff --git a/xmlwriter.c b/xmlwriter.c index 43934b3..74838e6 100644 --- a/xmlwriter.c +++ b/xmlwriter.c @@ -91,6 +91,7 @@ struct _xmlTextWriter { char qchar; /* character used for quoting attribute values */ xmlParserCtxtPtr ctxt; int no_doc_free; + xmlDocPtr doc; }; static void xmlFreeTextWriterStackEntry(xmlLinkPtr lk); @@ -215,6 +216,9 @@ xmlNewTextWriter(xmlOutputBufferPtr out) "xmlNewTextWriter : out of memory!\n"); return NULL; } + + ret->doc = xmlNewDoc(NULL); + ret->no_doc_free = 0; return ret; @@ -487,6 +491,9 @@ xmlFreeTextWriter(xmlTextWriterPtr writer) xmlFreeParserCtxt(writer->ctxt); } + if (writer->doc != NULL) + xmlFreeDoc(writer->doc); + if (writer->ichar != NULL) xmlFree(writer->ichar); xmlFree(writer); @@ -539,6 +546,8 @@ xmlTextWriterStartDocument(xmlTextWriterPtr writer, const char *version, if (encoder != NULL) { writer->out->conv = xmlBufferCreateSize(4000); xmlCharEncOutFunc(encoder, writer->out->conv, NULL); + if ((writer->doc != NULL) && (writer->doc->encoding == NULL)) + writer->doc->encoding = xmlStrdup((xmlChar *)writer->out->encoder->name); } else writer->out->conv = NULL; @@ -1425,7 +1434,7 @@ xmlTextWriterWriteString(xmlTextWriterPtr writer, const xmlChar * content) break; case XML_TEXTWRITER_ATTRIBUTE: buf = NULL; - xmlAttrSerializeTxtContent(writer->out->buffer, NULL, + xmlAttrSerializeTxtContent(writer->out->buffer, writer->doc, NULL, content); break; default: diff --git a/xpath.c b/xpath.c index c6c2274..8964628 100644 --- a/xpath.c +++ b/xpath.c @@ -64,18 +64,6 @@ "Unimplemented block at %s:%d\n", \ __FILE__, __LINE__); -/* -* XP_PATTERN_TO_ANY_NODE_ENABLED: when an XPath expression can be -* evaluated using the streaming mode (pattern.c) then this is used to -* enable resolution to nodes of type text-node, cdata-section-node, -* comment-node and pi-node. The only known scenario where this is -* needed is an expression like "foo//.", "//.", etc.; i.e. an expression -* where the final node to be selected can be of any type. -* Disabling this #define will result in an incorrect evaluation to -* only element-nodes and the document node. -*/ -#define XP_PATTERN_TO_ANY_NODE_ENABLED - /* * XP_OPTIMIZED_NON_ELEM_COMPARISON: * If defined, this will use xmlXPathCmpNodesExt() instead of @@ -109,15 +97,6 @@ */ #if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -/************************************************************************ - * * - * Forward declarations * - * * - ************************************************************************/ -static void -xmlXPathFreeValueTree(xmlNodeSetPtr obj); -static void -xmlXPathReleaseObject(xmlXPathContextPtr ctxt, xmlXPathObjectPtr obj); /************************************************************************ * * @@ -606,6 +585,23 @@ struct _xmlXPathCompExpr { #endif }; +/************************************************************************ + * * + * Forward declarations * + * * + ************************************************************************/ +static void +xmlXPathFreeValueTree(xmlNodeSetPtr obj); +static void +xmlXPathReleaseObject(xmlXPathContextPtr ctxt, xmlXPathObjectPtr obj); +static int +xmlXPathCompOpEvalFirst(xmlXPathParserContextPtr ctxt, + xmlXPathStepOpPtr op, xmlNodePtr *first); +static int +xmlXPathCompOpEvalToBoolean(xmlXPathParserContextPtr ctxt, + xmlXPathStepOpPtr op, + int isPredicate); + /************************************************************************ * * * Parser Type functions * @@ -736,6 +732,7 @@ xmlXPathCompExprAdd(xmlXPathCompExprPtr comp, int ch1, int ch2, comp->steps = real; } comp->last = comp->nbStep; + comp->steps[comp->nbStep].rewriteType = 0; comp->steps[comp->nbStep].ch1 = ch1; comp->steps[comp->nbStep].ch2 = ch2; comp->steps[comp->nbStep].op = op; @@ -2327,22 +2324,20 @@ xmlXPathCacheObjectCopy(xmlXPathContextPtr ctxt, xmlXPathObjectPtr val) if (val == NULL) return(NULL); - switch (val->type) { - case XPATH_NODESET: - if (XP_HAS_CACHE(ctxt)) + if (XP_HAS_CACHE(ctxt)) { + switch (val->type) { + case XPATH_NODESET: return(xmlXPathCacheWrapNodeSet(ctxt, xmlXPathNodeSetMerge(NULL, val->nodesetval))); - case XPATH_STRING: - if (XP_HAS_CACHE(ctxt)) + case XPATH_STRING: return(xmlXPathCacheNewString(ctxt, val->stringval)); - case XPATH_BOOLEAN: - if (XP_HAS_CACHE(ctxt)) + case XPATH_BOOLEAN: return(xmlXPathCacheNewBoolean(ctxt, val->boolval)); - case XPATH_NUMBER: - if (XP_HAS_CACHE(ctxt)) - return(xmlXPathCacheNewFloat(ctxt, val->floatval)); - default: - break; + case XPATH_NUMBER: + return(xmlXPathCacheNewFloat(ctxt, val->floatval)); + default: + break; + } } return(xmlXPathObjectCopy(val)); } @@ -3399,6 +3394,37 @@ xmlXPathNodeSetCreate(xmlNodePtr val) { return(ret); } +/** + * xmlXPathNodeSetCreateSize: + * @size: the initial size of the set + * + * Create a new xmlNodeSetPtr of type double and of value @val + * + * Returns the newly created object. + */ +static xmlNodeSetPtr +xmlXPathNodeSetCreateSize(int size) { + xmlNodeSetPtr ret; + + ret = (xmlNodeSetPtr) xmlMalloc(sizeof(xmlNodeSet)); + if (ret == NULL) { + xmlXPathErrMemory(NULL, "creating nodeset\n"); + return(NULL); + } + memset(ret, 0 , (size_t) sizeof(xmlNodeSet)); + if (size < XML_NODESET_DEFAULT) + size = XML_NODESET_DEFAULT; + ret->nodeTab = (xmlNodePtr *) xmlMalloc(size * sizeof(xmlNodePtr)); + if (ret->nodeTab == NULL) { + xmlXPathErrMemory(NULL, "creating nodeset\n"); + xmlFree(ret); + return(NULL); + } + memset(ret->nodeTab, 0 , size * (size_t) sizeof(xmlNodePtr)); + ret->nodeMax = size; + return(ret); +} + /** * xmlXPathNodeSetContains: * @cur: the node-set @@ -3717,6 +3743,7 @@ xmlXPathNodeSetMerge(xmlNodeSetPtr val1, xmlNodeSetPtr val2) { return(val1); } +#if 0 /* xmlXPathNodeSetMergeUnique() is currently not used anymore */ /** * xmlXPathNodeSetMergeUnique: * @val1: the first NodeSet or NULL @@ -3775,6 +3802,188 @@ xmlXPathNodeSetMergeUnique(xmlNodeSetPtr val1, xmlNodeSetPtr val2) { return(val1); } +#endif /* xmlXPathNodeSetMergeUnique() is currently not used anymore */ + +/** + * xmlXPathNodeSetMergeAndClear: + * @set1: the first NodeSet or NULL + * @set2: the second NodeSet + * @hasSet2NsNodes: 1 if set2 contains namespaces nodes + * + * Merges two nodesets, all nodes from @set2 are added to @set1 + * if @set1 is NULL, a new set is created and copied from @set2. + * Checks for duplicate nodes. Clears set2. + * + * Returns @set1 once extended or NULL in case of error. + */ +static xmlNodeSetPtr +xmlXPathNodeSetMergeAndClear(xmlNodeSetPtr set1, xmlNodeSetPtr set2, + int hasNullEntries) +{ + if ((set1 == NULL) && (hasNullEntries == 0)) { + /* + * Note that doing a memcpy of the list, namespace nodes are + * just assigned to set1, since set2 is cleared anyway. + */ + set1 = xmlXPathNodeSetCreateSize(set2->nodeNr); + if (set1 == NULL) + return(NULL); + if (set2->nodeNr != 0) { + memcpy(set1->nodeTab, set2->nodeTab, + set2->nodeNr * sizeof(xmlNodePtr)); + set1->nodeNr = set2->nodeNr; + } + } else { + int i, j, initNbSet1; + xmlNodePtr n1, n2; + + if (set1 == NULL) + set1 = xmlXPathNodeSetCreate(NULL); + + initNbSet1 = set1->nodeNr; + for (i = 0;i < set2->nodeNr;i++) { + n2 = set2->nodeTab[i]; + /* + * Skip NULLed entries. + */ + if (n2 == NULL) + continue; + /* + * Skip duplicates. + */ + for (j = 0; j < initNbSet1; j++) { + n1 = set1->nodeTab[j]; + if (n1 == n2) { + goto skip_node; + } else if ((n1->type == XML_NAMESPACE_DECL) && + (n2->type == XML_NAMESPACE_DECL)) + { + if ((((xmlNsPtr) n1)->next == ((xmlNsPtr) n2)->next) && + (xmlStrEqual(((xmlNsPtr) n1)->prefix, + ((xmlNsPtr) n2)->prefix))) + { + /* + * Free the namespace node. + */ + set2->nodeTab[i] = NULL; + xmlXPathNodeSetFreeNs((xmlNsPtr) n2); + goto skip_node; + } + } + } + /* + * grow the nodeTab if needed + */ + if (set1->nodeMax == 0) { + set1->nodeTab = (xmlNodePtr *) xmlMalloc( + XML_NODESET_DEFAULT * sizeof(xmlNodePtr)); + if (set1->nodeTab == NULL) { + xmlXPathErrMemory(NULL, "merging nodeset\n"); + return(NULL); + } + memset(set1->nodeTab, 0, + XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr)); + set1->nodeMax = XML_NODESET_DEFAULT; + } else if (set1->nodeNr >= set1->nodeMax) { + xmlNodePtr *temp; + + set1->nodeMax *= 2; + temp = (xmlNodePtr *) xmlRealloc( + set1->nodeTab, set1->nodeMax * sizeof(xmlNodePtr)); + if (temp == NULL) { + xmlXPathErrMemory(NULL, "merging nodeset\n"); + return(NULL); + } + set1->nodeTab = temp; + } + if (n2->type == XML_NAMESPACE_DECL) { + xmlNsPtr ns = (xmlNsPtr) n2; + + set1->nodeTab[set1->nodeNr++] = + xmlXPathNodeSetDupNs((xmlNodePtr) ns->next, ns); + } else + set1->nodeTab[set1->nodeNr++] = n2; +skip_node: + {} + } + } + set2->nodeNr = 0; + return(set1); +} + +/** + * xmlXPathNodeSetMergeAndClearNoDupls: + * @set1: the first NodeSet or NULL + * @set2: the second NodeSet + * @hasSet2NsNodes: 1 if set2 contains namespaces nodes + * + * Merges two nodesets, all nodes from @set2 are added to @set1 + * if @set1 is NULL, a new set is created and copied from @set2. + * Doesn't chack for duplicate nodes. Clears set2. + * + * Returns @set1 once extended or NULL in case of error. + */ +static xmlNodeSetPtr +xmlXPathNodeSetMergeAndClearNoDupls(xmlNodeSetPtr set1, xmlNodeSetPtr set2, + int hasNullEntries) +{ + if (set2 == NULL) + return(set1); + if ((set1 == NULL) && (hasNullEntries == 0)) { + /* + * Note that doing a memcpy of the list, namespace nodes are + * just assigned to set1, since set2 is cleared anyway. + */ + set1 = xmlXPathNodeSetCreateSize(set2->nodeNr); + if (set1 == NULL) + return(NULL); + if (set2->nodeNr != 0) { + memcpy(set1->nodeTab, set2->nodeTab, + set2->nodeNr * sizeof(xmlNodePtr)); + set1->nodeNr = set2->nodeNr; + } + } else { + int i; + xmlNodePtr n2; + + if (set1 == NULL) + set1 = xmlXPathNodeSetCreate(NULL); + + for (i = 0;i < set2->nodeNr;i++) { + n2 = set2->nodeTab[i]; + /* + * Skip NULLed entries. + */ + if (n2 == NULL) + continue; + if (set1->nodeMax == 0) { + set1->nodeTab = (xmlNodePtr *) xmlMalloc( + XML_NODESET_DEFAULT * sizeof(xmlNodePtr)); + if (set1->nodeTab == NULL) { + xmlXPathErrMemory(NULL, "merging nodeset\n"); + return(NULL); + } + memset(set1->nodeTab, 0, + XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr)); + set1->nodeMax = XML_NODESET_DEFAULT; + } else if (set1->nodeNr >= set1->nodeMax) { + xmlNodePtr *temp; + + set1->nodeMax *= 2; + temp = (xmlNodePtr *) xmlRealloc( + set1->nodeTab, set1->nodeMax * sizeof(xmlNodePtr)); + if (temp == NULL) { + xmlXPathErrMemory(NULL, "merging nodeset\n"); + return(NULL); + } + set1->nodeTab = temp; + } + set1->nodeTab[set1->nodeNr++] = n2; + } + } + set2->nodeNr = 0; + return(set1); +} /** * xmlXPathNodeSetDel: @@ -3857,32 +4066,59 @@ xmlXPathFreeNodeSet(xmlNodeSetPtr obj) { /** * xmlXPathNodeSetClear: - * @set: the xmlNodeSetPtr to free + * @set: the node set to clear * * Clears the list from all temporary XPath objects (e.g. namespace nodes * are feed), but does *not* free the list itself. Sets the length of the * list to 0. */ static void -xmlXPathNodeSetClear(xmlNodeSetPtr set) -{ - int i; - xmlNodePtr node; - +xmlXPathNodeSetClear(xmlNodeSetPtr set, int hasNsNodes) +{ if ((set == NULL) || (set->nodeNr <= 0)) return; - - for (i = 0; i < set->nodeNr; i++) { - node = set->nodeTab[i]; - if ((node != NULL) && - (node->type == XML_NAMESPACE_DECL)) - { - xmlXPathNodeSetFreeNs((xmlNsPtr) node); - } + else if (hasNsNodes) { + int i; + xmlNodePtr node; + + for (i = 0; i < set->nodeNr; i++) { + node = set->nodeTab[i]; + if ((node != NULL) && + (node->type == XML_NAMESPACE_DECL)) + xmlXPathNodeSetFreeNs((xmlNsPtr) node); + } } set->nodeNr = 0; } +/** + * xmlXPathNodeSetClearFromPos: + * @set: the node set to be cleared + * @pos: the start position to clear from + * + * Clears the list from temporary XPath objects (e.g. namespace nodes + * are feed) starting with the entry at @pos, but does *not* free the list + * itself. Sets the length of the list to @pos. + */ +static void +xmlXPathNodeSetClearFromPos(xmlNodeSetPtr set, int pos, int hasNsNodes) +{ + if ((set == NULL) || (set->nodeNr <= 0) || (pos >= set->nodeNr)) + return; + else if ((hasNsNodes)) { + int i; + xmlNodePtr node; + + for (i = pos; i < set->nodeNr; i++) { + node = set->nodeTab[i]; + if ((node != NULL) && + (node->type == XML_NAMESPACE_DECL)) + xmlXPathNodeSetFreeNs((xmlNsPtr) node); + } + } + set->nodeNr = pos; +} + /** * xmlXPathFreeValueTree: * @obj: the xmlNodeSetPtr to free @@ -5361,9 +5597,8 @@ xmlXPathCastNodeSetToString (xmlNodeSetPtr ns) { * * Converts an existing object to its string() equivalent * - * Returns the string value of the object, NULL in case of error. - * A new string is allocated only if needed (@val isn't a - * string object). + * Returns the allocated string value of the object, NULL in case of error. + * It's up to the caller to free the string memory with xmlFree(). */ xmlChar * xmlXPathCastToString(xmlXPathObjectPtr val) { @@ -5795,6 +6030,17 @@ xmlXPathFreeContext(xmlXPathContextPtr ctxt) { return(NULL); \ } \ +#define CHECK_CTXT_NEG(ctxt) \ + if (ctxt == NULL) { \ + __xmlRaiseError(NULL, NULL, NULL, \ + NULL, NULL, XML_FROM_XPATH, \ + XML_ERR_INTERNAL_ERROR, XML_ERR_FATAL, \ + __FILE__, __LINE__, \ + NULL, NULL, NULL, 0, 0, \ + "NULL context pointer\n"); \ + return(-1); \ + } \ + #define CHECK_CONTEXT(ctxt) \ if ((ctxt == NULL) || (ctxt->doc == NULL) || \ @@ -7221,6 +7467,13 @@ typedef xmlNodePtr (*xmlXPathTraversalFunction) typedef xmlNodePtr (*xmlXPathTraversalFunctionExt) (xmlNodePtr cur, xmlNodePtr contextNode); +/* + * xmlXPathNodeSetMergeFunction: + * Used for merging node sets in xmlXPathCollectAndTest(). + */ +typedef xmlNodeSetPtr (*xmlXPathNodeSetMergeFunction) + (xmlNodeSetPtr, xmlNodeSetPtr, int); + /** * xmlXPathNextSelf: @@ -10602,7 +10855,19 @@ xmlXPathCompPredicate(xmlXPathParserContextPtr ctxt, int filter) { SKIP_BLANKS; ctxt->comp->last = -1; - xmlXPathCompileExpr(ctxt, 1); + /* + * This call to xmlXPathCompileExpr() will deactivate sorting + * of the predicate result. + * TODO: Sorting is still activated for filters, since I'm not + * sure if needed. Normally sorting should not be needed, since + * a filter can only diminish the number of items in a sequence, + * but won't change its order; so if the initial sequence is sorted, + * subsequent sorting is not needed. + */ + if (! filter) + xmlXPathCompileExpr(ctxt, 0); + else + xmlXPathCompileExpr(ctxt, 1); CHECK_ERROR; if (CUR != ']') { @@ -11092,201 +11357,60 @@ xmlXPathCompLocationPath(xmlXPathParserContextPtr ctxt) { static int xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op); -/** - * xmlXPathNodeCollectAndTest: - * @ctxt: the XPath Parser context - * @op: the XPath precompiled step operation - * @first: pointer to the first element in document order - * @last: pointer to the last element in document order - * - * This is the function implementing a step: based on the current list - * of nodes, it builds up a new list, looking at all nodes under that - * axis and selecting them. It also does the predicate filtering - * - * Pushes the new NodeSet resulting from the search. - * - * Returns the number of nodes traversed - */ -static int -xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, - xmlXPathStepOpPtr op, - xmlNodePtr * first, xmlNodePtr * last) -{ - xmlXPathAxisVal axis = (xmlXPathAxisVal) op->value; - xmlXPathTestVal test = (xmlXPathTestVal) op->value2; - xmlXPathTypeVal type = (xmlXPathTypeVal) op->value3; - const xmlChar *prefix = op->value4; - const xmlChar *name = op->value5; - const xmlChar *URI = NULL; - -#ifdef DEBUG_STEP - int nbMatches = 0; -#endif - int inputIdx, total = 0, specialNodeInSet = 0; - xmlNodeSetPtr inputList, resultList, list; - xmlXPathTraversalFunction next = NULL; - xmlXPathTraversalFunctionExt compoundNext = NULL; - void (*addNode) (xmlNodeSetPtr, xmlNodePtr); - xmlNodeSetPtr (*mergeNodeSet) (xmlNodeSetPtr, xmlNodeSetPtr); - xmlNodePtr oldContextNode, contextNode, cur, compoundContextNode; - xmlXPathObjectPtr obj; - xmlXPathContextPtr xpctxt = ctxt->context; - - CHECK_TYPE0(XPATH_NODESET); - obj = valuePop(ctxt); - - /* - * Setup wrt namespaces. - */ - if (prefix != NULL) { - URI = xmlXPathNsLookup(xpctxt, prefix); - if (URI == NULL) { - xmlXPathFreeObject(obj); - XP_ERROR0(XPATH_UNDEF_PREFIX_ERROR); - } - } - #ifdef DEBUG_STEP +static void +xmlXPathDebugDumpStepAxis(xmlXPathAxisVal axis, + xmlXPathTestVal test, + int nbNodes) +{ xmlGenericError(xmlGenericErrorContext, "new step : "); -#endif - - /* - * Setup wrt the axis. - */ - addNode = xmlXPathNodeSetAdd; - mergeNodeSet = xmlXPathNodeSetMerge; switch (axis) { case AXIS_ANCESTOR: -#ifdef DEBUG_STEP xmlGenericError(xmlGenericErrorContext, "axis 'ancestors' "); -#endif - first = NULL; - next = xmlXPathNextAncestor; break; case AXIS_ANCESTOR_OR_SELF: -#ifdef DEBUG_STEP xmlGenericError(xmlGenericErrorContext, "axis 'ancestors-or-self' "); -#endif - first = NULL; - next = xmlXPathNextAncestorOrSelf; break; case AXIS_ATTRIBUTE: -#ifdef DEBUG_STEP xmlGenericError(xmlGenericErrorContext, "axis 'attributes' "); -#endif - first = NULL; - last = NULL; - next = xmlXPathNextAttribute; - mergeNodeSet = xmlXPathNodeSetMergeUnique; break; case AXIS_CHILD: -#ifdef DEBUG_STEP xmlGenericError(xmlGenericErrorContext, "axis 'child' "); -#endif - last = NULL; - if (op->rewriteType == XP_REWRITE_DOS_CHILD_ELEM) { - /* - * This iterator will give us only nodes which can - * hold element nodes. - */ - compoundNext = xmlXPathNextDescendantOrSelfElemParent; - } - if ((test == NODE_TEST_NAME) && (type == NODE_TYPE_NODE)) { - /* - * Optimization if an element node type is 'element'. - */ - next = xmlXPathNextChildElement; - } else - next = xmlXPathNextChild; - mergeNodeSet = xmlXPathNodeSetMergeUnique; break; case AXIS_DESCENDANT: -#ifdef DEBUG_STEP xmlGenericError(xmlGenericErrorContext, "axis 'descendant' "); -#endif - last = NULL; - next = xmlXPathNextDescendant; break; case AXIS_DESCENDANT_OR_SELF: -#ifdef DEBUG_STEP xmlGenericError(xmlGenericErrorContext, "axis 'descendant-or-self' "); -#endif - last = NULL; - next = xmlXPathNextDescendantOrSelf; break; case AXIS_FOLLOWING: -#ifdef DEBUG_STEP xmlGenericError(xmlGenericErrorContext, "axis 'following' "); -#endif - last = NULL; - next = xmlXPathNextFollowing; break; case AXIS_FOLLOWING_SIBLING: -#ifdef DEBUG_STEP xmlGenericError(xmlGenericErrorContext, "axis 'following-siblings' "); -#endif - last = NULL; - next = xmlXPathNextFollowingSibling; break; case AXIS_NAMESPACE: -#ifdef DEBUG_STEP xmlGenericError(xmlGenericErrorContext, "axis 'namespace' "); -#endif - first = NULL; - last = NULL; - next = (xmlXPathTraversalFunction) xmlXPathNextNamespace; - mergeNodeSet = xmlXPathNodeSetMergeUnique; break; case AXIS_PARENT: -#ifdef DEBUG_STEP xmlGenericError(xmlGenericErrorContext, "axis 'parent' "); -#endif - first = NULL; - next = xmlXPathNextParent; break; case AXIS_PRECEDING: -#ifdef DEBUG_STEP xmlGenericError(xmlGenericErrorContext, "axis 'preceding' "); -#endif - first = NULL; - next = xmlXPathNextPrecedingInternal; break; case AXIS_PRECEDING_SIBLING: -#ifdef DEBUG_STEP xmlGenericError(xmlGenericErrorContext, "axis 'preceding-sibling' "); -#endif - first = NULL; - next = xmlXPathNextPrecedingSibling; break; case AXIS_SELF: -#ifdef DEBUG_STEP xmlGenericError(xmlGenericErrorContext, "axis 'self' "); -#endif - first = NULL; - last = NULL; - next = xmlXPathNextSelf; - mergeNodeSet = xmlXPathNodeSetMergeUnique; break; } - if (next == NULL) { - xmlXPathReleaseObject(xpctxt, obj); - return(0); - } - - inputList = obj->nodesetval; - if ((inputList == NULL) || (inputList->nodeNr <= 0)) { - xmlXPathReleaseObject(xpctxt, obj); - valuePush(ctxt, xmlXPathCacheWrapNodeSet(xpctxt, NULL)); - return(0); - } - -#ifdef DEBUG_STEP xmlGenericError(xmlGenericErrorContext, - " context contains %d nodes\n", nodelist->nodeNr); + " context contains %d nodes\n", nbNodes); switch (test) { case NODE_TEST_NONE: xmlGenericError(xmlGenericErrorContext, @@ -11318,561 +11442,638 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, break; } xmlGenericError(xmlGenericErrorContext, "Testing : "); -#endif - /* - * 2.3 Node Tests - * - For the attribute axis, the principal node type is attribute. - * - For the namespace axis, the principal node type is namespace. - * - For other axes, the principal node type is element. - * - * A node test * is true for any node of the - * principal node type. For example, child::* will - * select all element children of the context node - */ - oldContextNode = xpctxt->node; - addNode = xmlXPathNodeSetAddUnique; - resultList = NULL; - list = NULL; - compoundContextNode = NULL; - contextNode = NULL; - inputIdx = 0; +} +#endif /* DEBUG_STEP */ - while ((inputIdx < inputList->nodeNr) || (contextNode != NULL)) { - if (compoundNext != NULL) { +static int +xmlXPathCompOpEvalPredicate(xmlXPathParserContextPtr ctxt, + xmlXPathStepOpPtr op, + xmlNodeSetPtr set, + int contextSize, + int hasNsNodes) +{ + if (op->ch1 != -1) { + xmlXPathCompExprPtr comp = ctxt->comp; + /* + * Process inner predicates first. + */ + if (comp->steps[op->ch1].op != XPATH_OP_PREDICATE) { /* - * This is a compound traversal. + * TODO: raise an internal error. */ - if (contextNode == NULL) { - /* - * Set the context for the initial traversal. - */ - compoundContextNode = inputList->nodeTab[inputIdx++]; - contextNode = compoundNext(NULL, compoundContextNode); - } else - contextNode = compoundNext(contextNode, compoundContextNode); - if (contextNode == NULL) + } + contextSize = xmlXPathCompOpEvalPredicate(ctxt, + &comp->steps[op->ch1], set, contextSize, hasNsNodes); + CHECK_ERROR0; + if (contextSize <= 0) + return(0); + } + if (op->ch2 != -1) { + xmlXPathContextPtr xpctxt = ctxt->context; + xmlNodePtr contextNode, oldContextNode; + xmlDocPtr oldContextDoc; + int i, res, contextPos = 0, newContextSize; + xmlXPathStepOpPtr exprOp; + xmlXPathObjectPtr contextObj = NULL, exprRes = NULL; + +#ifdef LIBXML_XPTR_ENABLED + /* + * URGENT TODO: Check the following: + * We don't expect location sets if evaluating prediates, right? + * Only filters should expect location sets, right? + */ +#endif + /* + * SPEC XPath 1.0: + * "For each node in the node-set to be filtered, the + * PredicateExpr is evaluated with that node as the + * context node, with the number of nodes in the + * node-set as the context size, and with the proximity + * position of the node in the node-set with respect to + * the axis as the context position;" + * @oldset is the node-set" to be filtered. + * + * SPEC XPath 1.0: + * "only predicates change the context position and + * context size (see [2.4 Predicates])." + * Example: + * node-set context pos + * nA 1 + * nB 2 + * nC 3 + * After applying predicate [position() > 1] : + * node-set context pos + * nB 1 + * nC 2 + */ + oldContextNode = xpctxt->node; + oldContextDoc = xpctxt->doc; + /* + * Get the expression of this predicate. + */ + exprOp = &ctxt->comp->steps[op->ch2]; + newContextSize = 0; + for (i = 0; i < set->nodeNr; i++) { + if (set->nodeTab[i] == NULL) continue; + + contextNode = set->nodeTab[i]; + xpctxt->node = contextNode; + xpctxt->contextSize = contextSize; + xpctxt->proximityPosition = ++contextPos; + + /* + * Also set the xpath document in case things like + * key() are evaluated in the predicate. + */ + if ((contextNode->type != XML_NAMESPACE_DECL) && + (contextNode->doc != NULL)) + xpctxt->doc = contextNode->doc; /* - * Set the context for the main traversal. + * Evaluate the predicate expression with 1 context node + * at a time; this node is packaged into a node set; this + * node set is handed over to the evaluation mechanism. */ - xpctxt->node = contextNode; - } else - xpctxt->node = inputList->nodeTab[inputIdx++]; - - if (list == NULL) { - list = xmlXPathNodeSetCreate(NULL); - if (list == NULL) { - total = 0; - goto error; - } - } - cur = NULL; - specialNodeInSet = 0; - do { - cur = next(ctxt, cur); - if (cur == NULL) - break; + if (contextObj == NULL) + contextObj = xmlXPathCacheNewNodeSet(xpctxt, contextNode); + else + xmlXPathNodeSetAddUnique(contextObj->nodesetval, + contextNode); - if (first != NULL) { - if (*first == cur) - break; - if ((*first != NULL) && - ((total % 256) == 0) && -#ifdef XP_OPTIMIZED_NON_ELEM_COMPARISON - (xmlXPathCmpNodesExt(*first, cur) >= 0)) -#else - (xmlXPathCmpNodes(*first, cur) >= 0)) -#endif - { - break; - } + valuePush(ctxt, contextObj); + + res = xmlXPathCompOpEvalToBoolean(ctxt, exprOp, 1); + + if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) + goto evaluation_error; + + if (res != 0) { + newContextSize++; + } else { + /* + * Remove the entry from the initial node set. + */ + set->nodeTab[i] = NULL; + if (contextNode->type == XML_NAMESPACE_DECL) + xmlXPathNodeSetFreeNs((xmlNsPtr) contextNode); } - if (last != NULL) { - if (*last == cur) - break; - if ((*last != NULL) && - ((total % 256) == 0) && -#ifdef XP_OPTIMIZED_NON_ELEM_COMPARISON - (xmlXPathCmpNodesExt(cur, *last) >= 0)) -#else - (xmlXPathCmpNodes(cur, *last) >= 0)) -#endif - { - break; - } + if (ctxt->value == contextObj) { + /* + * Don't free the temporary XPath object holding the + * context node, in order to avoid massive recreation + * inside this loop. + */ + valuePop(ctxt); + xmlXPathNodeSetClear(contextObj->nodesetval, hasNsNodes); + } else { + /* + * TODO: The object was lost in the evaluation machinery. + * Can this happen? Maybe in internal-error cases. + */ + contextObj = NULL; } + } + goto evaluation_exit; - total++; -#ifdef DEBUG_STEP - xmlGenericError(xmlGenericErrorContext, " %s", cur->name); -#endif - switch (test) { - case NODE_TEST_NONE: - STRANGE - goto error; - case NODE_TEST_TYPE: - if ((cur->type == type) || - ((type == NODE_TYPE_NODE) && - ((cur->type == XML_DOCUMENT_NODE) || - (cur->type == XML_HTML_DOCUMENT_NODE) || - (cur->type == XML_ELEMENT_NODE) || - (cur->type == XML_NAMESPACE_DECL) || - (cur->type == XML_ATTRIBUTE_NODE) || - (cur->type == XML_PI_NODE) || - (cur->type == XML_COMMENT_NODE) || - (cur->type == XML_CDATA_SECTION_NODE) || - (cur->type == XML_TEXT_NODE))) || - ((type == NODE_TYPE_TEXT) && - (cur->type == XML_CDATA_SECTION_NODE))) - { -#ifdef DEBUG_STEP - nbMatches++; -#endif - if (cur->type == XML_NAMESPACE_DECL) - specialNodeInSet = 1; - /* - * TODO: Don't we need to use xmlXPathNodeSetAddNs() - * for namespace nodes here ? - */ - addNode(list, cur); - } - break; - case NODE_TEST_PI: - if ((cur->type == XML_PI_NODE) && - ((name == NULL) || xmlStrEqual(name, cur->name))) - { -#ifdef DEBUG_STEP - nbMatches++; -#endif - addNode(list, cur); - } - break; - case NODE_TEST_ALL: - if (axis == AXIS_ATTRIBUTE) { - if (cur->type == XML_ATTRIBUTE_NODE) { -#ifdef DEBUG_STEP - nbMatches++; -#endif - addNode(list, cur); - } - } else if (axis == AXIS_NAMESPACE) { - if (cur->type == XML_NAMESPACE_DECL) { -#ifdef DEBUG_STEP - nbMatches++; -#endif - specialNodeInSet = 1; - xmlXPathNodeSetAddNs(list, xpctxt->node, - (xmlNsPtr) cur); - } - } else { - if (cur->type == XML_ELEMENT_NODE) { - if (prefix == NULL) { -#ifdef DEBUG_STEP - nbMatches++; -#endif - addNode(list, cur); - } else if ((cur->ns != NULL) && - (xmlStrEqual(URI, cur->ns->href))) - { -#ifdef DEBUG_STEP - nbMatches++; -#endif - addNode(list, cur); - } - } - } - break; - case NODE_TEST_NS:{ - TODO; - break; - } - case NODE_TEST_NAME: - switch (cur->type) { - case XML_ELEMENT_NODE: - if (xmlStrEqual(name, cur->name)) { - if (prefix == NULL) { - if (cur->ns == NULL) { -#ifdef DEBUG_STEP - nbMatches++; -#endif - addNode(list, cur); - } - } else { - if ((cur->ns != NULL) && - (xmlStrEqual(URI, - cur->ns->href))) - { -#ifdef DEBUG_STEP - nbMatches++; -#endif - addNode(list, cur); - } - } - } - break; - case XML_ATTRIBUTE_NODE:{ - xmlAttrPtr attr = (xmlAttrPtr) cur; +evaluation_error: + xmlXPathNodeSetClear(set, hasNsNodes); + newContextSize = 0; - if (xmlStrEqual(name, attr->name)) { - if (prefix == NULL) { - if ((attr->ns == NULL) || - (attr->ns->prefix == NULL)) { -#ifdef DEBUG_STEP - nbMatches++; -#endif - addNode(list, - (xmlNodePtr) attr); - } - } else { - if ((attr->ns != NULL) && - (xmlStrEqual(URI, - attr->ns-> - href))) - { -#ifdef DEBUG_STEP - nbMatches++; -#endif - addNode(list, - (xmlNodePtr) attr); - } - } - } - break; - } - case XML_NAMESPACE_DECL: - if (cur->type == XML_NAMESPACE_DECL) { - xmlNsPtr ns = (xmlNsPtr) cur; +evaluation_exit: + if (contextObj != NULL) { + if (ctxt->value == contextObj) + valuePop(ctxt); + xmlXPathReleaseObject(xpctxt, contextObj); + } + if (exprRes != NULL) + xmlXPathReleaseObject(ctxt->context, exprRes); + /* + * Reset/invalidate the context. + */ + xpctxt->node = oldContextNode; + xpctxt->doc = oldContextDoc; + xpctxt->contextSize = -1; + xpctxt->proximityPosition = -1; + return(newContextSize); + } + return(contextSize); +} - if ((ns->prefix != NULL) && (name != NULL) - && (xmlStrEqual(ns->prefix, name))) - { -#ifdef DEBUG_STEP - nbMatches++; -#endif - specialNodeInSet = 1; - xmlXPathNodeSetAddNs(list, - xpctxt->node, (xmlNsPtr) cur); - } - } - break; - default: - break; - } /* switch (cur->type) */ - break; /* case NODE_TEST_NAME: */ - } /* switch (test) */ - } while (cur != NULL); +static int +xmlXPathCompOpEvalPositionalPredicate(xmlXPathParserContextPtr ctxt, + xmlXPathStepOpPtr op, + xmlNodeSetPtr set, + int contextSize, + int minPos, + int maxPos, + int hasNsNodes) +{ + if (op->ch1 != -1) { + xmlXPathCompExprPtr comp = ctxt->comp; + if (comp->steps[op->ch1].op != XPATH_OP_PREDICATE) { + /* + * TODO: raise an internal error. + */ + } + contextSize = xmlXPathCompOpEvalPredicate(ctxt, + &comp->steps[op->ch1], set, contextSize, hasNsNodes); + CHECK_ERROR0; + if (contextSize <= 0) + return(0); + } + /* + * Check if the node set contains a sufficient number of nodes for + * the requested range. + */ + if (contextSize < minPos) { + xmlXPathNodeSetClear(set, hasNsNodes); + return(0); + } + if (op->ch2 == -1) { + /* + * TODO: Can this ever happen? + */ + return (contextSize); + } else { + xmlDocPtr oldContextDoc; + int i, pos = 0, newContextSize = 0, contextPos = 0, res; + xmlXPathStepOpPtr exprOp; + xmlXPathObjectPtr contextObj = NULL, exprRes = NULL; + xmlNodePtr oldContextNode, contextNode = NULL; + xmlXPathContextPtr xpctxt = ctxt->context; - /* - * If there is some predicate filtering do it now - */ - if ((op->ch2 != -1) && (list != NULL) && (list->nodeNr > 0)) { - xmlXPathObjectPtr obj2; +#ifdef LIBXML_XPTR_ENABLED + /* + * URGENT TODO: Check the following: + * We don't expect location sets if evaluating prediates, right? + * Only filters should expect location sets, right? + */ +#endif /* LIBXML_XPTR_ENABLED */ - valuePush(ctxt, xmlXPathCacheWrapNodeSet(xpctxt, list)); - xmlXPathCompOpEval(ctxt, &ctxt->comp->steps[op->ch2]); - CHECK_TYPE0(XPATH_NODESET); - obj2 = valuePop(ctxt); - list = obj2->nodesetval; - obj2->nodesetval = NULL; - xmlXPathReleaseObject(xpctxt, obj2); + /* + * Save old context. + */ + oldContextNode = xpctxt->node; + oldContextDoc = xpctxt->doc; + /* + * Get the expression of this predicate. + */ + exprOp = &ctxt->comp->steps[op->ch2]; + for (i = 0; i < set->nodeNr; i++) { + if (set->nodeTab[i] == NULL) + continue; - if (ctxt->error != XPATH_EXPRESSION_OK) { - total = 0; - goto error; - } - } - if (resultList == NULL) { - resultList = list; - list = NULL; - } else if ((list != NULL) && (list->nodeNr > 0)) { - resultList = mergeNodeSet(resultList, list); + contextNode = set->nodeTab[i]; + xpctxt->node = contextNode; + xpctxt->contextSize = contextSize; + xpctxt->proximityPosition = ++contextPos; + /* - * This is the list containing the current matching nodes. - * Avoid massive creation/freeing and preserve it for the - * next iterations. + * Initialize the new set. + * Also set the xpath document in case things like + * key() evaluation are attempted on the predicate */ - /* If a namespace node was put it, then we need a more - * time consuming cleanup. + if ((contextNode->type != XML_NAMESPACE_DECL) && + (contextNode->doc != NULL)) + xpctxt->doc = contextNode->doc; + /* + * Evaluate the predicate expression with 1 context node + * at a time; this node is packaged into a node set; this + * node set is handed over to the evaluation mechanism. */ - if (specialNodeInSet) - xmlXPathNodeSetClear(list); + if (contextObj == NULL) + contextObj = xmlXPathCacheNewNodeSet(xpctxt, contextNode); else - list->nodeNr = 0; - } + xmlXPathNodeSetAddUnique(contextObj->nodesetval, + contextNode); + + valuePush(ctxt, contextObj); + res = xmlXPathCompOpEvalToBoolean(ctxt, exprOp, 1); + + if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) + goto evaluation_error; + + if (res) + pos++; + + if (res && (pos >= minPos) && (pos <= maxPos)) { + /* + * Fits in the requested range. + */ + newContextSize++; + if (minPos == maxPos) { + /* + * Only 1 node was requested. + */ + if (contextNode->type == XML_NAMESPACE_DECL) { + /* + * As always: take care of those nasty + * namespace nodes. + */ + set->nodeTab[i] = NULL; + } + xmlXPathNodeSetClear(set, hasNsNodes); + set->nodeNr = 1; + set->nodeTab[0] = contextNode; + goto evaluation_exit; + } + if (pos == maxPos) { + /* + * We are done. + */ + xmlXPathNodeSetClearFromPos(set, i +1, hasNsNodes); + goto evaluation_exit; + } + } else { + /* + * Remove the entry from the initial node set. + */ + set->nodeTab[i] = NULL; + if (contextNode->type == XML_NAMESPACE_DECL) + xmlXPathNodeSetFreeNs((xmlNsPtr) contextNode); + } + if (exprRes != NULL) { + xmlXPathReleaseObject(ctxt->context, exprRes); + exprRes = NULL; + } + if (ctxt->value == contextObj) { + /* + * Don't free the temporary XPath object holding the + * context node, in order to avoid massive recreation + * inside this loop. + */ + valuePop(ctxt); + xmlXPathNodeSetClear(contextObj->nodesetval, hasNsNodes); + } else { + /* + * The object was lost in the evaluation machinery. + * Can this happen? Maybe in case of internal-errors. + */ + contextObj = NULL; + } + } + goto evaluation_exit; + +evaluation_error: + xmlXPathNodeSetClear(set, hasNsNodes); + newContextSize = 0; + +evaluation_exit: + if (contextObj != NULL) { + if (ctxt->value == contextObj) + valuePop(ctxt); + xmlXPathReleaseObject(xpctxt, contextObj); + } + if (exprRes != NULL) + xmlXPathReleaseObject(ctxt->context, exprRes); + /* + * Reset/invalidate the context. + */ + xpctxt->node = oldContextNode; + xpctxt->doc = oldContextDoc; + xpctxt->contextSize = -1; + xpctxt->proximityPosition = -1; + return(newContextSize); } + return(contextSize); +} + +static int +xmlXPathIsPositionalPredicate(xmlXPathParserContextPtr ctxt, + xmlXPathStepOpPtr op, + int *maxPos) +{ + + xmlXPathStepOpPtr exprOp; - xpctxt->node = oldContextNode; /* - * Cleanup the temporary list of current node-test matches. + * BIG NOTE: This is not intended for XPATH_OP_FILTER yet! */ - if ((list != NULL) && (list != resultList)) { - xmlXPathFreeNodeSet(list); - list = NULL; - } -#ifdef DEBUG_STEP - xmlGenericError(xmlGenericErrorContext, - "\nExamined %d nodes, found %d nodes at that step\n", - total, nbMatches); -#endif + /* + * If not -1, then ch1 will point to: + * 1) For predicates (XPATH_OP_PREDICATE): + * - an inner predicate operator + * 2) For filters (XPATH_OP_FILTER): + * - an inner filter operater OR + * - an expression selecting the node set. + * E.g. "key('a', 'b')" or "(//foo | //bar)". + */ + if ((op->op != XPATH_OP_PREDICATE) && (op->op != XPATH_OP_FILTER)) + return(0); - valuePush(ctxt, xmlXPathCacheWrapNodeSet(xpctxt, resultList)); + if (op->ch2 != -1) { + exprOp = &ctxt->comp->steps[op->ch2]; + } else + return(0); - if ((obj->boolval) && (obj->user != NULL)) { + if ((exprOp != NULL) && + (exprOp->op == XPATH_OP_VALUE) && + (exprOp->value4 != NULL) && + (((xmlXPathObjectPtr) exprOp->value4)->type == XPATH_NUMBER)) + { /* - * QUESTION TODO: What does this do and why? + * We have a "[n]" predicate here. + * TODO: Unfortunately this simplistic test here is not + * able to detect a position() predicate in compound + * expressions like "[@attr = 'a" and position() = 1], + * and even not the usage of position() in + * "[position() = 1]"; thus - obviously - a position-range, + * like it "[position() < 5]", is also not detected. + * Maybe we could rewrite the AST to ease the optimization. */ - ctxt->value->boolval = 1; - ctxt->value->user = obj->user; - obj->user = NULL; - obj->boolval = 0; - } - xmlXPathReleaseObject(xpctxt, obj); - return(total); - -error: - xpctxt->node = oldContextNode; - xmlXPathReleaseObject(xpctxt, obj); - if ((list != NULL) && (list != resultList)) { - xmlXPathFreeNodeSet(list); + *maxPos = (int) ((xmlXPathObjectPtr) exprOp->value4)->floatval; + + if (((xmlXPathObjectPtr) exprOp->value4)->floatval == + (float) *maxPos) + { + return(1); + } } - if (resultList != NULL) - xmlXPathFreeNodeSet(resultList); - return(total); + return(0); } -/** - * xmlXPathNodeCollectAndTestNth: - * @ctxt: the XPath Parser context - * @op: the XPath precompiled step operation - * @reqpos: the requested position wrt to the axis - * @first: pointer to the first element in document order - * @last: pointer to the last element in document order - * - * This is the function implementing a step: based on the current list - * of nodes, it builds up a new list, looking at all nodes under that - * axis and selecting them. It also does the predicate filtering - * - * Pushes the new NodeSet resulting from the search. - * Returns the number of node traversed - */ static int -xmlXPathNodeCollectAndTestNth(xmlXPathParserContextPtr ctxt, - xmlXPathStepOpPtr op, int reqpos, - xmlNodePtr * first, xmlNodePtr * last) +xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, + xmlXPathStepOpPtr op, + xmlNodePtr * first, xmlNodePtr * last, + int toBool) { + +#define XP_TEST_HIT \ + if (hasAxisRange != 0) { \ + if (++pos == maxPos) { \ + addNode(seq, cur); \ + goto axis_range_end; } \ + } else { \ + addNode(seq, cur); \ + if (breakOnFirstHit) goto first_hit; } + +#define XP_TEST_HIT_NS \ + if (hasAxisRange != 0) { \ + if (++pos == maxPos) { \ + hasNsNodes = 1; \ + xmlXPathNodeSetAddNs(seq, xpctxt->node, (xmlNsPtr) cur); \ + goto axis_range_end; } \ + } else { \ + hasNsNodes = 1; \ + xmlXPathNodeSetAddNs(seq, \ + xpctxt->node, (xmlNsPtr) cur); \ + if (breakOnFirstHit) goto first_hit; } + xmlXPathAxisVal axis = (xmlXPathAxisVal) op->value; xmlXPathTestVal test = (xmlXPathTestVal) op->value2; xmlXPathTypeVal type = (xmlXPathTypeVal) op->value3; const xmlChar *prefix = op->value4; const xmlChar *name = op->value5; const xmlChar *URI = NULL; - int pos; /* The current context position */ - int inputIdx, total = 0; - xmlNodeSetPtr inputList, list; +#ifdef DEBUG_STEP + int nbMatches = 0, prevMatches = 0; +#endif + int total = 0, hasNsNodes = 0; + /* The popped object holding the context nodes */ + xmlXPathObjectPtr obj; + /* The set of context nodes for the node tests */ + xmlNodeSetPtr contextSeq; + int contextIdx; + xmlNodePtr contextNode; + /* The context node for a compound traversal */ + xmlNodePtr outerContextNode; + /* The final resulting node set wrt to all context nodes */ + xmlNodeSetPtr outSeq; + /* + * The temporary resulting node set wrt 1 context node. + * Used to feed predicate evaluation. + */ + xmlNodeSetPtr seq; + xmlNodePtr cur; + /* First predicate operator */ + xmlXPathStepOpPtr predOp; + int maxPos; /* The requested position() (when a "[n]" predicate) */ + int hasPredicateRange, hasAxisRange, pos, size, newSize; + int breakOnFirstHit; + xmlXPathTraversalFunction next = NULL; - xmlXPathTraversalFunctionExt compoundNext = NULL; + /* compound axis traversal */ + xmlXPathTraversalFunctionExt outerNext = NULL; void (*addNode) (xmlNodeSetPtr, xmlNodePtr); - xmlNodePtr oldContextNode, contextNode, cur, compoundContextNode; - xmlXPathObjectPtr obj; - xmlXPathContextPtr xpctxt = ctxt->context; + xmlXPathNodeSetMergeFunction mergeAndClear; + xmlNodePtr oldContextNode; + xmlXPathContextPtr xpctxt = ctxt->context; CHECK_TYPE0(XPATH_NODESET); obj = valuePop(ctxt); - addNode = xmlXPathNodeSetAdd; - + /* + * Setup namespaces. + */ if (prefix != NULL) { URI = xmlXPathNsLookup(xpctxt, prefix); if (URI == NULL) { - xmlXPathFreeObject(obj); + xmlXPathReleaseObject(xpctxt, obj); XP_ERROR0(XPATH_UNDEF_PREFIX_ERROR); } - } - -#ifdef DEBUG_STEP_NTH - xmlGenericError(xmlGenericErrorContext, "new step : "); - if (first != NULL) { - if (*first != NULL) - xmlGenericError(xmlGenericErrorContext, "first = %s ", - (*first)->name); - else - xmlGenericError(xmlGenericErrorContext, "first = NULL "); - } - if (last != NULL) { - if (*last != NULL) - xmlGenericError(xmlGenericErrorContext, "last = %s ", - (*last)->name); - else - xmlGenericError(xmlGenericErrorContext, "last = NULL "); - } -#endif + } + /* + * Setup axis. + * + * MAYBE FUTURE TODO: merging optimizations: + * - If the nodes to be traversed wrt to the initial nodes and + * the current axis cannot overlap, then we could avoid searching + * for duplicates during the merge. + * But the question is how/when to evaluate if they cannot overlap. + * Example: if we know that for two initial nodes, the one is + * not in the ancestor-or-self axis of the other, then we could safely + * avoid a duplicate-aware merge, if the axis to be traversed is e.g. + * the descendant-or-self axis. + */ + addNode = xmlXPathNodeSetAdd; + mergeAndClear = xmlXPathNodeSetMergeAndClear; switch (axis) { case AXIS_ANCESTOR: -#ifdef DEBUG_STEP_NTH - xmlGenericError(xmlGenericErrorContext, "axis 'ancestors' "); -#endif first = NULL; next = xmlXPathNextAncestor; break; case AXIS_ANCESTOR_OR_SELF: -#ifdef DEBUG_STEP_NTH - xmlGenericError(xmlGenericErrorContext, - "axis 'ancestors-or-self' "); -#endif first = NULL; next = xmlXPathNextAncestorOrSelf; break; case AXIS_ATTRIBUTE: -#ifdef DEBUG_STEP_NTH - xmlGenericError(xmlGenericErrorContext, "axis 'attributes' "); -#endif first = NULL; last = NULL; next = xmlXPathNextAttribute; + mergeAndClear = xmlXPathNodeSetMergeAndClearNoDupls; break; case AXIS_CHILD: -#ifdef DEBUG_STEP_NTH - xmlGenericError(xmlGenericErrorContext, "axis 'child' "); -#endif last = NULL; if (op->rewriteType == XP_REWRITE_DOS_CHILD_ELEM) { /* * This iterator will give us only nodes which can * hold element nodes. */ - compoundNext = xmlXPathNextDescendantOrSelfElemParent; - } - if ((test == NODE_TEST_NAME) && (type == NODE_TYPE_NODE)) { + outerNext = xmlXPathNextDescendantOrSelfElemParent; + } + if (((test == NODE_TEST_NAME) || (test == NODE_TEST_ALL)) && + (type == NODE_TYPE_NODE)) + { /* * Optimization if an element node type is 'element'. */ next = xmlXPathNextChildElement; } else - next = xmlXPathNextChild; + next = xmlXPathNextChild; + mergeAndClear = xmlXPathNodeSetMergeAndClearNoDupls; break; case AXIS_DESCENDANT: -#ifdef DEBUG_STEP_NTH - xmlGenericError(xmlGenericErrorContext, "axis 'descendant' "); -#endif last = NULL; next = xmlXPathNextDescendant; break; case AXIS_DESCENDANT_OR_SELF: -#ifdef DEBUG_STEP_NTH - xmlGenericError(xmlGenericErrorContext, - "axis 'descendant-or-self' "); -#endif last = NULL; next = xmlXPathNextDescendantOrSelf; break; case AXIS_FOLLOWING: -#ifdef DEBUG_STEP_NTH - xmlGenericError(xmlGenericErrorContext, "axis 'following' "); -#endif last = NULL; next = xmlXPathNextFollowing; break; case AXIS_FOLLOWING_SIBLING: -#ifdef DEBUG_STEP_NTH - xmlGenericError(xmlGenericErrorContext, - "axis 'following-siblings' "); -#endif last = NULL; next = xmlXPathNextFollowingSibling; break; case AXIS_NAMESPACE: -#ifdef DEBUG_STEP_NTH - xmlGenericError(xmlGenericErrorContext, "axis 'namespace' "); -#endif - last = NULL; first = NULL; + last = NULL; next = (xmlXPathTraversalFunction) xmlXPathNextNamespace; + mergeAndClear = xmlXPathNodeSetMergeAndClearNoDupls; break; case AXIS_PARENT: -#ifdef DEBUG_STEP_NTH - xmlGenericError(xmlGenericErrorContext, "axis 'parent' "); -#endif first = NULL; next = xmlXPathNextParent; break; case AXIS_PRECEDING: -#ifdef DEBUG_STEP_NTH - xmlGenericError(xmlGenericErrorContext, "axis 'preceding' "); -#endif first = NULL; next = xmlXPathNextPrecedingInternal; break; case AXIS_PRECEDING_SIBLING: -#ifdef DEBUG_STEP_NTH - xmlGenericError(xmlGenericErrorContext, - "axis 'preceding-sibling' "); -#endif first = NULL; next = xmlXPathNextPrecedingSibling; break; case AXIS_SELF: -#ifdef DEBUG_STEP_NTH - xmlGenericError(xmlGenericErrorContext, "axis 'self' "); -#endif first = NULL; last = NULL; next = xmlXPathNextSelf; + mergeAndClear = xmlXPathNodeSetMergeAndClearNoDupls; break; } + +#ifdef DEBUG_STEP + xmlXPathDebugDumpStepAxis(axis, test, + (obj->nodesetval != NULL) ? obj->nodsetval->nodeNr : 0); +#endif + if (next == NULL) { - xmlXPathReleaseObject(xpctxt, obj); + xmlXPathReleaseObject(xpctxt, obj); return(0); - } - - inputList = obj->nodesetval; - if ((inputList == NULL) || (inputList->nodeNr <= 0)) { - xmlXPathReleaseObject(xpctxt, obj); - valuePush(ctxt, xmlXPathCacheWrapNodeSet(xpctxt, NULL)); + } + contextSeq = obj->nodesetval; + if ((contextSeq == NULL) || (contextSeq->nodeNr <= 0)) { + xmlXPathReleaseObject(xpctxt, obj); + valuePush(ctxt, xmlXPathCacheWrapNodeSet(xpctxt, NULL)); return(0); + } + /* + * Predicate optimization --------------------------------------------- + * If this step has a last predicate, which contains a position(), + * then we'll optimize (although not exactly "position()", but only + * the short-hand form, i.e., "[n]". + * + * Example - expression "/foo[parent::bar][1]": + * + * COLLECT 'child' 'name' 'node' foo -- op (we are here) + * ROOT -- op->ch1 + * PREDICATE -- op->ch2 (predOp) + * PREDICATE -- predOp->ch1 = [parent::bar] + * SORT + * COLLECT 'parent' 'name' 'node' bar + * NODE + * ELEM Object is a number : 1 -- predOp->ch2 = [1] + * + */ + maxPos = 0; + predOp = NULL; + hasPredicateRange = 0; + hasAxisRange = 0; + if (op->ch2 != -1) { + /* + * There's at least one predicate. 16 == XPATH_OP_PREDICATE + */ + predOp = &ctxt->comp->steps[op->ch2]; + if (xmlXPathIsPositionalPredicate(ctxt, predOp, &maxPos)) { + if (predOp->ch1 != -1) { + /* + * Use the next inner predicate operator. + */ + predOp = &ctxt->comp->steps[predOp->ch1]; + hasPredicateRange = 1; + } else { + /* + * There's no other predicate than the [n] predicate. + */ + predOp = NULL; + hasAxisRange = 1; + } + } } - -#ifdef DEBUG_STEP_NTH - xmlGenericError(xmlGenericErrorContext, - " context contains %d nodes\n", nodelist->nodeNr); - switch (test) { - case NODE_TEST_NONE: - xmlGenericError(xmlGenericErrorContext, - " searching for none !!!\n"); - break; - case NODE_TEST_TYPE: - xmlGenericError(xmlGenericErrorContext, - " searching for type %d\n", type); - break; - case NODE_TEST_PI: - xmlGenericError(xmlGenericErrorContext, - " searching for PI !!!\n"); - break; - case NODE_TEST_ALL: - xmlGenericError(xmlGenericErrorContext, - " searching for *\n"); - break; - case NODE_TEST_NS: - xmlGenericError(xmlGenericErrorContext, - " searching for namespace %s\n", - prefix); - break; - case NODE_TEST_NAME: - xmlGenericError(xmlGenericErrorContext, - " searching for name %s\n", name); - if (prefix != NULL) - xmlGenericError(xmlGenericErrorContext, - " with namespace %s\n", prefix); - break; - } - xmlGenericError(xmlGenericErrorContext, "Testing : "); -#endif + breakOnFirstHit = ((toBool) && (predOp == NULL)) ? 1 : 0; + /* + * Axis traversal ----------------------------------------------------- + */ /* * 2.3 Node Tests * - For the attribute axis, the principal node type is attribute. - * - For the namespace axis, the principal node type is namespace. - * - For other axes, the principal node type is element. + * - For the namespace axis, the principal node type is namespace. + * - For other axes, the principal node type is element. * * A node test * is true for any node of the * principal node type. For example, child::* will @@ -11880,25 +12081,26 @@ xmlXPathNodeCollectAndTestNth(xmlXPathParserContextPtr ctxt, */ oldContextNode = xpctxt->node; addNode = xmlXPathNodeSetAddUnique; - list = NULL; - compoundContextNode = NULL; + outSeq = NULL; + seq = NULL; + outerContextNode = NULL; contextNode = NULL; - inputIdx = 0; - list = xmlXPathNodeSetCreate(NULL); + contextIdx = 0; + - while ((inputIdx < inputList->nodeNr) || (contextNode != NULL)) { - if (compoundNext != NULL) { + while ((contextIdx < contextSeq->nodeNr) || (contextNode != NULL)) { + if (outerNext != NULL) { /* * This is a compound traversal. */ if (contextNode == NULL) { /* - * Set the context for the initial traversal. + * Set the context for the outer traversal. */ - compoundContextNode = inputList->nodeTab[inputIdx++]; - contextNode = compoundNext(NULL, compoundContextNode); + outerContextNode = contextSeq->nodeTab[contextIdx++]; + contextNode = outerNext(NULL, outerContextNode); } else - contextNode = compoundNext(contextNode, compoundContextNode); + contextNode = outerNext(contextNode, outerContextNode); if (contextNode == NULL) continue; /* @@ -11906,20 +12108,33 @@ xmlXPathNodeCollectAndTestNth(xmlXPathParserContextPtr ctxt, */ xpctxt->node = contextNode; } else - xpctxt->node = inputList->nodeTab[inputIdx++]; - - cur = NULL; - pos = 0; + xpctxt->node = contextSeq->nodeTab[contextIdx++]; + + if (seq == NULL) { + seq = xmlXPathNodeSetCreate(NULL); + if (seq == NULL) { + total = 0; + goto error; + } + } + /* + * Traverse the axis and test the nodes. + */ + pos = 0; + cur = NULL; + hasNsNodes = 0; do { cur = next(ctxt, cur); if (cur == NULL) break; - if (first != NULL) { + /* + * QUESTION TODO: What does the "first" and "last" stuff do? + */ + if ((first != NULL) && (*first != NULL)) { if (*first == cur) break; - if ((*first != NULL) && - ((total % 256) == 0) && + if (((total % 256) == 0) && #ifdef XP_OPTIMIZED_NON_ELEM_COMPARISON (xmlXPathCmpNodesExt(*first, cur) >= 0)) #else @@ -11929,11 +12144,10 @@ xmlXPathNodeCollectAndTestNth(xmlXPathParserContextPtr ctxt, break; } } - if (last != NULL) { + if ((last != NULL) && (*last != NULL)) { if (*last == cur) break; - if ((*last != NULL) && - ((total % 256) == 0) && + if (((total % 256) == 0) && #ifdef XP_OPTIMIZED_NON_ELEM_COMPARISON (xmlXPathCmpNodesExt(cur, *last) >= 0)) #else @@ -11945,63 +12159,79 @@ xmlXPathNodeCollectAndTestNth(xmlXPathParserContextPtr ctxt, } total++; - switch (test) { + +#ifdef DEBUG_STEP + xmlGenericError(xmlGenericErrorContext, " %s", cur->name); +#endif + switch (test) { case NODE_TEST_NONE: total = 0; STRANGE goto error; case NODE_TEST_TYPE: - if ((cur->type == type) || - ((type == NODE_TYPE_NODE) && - ((cur->type == XML_DOCUMENT_NODE) || - (cur->type == XML_HTML_DOCUMENT_NODE) || - (cur->type == XML_ELEMENT_NODE) || - (cur->type == XML_PI_NODE) || - (cur->type == XML_COMMENT_NODE) || - (cur->type == XML_CDATA_SECTION_NODE) || - (cur->type == XML_TEXT_NODE))) || - ((type == NODE_TYPE_TEXT) && - (cur->type == XML_CDATA_SECTION_NODE))) { - pos++; - if (pos == reqpos) - addNode(list, cur); - } - break; + /* + * TODO: Don't we need to use + * xmlXPathNodeSetAddNs() for namespace nodes here? + * Surprisingly, some c14n tests fail, if we do this. + */ + if (type == NODE_TYPE_NODE) { + switch (cur->type) { + case XML_DOCUMENT_NODE: + case XML_HTML_DOCUMENT_NODE: +#ifdef LIBXML_DOCB_ENABLED + case XML_DOCB_DOCUMENT_NODE: +#endif + case XML_ELEMENT_NODE: + case XML_ATTRIBUTE_NODE: + case XML_PI_NODE: + case XML_COMMENT_NODE: + case XML_CDATA_SECTION_NODE: + case XML_TEXT_NODE: + case XML_NAMESPACE_DECL: + XP_TEST_HIT + break; + default: + break; + } + } else if (cur->type == type) { + if (type == XML_NAMESPACE_DECL) + XP_TEST_HIT_NS + else + XP_TEST_HIT + } else if ((type == NODE_TYPE_TEXT) && + (cur->type == XML_CDATA_SECTION_NODE)) + { + XP_TEST_HIT + } + break; case NODE_TEST_PI: - if (cur->type == XML_PI_NODE) { - if ((name != NULL) && - (!xmlStrEqual(name, cur->name))) - break; - pos++; - if (pos == reqpos) - addNode(list, cur); + if ((cur->type == XML_PI_NODE) && + ((name == NULL) || xmlStrEqual(name, cur->name))) + { + XP_TEST_HIT } break; case NODE_TEST_ALL: if (axis == AXIS_ATTRIBUTE) { - if (cur->type == XML_ATTRIBUTE_NODE) { - pos++; - if (pos == reqpos) - addNode(list, cur); + if (cur->type == XML_ATTRIBUTE_NODE) + { + XP_TEST_HIT } } else if (axis == AXIS_NAMESPACE) { - if (cur->type == XML_NAMESPACE_DECL) { - pos++; - if (pos == reqpos) - xmlXPathNodeSetAddNs(list, xpctxt->node, - (xmlNsPtr) cur); + if (cur->type == XML_NAMESPACE_DECL) + { + XP_TEST_HIT_NS } } else { if (cur->type == XML_ELEMENT_NODE) { - if (prefix == NULL) { - pos++; - if (pos == reqpos) - addNode(list, cur); + if (prefix == NULL) + { + XP_TEST_HIT + } else if ((cur->ns != NULL) && - (xmlStrEqual(URI, cur->ns->href))) { - pos++; - if (pos == reqpos) - addNode(list, cur); + (xmlStrEqual(URI, cur->ns->href))) + { + XP_TEST_HIT } } } @@ -12015,19 +12245,15 @@ xmlXPathNodeCollectAndTestNth(xmlXPathParserContextPtr ctxt, case XML_ELEMENT_NODE: if (xmlStrEqual(name, cur->name)) { if (prefix == NULL) { - if (cur->ns == NULL) { - pos++; - if (pos == reqpos) - addNode(list, cur); + if (cur->ns == NULL) + { + XP_TEST_HIT } } else { if ((cur->ns != NULL) && - (xmlStrEqual(URI, - cur->ns->href))) + (xmlStrEqual(URI, cur->ns->href))) { - pos++; - if (pos == reqpos) - addNode(list, cur); + XP_TEST_HIT } } } @@ -12040,18 +12266,14 @@ xmlXPathNodeCollectAndTestNth(xmlXPathParserContextPtr ctxt, if ((attr->ns == NULL) || (attr->ns->prefix == NULL)) { - pos++; - if (pos == reqpos) - addNode(list, cur); + XP_TEST_HIT } } else { if ((attr->ns != NULL) && (xmlStrEqual(URI, attr->ns->href))) { - pos++; - if (pos == reqpos) - addNode(list, cur); + XP_TEST_HIT } } } @@ -12062,11 +12284,9 @@ xmlXPathNodeCollectAndTestNth(xmlXPathParserContextPtr ctxt, xmlNsPtr ns = (xmlNsPtr) cur; if ((ns->prefix != NULL) && (name != NULL) - && (xmlStrEqual(ns->prefix, name))) { - pos++; - if (pos == reqpos) - xmlXPathNodeSetAddNs(list, - xpctxt->node, (xmlNsPtr) cur); + && (xmlStrEqual(ns->prefix, name))) + { + XP_TEST_HIT_NS } } break; @@ -12074,33 +12294,179 @@ xmlXPathNodeCollectAndTestNth(xmlXPathParserContextPtr ctxt, break; } break; - } - } while (pos < reqpos); + } /* switch(test) */ + } while (cur != NULL); + + goto apply_predicates; + +axis_range_end: /* ----------------------------------------------------- */ + /* + * We have a "/foo[n]", and position() = n was reached. + * Note that we can have as well "/foo/::parent::foo[1]", so + * a duplicate-aware merge is still needed. + * Merge with the result. + */ + if (outSeq == NULL) { + outSeq = seq; + seq = NULL; + } else + outSeq = mergeAndClear(outSeq, seq, 0); + /* + * Break if only a true/false result was requested. + */ + if (toBool) + break; + continue; + +first_hit: /* ---------------------------------------------------------- */ + /* + * Break if only a true/false result was requested and + * no predicates existed and a node test succeeded. + */ + if (outSeq == NULL) { + outSeq = seq; + seq = NULL; + } else + outSeq = mergeAndClear(outSeq, seq, 0); + break; + +#ifdef DEBUG_STEP + if (seq != NULL) + nbMatches += seq->nodeNr; +#endif + +apply_predicates: /* --------------------------------------------------- */ + /* + * Apply predicates. + */ + if ((predOp != NULL) && (seq->nodeNr > 0)) { + /* + * E.g. when we have a "/foo[some expression][n]". + */ + /* + * QUESTION TODO: The old predicate evaluation took into + * account location-sets. + * (E.g. ctxt->value->type == XPATH_LOCATIONSET) + * Do we expect such a set here? + * All what I learned now from the evaluation semantics + * does not indicate that a location-set will be processed + * here, so this looks OK. + */ + /* + * Iterate over all predicates, starting with the outermost + * predicate. + * TODO: Problem: we cannot execute the inner predicates first + * since we cannot go back *up* the operator tree! + * Options we have: + * 1) Use of recursive functions (like is it currently done + * via xmlXPathCompOpEval()) + * 2) Add a predicate evaluation information stack to the + * context struct + * 3) Change the way the operators are linked; we need a + * "parent" field on xmlXPathStepOp + * + * For the moment, I'll try to solve this with a recursive + * function: xmlXPathCompOpEvalPredicate(). + */ + size = seq->nodeNr; + if (hasPredicateRange != 0) + newSize = xmlXPathCompOpEvalPositionalPredicate(ctxt, + predOp, seq, size, maxPos, maxPos, hasNsNodes); + else + newSize = xmlXPathCompOpEvalPredicate(ctxt, + predOp, seq, size, hasNsNodes); + + if (ctxt->error != XPATH_EXPRESSION_OK) { + total = 0; + goto error; + } + /* + * Add the filtered set of nodes to the result node set. + */ + if (newSize == 0) { + /* + * The predicates filtered all nodes out. + */ + xmlXPathNodeSetClear(seq, hasNsNodes); + } else if (seq->nodeNr > 0) { + /* + * Add to result set. + */ + if (outSeq == NULL) { + if (size != newSize) { + /* + * We need to merge and clear here, since + * the sequence will contained NULLed entries. + */ + outSeq = mergeAndClear(NULL, seq, 1); + } else { + outSeq = seq; + seq = NULL; + } + } else + outSeq = mergeAndClear(outSeq, seq, + (size != newSize) ? 1: 0); + /* + * Break if only a true/false result was requested. + */ + if (toBool) + break; + } + } else if (seq->nodeNr > 0) { + /* + * Add to result set. + */ + if (outSeq == NULL) { + outSeq = seq; + seq = NULL; + } else { + outSeq = mergeAndClear(outSeq, seq, 0); + } + } } - xpctxt->node = oldContextNode; - -#ifdef DEBUG_STEP_NTH - xmlGenericError(xmlGenericErrorContext, - "\nExamined %d nodes, found %d nodes at that step\n", - total, list->nodeNr); -#endif - - valuePush(ctxt, xmlXPathCacheWrapNodeSet(xpctxt, list)); +error: if ((obj->boolval) && (obj->user != NULL)) { + /* + * QUESTION TODO: What does this do and why? + * TODO: Do we have to do this also for the "error" + * cleanup further down? + */ ctxt->value->boolval = 1; ctxt->value->user = obj->user; obj->user = NULL; obj->boolval = 0; } xmlXPathReleaseObject(xpctxt, obj); - return(total); -error: + /* + * Ensure we return at least an emtpy set. + */ + if (outSeq == NULL) { + if ((seq != NULL) && (seq->nodeNr == 0)) + outSeq = seq; + else + outSeq = xmlXPathNodeSetCreate(NULL); + } + if ((seq != NULL) && (seq != outSeq)) { + xmlXPathFreeNodeSet(seq); + } + /* + * Hand over the result. Better to push the set also in + * case of errors. + */ + valuePush(ctxt, xmlXPathCacheWrapNodeSet(xpctxt, outSeq)); + /* + * Reset the context node. + */ xpctxt->node = oldContextNode; - xmlXPathReleaseObject(xpctxt, obj); - if (list != NULL) - xmlXPathFreeNodeSet(list); + +#ifdef DEBUG_STEP + xmlGenericError(xmlGenericErrorContext, + "\nExamined %d nodes, found %d nodes at that step\n", + total, nbMatches); +#endif + return(total); } @@ -12202,29 +12568,7 @@ xmlXPathCompOpEvalFirst(xmlXPathParserContextPtr ctxt, total = xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); CHECK_ERROR0; - /* - * Optimization for [n] selection where n is a number - */ - if ((op->ch2 != -1) && - (comp->steps[op->ch2].op == XPATH_OP_PREDICATE) && - (comp->steps[op->ch2].ch1 == -1) && - (comp->steps[op->ch2].ch2 != -1) && - (comp->steps[comp->steps[op->ch2].ch2].op == - XPATH_OP_VALUE)) { - xmlXPathObjectPtr val; - - val = comp->steps[comp->steps[op->ch2].ch2].value4; - if ((val != NULL) && (val->type == XPATH_NUMBER)) { - int indx = (int) val->floatval; - - if (val->floatval == (float) indx) { - xmlXPathNodeCollectAndTestNth(ctxt, op, indx, - first, NULL); - return (total); - } - } - } - total += xmlXPathNodeCollectAndTest(ctxt, op, first, NULL); + total += xmlXPathNodeCollectAndTest(ctxt, op, first, NULL, 0); return (total); } case XPATH_OP_VALUE: @@ -12359,31 +12703,7 @@ xmlXPathCompOpEvalLast(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op, total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); CHECK_ERROR0; - /* - * Optimization for [n] selection where n is a number - */ - if ((op->ch2 != -1) && - (comp->steps[op->ch2].op == XPATH_OP_PREDICATE) && - (comp->steps[op->ch2].ch1 == -1) && - (comp->steps[op->ch2].ch2 != -1) && - (comp->steps[comp->steps[op->ch2].ch2].op == - XPATH_OP_VALUE)) { - xmlXPathObjectPtr val; - - val = comp->steps[comp->steps[op->ch2].ch2].value4; - if ((val != NULL) && (val->type == XPATH_NUMBER)) { - int indx = (int) val->floatval; - - if (val->floatval == (float) indx) { - total += - xmlXPathNodeCollectAndTestNth(ctxt, op, - indx, NULL, - last); - return (total); - } - } - } - total += xmlXPathNodeCollectAndTest(ctxt, op, NULL, last); + total += xmlXPathNodeCollectAndTest(ctxt, op, NULL, last, 0); return (total); } case XPATH_OP_VALUE: @@ -12551,7 +12871,7 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, } if (ctxt->value == tmp) { valuePop(ctxt); - xmlXPathNodeSetClear(tmp->nodesetval); + xmlXPathNodeSetClear(tmp->nodesetval, 1); /* * REVISIT TODO: Don't create a temporary nodeset * for everly iteration. @@ -12670,7 +12990,7 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, * in order to avoid massive recreation inside this * loop. */ - xmlXPathNodeSetClear(tmp->nodesetval); + xmlXPathNodeSetClear(tmp->nodesetval, 1); } else tmp = NULL; ctxt->context->node = NULL; @@ -12917,32 +13237,8 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); CHECK_ERROR0; - - if ((op->ch2 != -1) && - (comp->steps[op->ch2].op == XPATH_OP_PREDICATE) && - (comp->steps[op->ch2].ch1 == -1) && - (comp->steps[op->ch2].ch2 != -1) && - (comp->steps[comp->steps[op->ch2].ch2].op == - XPATH_OP_VALUE)) - { - xmlXPathObjectPtr val; - /* - * Optimization for [n] selection where n is a number - */ - val = comp->steps[comp->steps[op->ch2].ch2].value4; - if ((val != NULL) && (val->type == XPATH_NUMBER)) { - int indx = (int) val->floatval; - if (val->floatval == (float) indx) { - total += - xmlXPathNodeCollectAndTestNth(ctxt, op, - indx, NULL, - NULL); - return (total); - } - } - } - total += xmlXPathNodeCollectAndTest(ctxt, op, NULL, NULL); + total += xmlXPathNodeCollectAndTest(ctxt, op, NULL, NULL, 0); return (total); } case XPATH_OP_VALUE: @@ -13391,7 +13687,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) } if (ctxt->value == tmp) { valuePop(ctxt); - xmlXPathNodeSetClear(tmp->nodesetval); + xmlXPathNodeSetClear(tmp->nodesetval, 1); /* * Don't free the temporary nodeset * in order to avoid massive recreation inside this @@ -13599,6 +13895,95 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) return (total); } +/** + * xmlXPathCompOpEvalToBoolean: + * @ctxt: the XPath parser context + * + * Evaluates if the expression evaluates to true. + * + * Returns 1 if true, 0 if false and -1 on API or internal errors. + */ +static int +xmlXPathCompOpEvalToBoolean(xmlXPathParserContextPtr ctxt, + xmlXPathStepOpPtr op, + int isPredicate) +{ + xmlXPathObjectPtr resObj = NULL; + +start: + /* comp = ctxt->comp; */ + switch (op->op) { + case XPATH_OP_END: + return (0); + case XPATH_OP_VALUE: + resObj = (xmlXPathObjectPtr) op->value4; + if (isPredicate) + return(xmlXPathEvaluatePredicateResult(ctxt, resObj)); + return(xmlXPathCastToBoolean(resObj)); + case XPATH_OP_SORT: + /* + * We don't need sorting for boolean results. Skip this one. + */ + if (op->ch1 != -1) { + op = &ctxt->comp->steps[op->ch1]; + goto start; + } + return(0); + case XPATH_OP_COLLECT: + if (op->ch1 == -1) + return(0); + + xmlXPathCompOpEval(ctxt, &ctxt->comp->steps[op->ch1]); + if (ctxt->error != XPATH_EXPRESSION_OK) + return(-1); + + xmlXPathNodeCollectAndTest(ctxt, op, NULL, NULL, 1); + if (ctxt->error != XPATH_EXPRESSION_OK) + return(-1); + + resObj = valuePop(ctxt); + if (resObj == NULL) + return(-1); + break; + default: + /* + * Fallback to call xmlXPathCompOpEval(). + */ + xmlXPathCompOpEval(ctxt, op); + if (ctxt->error != XPATH_EXPRESSION_OK) + return(-1); + + resObj = valuePop(ctxt); + if (resObj == NULL) + return(-1); + break; + } + + if (resObj) { + int res; + + if (resObj->type == XPATH_BOOLEAN) { + res = resObj->boolval; + } else if (isPredicate) { + /* + * For predicates a result of type "number" is handled + * differently: + * SPEC XPath 1.0: + * "If the result is a number, the result will be converted + * to true if the number is equal to the context position + * and will be converted to false otherwise;" + */ + res = xmlXPathEvaluatePredicateResult(ctxt, resObj); + } else { + res = xmlXPathCastToBoolean(resObj); + } + xmlXPathReleaseObject(ctxt->context, resObj); + return(res); + } + + return(0); +} + #ifdef XPATH_STREAMING /** * xmlXPathRunStreamEval: @@ -13606,53 +13991,63 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) * * Evaluate the Precompiled Streamable XPath expression in the given context. */ -static xmlXPathObjectPtr -xmlXPathRunStreamEval(xmlXPathContextPtr ctxt, xmlPatternPtr comp) { +static int +xmlXPathRunStreamEval(xmlXPathContextPtr ctxt, xmlPatternPtr comp, + xmlXPathObjectPtr *resultSeq, int toBool) +{ int max_depth, min_depth; int from_root; int ret, depth; -#ifdef XP_PATTERN_TO_ANY_NODE_ENABLED int eval_all_nodes; -#endif xmlNodePtr cur = NULL, limit = NULL; - xmlXPathObjectPtr retval; - xmlStreamCtxtPtr patstream; + xmlStreamCtxtPtr patstream = NULL; int nb_nodes = 0; if ((ctxt == NULL) || (comp == NULL)) - return(NULL); + return(-1); max_depth = xmlPatternMaxDepth(comp); if (max_depth == -1) - return(NULL); + return(-1); if (max_depth == -2) max_depth = 10000; min_depth = xmlPatternMinDepth(comp); if (min_depth == -1) - return(NULL); + return(-1); from_root = xmlPatternFromRoot(comp); if (from_root < 0) - return(NULL); + return(-1); #if 0 printf("stream eval: depth %d from root %d\n", max_depth, from_root); #endif - retval = xmlXPathCacheNewNodeSet(ctxt, NULL); - if (retval == NULL) - return(NULL); + if (! toBool) { + if (resultSeq == NULL) + return(-1); + *resultSeq = xmlXPathCacheNewNodeSet(ctxt, NULL); + if (*resultSeq == NULL) + return(-1); + } /* - * handle the special cases of / amd . being matched + * handle the special cases of "/" amd "." being matched */ if (min_depth == 0) { if (from_root) { - xmlXPathNodeSetAddUnique(retval->nodesetval, (xmlNodePtr) ctxt->doc); + /* Select "/" */ + if (toBool) + return(1); + xmlXPathNodeSetAddUnique((*resultSeq)->nodesetval, + (xmlNodePtr) ctxt->doc); } else { - xmlXPathNodeSetAddUnique(retval->nodesetval, ctxt->node); + /* Select "self::node()" */ + if (toBool) + return(1); + xmlXPathNodeSetAddUnique((*resultSeq)->nodesetval, ctxt->node); } } if (max_depth == 0) { - return(retval); + return(0); } if (from_root) { @@ -13688,23 +14083,27 @@ xmlXPathRunStreamEval(xmlXPathContextPtr ctxt, xmlPatternPtr comp) { } limit = cur; } - if (cur == NULL) - return(retval); + if (cur == NULL) { + return(0); + } patstream = xmlPatternGetStreamCtxt(comp); if (patstream == NULL) { - return(retval); + /* + * QUESTION TODO: Is this an error? + */ + return(0); } -#ifdef XP_PATTERN_TO_ANY_NODE_ENABLED eval_all_nodes = xmlStreamWantsAnyNode(patstream); -#endif if (from_root) { ret = xmlStreamPush(patstream, NULL, NULL); if (ret < 0) { } else if (ret == 1) { - xmlXPathNodeSetAddUnique(retval->nodesetval, cur); + if (toBool) + goto return_1; + xmlXPathNodeSetAddUnique((*resultSeq)->nodesetval, cur); } } depth = 0; @@ -13715,27 +14114,24 @@ next_node: switch (cur->type) { case XML_ELEMENT_NODE: -#ifdef XP_PATTERN_TO_ANY_NODE_ENABLED case XML_TEXT_NODE: case XML_CDATA_SECTION_NODE: case XML_COMMENT_NODE: - case XML_PI_NODE: -#endif + case XML_PI_NODE: if (cur->type == XML_ELEMENT_NODE) { ret = xmlStreamPush(patstream, cur->name, (cur->ns ? cur->ns->href : NULL)); - } -#ifdef XP_PATTERN_TO_ANY_NODE_ENABLED - else if (eval_all_nodes) + } else if (eval_all_nodes) ret = xmlStreamPushNode(patstream, NULL, NULL, cur->type); else break; -#endif if (ret < 0) { /* NOP. */ } else if (ret == 1) { - xmlXPathNodeSetAddUnique(retval->nodesetval, cur); + if (toBool) + goto return_1; + xmlXPathNodeSetAddUnique((*resultSeq)->nodesetval, cur); } if ((cur->children == NULL) || (depth >= max_depth)) { ret = xmlStreamPop(patstream); @@ -13748,8 +14144,8 @@ next_node: } default: break; - } - + } + scan_children: if ((cur->children != NULL) && (depth < max_depth)) { /* @@ -13783,9 +14179,7 @@ scan_children: goto done; if (cur->type == XML_ELEMENT_NODE) { ret = xmlStreamPop(patstream); - } -#ifdef XP_PATTERN_TO_ANY_NODE_ENABLED - else if ((eval_all_nodes) && + } else if ((eval_all_nodes) && ((cur->type == XML_TEXT_NODE) || (cur->type == XML_CDATA_SECTION_NODE) || (cur->type == XML_COMMENT_NODE) || @@ -13793,7 +14187,6 @@ scan_children: { ret = xmlStreamPop(patstream); } -#endif if (cur->next != NULL) { cur = cur->next; break; @@ -13801,28 +14194,39 @@ scan_children: } while (cur != NULL); } while ((cur != NULL) && (depth >= 0)); + done: + #if 0 printf("stream eval: checked %d nodes selected %d\n", - nb_nodes, retval->nodesetval->nodeNr); + nb_nodes, retObj->nodesetval->nodeNr); #endif - xmlFreeStreamCtxt(patstream); - return(retval); + + if (patstream) + xmlFreeStreamCtxt(patstream); + return(0); + +return_1: + if (patstream) + xmlFreeStreamCtxt(patstream); + return(1); } #endif /* XPATH_STREAMING */ /** * xmlXPathRunEval: * @ctxt: the XPath parser context with the compiled expression + * @toBool: evaluate to a boolean result * * Evaluate the Precompiled XPath expression in the given context. */ -static void -xmlXPathRunEval(xmlXPathParserContextPtr ctxt) { +static int +xmlXPathRunEval(xmlXPathParserContextPtr ctxt, int toBool) +{ xmlXPathCompExprPtr comp; if ((ctxt == NULL) || (ctxt->comp == NULL)) - return; + return(-1); if (ctxt->valueTab == NULL) { /* Allocate the value stack */ @@ -13838,21 +14242,51 @@ xmlXPathRunEval(xmlXPathParserContextPtr ctxt) { } #ifdef XPATH_STREAMING if (ctxt->comp->stream) { - xmlXPathObjectPtr ret; - ret = xmlXPathRunStreamEval(ctxt->context, ctxt->comp->stream); - if (ret != NULL) { - valuePush(ctxt, ret); - return; + int res; + + if (toBool) { + /* + * Evaluation to boolean result. + */ + res = xmlXPathRunStreamEval(ctxt->context, + ctxt->comp->stream, NULL, 1); + if (res != -1) + return(res); + } else { + xmlXPathObjectPtr resObj = NULL; + + /* + * Evaluation to a sequence. + */ + res = xmlXPathRunStreamEval(ctxt->context, + ctxt->comp->stream, &resObj, 0); + + if ((res != -1) && (resObj != NULL)) { + valuePush(ctxt, resObj); + return(0); + } + if (resObj != NULL) + xmlXPathReleaseObject(ctxt->context, resObj); } + /* + * QUESTION TODO: This falls back to normal XPath evaluation + * if res == -1. Is this intended? + */ } #endif comp = ctxt->comp; - if(comp->last < 0) { + if (comp->last < 0) { xmlGenericError(xmlGenericErrorContext, "xmlXPathRunEval: last is less than zero\n"); - return; + return(-1); } - xmlXPathCompOpEval(ctxt, &comp->steps[comp->last]); + if (toBool) + return(xmlXPathCompOpEvalToBoolean(ctxt, + &comp->steps[comp->last], 0)); + else + xmlXPathCompOpEval(ctxt, &comp->steps[comp->last]); + + return(0); } /************************************************************************ @@ -13935,8 +14369,7 @@ xmlXPathEvaluatePredicateResult(xmlXPathParserContextPtr ctxt, return(0); return(res->nodesetval->nodeNr != 0); case XPATH_STRING: - return((res->stringval != NULL) && - (xmlStrlen(res->stringval) != 0)); + return((res->stringval != NULL) && (res->stringval[0] != 0)); #ifdef LIBXML_XPTR_ENABLED case XPATH_LOCATIONSET:{ xmlLocationSetPtr ptr = res->user; @@ -14058,7 +14491,7 @@ xmlXPathRewriteDOSExpression(xmlXPathCompExprPtr comp, xmlXPathStepOpPtr op) ((xmlXPathTypeVal) op->value3 == NODE_TYPE_NODE /* 0 */)) { /* - * This is an "foo" + * This is a "child::foo" */ xmlXPathStepOpPtr prevop = &comp->steps[op->ch1]; @@ -14072,7 +14505,7 @@ xmlXPathRewriteDOSExpression(xmlXPathCompExprPtr comp, xmlXPathStepOpPtr op) (comp->steps[prevop->ch1].op == XPATH_OP_ROOT)) { /* - * This is a "descendant-or-self::node()" without predicates. + * This is a "/descendant-or-self::node()" without predicates. * Eliminate it. */ op->ch1 = prevop->ch1; @@ -14132,17 +14565,20 @@ xmlXPathCtxtCompile(xmlXPathContextPtr ctxt, const xmlChar *str) { pctxt->comp = NULL; } xmlXPathFreeParserContext(pctxt); + if (comp != NULL) { comp->expr = xmlStrdup(str); #ifdef DEBUG_EVAL_COUNTS comp->string = xmlStrdup(str); comp->nb = 0; -#endif - if ((comp->nbStep > 2) && +#endif + if ((comp->expr != NULL) && + (comp->nbStep > 2) && + (comp->last >= 0) && (xmlXPathCanRewriteDosExpression(comp->expr) == 1)) { xmlXPathRewriteDOSExpression(comp, &comp->steps[comp->last]); - } + } } return(comp); } @@ -14162,28 +14598,34 @@ xmlXPathCompile(const xmlChar *str) { } /** - * xmlXPathCompiledEval: + * xmlXPathCompiledEvalInternal: * @comp: the compiled XPath expression - * @ctx: the XPath context + * @ctxt: the XPath context + * @resObj: the resulting XPath object or NULL + * @toBool: 1 if only a boolean result is requested * * Evaluate the Precompiled XPath expression in the given context. + * The caller has to free @resObj. * * Returns the xmlXPathObjectPtr resulting from the evaluation or NULL. * the caller has to free the object. */ -xmlXPathObjectPtr -xmlXPathCompiledEval(xmlXPathCompExprPtr comp, xmlXPathContextPtr ctx) { - xmlXPathParserContextPtr ctxt; - xmlXPathObjectPtr res, tmp, init = NULL; - int stack = 0; +static int +xmlXPathCompiledEvalInternal(xmlXPathCompExprPtr comp, + xmlXPathContextPtr ctxt, + xmlXPathObjectPtr *resObj, + int toBool) +{ + xmlXPathParserContextPtr pctxt; #ifndef LIBXML_THREAD_ENABLED static int reentance = 0; #endif + int res; - CHECK_CTXT(ctx) + CHECK_CTXT_NEG(ctxt) if (comp == NULL) - return(NULL); + return(-1); xmlXPathInit(); #ifndef LIBXML_THREAD_ENABLED @@ -14199,43 +14641,93 @@ xmlXPathCompiledEval(xmlXPathCompExprPtr comp, xmlXPathContextPtr ctx) { comp->nb = 0; } #endif - ctxt = xmlXPathCompParserContext(comp, ctx); - xmlXPathRunEval(ctxt); + pctxt = xmlXPathCompParserContext(comp, ctxt); + res = xmlXPathRunEval(pctxt, toBool); - if (ctxt->value == NULL) { - xmlGenericError(xmlGenericErrorContext, + if (resObj) { + if (pctxt->value == NULL) { + xmlGenericError(xmlGenericErrorContext, "xmlXPathCompiledEval: evaluation failed\n"); - res = NULL; - } else { - res = valuePop(ctxt); + *resObj = NULL; + } else { + *resObj = valuePop(pctxt); + } } - - do { - tmp = valuePop(ctxt); - if (tmp != NULL) { - if (tmp != init) - stack++; - xmlXPathReleaseObject(ctx, tmp); - } - } while (tmp != NULL); - if ((stack != 0) && (res != NULL)) { - xmlGenericError(xmlGenericErrorContext, - "xmlXPathCompiledEval: %d object left on the stack\n", - stack); + /* + * Pop all remaining objects from the stack. + */ + if (pctxt->valueNr > 0) { + xmlXPathObjectPtr tmp; + int stack = 0; + + do { + tmp = valuePop(pctxt); + if (tmp != NULL) { + if (tmp != NULL) + stack++; + xmlXPathReleaseObject(ctxt, tmp); + } + } while (tmp != NULL); + if ((stack != 0) && + ((toBool) || ((resObj) && (*resObj)))) + { + xmlGenericError(xmlGenericErrorContext, + "xmlXPathCompiledEval: %d objects left on the stack.\n", + stack); + } } - if (ctxt->error != XPATH_EXPRESSION_OK) { - xmlXPathFreeObject(res); - res = NULL; + + if ((pctxt->error != XPATH_EXPRESSION_OK) && (resObj) && (*resObj)) { + xmlXPathFreeObject(*resObj); + *resObj = NULL; } - ctxt->comp = NULL; - xmlXPathFreeParserContext(ctxt); + pctxt->comp = NULL; + xmlXPathFreeParserContext(pctxt); #ifndef LIBXML_THREAD_ENABLED reentance--; #endif + + return(res); +} + +/** + * xmlXPathCompiledEval: + * @comp: the compiled XPath expression + * @ctx: the XPath context + * + * Evaluate the Precompiled XPath expression in the given context. + * + * Returns the xmlXPathObjectPtr resulting from the evaluation or NULL. + * the caller has to free the object. + */ +xmlXPathObjectPtr +xmlXPathCompiledEval(xmlXPathCompExprPtr comp, xmlXPathContextPtr ctx) +{ + xmlXPathObjectPtr res = NULL; + + xmlXPathCompiledEvalInternal(comp, ctx, &res, 0); return(res); } +/** + * xmlXPathCompiledEvalToBoolean: + * @comp: the compiled XPath expression + * @ctxt: the XPath context + * + * Applies the XPath boolean() function on the result of the given + * compiled expression. + * + * Returns 1 if the expression evaluated to true, 0 if to false and + * -1 in API and internal errors. + */ +int +xmlXPathCompiledEvalToBoolean(xmlXPathCompExprPtr comp, + xmlXPathContextPtr ctxt) +{ + return(xmlXPathCompiledEvalInternal(comp, ctxt, NULL, 1)); +} + /** * xmlXPathEvalExpr: * @ctxt: the XPath Parser context @@ -14263,16 +14755,22 @@ xmlXPathEvalExpr(xmlXPathParserContextPtr ctxt) { #endif { xmlXPathCompileExpr(ctxt, 1); - if ((ctxt->comp != NULL) && + /* + * In this scenario the expression string will sit in ctxt->base. + */ + if ((ctxt->error == XPATH_EXPRESSION_OK) && + (ctxt->comp != NULL) && + (ctxt->base != NULL) && (ctxt->comp->nbStep > 2) && - (xmlXPathCanRewriteDosExpression(ctxt->comp->expr) == 1)) + (ctxt->comp->last >= 0) && + (xmlXPathCanRewriteDosExpression((xmlChar *) ctxt->base) == 1)) { xmlXPathRewriteDOSExpression(ctxt->comp, - &ctxt->comp->steps[comp->last]); + &ctxt->comp->steps[ctxt->comp->last]); } } CHECK_ERROR; - xmlXPathRunEval(ctxt); + xmlXPathRunEval(ctxt, 0); } /** @@ -14358,7 +14856,7 @@ xmlXPathEvalExpression(const xmlChar *str, xmlXPathContextPtr ctxt) { pctxt = xmlXPathNewParserContext(str, ctxt); xmlXPathEvalExpr(pctxt); - if (*pctxt->cur != 0) { + if ((*pctxt->cur != 0) || (pctxt->error != XPATH_EXPRESSION_OK)) { xmlXPatherror(pctxt, __FILE__, __LINE__, XPATH_EXPR_ERROR); res = NULL; } else { diff --git a/xstc/Makefile.am b/xstc/Makefile.am index 8b1d1f0..57e1a4a 100644 --- a/xstc/Makefile.am +++ b/xstc/Makefile.am @@ -33,20 +33,24 @@ $(TESTDIRS) Tests/Metadata/$(NISTTESTDEF_2) Tests/Metadata/$(MSTTESTDEF) Tests/M mkdir Tests ; \ fi) -@(if [ ! -f $(TARBALL_2) ] ; then \ + if [ -f $(srcdir)/$(TARBALL_2) ] ; then \ + $(LN_S) $(srcdir)/$(TARBALL_2) $(TARBALL_2) ; else \ echo "Missing the test suite description (2004-01-14), trying to fetch it" ;\ - if [ -x /usr/bin/wget ] ; then \ - wget $(TARBALLURL_2) ; \ - else echo "Dont' know how to fetch $(TARBALLURL_2)" ; fi ; fi) + if [ -x "$(WGET)" ] ; then \ + $(WGET) $(TARBALLURL_2) ; \ + else echo "Dont' know how to fetch $(TARBALLURL_2)" ; fi ; fi ; fi) -@(if [ -f $(TARBALL_2) ] ; then \ echo -n "extracting test data (NIST)..." ; \ $(TAR) -xzf $(TARBALL_2) '*/Datatypes' '*/Metadata/$(NISTTESTDEF_2)' ; \ echo "done" ; \ fi) -@(if [ ! -f $(TARBALL) ] ; then \ + if [ -f $(srcdir)/$(TARBALL) ] ; then \ + $(LN_S) $(srcdir)/$(TARBALL) $(TARBALL) ; else \ echo "Missing the test suite description (2002-01-16), trying to fetch it" ;\ - if [ -x /usr/bin/wget ] ; then \ - wget $(TARBALLURL) ; \ - else echo "Dont' know how to fetch $(TARBALLURL)" ; fi ; fi) + if [ -x "$(WGET)" ] ; then \ + $(WGET) $(TARBALLURL) ; \ + else echo "Dont' know how to fetch $(TARBALLURL)" ; fi ; fi ; fi) -@(if [ -f $(TARBALL) ] ; then \ echo -n "extracting test data (Sun, Microsoft)..." ; \ $(TAR) -C Tests -xzf $(TARBALL) '*/suntest' '*/msxsdtest' '*/$(MSTESTDEF)' '*/$(SUNTESTDEF)' ; \ @@ -92,21 +96,21 @@ sun-test.py: Tests/Metadata/$(SUNTESTDEF) xstc-to-python.xsl pytests: $(PYSCRIPTS) $(TESTDIRS) -@(if [ -x nist-test.py -a -d $(TESTDIR)/Datatypes ] ; then \ echo "## Running XML Schema tests (NIST)"; \ - PYTHONPATH="../python:../python/.libs:..:../libs:$$PYTHONPATH" ;\ + PYTHONPATH="../python:../python/.libs:..:../.libs:$$PYTHONPATH" ;\ export PYTHONPATH; \ LD_LIBRARY_PATH="$(top_builddir)/.libs:$$LD_LIBRARY_PATH" ; \ export LD_LIBRARY_PATH; \ $(CHECKER) $(PYTHON) nist-test.py -s -b $(srcdir) ; fi) -@(if [ -x sun-test.py -a -d $(TESTDIR)/suntest ] ; then \ echo "## Running Schema tests (Sun)"; \ - PYTHONPATH="../python:../python/.libs:..:../libs:$$PYTHONPATH" ;\ + PYTHONPATH="../python:../python/.libs:..:../.libs:$$PYTHONPATH" ;\ export PYTHONPATH; \ LD_LIBRARY_PATH="$(top_builddir)/.libs:$$LD_LIBRARY_PATH" ; \ export LD_LIBRARY_PATH; \ $(CHECKER) $(PYTHON) sun-test.py -s -b $(srcdir) ; fi) -@(if [ -x ms-test.py -a -d $(TESTDIR)/msxsdtest ] ; then \ echo "## Running Schema tests (Microsoft)"; \ - PYTHONPATH="../python:../python/.libs:..:../libs:$$PYTHONPATH" ;\ + PYTHONPATH="../python:../python/.libs:..:../.libs:$$PYTHONPATH" ;\ export PYTHONPATH; \ LD_LIBRARY_PATH="$(top_builddir)/.libs:$$LD_LIBRARY_PATH" ; \ export LD_LIBRARY_PATH; \ diff --git a/xstc/Makefile.in b/xstc/Makefile.in index ad49db7..f889d3f 100644 --- a/xstc/Makefile.in +++ b/xstc/Makefile.in @@ -136,6 +136,7 @@ RDL_LIBS = @RDL_LIBS@ READER_TEST = @READER_TEST@ RELDATE = @RELDATE@ RM = @RM@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STATIC_BINARIES = @STATIC_BINARIES@ @@ -164,6 +165,7 @@ THREAD_CFLAGS = @THREAD_CFLAGS@ THREAD_LIBS = @THREAD_LIBS@ U = @U@ VERSION = @VERSION@ +WGET = @WGET@ WIN32_EXTRA_LDFLAGS = @WIN32_EXTRA_LDFLAGS@ WIN32_EXTRA_LIBADD = @WIN32_EXTRA_LIBADD@ WITH_C14N = @WITH_C14N@ @@ -199,6 +201,7 @@ WITH_WRITER = @WITH_WRITER@ WITH_XINCLUDE = @WITH_XINCLUDE@ WITH_XPATH = @WITH_XPATH@ WITH_XPTR = @WITH_XPTR@ +WITH_ZLIB = @WITH_ZLIB@ XINCLUDE_OBJ = @XINCLUDE_OBJ@ XMLLINT = @XMLLINT@ XML_CFLAGS = @XML_CFLAGS@ @@ -450,20 +453,24 @@ $(TESTDIRS) Tests/Metadata/$(NISTTESTDEF_2) Tests/Metadata/$(MSTTESTDEF) Tests/M mkdir Tests ; \ fi) -@(if [ ! -f $(TARBALL_2) ] ; then \ + if [ -f $(srcdir)/$(TARBALL_2) ] ; then \ + $(LN_S) $(srcdir)/$(TARBALL_2) $(TARBALL_2) ; else \ echo "Missing the test suite description (2004-01-14), trying to fetch it" ;\ - if [ -x /usr/bin/wget ] ; then \ - wget $(TARBALLURL_2) ; \ - else echo "Dont' know how to fetch $(TARBALLURL_2)" ; fi ; fi) + if [ -x "$(WGET)" ] ; then \ + $(WGET) $(TARBALLURL_2) ; \ + else echo "Dont' know how to fetch $(TARBALLURL_2)" ; fi ; fi ; fi) -@(if [ -f $(TARBALL_2) ] ; then \ echo -n "extracting test data (NIST)..." ; \ $(TAR) -xzf $(TARBALL_2) '*/Datatypes' '*/Metadata/$(NISTTESTDEF_2)' ; \ echo "done" ; \ fi) -@(if [ ! -f $(TARBALL) ] ; then \ + if [ -f $(srcdir)/$(TARBALL) ] ; then \ + $(LN_S) $(srcdir)/$(TARBALL) $(TARBALL) ; else \ echo "Missing the test suite description (2002-01-16), trying to fetch it" ;\ - if [ -x /usr/bin/wget ] ; then \ - wget $(TARBALLURL) ; \ - else echo "Dont' know how to fetch $(TARBALLURL)" ; fi ; fi) + if [ -x "$(WGET)" ] ; then \ + $(WGET) $(TARBALLURL) ; \ + else echo "Dont' know how to fetch $(TARBALLURL)" ; fi ; fi ; fi) -@(if [ -f $(TARBALL) ] ; then \ echo -n "extracting test data (Sun, Microsoft)..." ; \ $(TAR) -C Tests -xzf $(TARBALL) '*/suntest' '*/msxsdtest' '*/$(MSTESTDEF)' '*/$(SUNTESTDEF)' ; \ @@ -509,21 +516,21 @@ sun-test.py: Tests/Metadata/$(SUNTESTDEF) xstc-to-python.xsl pytests: $(PYSCRIPTS) $(TESTDIRS) -@(if [ -x nist-test.py -a -d $(TESTDIR)/Datatypes ] ; then \ echo "## Running XML Schema tests (NIST)"; \ - PYTHONPATH="../python:../python/.libs:..:../libs:$$PYTHONPATH" ;\ + PYTHONPATH="../python:../python/.libs:..:../.libs:$$PYTHONPATH" ;\ export PYTHONPATH; \ LD_LIBRARY_PATH="$(top_builddir)/.libs:$$LD_LIBRARY_PATH" ; \ export LD_LIBRARY_PATH; \ $(CHECKER) $(PYTHON) nist-test.py -s -b $(srcdir) ; fi) -@(if [ -x sun-test.py -a -d $(TESTDIR)/suntest ] ; then \ echo "## Running Schema tests (Sun)"; \ - PYTHONPATH="../python:../python/.libs:..:../libs:$$PYTHONPATH" ;\ + PYTHONPATH="../python:../python/.libs:..:../.libs:$$PYTHONPATH" ;\ export PYTHONPATH; \ LD_LIBRARY_PATH="$(top_builddir)/.libs:$$LD_LIBRARY_PATH" ; \ export LD_LIBRARY_PATH; \ $(CHECKER) $(PYTHON) sun-test.py -s -b $(srcdir) ; fi) -@(if [ -x ms-test.py -a -d $(TESTDIR)/msxsdtest ] ; then \ echo "## Running Schema tests (Microsoft)"; \ - PYTHONPATH="../python:../python/.libs:..:../libs:$$PYTHONPATH" ;\ + PYTHONPATH="../python:../python/.libs:..:../.libs:$$PYTHONPATH" ;\ export PYTHONPATH; \ LD_LIBRARY_PATH="$(top_builddir)/.libs:$$LD_LIBRARY_PATH" ; \ export LD_LIBRARY_PATH; \ -- cgit v1.2.3 From 58f9d16e3a77d5207d9ccc413b61e2cb45190018 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Wed, 13 Jun 2007 20:47:19 +0200 Subject: Load /tmp/libxml2-2.6.29 into libxml2/branches/upstream/current. --- ChangeLog | 177 +++++++++++++++++++++++++ HTMLparser.c | 23 +++- HTMLtree.c | 4 + Makefile.am | 2 +- Makefile.in | 2 +- NEWS | 26 ++++ SAX2.c | 42 +++--- catalog.c | 23 +++- configure | 8 +- configure.in | 8 +- doc/APIchunk10.html | 3 +- doc/APIchunk12.html | 2 +- doc/APIchunk13.html | 1 + doc/APIchunk24.html | 2 + doc/APIchunk26.html | 1 - doc/APIchunk5.html | 1 - doc/APIfiles.html | 1 + doc/APIfunctions.html | 2 + doc/APIsymbols.html | 1 + doc/devhelp/libxml2-threads.html | 11 +- doc/devhelp/libxml2-uri.html | 7 +- doc/devhelp/libxml2.devhelp | 1 + doc/examples/Makefile.am | 2 +- doc/examples/Makefile.in | 2 +- doc/html/libxml-threads.html | 5 +- doc/html/libxml-uri.html | 7 +- doc/libxml2-api.xml | 21 ++- doc/libxml2.xsa | 77 ++++------- doc/news.html | 25 +++- doc/xml.html | 27 ++++ encoding.c | 13 +- include/libxml/threads.h | 4 + include/libxml/uri.h | 7 +- include/libxml/xmlversion.h | 11 +- include/libxml/xmlversion.h.in | 3 +- include/win32config.h | 9 +- libxml.h | 17 ++- libxml2.spec | 6 +- list.c | 4 +- nanohttp.c | 9 +- parser.c | 24 +++- python/libxml2-py.c | 32 +++++ python/libxml2-python-api.xml | 11 ++ python/setup.py | 2 +- python/types.c | 3 +- relaxng.c | 3 +- schematron.c | 4 + testapi.c | 2 +- threads.c | 6 +- tree.c | 5 +- uri.c | 65 ++++++++-- valid.c | 23 +++- win32/Makefile.msvc | 81 +++++++++++- win32/configure.js | 12 +- xmlIO.c | 13 +- xmlregexp.c | 6 + xmlsave.c | 1 - xmlwriter.c | 274 +++++++++++++++++++++++++-------------- xpath.c | 50 ++++--- xstc/Makefile.am | 6 +- xstc/Makefile.in | 6 +- 61 files changed, 922 insertions(+), 304 deletions(-) (limited to 'doc/devhelp/libxml2-uri.html') diff --git a/ChangeLog b/ChangeLog index b6a6855..5f5d9a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,180 @@ +Tue Jun 12 18:17:28 CEST 2007 Daniel Veillard + + * doc/* configure.in NEWS: release of libxml2 2.6.28 + * valid.c: patch from Dagfinn I. Mannsåker for idness of name + in HTML, c.f. bug #305885. + +Tue Jun 12 17:14:08 CEST 2007 Daniel Veillard + + * SAX2.c: fixing bug #319964, parsing of HTML attribute really + should not have namespace processing. + +Tue Jun 12 16:42:14 CEST 2007 Daniel Veillard + + * parser.c: fixed the push mode when a big comment occurs before + an internal subset, should close bug #438835 + * test/comment6.xml result//comment6.xml*: added a special + test in the regression suite + +Tue Jun 12 15:41:09 CEST 2007 Daniel Veillard + + * parser.c: fix bug #414846 where invalid characters in attributes + would sometimes not be detected. + * test/errors/attr4.xml result/errors/attr4.xml*: added a specific + test case to the regression tests + +Tue Jun 12 14:23:24 CEST 2007 Daniel Veillard + + * xstc/Makefile.am: apply patch from Ryan Hill to cope with changes + in GNU tar, should fix #396751 + +Tue Jun 12 12:03:36 CEST 2007 Daniel Veillard + + * python/types.c: try to allow compilation on old python version + should fix #398125 + +Tue Jun 12 11:48:15 CEST 2007 Daniel Veillard + + * HTMLtree.c: htmlNodeDumpFormatOutput didn't handle XML_ATTRIBUTE_NODe + fixes bug #438390 + +Tue Jun 12 11:37:55 CEST 2007 Daniel Veillard + + * xmlIO.c: workaround misgenerated file: URIs c.f. #437385 + +Tue Jun 12 11:22:47 CEST 2007 Daniel Veillard + + * relaxng.c: fixed bug #407436 a crash in a specific case of + Relax-NG validation + +Tue Jun 12 11:12:50 CEST 2007 Daniel Veillard + + * catalog.c: fixed bug #383687, some case of recursion on next + were not caught in the catalog code. + +Tue Jun 12 10:37:42 CEST 2007 Daniel Veillard + + * HTMLparser.c: fixed bug #381877, avoid reading over the end + of stream when generating an UTF-8 encoding error. + +Tue Jun 12 10:16:48 CEST 2007 Daniel Veillard + + * parser.c: fixed bug #366161, trivially added the check in + xmlCtxtReset() + +Fri Jun 8 21:48:21 CEST 2007 Rob Richards + + * win32/configure.js win32/Makefile.msvc: add --vcmanifest flag (yes/no) + for VC8 build support to embed manifest within files. Under MS VC, build + libxml2_a_dll.lib by default (LIBXML_STATIC_FOR_DLL flag). + +Fri Jun 8 21:37:46 CEST 2007 Rob Richards + + * threads.c include/libxml/threads.h: use specified calling convention + for xmlDllMain. Old SDKs (VC6) only support InterlockedCompareExchange. + add xmlDllMain to header for win32 when building for static dll + +Fri Jun 8 10:51:28 CEST 2007 Rob Richards + + * xmlwriter.c: fixed problem with namespace declaration being + written more than once per element start tag + +Wed Jun 6 10:18:28 PDT 2007 William Brack + + * xpath.c: fixed problem with xmlXPathNodeSetSort; + fixed problem with xmlXPathNodeTrailingSorted (both bug#413451) + +Wed May 30 22:05:08 PDT 2007 William Brack + + * xpath.c: fixed problem with string value for PI node + (bug #442275) + +Mon May 28 16:14:50 CEST 2007 Daniel Veillard + + * uri.c: fix bug reported by François Delyon + +Tue May 22 08:59:48 PDT 2007 William Brack + + * encoding.c: Fixed typo in xmlCharEncFirstLine pointed out + by Mark Rowe (bug #440159) + * include/libxml/xmlversion.h.in: Added check for definition of + _POSIX_C_SOURCE to avoid warnings on Apple OS/X (patch from + Wendy Doyle and Mark Rowe, bug #346675) + * schematron.c, testapi.c, tree.c, xmlIO.c, xmlsave.c: minor + changes to fix compilation warnings - no change to logic. + +Tue May 15 22:18:08 PDT 2007 William Brack + + * nanohttp.c: small enhancement to last fix, pointed out + by Alex Cornejo + +Tue May 15 12:38:38 PDT 2007 William Brack + + * nanohttp.c: fixed problem on gzip streams (bug #438045) + * xpath.c: fixed minor spot of redundant code - no logic change. + +Fri May 11 22:45:18 HKT 2007 William Brack + + * xpath.c: enhanced the coding for xmlXPathCastNumberToString + in order to produce the required number of significant digits + (bug #437179) + +Thu May 10 01:52:42 CEST 2007 Daniel Veillard + + * list.c: applied patch to fix xmlListAppend() from + Georges-André SILBER + * valid.c: also fix the place wher it was called. + +Wed May 2 18:47:33 CEST 2007 Daniel Veillard + + * parser.c: tried to fix an error problem on entity content failure + reported by Michael Day + +Wed May 2 18:23:35 CEST 2007 Daniel Veillard + + * configure.in: typo patch from Bjorn Reese + +Wed May 2 18:12:58 CEST 2007 Daniel Veillard + + * HTMLparser.c: applied patch from Michael Day to add support for + + +Thu Apr 26 10:58:50 CEST 2007 Daniel Veillard + + * HTMLparser.c: Jean-Daniel Dupas pointed a couple of problems + in htmlCreateDocParserCtxt. + +Thu Apr 26 10:36:26 CEST 2007 Daniel Veillard + + * uri.c include/libxml/uri.h: patch from Richard Jones to save + the query part in raw form. + * libxml2-python-api.xml: also added accessor for the python bindings + +Wed Apr 25 15:57:32 CEST 2007 Daniel Veillard + + * xstc/Makefile.am doc/examples/Makefile.am Makefile.am: applied + patch from Richard Jones to for the silent flag on valgrind + when doing "make valgrind" + * xmlregexp.c: raise a regexp error when '\' is misused to escape + a standard character. + +Tue Apr 24 20:15:14 CEST 2007 Daniel Veillard + + * tree.c: Richard Jones reported xmlBufferAdd (buf, "", -1), fixing it + +Tue Apr 24 10:59:28 CEST 2007 Daniel Veillard + + * uri.c: fix xmlURIUnescapeString comments which was confusing + +Wed Apr 18 09:52:25 CEST 2007 Daniel Veillard + + * include/win32config.h libxml.h: new patch from Andreas Stricke to + better integrate support for Windows CE + +Tue Apr 17 16:50:12 CEST 2007 Daniel Veillard + + * doc/* configure.in NEWS: release of libxml2 2.6.28 + Tue Apr 17 14:47:42 CEST 2007 Daniel Veillard * catalog.c libxml.h win32/wince/wincecompat.h win32/wince/wincecompat.c diff --git a/HTMLparser.c b/HTMLparser.c index 8f2f776..91d54c7 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -401,9 +401,13 @@ encoding_error: { char buffer[150]; - snprintf(buffer, 149, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n", - ctxt->input->cur[0], ctxt->input->cur[1], - ctxt->input->cur[2], ctxt->input->cur[3]); + if (ctxt->input->end - ctxt->input->cur >= 4) { + snprintf(buffer, 149, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n", + ctxt->input->cur[0], ctxt->input->cur[1], + ctxt->input->cur[2], ctxt->input->cur[3]); + } else { + snprintf(buffer, 149, "Bytes: 0x%02X\n", ctxt->input->cur[0]); + } htmlParseErr(ctxt, XML_ERR_INVALID_ENCODING, "Input is not proper UTF-8, indicate encoding !\n", BAD_CAST buffer, NULL); @@ -472,8 +476,8 @@ htmlSkipBlankChars(xmlParserCtxtPtr ctxt) { #define NB_FONTSTYLE 8 #define PHRASE "em", "strong", "dfn", "code", "samp", "kbd", "var", "cite", "abbr", "acronym" #define NB_PHRASE 10 -#define SPECIAL "a", "img", "applet", "object", "font", "basefont", "br", "script", "map", "q", "sub", "sup", "span", "bdo", "iframe" -#define NB_SPECIAL 15 +#define SPECIAL "a", "img", "applet", "embed", "object", "font", "basefont", "br", "script", "map", "q", "sub", "sup", "span", "bdo", "iframe" +#define NB_SPECIAL 16 #define INLINE PCDATA FONTSTYLE PHRASE SPECIAL FORMCTRL #define NB_INLINE NB_PCDATA + NB_FONTSTYLE + NB_PHRASE + NB_SPECIAL + NB_FORMCTRL #define BLOCK HEADING, LIST "pre", "p", "dl", "div", "center", "noscript", "noframes", "blockquote", "form", "isindex", "hr", "table", "fieldset", "address" @@ -572,6 +576,7 @@ static const char* const version_attr[] = { "version", NULL } ; static const char* const html_content[] = { "head", "body", "frameset", NULL } ; static const char* const iframe_attrs[] = { COREATTRS, "longdesc", "name", "src", "frameborder", "marginwidth", "marginheight", "scrolling", "align", "height", "width", NULL } ; static const char* const img_attrs[] = { ATTRS, "longdesc", "name", "height", "width", "usemap", "ismap", NULL } ; +static const char* const embed_attrs[] = { COREATTRS, "align", "alt", "border", "code", "codebase", "frameborder", "height", "hidden", "hspace", "name", "palette", "pluginspace", "pluginurl", "src", "type", "units", "vspace", "width", NULL } ; static const char* const input_attrs[] = { ATTRS, "type", "name", "value", "checked", "disabled", "readonly", "size", "maxlength", "src", "alt", "usemap", "ismap", "tabindex", "accesskey", "onfocus", "onblur", "onselect", "onchange", "accept", NULL } ; static const char* const prompt_attrs[] = { COREATTRS, I18N, "prompt", NULL } ; static const char* const label_attrs[] = { ATTRS, "for", "accesskey", "onfocus", "onblur", NULL } ; @@ -706,6 +711,9 @@ html40ElementTable[] = { { "em", 0, 3, 0, 0, 0, 0, 1, "emphasis", DECL html_inline, NULL, DECL html_attrs, NULL, NULL }, +{ "embed", 0, 1, 2, 0, 1, 1, 1, "generic embedded object ", + EMPTY, NULL, DECL embed_attrs, NULL, NULL +}, { "fieldset", 0, 0, 0, 0, 0, 0, 0, "form control group ", DECL fieldset_contents , NULL, DECL html_attrs, NULL, NULL }, @@ -4391,8 +4399,7 @@ htmlCreateMemoryParserCtxt(const char *buffer, int size) { * Returns the new parser context or NULL */ static htmlParserCtxtPtr -htmlCreateDocParserCtxt(const xmlChar *cur, - const char *encoding ATTRIBUTE_UNUSED) { +htmlCreateDocParserCtxt(const xmlChar *cur, const char *encoding) { int len; htmlParserCtxtPtr ctxt; @@ -4400,6 +4407,8 @@ htmlCreateDocParserCtxt(const xmlChar *cur, return(NULL); len = xmlStrlen(cur); ctxt = htmlCreateMemoryParserCtxt((char *)cur, len); + if (ctxt == NULL) + return(NULL); if (encoding != NULL) { xmlCharEncoding enc; diff --git a/HTMLtree.c b/HTMLtree.c index c1e5a0a..e79d118 100644 --- a/HTMLtree.c +++ b/HTMLtree.c @@ -780,6 +780,10 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, htmlDocContentDumpOutput(buf, (xmlDocPtr) cur, encoding); return; } + if (cur->type == XML_ATTRIBUTE_NODE) { + htmlAttrDumpOutput(buf, doc, (xmlAttrPtr) cur, encoding); + return; + } if (cur->type == HTML_TEXT_NODE) { if (cur->content != NULL) { if (((cur->name == (const xmlChar *)xmlStringText) || diff --git a/Makefile.am b/Makefile.am index 6676040..d1feb94 100644 --- a/Makefile.am +++ b/Makefile.am @@ -167,7 +167,7 @@ tests: XMLtests XMLenttests NStests IDtests Errtests APItests @READER_TEST@ @TES valgrind: @echo '## Running the regression tests under Valgrind' @echo '## Go get a cup of coffee it is gonna take a while ...' - $(MAKE) CHECKER='valgrind' tests + $(MAKE) CHECKER='valgrind -q' tests APItests: testapi$(EXEEXT) @echo "## Running the API regression tests this may take a little while" diff --git a/Makefile.in b/Makefile.in index e49ced2..d2e51b3 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1438,7 +1438,7 @@ tests: XMLtests XMLenttests NStests IDtests Errtests APItests @READER_TEST@ @TES valgrind: @echo '## Running the regression tests under Valgrind' @echo '## Go get a cup of coffee it is gonna take a while ...' - $(MAKE) CHECKER='valgrind' tests + $(MAKE) CHECKER='valgrind -q' tests APItests: testapi$(EXEEXT) @echo "## Running the API regression tests this may take a little while" diff --git a/NEWS b/NEWS index fa7ae09..0bad177 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,32 @@ ChangeLog.html to the SVN at http://svn.gnome.org/viewcvs/libxml2/trunk/ code base.Here is the list of public releases: +2.6.29: Jun 12 2007: + - Portability: patches from Andreas Stricke for WinCEi, + fix compilation warnings (William Brack), avoid warnings on Apple OS/X + (Wendy Doyle and Mark Rowe), Windows compilation and threading + improvements (Rob Richards), compilation against old Python versions, + new GNU tar changes (Ryan Hill) + - Documentation: xmlURIUnescapeString comment, + - Bugfixes: xmlBufferAdd problem (Richard Jones), 'make valgrind' + flag fix (Richard Jones), regexp interpretation of \, + htmlCreateDocParserCtxt (Jean-Daniel Dupas), configure.in + typo (Bjorn Reese), entity content failure, xmlListAppend() fix + (Georges-André Silber), XPath number serialization (William Brack), + nanohttp gzipped stream fix (William Brack and Alex Cornejo), + xmlCharEncFirstLine typo (Mark Rowe), uri bug (François Delyon), + XPath string value of PI nodes (William Brack), XPath node set + sorting bugs (William Brack), avoid outputting namespace decl + dups in the writer (Rob Richards), xmlCtxtReset bug, UTF-8 encoding + error handling, recustion on next in catalogs, fix a Relax-NG crash, + workaround wrong file: URIs, htmlNodeDumpFormatOutput on attributes, + invalid character in attribute detection bug, big comments before + internal subset streaming bug, HTML parsing of attributes with : in + the name + - Improvement: keep URI query parts in raw form (Richard Jones), + embed tag support in HTML (Michael Day) + + 2.6.28: Apr 17 2007: - Documentation: comment fixes (Markus Keim), xpath comments fixes too (James Dennett) diff --git a/SAX2.c b/SAX2.c index 7d4ab64..9739831 100644 --- a/SAX2.c +++ b/SAX2.c @@ -1059,25 +1059,31 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname, xmlChar *nval; xmlNsPtr namespace; - /* - * Split the full name into a namespace prefix and the tag name - */ - name = xmlSplitQName(ctxt, fullname, &ns); - if ((name != NULL) && (name[0] == 0)) { - if (xmlStrEqual(ns, BAD_CAST "xmlns")) { - xmlNsErrMsg(ctxt, XML_ERR_NS_DECL_ERROR, - "invalid namespace declaration '%s'\n", - fullname, NULL); - } else { - xmlNsWarnMsg(ctxt, XML_WAR_NS_COLUMN, - "Avoid attribute ending with ':' like '%s'\n", - fullname, NULL); - } - if (ns != NULL) - xmlFree(ns); - ns = NULL; - xmlFree(name); + if (ctxt->html) { name = xmlStrdup(fullname); + ns = NULL; + namespace = NULL; + } else { + /* + * Split the full name into a namespace prefix and the tag name + */ + name = xmlSplitQName(ctxt, fullname, &ns); + if ((name != NULL) && (name[0] == 0)) { + if (xmlStrEqual(ns, BAD_CAST "xmlns")) { + xmlNsErrMsg(ctxt, XML_ERR_NS_DECL_ERROR, + "invalid namespace declaration '%s'\n", + fullname, NULL); + } else { + xmlNsWarnMsg(ctxt, XML_WAR_NS_COLUMN, + "Avoid attribute ending with ':' like '%s'\n", + fullname, NULL); + } + if (ns != NULL) + xmlFree(ns); + ns = NULL; + xmlFree(name); + name = xmlStrdup(fullname); + } } if (name == NULL) { xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElement"); diff --git a/catalog.c b/catalog.c index 95ebee8..ee3f8f2 100644 --- a/catalog.c +++ b/catalog.c @@ -1828,6 +1828,8 @@ xmlCatalogXMLResolve(xmlCatalogEntryPtr catal, const xmlChar *pubID, if (ret != NULL) { catal->depth--; return(ret); + } else if (catal->depth > MAX_CATAL_DEPTH) { + return(NULL); } } } @@ -1868,6 +1870,13 @@ xmlCatalogXMLResolveURI(xmlCatalogEntryPtr catal, const xmlChar *URI) { if (URI == NULL) return(NULL); + if (catal->depth > MAX_CATAL_DEPTH) { + xmlCatalogErr(catal, NULL, XML_CATALOG_RECURSION, + "Detected recursion in catalog %s\n", + catal->name, NULL, NULL); + return(NULL); + } + /* * First tries steps 2/ 3/ 4/ if a system ID is provided. */ @@ -2053,16 +2062,18 @@ xmlCatalogListXMLResolve(xmlCatalogEntryPtr catal, const xmlChar *pubID, if (catal->children != NULL) { ret = xmlCatalogXMLResolve(catal->children, pubID, sysID); if (ret != NULL) { - if (normid != NULL) - xmlFree(normid); - return(ret); - } + break; + } else if ((catal->children != NULL) && + (catal->children->depth > MAX_CATAL_DEPTH)) { + ret = NULL; + break; + } } } catal = catal->next; } - if (normid != NULL) - xmlFree(normid); + if (normid != NULL) + xmlFree(normid); return(ret); } diff --git a/configure b/configure index 19453ad..7fd6150 100755 --- a/configure +++ b/configure @@ -1618,7 +1618,7 @@ host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` LIBXML_MAJOR_VERSION=2 LIBXML_MINOR_VERSION=6 -LIBXML_MICRO_VERSION=28 +LIBXML_MICRO_VERSION=29 LIBXML_MICRO_VERSION_SUFFIX= LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION @@ -19710,7 +19710,7 @@ fi; if test "$with_schemas" = "yes" then with_pattern=yes - with_regexp=yes + with_regexps=yes fi if test "$with_schematron" = "yes" then @@ -19805,9 +19805,9 @@ then then with_readline=no fi - if test "$with_regexp" = "" + if test "$with_regexps" = "" then - with_regexp=no + with_regexps=no fi if test "$with_run_debug" = "" then diff --git a/configure.in b/configure.in index c355498..866df62 100644 --- a/configure.in +++ b/configure.in @@ -5,7 +5,7 @@ AC_CANONICAL_HOST LIBXML_MAJOR_VERSION=2 LIBXML_MINOR_VERSION=6 -LIBXML_MICRO_VERSION=28 +LIBXML_MICRO_VERSION=29 LIBXML_MICRO_VERSION_SUFFIX= LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION @@ -170,7 +170,7 @@ dnl if test "$with_schemas" = "yes" then with_pattern=yes - with_regexp=yes + with_regexps=yes fi if test "$with_schematron" = "yes" then @@ -268,9 +268,9 @@ then then with_readline=no fi - if test "$with_regexp" = "" + if test "$with_regexps" = "" then - with_regexp=no + with_regexps=no fi if test "$with_run_debug" = "" then diff --git a/doc/APIchunk10.html b/doc/APIchunk10.html index c55e04a..38a6660 100644 --- a/doc/APIchunk10.html +++ b/doc/APIchunk10.html @@ -453,7 +453,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlParserHandlePEReference
            appearing
            xmlValidatePopElement
            xmlValidatePushElement
            -
            appears
            xmlExpGetStart
            +
            appears
            _xmlURI
            +xmlExpGetStart
            xmlParseCharData
            xmlParseElementChildrenContentDecl
            xmlParseEntityRef
            diff --git a/doc/APIchunk12.html b/doc/APIchunk12.html index fb3ad79..daaf7ce 100644 --- a/doc/APIchunk12.html +++ b/doc/APIchunk12.html @@ -124,6 +124,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlLoadCatalogs
            category
            xmlUCSIsCat
            cause
            xmlShellPrintXPathError
            +
            caution
            _xmlURI
            cdata-section-
            xmlStreamPushNode
            xmlStreamWantsAnyNode
            ceiling
            xmlXPathCeilingFunction
            @@ -222,7 +223,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlParseElementMixedContentDecl
            xmlReconciliateNs
            xmlURIEscape
            -xmlURIUnescapeString
            xmlValidateAttributeDecl
            xmlValidateDocument
            xmlValidateDocumentFinal
            diff --git a/doc/APIchunk13.html b/doc/APIchunk13.html index 834cde1..c0be627 100644 --- a/doc/APIchunk13.html +++ b/doc/APIchunk13.html @@ -232,6 +232,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXPathNotEqualValues
            deprecated
            LIBXML_LEGACY_ENABLED
            _htmlElemDesc
            +_xmlURI
            htmlAttrAllowed
            htmlElementAllowedHere
            htmlElementStatusHere
            diff --git a/doc/APIchunk24.html b/doc/APIchunk24.html index a965455..d853a75 100644 --- a/doc/APIchunk24.html +++ b/doc/APIchunk24.html @@ -56,6 +56,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlReplaceNode
            xmlStrEqual
            xmlStrncatNew
            +xmlURIUnescapeString
            xmlXPathCmpNodes
            xmlXPathIdFunction
            xmlXPathLangFunction
            @@ -393,6 +394,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSkipBlankChars
            slot
            xmlXPathContextSetCache
            slots
            xmlXPathContextSetCache
            +
            smaller
            xmlURIUnescapeString
            smallest
            xmlXPathCeilingFunction
            socket
            xmlCheckFilename
            xmlNanoFTPGetSocket
            diff --git a/doc/APIchunk26.html b/doc/APIchunk26.html index 5606555..e5b01d0 100644 --- a/doc/APIchunk26.html +++ b/doc/APIchunk26.html @@ -240,7 +240,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlParserValidityWarning
            xmlTextReaderIsValid
            xmlURIEscape
            -xmlURIUnescapeString
            xmlValidGetValidElements
            xmlValidateDocumentFinal
            xmlValidateNotationDecl
            diff --git a/doc/APIchunk5.html b/doc/APIchunk5.html index 9a6b23f..8bd78ca 100644 --- a/doc/APIchunk5.html +++ b/doc/APIchunk5.html @@ -77,7 +77,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlOutputMatchCallback
            xmlOutputOpenCallback
            xmlOutputWriteCallback
            -xmlURIUnescapeString
            OutputBufferCreateFilenameFunc
            xmlOutputBufferCreateFilenameDefault
            Override
            xmlGcMemSetup
            xmlMemSetup
            diff --git a/doc/APIfiles.html b/doc/APIfiles.html index 8a3f6d7..208205f 100644 --- a/doc/APIfiles.html +++ b/doc/APIfiles.html @@ -1242,6 +1242,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSchematronValidityErrorFunc
            xmlSchematronValidityWarningFunc

            Module threads:

            xmlCleanupThreads
            +xmlDllMain
            xmlFreeMutex
            xmlFreeRMutex
            xmlGetGlobalState
            diff --git a/doc/APIfunctions.html b/doc/APIfunctions.html index bbfd181..8d12650 100644 --- a/doc/APIfunctions.html +++ b/doc/APIfunctions.html @@ -607,6 +607,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlIsIdeographic
            xmlIsPubidChar

            Type unsigned long:

            ftpListCallback
            +xmlDllMain
            xmlSchemaValidateListSimpleTypeFacet

            Type unsigned long *:

            xmlSchemaValidateLengthFacet
            xmlSchemaValidateLengthFacetWhtsp
            @@ -722,6 +723,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlCtxtGetLastError
            xmlCtxtReadIO
            xmlCtxtResetLastError
            +xmlDllMain
            xmlFileClose
            xmlFileRead
            xmlFreeFunc
            diff --git a/doc/APIsymbols.html b/doc/APIsymbols.html index 4cfeef8..2a64797 100644 --- a/doc/APIsymbols.html +++ b/doc/APIsymbols.html @@ -1891,6 +1891,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlDictQLookup
            xmlDictReference
            xmlDictSize
            +xmlDllMain
            xmlDoValidityCheckingDefaultValue
            xmlDoc
            xmlDocCopyNode
            diff --git a/doc/devhelp/libxml2-threads.html b/doc/devhelp/libxml2-threads.html index 66e5ba4..3ce5f93 100644 --- a/doc/devhelp/libxml2-threads.html +++ b/doc/devhelp/libxml2-threads.html @@ -58,10 +58,11 @@ int xmlIsMainThread (void); void xmlRMutexUnlock (xmlRMutexPtr tok); xmlGlobalStatePtr xmlGetGlobalState (void); xmlMutexPtr xmlNewMutex (void); -void xmlRMutexLock (xmlRMutexPtr tok); -void xmlInitThreads (void); -void xmlUnlockLibrary (void); +int xmlDllMain (void * hinstDLL,
            unsigned long fdwReason,
            void * lpvReserved); void xmlFreeMutex (xmlMutexPtr tok); +void xmlUnlockLibrary (void); +void xmlInitThreads (void); +void xmlRMutexLock (xmlRMutexPtr tok);

            @@ -93,6 +94,10 @@ The content of this structure is not made public by the API. +
            +

            xmlFreeMutex ()

            void	xmlFreeMutex			(xmlMutexPtr tok)

            xmlFreeMutex() is used to reclaim resources associated with a libxml2 token struct.

            diff --git a/doc/devhelp/libxml2-uri.html b/doc/devhelp/libxml2-uri.html index 33f32fa..c67dacf 100644 --- a/doc/devhelp/libxml2-uri.html +++ b/doc/devhelp/libxml2-uri.html @@ -76,9 +76,10 @@ int xmlParseURIReference (xmlParseURIReference (
            str:string to escape
            list:exception list string of chars not to escape
            Returns:a new escaped string or NULL in case of error.

            +

            Unescaping routine, but does not check that the string is an URI. The output is a direct unsigned char translation of %XX values (no encoding) Note that the length of the result can only be smaller or same size as the input string.

            +
            str:the string to unescape
            len:the length in bytes to unescape (or <= 0 to indicate full string)
            target:optional destination buffer
            Returns:a copy of the string, but unescaped, will return NULL only in case of error

            diff --git a/doc/devhelp/libxml2.devhelp b/doc/devhelp/libxml2.devhelp index 6a3841c..a932cdf 100644 --- a/doc/devhelp/libxml2.devhelp +++ b/doc/devhelp/libxml2.devhelp @@ -2193,6 +2193,7 @@ + diff --git a/doc/examples/Makefile.am b/doc/examples/Makefile.am index cd9f4ef..ea23621 100644 --- a/doc/examples/Makefile.am +++ b/doc/examples/Makefile.am @@ -96,7 +96,7 @@ xpath2_DEPENDENCIES= $(DEPS) xpath2_LDADD= @RDL_LIBS@ $(LDADDS) valgrind: - $(MAKE) CHECKER='valgrind' tests + $(MAKE) CHECKER='valgrind -q' tests tests: $(noinst_PROGRAMS) @(echo '## examples regression tests') diff --git a/doc/examples/Makefile.in b/doc/examples/Makefile.in index f8af861..5fd6a3a 100644 --- a/doc/examples/Makefile.in +++ b/doc/examples/Makefile.in @@ -707,7 +707,7 @@ install-data-local: -@INSTALL@ -m 0644 $(srcdir)/*.html $(srcdir)/*.c $(srcdir)/*.xml $(srcdir)/*.xsl $(srcdir)/*.res $(DESTDIR)$(HTML_DIR) valgrind: - $(MAKE) CHECKER='valgrind' tests + $(MAKE) CHECKER='valgrind -q' tests tests: $(noinst_PROGRAMS) @(echo '## examples regression tests') diff --git a/doc/html/libxml-threads.html b/doc/html/libxml-threads.html index eebcf3c..8bb2cbf 100644 --- a/doc/html/libxml-threads.html +++ b/doc/html/libxml-threads.html @@ -17,6 +17,7 @@ The content of this structure is not made public by the API. The content of this structure is not made public by the API.
            Typedef xmlRMutex * xmlRMutexPtr
             
            void	xmlCleanupThreads		(void)
            +
            int	xmlDllMain			(void * hinstDLL, 
            unsigned long fdwReason,
            void * lpvReserved)
            void	xmlFreeMutex			(xmlMutexPtr tok)
            void	xmlFreeRMutex			(xmlRMutexPtr tok)
            xmlGlobalStatePtr	xmlGetGlobalState	(void)
            @@ -38,7 +39,9 @@ The content of this structure is not made public by the API. The content of this structure is not made public by the API. }

            Function: xmlCleanupThreads

            void	xmlCleanupThreads		(void)

            xmlCleanupThreads() is used to to cleanup all the thread related data of the libxml2 library once processing has ended.

            -

            Function: xmlFreeMutex

            void	xmlFreeMutex			(xmlMutexPtr tok)
            +

            Function: xmlDllMain

            int	xmlDllMain			(void * hinstDLL, 
            unsigned long fdwReason,
            void * lpvReserved)
            +

            +
            hinstDLL:
            fdwReason:
            lpvReserved:
            Returns:

            Function: xmlFreeMutex

            void	xmlFreeMutex			(xmlMutexPtr tok)

            xmlFreeMutex() is used to reclaim resources associated with a libxml2 token struct.

            tok:the simple mutex

            Function: xmlFreeRMutex

            void	xmlFreeRMutex			(xmlRMutexPtr tok)

            xmlRFreeMutex() is used to reclaim resources associated with a reentrant mutex.

            diff --git a/doc/html/libxml-uri.html b/doc/html/libxml-uri.html index fa7ee19..1c668e8 100644 --- a/doc/html/libxml-uri.html +++ b/doc/html/libxml-uri.html @@ -36,9 +36,10 @@ A:link, A:visited, A:active { text-decoration: underline } char * user : the user part int port : the port number char * path : the path string - char * query : the query string + char * query : the query string (deprecated - use with char * fragment : the fragment identifier int cleanup : parsing potentially unclean URI + char * query_raw : the query string (as it appears in the }

            Function: xmlBuildRelativeURI

            xmlChar *	xmlBuildRelativeURI	(const xmlChar * URI, 
            const xmlChar * base)

            Expresses the URI of the reference in terms relative to the base. Some examples of this operation include: base = "http://site1.com/docs/book1.html" URI input URI returned docs/pic1.gif pic1.gif docs/img/pic1.gif img/pic1.gif img/pic1.gif ../img/pic1.gif http://site1.com/docs/pic1.gif pic1.gif http://site2.com/docs/pic1.gif http://site2.com/docs/pic1.gif base = "docs/book1.html" URI input URI returned docs/pic1.gif pic1.gif docs/img/pic1.gif img/pic1.gif img/pic1.gif ../img/pic1.gif http://site1.com/docs/pic1.gif http://site1.com/docs/pic1.gif Note: if the URI reference is really wierd or complicated, it may be worthwhile to first convert it into a "nice" one by calling xmlBuildURI (using 'base') before calling this routine, since this routine (for reasonable efficiency) assumes URI has already been through some validation.

            URI:the URI reference under consideration
            base:the base value
            Returns:a new URI string (to be freed by the caller) or NULL in case error.

            Function: xmlBuildURI

            xmlChar *	xmlBuildURI		(const xmlChar * URI, 
            const xmlChar * base)
            @@ -68,5 +69,5 @@ A:link, A:visited, A:active { text-decoration: underline }
            str:the string of the URI to escape
            Returns:an copy of the string, but escaped 25 May 2001 Uses xmlParseURI and xmlURIEscapeStr to try to escape correctly according to RFC2396. - Carl Douglas

            Function: xmlURIEscapeStr

            xmlChar *	xmlURIEscapeStr		(const xmlChar * str, 
            const xmlChar * list)

            This routine escapes a string to hex, ignoring reserved characters (a-z) and the characters in the exception list.

            str:string to escape
            list:exception list string of chars not to escape
            Returns:a new escaped string or NULL in case of error.

            Function: xmlURIUnescapeString

            char *	xmlURIUnescapeString		(const char * str, 
            int len,
            char * target)
            -

            Unescaping routine, does not do validity checks ! Output is direct unsigned char translation of %XX values (no encoding)

            -
            str:the string to unescape
            len:the length in bytes to unescape (or <= 0 to indicate full string)
            target:optional destination buffer
            Returns:an copy of the string, but unescaped

            Daniel Veillard

            +

            Unescaping routine, but does not check that the string is an URI. The output is a direct unsigned char translation of %XX values (no encoding) Note that the length of the result can only be smaller or same size as the input string.

            +
            str:the string to unescape
            len:the length in bytes to unescape (or <= 0 to indicate full string)
            target:optional destination buffer
            Returns:a copy of the string, but unescaped, will return NULL only in case of error

            Daniel Veillard

            diff --git a/doc/libxml2-api.xml b/doc/libxml2-api.xml index a7a8d56..4e031bc 100644 --- a/doc/libxml2-api.xml +++ b/doc/libxml2-api.xml @@ -1371,10 +1371,11 @@ - - - + + + +

            interfaces for tree manipulation @@ -6643,9 +6644,10 @@ Could we use @subtypes for this?'/> - + + @@ -9299,6 +9301,13 @@ Could we use @subtypes for this?'/> + + + + + + + Do a copy of the node to a given document. @@ -16511,8 +16520,8 @@ Could we use @subtypes for this?'/> - Unescaping routine, does not do validity checks ! Output is direct unsigned char translation of %XX values (no encoding) - + Unescaping routine, but does not check that the string is an URI. The output is a direct unsigned char translation of %XX values (no encoding) Note that the length of the result can only be smaller or same size as the input string. + diff --git a/doc/libxml2.xsa b/doc/libxml2.xsa index 45afec6..81db327 100644 --- a/doc/libxml2.xsa +++ b/doc/libxml2.xsa @@ -8,59 +8,32 @@ libxml2 - 2.6.27 - Oct 25 2006 + 2.6.28 + Apr 17 2007 http://xmlsoft.org/ - - Portability fixes: file names on windows (Roland Schwingel, - Emelyanov Alexey), windows compile fixup (Rob Richards), - AIX iconv() is apparently case sensitive - - improvements: Python XPath types mapping (Nic Ferrier), XPath optimization - (Kasimier), add xmlXPathCompiledEvalToBoolean (Kasimier), Python node - equality and comparison (Andreas Pakulat), xmlXPathCollectAndTest - improvememt (Kasimier), expose if library was compiled with zlib - support (Andrew Nosenko), cache for xmlSchemaIDCMatcher structs - (Kasimier), xmlTextConcat should work with comments and PIs (Rob - Richards), export htmlNewParserCtxt needed by Michael Day, refactoring - of catalog entity loaders (Michael Day), add XPointer support to - python bindings (Ross Reedstrom, Brian West and Stefan Anca), - try to sort out most file path to URI conversions and xmlPathToUri, - add --html --memory case to xmllint - - building fix: fix --with-minimum (Felipe Contreras), VMS fix, - const'ification of HTML parser structures (Matthias Clasen), - portability fix (Emelyanov Alexey), wget autodetection (Peter - Breitenlohner), remove the build path recorded in the python - shared module, separate library flags for shared and static builds - (Mikhail Zabaluev), fix --with-minimum --with-sax1 builds, fix - --with-minimum --with-schemas builds - - bug fix: xmlGetNodePath fix (Kasimier), xmlDOMWrapAdoptNode and - attribute (Kasimier), crash when using the recover mode, - xmlXPathEvalExpr problem (Kasimier), xmlXPathCompExprAdd bug (Kasimier), - missing destry in xmlFreeRMutex (Andrew Nosenko), XML Schemas fixes - (Kasimier), warning on entities processing, XHTML script and style - serialization (Kasimier), python generator for long types, bug in - xmlSchemaClearValidCtxt (Bertrand Fritsch), xmlSchemaXPathEvaluate - allocation bug (Marton Illes), error message end of line (Rob Richards), - fix attribute serialization in writer (Rob Richards), PHP4 DTD validation - crasher, parser safety patch (Ben Darnell), _private context propagation - when parsing entities (with Michael Day), fix entities behaviour when - using SAX, URI to file path fix (Mikhail Zabaluev), disapearing validity - context, arg error in SAX callback (Mike Hommey), fix mixed-content - autodetect when using --noblanks, fix xmlIOParseDTD error handling, - fix bug in xmlSplitQName on special Names, fix Relax-NG element content - validation bug, fix xmlReconciliateNs bug, fix potential attribute - XML parsing bug, fix line/column accounting in XML parser, chunking bug - in the HTML parser on script, try to detect obviously buggy HTML - meta encoding indications, bugs with encoding BOM and xmlSaveDoc, - HTML entities in attributes parsing, HTML minimized attribute values, - htmlReadDoc and htmlReadIO were broken, error handling bug in - xmlXPathEvalExpression (Olaf Walkowiak), fix a problem in - htmlCtxtUseOptions, xmlNewInputFromFile could leak (Marius Konitzer), - bug on misformed SSD regexps (Christopher Boumenot) - - - documentation: warning about XML_PARSE_COMPACT (Kasimier Buchcik), - fix xmlXPathCastToString documentation, improve man pages for - xmllitn and xmlcatalog (Daniel Leidert), fixed comments of a few - functions + - Documentation: comment fixes (Markus Keim), xpath comments fixes too + (James Dennett) + - Bug fixes: XPath bug (William Brack), HTML parser autoclose stack usage + (Usamah Malik), various regexp bug fixes (DV and William), path conversion + on Windows (Igor Zlatkovic), htmlCtxtReset fix (Michael Day), XPath + principal node of axis bug, HTML serialization of some codepoint + (Steven Rainwater), user data propagation in XInclude (Michael Day), + standalone and XML decl detection (Michael Day), Python id ouptut + for some id, fix the big python string memory leak, URI parsing fixes + (Stéphane Bidoul and William), long comments parsing bug (William), + concurrent threads initialization (Ted Phelps), invalid char + in text XInclude (William), XPath memory leak (William), tab in + python problems (Andreas Hanke), XPath node comparison error + (Oleg Paraschenko), cleanup patch for reader (Julien Reichel), + XML Schemas attribute group (William), HTML parsing problem (William), + fix char 0x2d in regexps (William), regexp quantifier range with + min occurs of 0 (William), HTML script/style parsing (Mike Day) + - Improvement: make xmlTextReaderSetup() public + - Compilation and postability: fix a missing include problem (William), + __ss_familly on AIX again (Björn Wiberg), compilation without zlib + (Michael Day), catalog patch for Win32 (Christian Ehrlicher), + Windows CE fixes (Andreas Stricke) + - Various CVS to SVN infrastructure changes diff --git a/doc/news.html b/doc/news.html index e05ab39..fae5b5a 100644 --- a/doc/news.html +++ b/doc/news.html @@ -12,7 +12,30 @@ to help those

            The change log describes the recents commits -to the SVN code base.

            Here is the list of public releases:

            2.6.28: Apr 17 2007

            • Documentation: comment fixes (Markus Keim), xpath comments fixes too +to the SVN code base.

              Here is the list of public releases:

              2.6.29: Jun 12 2007

              • Portability: patches from Andreas Stricke for WinCEi, + fix compilation warnings (William Brack), avoid warnings on Apple OS/X + (Wendy Doyle and Mark Rowe), Windows compilation and threading + improvements (Rob Richards), compilation against old Python versions, + new GNU tar changes (Ryan Hill)
              • +
              • Documentation: xmlURIUnescapeString comment,
              • +
              • Bugfixes: xmlBufferAdd problem (Richard Jones), 'make valgrind' + flag fix (Richard Jones), regexp interpretation of \, + htmlCreateDocParserCtxt (Jean-Daniel Dupas), configure.in + typo (Bjorn Reese), entity content failure, xmlListAppend() fix + (Georges-André Silber), XPath number serialization (William Brack), + nanohttp gzipped stream fix (William Brack and Alex Cornejo), + xmlCharEncFirstLine typo (Mark Rowe), uri bug (François Delyon), + XPath string value of PI nodes (William Brack), XPath node set + sorting bugs (William Brack), avoid outputting namespace decl + dups in the writer (Rob Richards), xmlCtxtReset bug, UTF-8 encoding + error handling, recustion on next in catalogs, fix a Relax-NG crash, + workaround wrong file: URIs, htmlNodeDumpFormatOutput on attributes, + invalid character in attribute detection bug, big comments before + internal subset streaming bug, HTML parsing of attributes with : in + the name, IDness of name in HTML (Dagfinn I. Mannsåker)
              • +
              • Improvement: keep URI query parts in raw form (Richard Jones), + embed tag support in HTML (Michael Day)
              • +

              2.6.28: Apr 17 2007

              • Documentation: comment fixes (Markus Keim), xpath comments fixes too (James Dennett)
              • Bug fixes: XPath bug (William Brack), HTML parser autoclose stack usage (Usamah Malik), various regexp bug fixes (DV and William), path conversion diff --git a/doc/xml.html b/doc/xml.html index 4b01691..6db27c7 100644 --- a/doc/xml.html +++ b/doc/xml.html @@ -739,6 +739,33 @@ to the SVN code base.<

                Here is the list of public releases:

                +

                2.6.29: Jun 12 2007

                +
                  +
                • Portability: patches from Andreas Stricke for WinCEi, + fix compilation warnings (William Brack), avoid warnings on Apple OS/X + (Wendy Doyle and Mark Rowe), Windows compilation and threading + improvements (Rob Richards), compilation against old Python versions, + new GNU tar changes (Ryan Hill)
                • +
                • Documentation: xmlURIUnescapeString comment,
                • +
                • Bugfixes: xmlBufferAdd problem (Richard Jones), 'make valgrind' + flag fix (Richard Jones), regexp interpretation of \, + htmlCreateDocParserCtxt (Jean-Daniel Dupas), configure.in + typo (Bjorn Reese), entity content failure, xmlListAppend() fix + (Georges-André Silber), XPath number serialization (William Brack), + nanohttp gzipped stream fix (William Brack and Alex Cornejo), + xmlCharEncFirstLine typo (Mark Rowe), uri bug (François Delyon), + XPath string value of PI nodes (William Brack), XPath node set + sorting bugs (William Brack), avoid outputting namespace decl + dups in the writer (Rob Richards), xmlCtxtReset bug, UTF-8 encoding + error handling, recustion on next in catalogs, fix a Relax-NG crash, + workaround wrong file: URIs, htmlNodeDumpFormatOutput on attributes, + invalid character in attribute detection bug, big comments before + internal subset streaming bug, HTML parsing of attributes with : in + the name, IDness of name in HTML (Dagfinn I. Mannsåker)
                • +
                • Improvement: keep URI query parts in raw form (Richard Jones), + embed tag support in HTML (Michael Day)
                • +
                +

                2.6.28: Apr 17 2007

                • Documentation: comment fixes (Markus Keim), xpath comments fixes too diff --git a/encoding.c b/encoding.c index ee33df1..002eeba 100644 --- a/encoding.c +++ b/encoding.c @@ -1761,19 +1761,20 @@ xmlCharEncFirstLine(xmlCharEncodingHandler *handler, xmlBufferPtr out, if (out == NULL) return(-1); if (in == NULL) return(-1); + /* calculate space available */ written = out->size - out->use; toconv = in->use; - if (toconv * 2 >= written) { - xmlBufferGrow(out, toconv); - written = out->size - out->use - 1; - } - /* * echo '' | wc -c => 38 * 45 chars should be sufficient to reach the end of the encoding * declaration without going too far inside the document content. */ - written = 45; + if (toconv > 45) + toconv = 45; + if (toconv * 2 >= written) { + xmlBufferGrow(out, toconv); + written = out->size - out->use - 1; + } if (handler->input != NULL) { ret = handler->input(&out->content[out->use], &written, diff --git a/include/libxml/threads.h b/include/libxml/threads.h index 4f7d10f..f81f982 100644 --- a/include/libxml/threads.h +++ b/include/libxml/threads.h @@ -72,6 +72,10 @@ XMLPUBFUN void XMLCALL XMLPUBFUN xmlGlobalStatePtr XMLCALL xmlGetGlobalState(void); +#if defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && defined(LIBXML_STATIC_FOR_DLL) +int XMLCALL xmlDllMain(void *hinstDLL, unsigned long fdwReason, void *lpvReserved); +#endif + #ifdef __cplusplus } #endif diff --git a/include/libxml/uri.h b/include/libxml/uri.h index 5e29671..49ed105 100644 --- a/include/libxml/uri.h +++ b/include/libxml/uri.h @@ -23,6 +23,10 @@ extern "C" { * * A parsed URI reference. This is a struct containing the various fields * as described in RFC 2396 but separated for further processing. + * + * Note: query is a deprecated field which is incorrectly unescaped. + * query_raw takes precedence over query if the former is set. + * See: http://mail.gnome.org/archives/xml/2007-April/thread.html#00127 */ typedef struct _xmlURI xmlURI; typedef xmlURI *xmlURIPtr; @@ -34,9 +38,10 @@ struct _xmlURI { char *user; /* the user part */ int port; /* the port number */ char *path; /* the path string */ - char *query; /* the query string */ + char *query; /* the query string (deprecated - use with caution) */ char *fragment; /* the fragment identifier */ int cleanup; /* parsing potentially unclean URI */ + char *query_raw; /* the query string (as it appears in the URI) */ }; /* diff --git a/include/libxml/xmlversion.h b/include/libxml/xmlversion.h index 6eee895..78bad60 100644 --- a/include/libxml/xmlversion.h +++ b/include/libxml/xmlversion.h @@ -29,21 +29,21 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * * the version string like "1.2.3" */ -#define LIBXML_DOTTED_VERSION "2.6.28" +#define LIBXML_DOTTED_VERSION "2.6.29" /** * LIBXML_VERSION: * * the version number: 1.2.3 value is 10203 */ -#define LIBXML_VERSION 20628 +#define LIBXML_VERSION 20629 /** * LIBXML_VERSION_STRING: * * the version number string, 1.2.3 value is "10203" */ -#define LIBXML_VERSION_STRING "20628" +#define LIBXML_VERSION_STRING "20629" /** * LIBXML_VERSION_EXTRA: @@ -58,7 +58,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * Macro to check that the libxml version in use is compatible with * the version the software has been compiled against */ -#define LIBXML_TEST_VERSION xmlCheckVersion(20628); +#define LIBXML_TEST_VERSION xmlCheckVersion(20629); #ifndef VMS #if 0 @@ -91,7 +91,8 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * Whether the thread support is configured in */ #if 1 -#if defined(_REENTRANT) || defined(__MT__) || (_POSIX_C_SOURCE - 0 >= 199506L) +#if defined(_REENTRANT) || defined(__MT__) || \ + (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE - 0 >= 199506L)) #define LIBXML_THREAD_ENABLED #endif #endif diff --git a/include/libxml/xmlversion.h.in b/include/libxml/xmlversion.h.in index 0967913..29cef74 100644 --- a/include/libxml/xmlversion.h.in +++ b/include/libxml/xmlversion.h.in @@ -91,7 +91,8 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * Whether the thread support is configured in */ #if @WITH_THREADS@ -#if defined(_REENTRANT) || defined(__MT__) || (_POSIX_C_SOURCE - 0 >= 199506L) +#if defined(_REENTRANT) || defined(__MT__) || \ + (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE - 0 >= 199506L)) #define LIBXML_THREAD_ENABLED #endif #endif diff --git a/include/win32config.h b/include/win32config.h index c61dfa9..6e9b33b 100644 --- a/include/win32config.h +++ b/include/win32config.h @@ -6,7 +6,7 @@ #define HAVE_MALLOC_H #define HAVE_ERRNO_H -#ifdef _WIN32_WCE +#if defined(_WIN32_WCE) #undef HAVE_ERRNO_H #include #include "wincecompat.h" @@ -27,6 +27,11 @@ #include #endif +/* + * Windows platforms may define except + */ +#undef except + #define HAVE_ISINF #define HAVE_ISNAN #include @@ -95,7 +100,7 @@ static int isnan (double d) { /* Threading API to use should be specified here for compatibility reasons. This is however best specified on the compiler's command-line. */ #if defined(LIBXML_THREAD_ENABLED) -#if !defined(HAVE_PTHREAD_H) && !defined(HAVE_WIN32_THREADS) +#if !defined(HAVE_PTHREAD_H) && !defined(HAVE_WIN32_THREADS) && !defined(_WIN32_WCE) #define HAVE_WIN32_THREADS #endif #endif diff --git a/libxml.h b/libxml.h index 478d3e3..f5c6394 100644 --- a/libxml.h +++ b/libxml.h @@ -20,6 +20,14 @@ #if defined(macintosh) #include "config-mac.h" +#elif defined(_WIN32_WCE) +/* + * Windows CE compatibility definitions and functions + * This is needed to compile libxml2 for Windows CE. + * At least I tested it with WinCE 5.0 for Emulator and WinCE 4.2/SH4 target + */ +#include +#include #else #include "config.h" #include @@ -32,15 +40,6 @@ int snprintf(char *, size_t, const char *, ...); int vfprintf(FILE *, const char *, va_list); #endif -/* - * Windows CE compatibility definitions and functions - * This is needed to compile libxml2 for Windows CE. - * At least I tested it with WinCE 4.2 for Emulator and SH4 target - */ -#if defined(_WIN32_WCE) -#include -#endif - #ifndef WITH_TRIO #include #else diff --git a/libxml2.spec b/libxml2.spec index 675eda1..da2e0e7 100644 --- a/libxml2.spec +++ b/libxml2.spec @@ -1,6 +1,6 @@ Summary: Library providing XML and HTML support Name: libxml2 -Version: 2.6.28 +Version: 2.6.29 Release: 1 License: MIT Group: Development/Libraries @@ -128,6 +128,6 @@ rm -fr %{buildroot} %doc doc/python.html %changelog -* Tue Apr 17 2007 Daniel Veillard -- upstream release 2.6.28 see http://xmlsoft.org/news.html +* Tue Jun 12 2007 Daniel Veillard +- upstream release 2.6.29 see http://xmlsoft.org/news.html diff --git a/list.c b/list.c index 2dc6d96..5c01c83 100644 --- a/list.c +++ b/list.c @@ -314,14 +314,14 @@ int xmlListAppend(xmlListPtr l, void *data) if (lkNew == NULL) { xmlGenericError(xmlGenericErrorContext, "Cannot initialize memory for new link"); - return (0); + return (1); } lkNew->data = data; lkNew->next = lkPlace->next; (lkPlace->next)->prev = lkNew; lkPlace->next = lkNew; lkNew->prev = lkPlace; - return 1; + return 0; } /** diff --git a/nanohttp.c b/nanohttp.c index 26b5d7e..2406e7e 100644 --- a/nanohttp.c +++ b/nanohttp.c @@ -1203,16 +1203,19 @@ xmlNanoHTTPRead(void *ctx, void *dest, int len) { ctxt->strm->next_out = dest; ctxt->strm->avail_out = len; + ctxt->strm->avail_in = ctxt->inptr - ctxt->inrptr; - do { - orig_avail_in = ctxt->strm->avail_in = ctxt->inptr - ctxt->inrptr - bytes_read; + while (ctxt->strm->avail_out > 0 && + (ctxt->strm->avail_in > 0 || xmlNanoHTTPRecv(ctxt) > 0)) { + orig_avail_in = ctxt->strm->avail_in = + ctxt->inptr - ctxt->inrptr - bytes_read; ctxt->strm->next_in = BAD_CAST (ctxt->inrptr + bytes_read); z_ret = inflate(ctxt->strm, Z_NO_FLUSH); bytes_read += orig_avail_in - ctxt->strm->avail_in; if (z_ret != Z_OK) break; - } while (ctxt->strm->avail_out > 0 && xmlNanoHTTPRecv(ctxt) > 0); + } ctxt->inrptr += bytes_read; return(len - ctxt->strm->avail_out); diff --git a/parser.c b/parser.c index b405164..6cc8277 100644 --- a/parser.c +++ b/parser.c @@ -3074,7 +3074,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { */ c = CUR_CHAR(l); while ((NXT(0) != limit) && /* checked */ - (c != '<')) { + (IS_CHAR(c)) && (c != '<')) { if (c == 0) break; if (c == '&') { in_space = 0; @@ -3208,8 +3208,13 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { if (RAW == '<') { xmlFatalErr(ctxt, XML_ERR_LT_IN_ATTRIBUTE, NULL); } else if (RAW != limit) { - xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, - "AttValue: ' expected\n"); + if ((c != 0) && (!IS_CHAR(c))) { + xmlFatalErrMsg(ctxt, XML_ERR_INVALID_CHAR, + "invalid character in attribute value\n"); + } else { + xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, + "AttValue: ' expected\n"); + } } else NEXT; if (attlen != NULL) *attlen = len; @@ -6097,7 +6102,8 @@ xmlParseReference(xmlParserCtxtPtr ctxt) { } } else if ((ret != XML_ERR_OK) && (ret != XML_WAR_UNDECLARED_ENTITY)) { - xmlFatalErr(ctxt, ret, NULL); + xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY, + "Entity '%s' failed to parse\n", ent->name); } else if (list != NULL) { xmlFreeNodeList(list); list = NULL; @@ -10135,6 +10141,7 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) { "PP: Parsing PI\n"); #endif xmlParsePI(ctxt); + ctxt->checkIndex = 0; } else if ((cur == '<') && (next == '!') && (ctxt->input->cur[2] == '-') && (ctxt->input->cur[3] == '-')) { @@ -10147,6 +10154,7 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) { #endif xmlParseComment(ctxt); ctxt->instate = XML_PARSER_MISC; + ctxt->checkIndex = 0; } else if ((cur == '<') && (next == '!') && (ctxt->input->cur[2] == 'D') && (ctxt->input->cur[3] == 'O') && @@ -12953,8 +12961,12 @@ xmlCtxtReset(xmlParserCtxtPtr ctxt) ctxt->input = NULL; ctxt->spaceNr = 0; - ctxt->spaceTab[0] = -1; - ctxt->space = &ctxt->spaceTab[0]; + if (ctxt->spaceTab != NULL) { + ctxt->spaceTab[0] = -1; + ctxt->space = &ctxt->spaceTab[0]; + } else { + ctxt->space = NULL; + } ctxt->nodeNr = 0; diff --git a/python/libxml2-py.c b/python/libxml2-py.c index c979a3a..0874a60 100644 --- a/python/libxml2-py.c +++ b/python/libxml2-py.c @@ -977,6 +977,22 @@ libxml_xmlParseMarkupDecl(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { return(Py_None); } +PyObject * +libxml_xmlURISetQueryRaw(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + xmlURIPtr URI; + PyObject *pyobj_URI; + char * query_raw; + + if (!PyArg_ParseTuple(args, (char *)"Oz:xmlURISetQueryRaw", &pyobj_URI, &query_raw)) + return(NULL); + URI = (xmlURIPtr) PyURI_Get(pyobj_URI); + + if (URI->query_raw != NULL) xmlFree(URI->query_raw); + URI->query_raw = (char *)xmlStrdup((const xmlChar *)query_raw); + Py_INCREF(Py_None); + return(Py_None); +} + PyObject * libxml_xmlHasNsProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; @@ -14054,6 +14070,22 @@ libxml_xmlUCSIsOldItalic(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { } #endif /* defined(LIBXML_UNICODE_ENABLED) */ +PyObject * +libxml_xmlURIGetQueryRaw(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + PyObject *py_retval; + const char * c_retval; + xmlURIPtr URI; + PyObject *pyobj_URI; + + if (!PyArg_ParseTuple(args, (char *)"O:xmlURIGetQueryRaw", &pyobj_URI)) + return(NULL); + URI = (xmlURIPtr) PyURI_Get(pyobj_URI); + + c_retval = URI->query_raw; + py_retval = libxml_charPtrConstWrap((const char *) c_retval); + return(py_retval); +} + #if defined(LIBXML_XPATH_ENABLED) PyObject * libxml_xmlXPathPopNumber(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { diff --git a/python/libxml2-python-api.xml b/python/libxml2-python-api.xml index f77a237..42f661d 100644 --- a/python/libxml2-python-api.xml +++ b/python/libxml2-python-api.xml @@ -265,6 +265,17 @@ + + Get the raw query part from an URI (i.e. the unescaped form). + + + + + Set the raw query part of an URI (i.e. the unescaped form). + + + + Get the fragment part from an URI diff --git a/python/setup.py b/python/setup.py index 5eab8dc..191c03d 100755 --- a/python/setup.py +++ b/python/setup.py @@ -226,7 +226,7 @@ else: setup (name = "libxml2-python", # On *nix, the version number is created from setup.py.in # On windows, it is set by configure.js - version = "2.6.28", + version = "2.6.29", description = descr, author = "Daniel Veillard", author_email = "veillard@redhat.com", diff --git a/python/types.c b/python/types.c index 5c5dcca..9a17749 100644 --- a/python/types.c +++ b/python/types.c @@ -525,6 +525,7 @@ libxml_xmlXPathObjectPtrConvert(PyObject * obj) ret = xmlXPathNewFloat((double) PyInt_AS_LONG(obj)); +#ifdef PyBool_Check } else if PyBool_Check (obj) { if (obj == Py_True) { @@ -533,7 +534,7 @@ libxml_xmlXPathObjectPtrConvert(PyObject * obj) else { ret = xmlXPathNewBoolean(0); } - +#endif } else if PyString_Check (obj) { xmlChar *str; diff --git a/relaxng.c b/relaxng.c index 16527cc..60fdbab 100644 --- a/relaxng.c +++ b/relaxng.c @@ -9828,7 +9828,8 @@ xmlRelaxNGValidateState(xmlRelaxNGValidCtxtPtr ctxt, ret = -1; } else { state = ctxt->state; - ctxt->state->seq = nseq; + if (ctxt->state != NULL) + ctxt->state->seq = nseq; if (ret == 0) ret = xmlRelaxNGValidateElementEnd(ctxt, 1); xmlRelaxNGFreeValidState(ctxt, state); diff --git a/schematron.c b/schematron.c index 0a90ff8..a2eabcc 100644 --- a/schematron.c +++ b/schematron.c @@ -714,6 +714,7 @@ xmlSchematronFreeParserCtxt(xmlSchematronParserCtxtPtr ctxt) xmlFree(ctxt); } +#if 0 /** * xmlSchematronPushInclude: * @ctxt: the schema parser context @@ -782,6 +783,7 @@ xmlSchematronPopInclude(xmlSchematronParserCtxtPtr ctxt) return(xmlSchematronPopInclude(ctxt)); return(ret); } +#endif /** * xmlSchematronAddNamespace: @@ -987,6 +989,7 @@ xmlSchematronParsePattern(xmlSchematronParserCtxtPtr ctxt, xmlNodePtr pat) } } +#if 0 /** * xmlSchematronLoadInclude: * @ctxt: a schema validation context @@ -1051,6 +1054,7 @@ done: xmlFree(URI); return(ret); } +#endif /** * xmlSchematronParse: diff --git a/testapi.c b/testapi.c index 969fdd3..af71ac2 100644 --- a/testapi.c +++ b/testapi.c @@ -128,7 +128,7 @@ int main(int argc, char **argv) { int blocks, mem; /* access to the proxy can slow up regression tests a lot */ - putenv("http_proxy="); + putenv((char *) "http_proxy="); memset(chartab, 0, sizeof(chartab)); strncpy((char *) chartab, " chartab\n", 20); diff --git a/threads.c b/threads.c index 87d0d36..0ab9e77 100644 --- a/threads.c +++ b/threads.c @@ -441,7 +441,11 @@ __xmlGlobalInitMutexLock(void) InitializeCriticalSection(cs); /* Swap it into the global_init_lock */ +#ifdef InterlockedCompareExchangePointer InterlockedCompareExchangePointer(&global_init_lock, cs, NULL); +#else /* Use older void* version */ + InterlockedCompareExchange((void **)&global_init_lock, (void *)cs, NULL); +#endif /* InterlockedCompareExchangePointer */ /* If another thread successfully recorded its critical * section in the global_init_lock then discard the one @@ -912,7 +916,7 @@ xmlOnceInit(void) { */ #if defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL)) #if defined(LIBXML_STATIC_FOR_DLL) -BOOL WINAPI xmlDllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +BOOL XMLCALL xmlDllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) #else BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) #endif diff --git a/tree.c b/tree.c index ffbcabd..432007e 100644 --- a/tree.c +++ b/tree.c @@ -4848,7 +4848,7 @@ xmlNodeSetBase(xmlNodePtr cur, const xmlChar* uri) { fixed = xmlPathToURI(uri); if (fixed != NULL) { xmlSetNsProp(cur, ns, BAD_CAST "base", fixed); - xmlFree(fixed); + xmlFree((xmlChar *)fixed); } else { xmlSetNsProp(cur, ns, BAD_CAST "base", uri); } @@ -6968,7 +6968,8 @@ xmlBufferAdd(xmlBufferPtr buf, const xmlChar *str, int len) { if (len < 0) len = xmlStrlen(str); - if (len <= 0) return -1; + if (len < 0) return -1; + if (len == 0) return 0; needSize = buf->use + len + 2; if (needSize > buf->size){ diff --git a/uri.c b/uri.c index 35cf98a..4f5e182 100644 --- a/uri.c +++ b/uri.c @@ -446,7 +446,33 @@ xmlSaveUri(xmlURIPtr uri) { } } } - if (uri->query != NULL) { + if (uri->query_raw != NULL) { + if (len + 1 >= max) { + max *= 2; + ret = (xmlChar *) xmlRealloc(ret, + (max + 1) * sizeof(xmlChar)); + if (ret == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xmlSaveUri: out of memory\n"); + return(NULL); + } + } + ret[len++] = '?'; + p = uri->query_raw; + while (*p != 0) { + if (len + 1 >= max) { + max *= 2; + ret = (xmlChar *) xmlRealloc(ret, + (max + 1) * sizeof(xmlChar)); + if (ret == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xmlSaveUri: out of memory\n"); + return(NULL); + } + } + ret[len++] = *p++; + } + } else if (uri->query != NULL) { if (len + 3 >= max) { max *= 2; ret = (xmlChar *) xmlRealloc(ret, @@ -574,6 +600,8 @@ xmlCleanURI(xmlURIPtr uri) { uri->authority = NULL; if (uri->query != NULL) xmlFree(uri->query); uri->query = NULL; + if (uri->query_raw != NULL) xmlFree(uri->query_raw); + uri->query_raw = NULL; } /** @@ -594,6 +622,7 @@ xmlFreeURI(xmlURIPtr uri) { if (uri->opaque != NULL) xmlFree(uri->opaque); if (uri->authority != NULL) xmlFree(uri->authority); if (uri->query != NULL) xmlFree(uri->query); + if (uri->query_raw != NULL) xmlFree(uri->query_raw); xmlFree(uri); } @@ -805,10 +834,13 @@ static int is_hex(char c) { * @len: the length in bytes to unescape (or <= 0 to indicate full string) * @target: optional destination buffer * - * Unescaping routine, does not do validity checks ! - * Output is direct unsigned char translation of %XX values (no encoding) + * Unescaping routine, but does not check that the string is an URI. The + * output is a direct unsigned char translation of %XX values (no encoding) + * Note that the length of the result can only be smaller or same size as + * the input string. * - * Returns an copy of the string, but unescaped + * Returns a copy of the string, but unescaped, will return NULL only in case + * of error */ char * xmlURIUnescapeString(const char *str, int len, char *target) { @@ -1027,7 +1059,11 @@ xmlURIEscape(const xmlChar * str) xmlFree(segment); } - if (uri->query) { + if (uri->query_raw) { + ret = xmlStrcat(ret, BAD_CAST "?"); + ret = xmlStrcat(ret, BAD_CAST uri->query_raw); + } + else if (uri->query) { segment = xmlURIEscapeStr(BAD_CAST uri->query, BAD_CAST ";/?:@&=+,$"); NULLCHK(segment) @@ -1130,6 +1166,13 @@ xmlParseURIQuery(xmlURIPtr uri, const char **str) uri->query = STRNDUP(*str, cur - *str); else uri->query = xmlURIUnescapeString(*str, cur - *str, NULL); + + /* Save the raw bytes of the query as well. + * See: http://mail.gnome.org/archives/xml/2007-April/thread.html#00114 + */ + if (uri->query_raw != NULL) + xmlFree (uri->query_raw); + uri->query_raw = STRNDUP (*str, cur - *str); } *str = cur; return (0); @@ -1253,7 +1296,7 @@ xmlParseURIServer(xmlURIPtr uri, const char **str) { if (uri != NULL) { if (uri->user != NULL) xmlFree(uri->user); if (uri->cleanup & 2) - uri->path = STRNDUP(*str, cur - *str); + uri->user = STRNDUP(*str, cur - *str); else uri->user = xmlURIUnescapeString(*str, cur - *str, NULL); } @@ -1943,8 +1986,12 @@ xmlBuildURI(const xmlChar *URI, const xmlChar *base) { } if (bas->path != NULL) res->path = xmlMemStrdup(bas->path); - if (ref->query != NULL) + if (ref->query_raw != NULL) + res->query_raw = xmlMemStrdup (ref->query_raw); + else if (ref->query != NULL) res->query = xmlMemStrdup(ref->query); + else if (bas->query_raw != NULL) + res->query_raw = xmlMemStrdup(bas->query_raw); else if (bas->query != NULL) res->query = xmlMemStrdup(bas->query); if (ref->fragment != NULL) @@ -1965,7 +2012,9 @@ xmlBuildURI(const xmlChar *URI, const xmlChar *base) { if (bas->scheme != NULL) res->scheme = xmlMemStrdup(bas->scheme); - if (ref->query != NULL) + if (ref->query_raw != NULL) + res->query_raw = xmlMemStrdup(ref->query_raw); + else if (ref->query != NULL) res->query = xmlMemStrdup(ref->query); if (ref->fragment != NULL) res->fragment = xmlMemStrdup(ref->fragment); diff --git a/valid.c b/valid.c index a239e68..2510b8d 100644 --- a/valid.c +++ b/valid.c @@ -2724,7 +2724,7 @@ xmlIsID(xmlDocPtr doc, xmlNodePtr elem, xmlAttrPtr attr) { } else if (doc->type == XML_HTML_DOCUMENT_NODE) { if ((xmlStrEqual(BAD_CAST "id", attr->name)) || ((xmlStrEqual(BAD_CAST "name", attr->name)) && - ((elem == NULL) || (!xmlStrEqual(elem->name, BAD_CAST "input"))))) + ((elem == NULL) || (xmlStrEqual(elem->name, BAD_CAST "a"))))) return(1); return(0); } else if (elem == NULL) { @@ -2998,19 +2998,32 @@ xmlAddRef(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value, xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, "xmlAddRef: Reference list creation failed!\n", NULL); - return(NULL); + goto failed; } if (xmlHashAddEntry(table, value, ref_list) < 0) { xmlListDelete(ref_list); xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, "xmlAddRef: Reference list insertion failed!\n", NULL); - return(NULL); + goto failed; } } -/* xmlListInsert(ref_list, ret); */ - xmlListAppend(ref_list, ret); + if (xmlListAppend(ref_list, ret) != 0) { + xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, + "xmlAddRef: Reference list insertion failed!\n", + NULL); + goto failed; + } return(ret); +failed: + if (ret != NULL) { + if (ret->value != NULL) + xmlFree((char *)ret->value); + if (ret->name != NULL) + xmlFree((char *)ret->name); + xmlFree(ret); + } + return(NULL); } /** diff --git a/win32/Makefile.msvc b/win32/Makefile.msvc index 35f4a80..9046ff3 100644 --- a/win32/Makefile.msvc +++ b/win32/Makefile.msvc @@ -25,11 +25,13 @@ XML_SO = $(XML_BASENAME).dll XML_IMP = $(XML_BASENAME).lib XML_DEF = $(XML_BASENAME).def XML_A = $(XML_BASENAME)_a.lib +XML_A_DLL = $(XML_BASENAME)_a_dll.lib # Place where we let the compiler put its output. BINDIR = bin.msvc XML_INTDIR = int.msvc XML_INTDIR_A = int.a.msvc +XML_INTDIR_A_DLL = int.a.dll.msvc UTILS_INTDIR = int.utils.msvc # The preprocessor and its options. @@ -56,6 +58,7 @@ CFLAGS = $(CFLAGS) /D "HAVE_PTHREAD_H" !if "$(WITH_ZLIB)" == "1" CFLAGS = $(CFLAGS) /D "HAVE_ZLIB_H" !endif +CFLAGS = $(CFLAGS) /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE # The linker and its options. LD = link.exe @@ -181,6 +184,51 @@ XML_OBJS_A = $(XML_INTDIR_A)\c14n.obj\ $(XML_INTDIR_A)\xpointer.obj\ $(XML_INTDIR_A)\xmlstring.obj +# Static libxml object files. +XML_OBJS_A_DLL = $(XML_INTDIR_A_DLL)\c14n.obj\ + $(XML_INTDIR_A_DLL)\catalog.obj\ + $(XML_INTDIR_A_DLL)\chvalid.obj\ + $(XML_INTDIR_A_DLL)\debugXML.obj\ + $(XML_INTDIR_A_DLL)\dict.obj\ + $(XML_INTDIR_A_DLL)\DOCBparser.obj\ + $(XML_INTDIR_A_DLL)\encoding.obj\ + $(XML_INTDIR_A_DLL)\entities.obj\ + $(XML_INTDIR_A_DLL)\error.obj\ + $(XML_INTDIR_A_DLL)\globals.obj\ + $(XML_INTDIR_A_DLL)\hash.obj\ + $(XML_INTDIR_A_DLL)\HTMLparser.obj\ + $(XML_INTDIR_A_DLL)\HTMLtree.obj\ + $(XML_INTDIR_A_DLL)\legacy.obj\ + $(XML_INTDIR_A_DLL)\list.obj\ + $(XML_INTDIR_A_DLL)\nanoftp.obj\ + $(XML_INTDIR_A_DLL)\nanohttp.obj\ + $(XML_INTDIR_A_DLL)\parser.obj\ + $(XML_INTDIR_A_DLL)\parserInternals.obj\ + $(XML_INTDIR_A_DLL)\pattern.obj\ + $(XML_INTDIR_A_DLL)\relaxng.obj\ + $(XML_INTDIR_A_DLL)\SAX2.obj\ + $(XML_INTDIR_A_DLL)\SAX.obj\ + $(XML_INTDIR_A_DLL)\schematron.obj\ + $(XML_INTDIR_A_DLL)\threads.obj\ + $(XML_INTDIR_A_DLL)\tree.obj\ + $(XML_INTDIR_A_DLL)\uri.obj\ + $(XML_INTDIR_A_DLL)\valid.obj\ + $(XML_INTDIR_A_DLL)\xinclude.obj\ + $(XML_INTDIR_A_DLL)\xlink.obj\ + $(XML_INTDIR_A_DLL)\xmlIO.obj\ + $(XML_INTDIR_A_DLL)\xmlmemory.obj\ + $(XML_INTDIR_A_DLL)\xmlreader.obj\ + $(XML_INTDIR_A_DLL)\xmlregexp.obj\ + $(XML_INTDIR_A_DLL)\xmlmodule.obj\ + $(XML_INTDIR_A_DLL)\xmlsave.obj\ + $(XML_INTDIR_A_DLL)\xmlschemas.obj\ + $(XML_INTDIR_A_DLL)\xmlschemastypes.obj\ + $(XML_INTDIR_A_DLL)\xmlunicode.obj\ + $(XML_INTDIR_A_DLL)\xmlwriter.obj\ + $(XML_INTDIR_A_DLL)\xpath.obj\ + $(XML_INTDIR_A_DLL)\xpointer.obj\ + $(XML_INTDIR_A_DLL)\xmlstring.obj + # Xmllint and friends executables. UTILS = $(BINDIR)\xmllint.exe\ $(BINDIR)\xmlcatalog.exe\ @@ -206,17 +254,28 @@ UTILS = $(UTILS) $(BINDIR)\testThreadsWin32.exe UTILS = $(UTILS) $(BINDIR)\testThreads.exe !endif -all : libxml libxmla utils +!if "$(VCMANIFEST)" == "1" +_VC_MANIFEST_EMBED_EXE= if exist $@.manifest mt.exe -nologo -manifest $@.manifest -outputresource:$@;1 +_VC_MANIFEST_EMBED_DLL= if exist $@.manifest mt.exe -nologo -manifest $@.manifest -outputresource:$@;2 +!else +_VC_MANIFEST_EMBED_EXE= +_VC_MANIFEST_EMBED_DLL= +!endif + +all : libxml libxmla libxmladll utils libxml : $(BINDIR)\$(XML_SO) libxmla : $(BINDIR)\$(XML_A) +libxmladll : $(BINDIR)\$(XML_A_DLL) + utils : $(UTILS) clean : if exist $(XML_INTDIR) rmdir /S /Q $(XML_INTDIR) if exist $(XML_INTDIR_A) rmdir /S /Q $(XML_INTDIR_A) + if exist $(XML_INTDIR_A_DLL) rmdir /S /Q $(XML_INTDIR_A_DLL) if exist $(UTILS_INTDIR) rmdir /S /Q $(UTILS_INTDIR) if exist $(BINDIR) rmdir /S /Q $(BINDIR) @@ -234,6 +293,7 @@ install-libs : all copy $(XML_SRCDIR)\include\libxml\*.h $(INCPREFIX)\libxml copy $(BINDIR)\$(XML_SO) $(SOPREFIX) copy $(BINDIR)\$(XML_A) $(LIBPREFIX) + copy $(BINDIR)\$(XML_A_DLL) $(LIBPREFIX) copy $(BINDIR)\$(XML_IMP) $(LIBPREFIX) install : install-libs @@ -266,6 +326,10 @@ $(XML_INTDIR) : $(XML_INTDIR_A) : if not exist $(XML_INTDIR_A) mkdir $(XML_INTDIR_A) +# Makes the static for dll libxml intermediate directory. +$(XML_INTDIR_A_DLL) : + if not exist $(XML_INTDIR_A_DLL) mkdir $(XML_INTDIR_A_DLL) + # An implicit rule for libxml compilation. {$(XML_SRCDIR)}.c{$(XML_INTDIR)}.obj:: $(CC) $(CFLAGS) /Fo$(XML_INTDIR)\ /c $< @@ -274,12 +338,19 @@ $(XML_INTDIR_A) : {$(XML_SRCDIR)}.c{$(XML_INTDIR_A)}.obj:: $(CC) $(CFLAGS) /D "LIBXML_STATIC" /Fo$(XML_INTDIR_A)\ /c $< +# An implicit rule for static for dll libxml compilation. +{$(XML_SRCDIR)}.c{$(XML_INTDIR_A_DLL)}.obj:: + $(CC) $(CFLAGS) /D "LIBXML_STATIC" /D "LIBXML_STATIC_FOR_DLL" /Fo$(XML_INTDIR_A_DLL)\ /c $< + # Compiles libxml source. Uses the implicit rule for commands. $(XML_OBJS) : $(XML_INTDIR) # Compiles static libxml source. Uses the implicit rule for commands. $(XML_OBJS_A) : $(XML_INTDIR_A) +# Compiles static for dll libxml source. Uses the implicit rule for commands. +$(XML_OBJS_A_DLL) : $(XML_INTDIR_A_DLL) + # Creates the export definition file (DEF) for libxml. $(XML_INTDIR)\$(XML_DEF) : $(XML_INTDIR) $(XML_DEF).src $(CPP) $(CPPFLAGS) $(XML_DEF).src > $(XML_INTDIR)\$(XML_DEF) @@ -288,6 +359,7 @@ $(XML_INTDIR)\$(XML_DEF) : $(XML_INTDIR) $(XML_DEF).src $(BINDIR)\$(XML_SO) : $(BINDIR) $(XML_OBJS) $(XML_INTDIR)\$(XML_DEF) $(LD) $(LDFLAGS) /DLL \ /IMPLIB:$(BINDIR)\$(XML_IMP) /OUT:$(BINDIR)\$(XML_SO) $(XML_OBJS) $(LIBS) + @$(_VC_MANIFEST_EMBED_DLL) #$(BINDIR)\$(XML_SO) : $(BINDIR) $(XML_OBJS) $(XML_INTDIR)\$(XML_DEF) # $(LD) $(LDFLAGS) /DLL /DEF:$(XML_INTDIR)\$(XML_DEF) \ @@ -297,6 +369,9 @@ $(BINDIR)\$(XML_SO) : $(BINDIR) $(XML_OBJS) $(XML_INTDIR)\$(XML_DEF) $(BINDIR)\$(XML_A) : $(BINDIR) $(XML_OBJS_A) $(AR) $(ARFLAGS) /OUT:$(BINDIR)\$(XML_A) $(XML_OBJS_A) +# Creates the libxml static for dll archive. +$(BINDIR)\$(XML_A_DLL) : $(BINDIR) $(XML_OBJS_A_DLL) + $(AR) $(ARFLAGS) /OUT:$(BINDIR)\$(XML_A_DLL) $(XML_OBJS_A_DLL) # Makes the utils intermediate directory. $(UTILS_INTDIR) : @@ -307,14 +382,16 @@ $(UTILS_INTDIR) : {$(UTILS_SRCDIR)}.c{$(BINDIR)}.exe: $(CC) /D "LIBXML_STATIC" $(CFLAGS) /Fo$(UTILS_INTDIR)\ /c $< $(LD) $(LDFLAGS) /OUT:$@ $(XML_A) $(LIBS) $(UTILS_INTDIR)\$(atom, ctxt->neg, type, 0, 0, NULL); } + } else { + ERROR("Wrong escape sequence, misuse of character '\\'"); } } @@ -5307,6 +5309,10 @@ xmlRegexpCompile(const xmlChar *regexp) { if (CUR != 0) { ERROR("xmlFAParseRegExp: extra characters"); } + if (ctxt->error != 0) { + xmlRegFreeParserCtxt(ctxt); + return(NULL); + } ctxt->end = ctxt->state; ctxt->start->type = XML_REGEXP_START_STATE; ctxt->end->type = XML_REGEXP_FINAL_STATE; diff --git a/xmlsave.c b/xmlsave.c index 231ee7b..b97327e 100644 --- a/xmlsave.c +++ b/xmlsave.c @@ -834,7 +834,6 @@ xmlDocContentDumpOutput(xmlSaveCtxtPtr ctxt, xmlDocPtr cur) { xmlCharEncodingOutputFunc oldescape = ctxt->escape; xmlCharEncodingOutputFunc oldescapeAttr = ctxt->escapeAttr; xmlOutputBufferPtr buf = ctxt->buf; - xmlCharEncodingHandlerPtr handler = NULL; xmlCharEncoding enc; xmlInitParser(); diff --git a/xmlwriter.c b/xmlwriter.c index 2e67a4f..f618610 100644 --- a/xmlwriter.c +++ b/xmlwriter.c @@ -97,6 +97,7 @@ struct _xmlTextWriter { static void xmlFreeTextWriterStackEntry(xmlLinkPtr lk); static int xmlCmpTextWriterStackEntry(const void *data0, const void *data1); +static int xmlTextWriterOutputNSDecl(xmlTextWriterPtr writer); static void xmlFreeTextWriterNsStackEntry(xmlLinkPtr lk); static int xmlCmpTextWriterNsStackEntry(const void *data0, const void *data1); @@ -734,6 +735,11 @@ xmlTextWriterStartComment(xmlTextWriterPtr writer) case XML_TEXTWRITER_NONE: break; case XML_TEXTWRITER_NAME: + /* Output namespace declarations */ + count = xmlTextWriterOutputNSDecl(writer); + if (count < 0) + return -1; + sum += count; count = xmlOutputBufferWriteString(writer->out, ">"); if (count < 0) return -1; @@ -965,6 +971,11 @@ xmlTextWriterStartElement(xmlTextWriterPtr writer, const xmlChar * name) sum += count; /* fallthrough */ case XML_TEXTWRITER_NAME: + /* Output namespace declarations */ + count = xmlTextWriterOutputNSDecl(writer); + if (count < 0) + return -1; + sum += count; count = xmlOutputBufferWriteString(writer->out, ">"); if (count < 0) return -1; @@ -1055,17 +1066,31 @@ xmlTextWriterStartElementNS(xmlTextWriterPtr writer, sum += count; if (namespaceURI != 0) { + xmlTextWriterNsStackEntry *p = (xmlTextWriterNsStackEntry *) + xmlMalloc(sizeof(xmlTextWriterNsStackEntry)); + if (p == 0) { + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, + "xmlTextWriterStartElementNS : out of memory!\n"); + return -1; + } + buf = xmlStrdup(BAD_CAST "xmlns"); if (prefix != 0) { buf = xmlStrcat(buf, BAD_CAST ":"); buf = xmlStrcat(buf, prefix); } - count = xmlTextWriterWriteAttribute(writer, buf, namespaceURI); - xmlFree(buf); - if (count < 0) + p->prefix = buf; + p->uri = xmlStrdup(namespaceURI); + if (p->uri == 0) { + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, + "xmlTextWriterStartElementNS : out of memory!\n"); + xmlFree(p); return -1; - sum += count; + } + p->elem = xmlListFront(writer->nodes); + + xmlListPushFront(writer->nsstack, p); } return sum; @@ -1091,22 +1116,37 @@ xmlTextWriterEndElement(xmlTextWriterPtr writer) return -1; lk = xmlListFront(writer->nodes); - if (lk == 0) + if (lk == 0) { + xmlListDelete(writer->nsstack); + writer->nsstack = NULL; return -1; + } p = (xmlTextWriterStackEntry *) xmlLinkGetData(lk); - if (p == 0) + if (p == 0) { + xmlListDelete(writer->nsstack); + writer->nsstack = NULL; return -1; + } sum = 0; switch (p->state) { case XML_TEXTWRITER_ATTRIBUTE: count = xmlTextWriterEndAttribute(writer); - if (count < 0) + if (count < 0) { + xmlListDelete(writer->nsstack); + writer->nsstack = NULL; return -1; + } sum += count; /* fallthrough */ case XML_TEXTWRITER_NAME: + /* Output namespace declarations */ + count = xmlTextWriterOutputNSDecl(writer); + if (count < 0) + return -1; + sum += count; + if (writer->indent) /* next element needs indent */ writer->doindent = 1; count = xmlOutputBufferWriteString(writer->out, "/>"); @@ -1184,6 +1224,12 @@ xmlTextWriterFullEndElement(xmlTextWriterPtr writer) sum += count; /* fallthrough */ case XML_TEXTWRITER_NAME: + /* Output namespace declarations */ + count = xmlTextWriterOutputNSDecl(writer); + if (count < 0) + return -1; + sum += count; + count = xmlOutputBufferWriteString(writer->out, ">"); if (count < 0) return -1; @@ -1767,6 +1813,57 @@ xmlTextWriterStartAttributeNS(xmlTextWriterPtr writer, if ((writer == NULL) || (name == NULL) || (*name == '\0')) return -1; + /* Handle namespace first in case of error */ + if (namespaceURI != 0) { + xmlTextWriterNsStackEntry nsentry, *curns; + + buf = xmlStrdup(BAD_CAST "xmlns"); + if (prefix != 0) { + buf = xmlStrcat(buf, BAD_CAST ":"); + buf = xmlStrcat(buf, prefix); + } + + nsentry.prefix = buf; + nsentry.uri = (xmlChar *)namespaceURI; + nsentry.elem = xmlListFront(writer->nodes); + + curns = (xmlTextWriterNsStackEntry *)xmlListSearch(writer->nsstack, + (void *)&nsentry); + if ((curns != NULL)) { + xmlFree(buf); + if (xmlStrcmp(curns->uri, namespaceURI) == 0) { + /* Namespace already defined on element skip */ + buf = NULL; + } else { + /* Prefix mismatch so error out */ + return -1; + } + } + + /* Do not add namespace decl to list - it is already there */ + if (buf != NULL) { + p = (xmlTextWriterNsStackEntry *) + xmlMalloc(sizeof(xmlTextWriterNsStackEntry)); + if (p == 0) { + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, + "xmlTextWriterStartAttributeNS : out of memory!\n"); + return -1; + } + + p->prefix = buf; + p->uri = xmlStrdup(namespaceURI); + if (p->uri == 0) { + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, + "xmlTextWriterStartAttributeNS : out of memory!\n"); + xmlFree(p); + return -1; + } + p->elem = xmlListFront(writer->nodes); + + xmlListPushFront(writer->nsstack, p); + } + } + buf = NULL; if (prefix != 0) { buf = xmlStrdup(prefix); @@ -1781,34 +1878,6 @@ xmlTextWriterStartAttributeNS(xmlTextWriterPtr writer, return -1; sum += count; - if (namespaceURI != 0) { - buf = xmlStrdup(BAD_CAST "xmlns"); - if (prefix != 0) { - buf = xmlStrcat(buf, BAD_CAST ":"); - buf = xmlStrcat(buf, prefix); - } - - p = (xmlTextWriterNsStackEntry *) - xmlMalloc(sizeof(xmlTextWriterNsStackEntry)); - if (p == 0) { - xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, - "xmlTextWriterStartAttributeNS : out of memory!\n"); - return -1; - } - - p->prefix = buf; - p->uri = xmlStrdup(namespaceURI); - if (p->uri == 0) { - xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, - "xmlTextWriterStartAttributeNS : out of memory!\n"); - xmlFree(p); - return -1; - } - p->elem = xmlListFront(writer->nodes); - - xmlListPushFront(writer->nsstack, p); - } - return sum; } @@ -1827,22 +1896,17 @@ xmlTextWriterEndAttribute(xmlTextWriterPtr writer) int sum; xmlLinkPtr lk; xmlTextWriterStackEntry *p; - xmlTextWriterNsStackEntry *np; if (writer == NULL) return -1; lk = xmlListFront(writer->nodes); if (lk == 0) { - xmlListDelete(writer->nsstack); - writer->nsstack = NULL; return -1; } p = (xmlTextWriterStackEntry *) xmlLinkGetData(lk); if (p == 0) { - xmlListDelete(writer->nsstack); - writer->nsstack = NULL; return -1; } @@ -1853,45 +1917,11 @@ xmlTextWriterEndAttribute(xmlTextWriterPtr writer) count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar); if (count < 0) { - xmlListDelete(writer->nsstack); - writer->nsstack = NULL; return -1; } sum += count; - - while (!xmlListEmpty(writer->nsstack)) { - xmlChar *namespaceURI = NULL; - xmlChar *prefix = NULL; - - lk = xmlListFront(writer->nsstack); - np = (xmlTextWriterNsStackEntry *) xmlLinkGetData(lk); - - if (np != 0) { - namespaceURI = xmlStrdup(np->uri); - prefix = xmlStrdup(np->prefix); - } - - xmlListPopFront(writer->nsstack); - - if (np != 0) { - count = - xmlTextWriterWriteAttribute(writer, prefix, - namespaceURI); - xmlFree(namespaceURI); - xmlFree(prefix); - - if (count < 0) { - xmlListDelete(writer->nsstack); - writer->nsstack = NULL; - return -1; - } - sum += count; - } - } break; - default: - xmlListClear(writer->nsstack); return -1; } @@ -2080,38 +2110,24 @@ xmlTextWriterWriteAttributeNS(xmlTextWriterPtr writer, { int count; int sum; - xmlChar *buf; if ((writer == NULL) || (name == NULL) || (*name == '\0')) return -1; - buf = NULL; - if (prefix != NULL) { - buf = xmlStrdup(prefix); - buf = xmlStrcat(buf, BAD_CAST ":"); - } - buf = xmlStrcat(buf, name); - sum = 0; - count = xmlTextWriterWriteAttribute(writer, buf, content); - xmlFree(buf); + count = xmlTextWriterStartAttributeNS(writer, prefix, name, namespaceURI); + if (count < 0) + return -1; + sum += count; + count = xmlTextWriterWriteString(writer, content); + if (count < 0) + return -1; + sum += count; + count = xmlTextWriterEndAttribute(writer); if (count < 0) return -1; sum += count; - if (namespaceURI != NULL) { - buf = NULL; - buf = xmlStrdup(BAD_CAST "xmlns"); - if (prefix != NULL) { - buf = xmlStrcat(buf, BAD_CAST ":"); - buf = xmlStrcat(buf, prefix); - } - count = xmlTextWriterWriteAttribute(writer, buf, namespaceURI); - xmlFree(buf); - if (count < 0) - return -1; - sum += count; - } return sum; } @@ -2358,6 +2374,11 @@ xmlTextWriterStartPI(xmlTextWriterPtr writer, const xmlChar * target) sum += count; /* fallthrough */ case XML_TEXTWRITER_NAME: + /* Output namespace declarations */ + count = xmlTextWriterOutputNSDecl(writer); + if (count < 0) + return -1; + sum += count; count = xmlOutputBufferWriteString(writer->out, ">"); if (count < 0) return -1; @@ -2592,6 +2613,11 @@ xmlTextWriterStartCDATA(xmlTextWriterPtr writer) sum += count; /* fallthrough */ case XML_TEXTWRITER_NAME: + /* Output namespace declarations */ + count = xmlTextWriterOutputNSDecl(writer); + if (count < 0) + return -1; + sum += count; count = xmlOutputBufferWriteString(writer->out, ">"); if (count < 0) return -1; @@ -4247,6 +4273,51 @@ xmlCmpTextWriterStackEntry(const void *data0, const void *data1) * misc */ +/** + * xmlTextWriterOutputNSDecl: + * @writer: the xmlTextWriterPtr + * + * Output the current namespace declarations. + */ +static int +xmlTextWriterOutputNSDecl(xmlTextWriterPtr writer) +{ + xmlLinkPtr lk; + xmlTextWriterNsStackEntry *np; + int count; + int sum; + + sum = 0; + while (!xmlListEmpty(writer->nsstack)) { + xmlChar *namespaceURI = NULL; + xmlChar *prefix = NULL; + + lk = xmlListFront(writer->nsstack); + np = (xmlTextWriterNsStackEntry *) xmlLinkGetData(lk); + + if (np != 0) { + namespaceURI = xmlStrdup(np->uri); + prefix = xmlStrdup(np->prefix); + } + + xmlListPopFront(writer->nsstack); + + if (np != 0) { + count = xmlTextWriterWriteAttribute(writer, prefix, namespaceURI); + xmlFree(namespaceURI); + xmlFree(prefix); + + if (count < 0) { + xmlListDelete(writer->nsstack); + writer->nsstack = NULL; + return -1; + } + sum += count; + } + } + return sum; +} + /** * xmlFreeTextWriterNsStackEntry: * @lk: the xmlLinkPtr @@ -4300,8 +4371,8 @@ xmlCmpTextWriterNsStackEntry(const void *data0, const void *data1) rc = xmlStrcmp(p0->prefix, p1->prefix); - if (rc == 0) - rc = p0->elem == p1->elem; + if ((rc != 0) || (p0->elem != p1->elem)) + rc = -1; return rc; } @@ -4568,6 +4639,11 @@ xmlTextWriterHandleStateDependencies(xmlTextWriterPtr writer, sum = 0; switch (p->state) { case XML_TEXTWRITER_NAME: + /* Output namespace declarations */ + count = xmlTextWriterOutputNSDecl(writer); + if (count < 0) + return -1; + sum += count; extra[0] = '>'; p->state = XML_TEXTWRITER_TEXT; break; diff --git a/xpath.c b/xpath.c index 8c35e30..8f6545a 100644 --- a/xpath.c +++ b/xpath.c @@ -2648,9 +2648,10 @@ xmlXPathPopExternal (xmlXPathParserContextPtr ctxt) { #define UPPER_DOUBLE 1E9 #define LOWER_DOUBLE 1E-5 +#define LOWER_DOUBLE_EXP 5 #define INTEGER_DIGITS DBL_DIG -#define FRACTION_DIGITS (DBL_DIG + 1) +#define FRACTION_DIGITS (DBL_DIG + 1 + (LOWER_DOUBLE_EXP)) #define EXPONENT_DIGITS (3 + 2) /** @@ -2701,8 +2702,16 @@ xmlXPathFormatNumber(double number, char buffer[], int buffersize) *ptr = 0; } } else { - /* 3 is sign, decimal point, and terminating zero */ - char work[DBL_DIG + EXPONENT_DIGITS + 3]; + /* + For the dimension of work, + DBL_DIG is number of significant digits + EXPONENT is only needed for "scientific notation" + 3 is sign, decimal point, and terminating zero + LOWER_DOUBLE_EXP is max number of leading zeroes in fraction + Note that this dimension is slightly (a few characters) + larger than actually necessary. + */ + char work[DBL_DIG + EXPONENT_DIGITS + 3 + LOWER_DOUBLE_EXP]; int integer_place, fraction_place; char *ptr; char *after_fraction; @@ -2725,24 +2734,25 @@ xmlXPathFormatNumber(double number, char buffer[], int buffersize) size = snprintf(work, sizeof(work),"%*.*e", integer_place, fraction_place, number); while ((size > 0) && (work[size] != 'e')) size--; - after_fraction = work + size; } else { /* Use regular notation */ - if (absolute_value > 0.0) - integer_place = 1 + (int)log10(absolute_value); - else - integer_place = 0; - fraction_place = (integer_place > 0) - ? DBL_DIG - integer_place - : DBL_DIG; + if (absolute_value > 0.0) { + integer_place = (int)log10(absolute_value); + if (integer_place > 0) + fraction_place = DBL_DIG - integer_place - 1; + else + fraction_place = DBL_DIG - integer_place; + } else { + fraction_place = 1; + } size = snprintf(work, sizeof(work), "%0.*f", fraction_place, number); - after_fraction = work + size; } /* Remove fractional trailing zeroes */ + after_fraction = work + size; ptr = after_fraction; while (*(--ptr) == '0') ; @@ -3184,6 +3194,11 @@ xmlXPathCmpNodesExt(xmlNodePtr node1, xmlNodePtr node2) { turtle_comparison: + if (miscNode1 != NULL) + node1 = miscNode1; + if (miscNode2 != NULL) + node2 = miscNode2; + if (node1 == node2->prev) return(1); if (node1 == node2->next) @@ -4602,12 +4617,13 @@ xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) { return(ret); l = xmlXPathNodeSetGetLength(nodes); - for (i = l; i > 0; i--) { + for (i = l - 1; i >= 0; i--) { cur = xmlXPathNodeSetItem(nodes, i); if (cur == node) break; xmlXPathNodeSetAddUnique(ret, cur); } + xmlXPathNodeSetSort(ret); /* bug 413451 */ return(ret); } @@ -5573,7 +5589,10 @@ xmlXPathCastNumberToString (double val) { */ xmlChar * xmlXPathCastNodeToString (xmlNodePtr node) { - return(xmlNodeGetContent(node)); +xmlChar *ret; + if ((ret = xmlNodeGetContent(node)) == NULL) + ret = xmlStrdup((const xmlChar *) ""); + return(ret); } /** @@ -14678,8 +14697,7 @@ xmlXPathCompiledEvalInternal(xmlXPathCompExprPtr comp, do { tmp = valuePop(pctxt); if (tmp != NULL) { - if (tmp != NULL) - stack++; + stack++; xmlXPathReleaseObject(ctxt, tmp); } } while (tmp != NULL); diff --git a/xstc/Makefile.am b/xstc/Makefile.am index 57e1a4a..2d24f02 100644 --- a/xstc/Makefile.am +++ b/xstc/Makefile.am @@ -41,7 +41,7 @@ $(TESTDIRS) Tests/Metadata/$(NISTTESTDEF_2) Tests/Metadata/$(MSTTESTDEF) Tests/M else echo "Dont' know how to fetch $(TARBALLURL_2)" ; fi ; fi ; fi) -@(if [ -f $(TARBALL_2) ] ; then \ echo -n "extracting test data (NIST)..." ; \ - $(TAR) -xzf $(TARBALL_2) '*/Datatypes' '*/Metadata/$(NISTTESTDEF_2)' ; \ + $(TAR) -xzf $(TARBALL_2) --wildcards '*/Datatypes' '*/Metadata/$(NISTTESTDEF_2)' ; \ echo "done" ; \ fi) -@(if [ ! -f $(TARBALL) ] ; then \ @@ -53,7 +53,7 @@ $(TESTDIRS) Tests/Metadata/$(NISTTESTDEF_2) Tests/Metadata/$(MSTTESTDEF) Tests/M else echo "Dont' know how to fetch $(TARBALLURL)" ; fi ; fi ; fi) -@(if [ -f $(TARBALL) ] ; then \ echo -n "extracting test data (Sun, Microsoft)..." ; \ - $(TAR) -C Tests -xzf $(TARBALL) '*/suntest' '*/msxsdtest' '*/$(MSTESTDEF)' '*/$(SUNTESTDEF)' ; \ + $(TAR) -C Tests -xzf $(TARBALL) --wildcards '*/suntest' '*/msxsdtest' '*/$(MSTESTDEF)' '*/$(SUNTESTDEF)' ; \ if [ -d Tests/suntest ] ; then rm -r Tests/suntest ; fi ; \ if [ -d Tests/msxsdtest ] ; then rm -r Tests/msxsdtest ; fi ; \ mv Tests/xmlschema2002-01-16/* Tests ; \ @@ -126,7 +126,7 @@ tests: valgrind: -@(if [ -x $(PYTHON) ] ; then \ echo '## Running the regression tests under Valgrind' ; \ - $(MAKE) CHECKER='valgrind' MAKEFLAGS+=--silent pytests ; fi); + $(MAKE) CHECKER='valgrind -q' MAKEFLAGS+=--silent pytests ; fi); clean: rm -f $(PYSCRIPTS) test.log diff --git a/xstc/Makefile.in b/xstc/Makefile.in index f889d3f..33533c0 100644 --- a/xstc/Makefile.in +++ b/xstc/Makefile.in @@ -461,7 +461,7 @@ $(TESTDIRS) Tests/Metadata/$(NISTTESTDEF_2) Tests/Metadata/$(MSTTESTDEF) Tests/M else echo "Dont' know how to fetch $(TARBALLURL_2)" ; fi ; fi ; fi) -@(if [ -f $(TARBALL_2) ] ; then \ echo -n "extracting test data (NIST)..." ; \ - $(TAR) -xzf $(TARBALL_2) '*/Datatypes' '*/Metadata/$(NISTTESTDEF_2)' ; \ + $(TAR) -xzf $(TARBALL_2) --wildcards '*/Datatypes' '*/Metadata/$(NISTTESTDEF_2)' ; \ echo "done" ; \ fi) -@(if [ ! -f $(TARBALL) ] ; then \ @@ -473,7 +473,7 @@ $(TESTDIRS) Tests/Metadata/$(NISTTESTDEF_2) Tests/Metadata/$(MSTTESTDEF) Tests/M else echo "Dont' know how to fetch $(TARBALLURL)" ; fi ; fi ; fi) -@(if [ -f $(TARBALL) ] ; then \ echo -n "extracting test data (Sun, Microsoft)..." ; \ - $(TAR) -C Tests -xzf $(TARBALL) '*/suntest' '*/msxsdtest' '*/$(MSTESTDEF)' '*/$(SUNTESTDEF)' ; \ + $(TAR) -C Tests -xzf $(TARBALL) --wildcards '*/suntest' '*/msxsdtest' '*/$(MSTESTDEF)' '*/$(SUNTESTDEF)' ; \ if [ -d Tests/suntest ] ; then rm -r Tests/suntest ; fi ; \ if [ -d Tests/msxsdtest ] ; then rm -r Tests/msxsdtest ; fi ; \ mv Tests/xmlschema2002-01-16/* Tests ; \ @@ -546,7 +546,7 @@ tests: valgrind: -@(if [ -x $(PYTHON) ] ; then \ echo '## Running the regression tests under Valgrind' ; \ - $(MAKE) CHECKER='valgrind' MAKEFLAGS+=--silent pytests ; fi); + $(MAKE) CHECKER='valgrind -q' MAKEFLAGS+=--silent pytests ; fi); clean: rm -f $(PYSCRIPTS) test.log -- cgit v1.2.3 From d03a853bb0370d89552eceee59df1746da4a37f8 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Sun, 1 Mar 2009 10:53:23 +0100 Subject: Import upstream version 2.7.0 --- ChangeLog | 450 ++++- HTMLparser.c | 23 +- Makefile.am | 62 +- Makefile.in | 157 +- Makefile.tests | 10 +- NEWS | 74 +- README.tests | 7 +- SAX2.c | 12 +- aclocal.m4 | 38 +- catalog.c | 4 +- configure | 96 +- configure.in | 16 +- depcomp | 33 +- dict.c | 357 +++- doc/APIchunk1.html | 2 + doc/APIchunk10.html | 11 +- doc/APIchunk11.html | 8 + doc/APIchunk12.html | 8 +- doc/APIchunk13.html | 16 +- doc/APIchunk14.html | 5 + doc/APIchunk15.html | 11 +- doc/APIchunk17.html | 7 + doc/APIchunk18.html | 6 + doc/APIchunk19.html | 22 +- doc/APIchunk2.html | 3 - doc/APIchunk20.html | 3 + doc/APIchunk21.html | 7 + doc/APIchunk22.html | 64 +- doc/APIchunk23.html | 43 +- doc/APIchunk24.html | 11 + doc/APIchunk25.html | 3 +- doc/APIchunk26.html | 5 + doc/APIchunk27.html | 8 + doc/APIchunk28.html | 7 + doc/APIchunk3.html | 2 - doc/APIchunk4.html | 5 - doc/APIchunk5.html | 1 + doc/APIchunk6.html | 5 +- doc/APIchunk7.html | 20 +- doc/APIchunk8.html | 2 +- doc/APIchunk9.html | 9 +- doc/APIconstructors.html | 2 + doc/APIfiles.html | 20 + doc/APIfunctions.html | 5 + doc/APIsymbols.html | 20 + doc/FAQ.html | 26 +- doc/Makefile.in | 17 +- doc/apibuild.py | 44 +- doc/devhelp/Makefile.in | 4 +- doc/devhelp/libxml2-c14n.html | 4 +- doc/devhelp/libxml2-entities.html | 5 + doc/devhelp/libxml2-globals.html | 16 +- doc/devhelp/libxml2-parser.html | 5 +- doc/devhelp/libxml2-parserInternals.html | 14 +- doc/devhelp/libxml2-relaxng.html | 8 +- doc/devhelp/libxml2-schematron.html | 8 +- doc/devhelp/libxml2-tree.html | 28 +- doc/devhelp/libxml2-uri.html | 6 +- doc/devhelp/libxml2-valid.html | 4 +- doc/devhelp/libxml2-xmlerror.html | 4 + doc/devhelp/libxml2-xmlmemory.html | 5 + doc/devhelp/libxml2-xmlreader.html | 4 +- doc/devhelp/libxml2-xmlregexp.html | 4 +- doc/devhelp/libxml2-xmlschemas.html | 73 +- doc/devhelp/libxml2.devhelp | 20 + doc/examples/Makefile.am | 104 +- doc/examples/Makefile.in | 121 +- doc/examples/examples.xml | 464 ++--- doc/examples/reader3.c | 5 +- doc/html/libxml-c14n.html | 2 +- doc/html/libxml-entities.html | 5 +- doc/html/libxml-globals.html | 8 +- doc/html/libxml-parser.html | 3 + doc/html/libxml-parserInternals.html | 14 +- doc/html/libxml-relaxng.html | 4 +- doc/html/libxml-schematron.html | 4 +- doc/html/libxml-tree.html | 27 +- doc/html/libxml-uri.html | 6 +- doc/html/libxml-valid.html | 4 +- doc/html/libxml-xmlerror.html | 4 + doc/html/libxml-xmlmemory.html | 5 +- doc/html/libxml-xmlreader.html | 2 +- doc/html/libxml-xmlregexp.html | 2 +- doc/html/libxml-xmlschemas.html | 65 +- doc/libxml2-api.xml | 346 ++-- doc/libxml2.xsa | 54 +- doc/news.html | 26 +- doc/news.xsl | 2 +- doc/xml.html | 53 +- elfgcchack.h | 12 + encoding.c | 8 +- entities.c | 122 +- example/Makefile.in | 19 +- gentest.py | 5 +- include/Makefile.in | 17 +- include/libxml/Makefile.in | 17 +- include/libxml/c14n.h | 46 +- include/libxml/entities.h | 40 +- include/libxml/globals.h | 46 +- include/libxml/parser.h | 7 +- include/libxml/parserInternals.h | 2 +- include/libxml/relaxng.h | 19 +- include/libxml/schematron.h | 19 +- include/libxml/tree.h | 29 +- include/libxml/uri.h | 36 +- include/libxml/xmlerror.h | 4 + include/libxml/xmlmemory.h | 44 +- include/libxml/xmlreader.h | 188 +- include/libxml/xmlregexp.h | 42 +- include/libxml/xmlschemas.h | 48 +- include/libxml/xmlversion.h | 8 +- include/wsockcompat.h | 1 + libxml.spec.in | 2 +- libxml2.spec | 8 +- macos/src/XMLTestPrefix.h.orig | 1 - nanoftp.c | 2 +- nanohttp.c | 4 +- parser.c | 2753 +++++++++++++++---------- parserInternals.c | 4 +- pattern.c | 10 +- python/Makefile.in | 27 +- python/generator.py | 760 +++---- python/libxml.c | 5 + python/libxml_wrap.h | 4 + python/setup.py | 2 +- python/tests/Makefile.in | 4 +- python/types.c | 2 + relaxng.c | 4 + runsuite.c | 2 +- runtest.c | 165 +- runxmlconf.c | 603 ++++++ testapi.c | 235 ++- testchar.c | 615 ++++++ testdict.c | 444 +++++ testrecurse.c | 973 +++++++++ threads.c | 8 +- tree.c | 706 ++++--- uri.c | 3216 +++++++++++++++--------------- valid.c | 279 ++- win32/Makefile.msvc.orig | 462 ----- win32/libxml2.def.src | 3 + xinclude.c | 4 +- xmlIO.c | 21 +- xmllint.c | 17 + xmlmemory.c | 143 +- xmlreader.c | 16 +- xmlregexp.c | 67 +- xmlschemas.c | 2205 ++++++++++---------- xpath.c | 792 ++++---- xstc/Makefile.in | 4 +- 150 files changed, 11637 insertions(+), 7023 deletions(-) delete mode 100644 macos/src/XMLTestPrefix.h.orig create mode 100644 runxmlconf.c create mode 100644 testchar.c create mode 100644 testdict.c create mode 100644 testrecurse.c delete mode 100644 win32/Makefile.msvc.orig (limited to 'doc/devhelp/libxml2-uri.html') diff --git a/ChangeLog b/ChangeLog index 4da35e4..1f976e8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,338 @@ +Sat Aug 30 14:50:16 CEST 2008 Daniel Veillard + + * include/libxml/tree.h tree.c: make a new kind of buffer where + shrinking and adding in head can avoid reallocation or full + buffer memmoves + * encoding.c xmlIO.c: use the new kind of buffers for output + buffers + +Sat Aug 30 10:18:13 CEST 2008 Daniel Veillard + + * doc/* testapi.c: regenerated + +Fri Aug 29 21:53:12 CEST 2008 Daniel Veillard + + * doc/examples/reader3.c: patch from Robert Schwebel , allows to + compile the example if configured without output support fixes + #545582 + * Makefile.am: add testrecurse to the make check tests + * HTMLparser.c: if the parser got a encoding argument it should be + used over what the meta specifies, patch fixing #536346 + +Fri Aug 29 14:41:38 CEST 2008 Daniel Veillard + + * parser.c: a couple more fixes + * nanohttp.c nanoftp.c: patch from Andreas Färber to compile on Haiku + fixes #527880 + * doc/examples/*: regenerated + +Thu Aug 28 17:31:46 CEST 2008 Daniel Veillard + + * parser.c include/libxml/parser.h: completely different fix for + the recursion detection based on entity density, big cleanups + in the entity parsing code too + * result/*.sax*: the parser should not ask for used defined versions + of the predefined entities + * testrecurse.c: automatic test for entity recursion checks + * Makefile.am: added testrecurse + * test/recurse/lol* test/recurse/good*: a first set of tests for + the recursion + +Wed Aug 27 21:55:34 CEST 2008 Daniel Veillard + + * include/libxml/xmlerror.h parser.c: a bit of cleanup and + added checks based on the regression tests of the xmlconf suite + +Wed Aug 27 19:22:35 CEST 2008 Daniel Veillard + + * uri.c: bug in parsing RFC 3986 uris with port numbers + +Wed Aug 27 17:30:48 CEST 2008 Daniel Veillard + + * configure.in Makefile.am: add an --with-coverage configure option + and a 'make cov' target based on gcc profiling and the lcov + tool. Currently at 68.9% coverage out of 'make check' and + runsuite executions. + * xmlreader.c: remove warnings due to C++ comments + +Wed Aug 27 15:00:54 CEST 2008 Daniel Veillard + + * include/libxml/parserInternals.h parser.c: cleanup entity + pushing error handling based on a patch from Ashwin + +Wed Aug 27 13:41:26 CEST 2008 Daniel Veillard + + * threads.c: fix a small initialization problem raised by Ashwin + * testapi.c gentest.py: increase testing especially for document + with an internal subset, and entities + * tree.c: fix a deallocation issue when unlinking entities from + a document. + * valid.c: fix a missing entry point test not found previously. + * doc/*: regenerated the APIs, docs etc. + +Tue Aug 26 15:02:58 CEST 2008 Daniel Veillard + + * include/libxml/parser.h parser.c xmllint.c: strengthen some + of the internal parser limits, add an XML_PARSE_HUGE option + to bypass them all. More internal parser limits will still need + to be added. + +Tue Aug 26 09:42:08 CEST 2008 Daniel Veillard + + * Makefile.am: add the testchar to 'make check' + * xmlschemas.c: Volker Grabsch pointed out a typo + * xmlregexp.c: production [19] from XML Schemas regexps were a + mistake removed in version REC-xmlschema-2-20041028, Volker Grabsch + provided a patch to remove it + * test/schemas/regexp-char-ref_0.xml test/schemas/regexp-char-ref_0.xsd + test/schemas/regexp-char-ref_1.xsd result/schemas/regexp-char-ref_0_0 + result/schemas/regexp-char-ref_1_0: Volker Grabsch also provided + regession tests for this + +Tue Aug 26 09:25:39 CEST 2008 Daniel Veillard + + * include/libxml/parser.h xinclude.c xmllint.c: patch based on + Wieant Nielander contribution to add the option of not doing + URI base fixup in XInclude + +Mon Aug 25 16:52:53 CEST 2008 Daniel Veillard + + * xmlreader.c: applied patch from Aswin to fix tree skipping + * include/libxml/entities.h entities.c: fixed a comment and + added a new xmlNewEntity() entry point + * runtest.c: be less verbose + * tree.c: space and tabs cleanups + +Mon Aug 25 10:56:30 CEST 2008 Daniel Veillard + + * include/libxml/entities.h entities.c SAX2.c parser.c: rework + the patch to avoid some ABI issue with people allocating + entities structure directly + +Wed Aug 20 19:02:01 CEST 2008 Daniel Veillard + + * include/libxml/parser.h include/libxml/entities.h entities.c + parserInternals.c parser.c: fix for CVE-2008-3281 + +Sun Aug 10 17:06:13 CEST 2008 Rob Richards + + * dict.c: fix non GNUC builds. + +Fri Aug 8 14:13:06 CEST 2008 Daniel Veillard + + * makefile.am: adding a check-valgrind target + +Fri Aug 8 14:01:59 CEST 2008 Daniel Veillard + + * Makefile.am testdict.c: add the new test in 'make check' and + update it to check subdictionaries processing. + +Fri Aug 8 12:07:20 CEST 2008 Daniel Veillard + + * testdict.c: added a program to regression test the dictionary code + * dict.c: improve the lookup efficiency by caching the key. + +Thu Aug 7 18:30:55 CEST 2008 Daniel Veillard + + * dict.c: chased and found a couple of nasty issues + +Thu Aug 7 15:51:31 CEST 2008 Sven Herzberg + + Bug 546629 – runtests doesn't pass on my mac + Reviewed by William M. Brack. + + * runtest.c: use libpthread on Mac OS X as well + +Wed Aug 6 12:24:33 CEST 2008 Daniel Veillard + + * uri.c: allow [ and ] in fragment identifiers, 3986 disallow them + but it's widely used for XPointer, and would break DocBook + processing among others + +Wed Aug 6 11:32:21 CEST 2008 Daniel Veillard + + * dict.c: change the big key algorithm to work properly with QName + too, fix a bug with dict size and sub dictionaries + +Mon Aug 4 17:27:27 CEST 2008 Daniel Veillard + + * uri.c include/libxml/uri.h: rewrite the URI parser to update to + rfc3986 (from 2396) + * test/errors/webdav.xml result/errors/webdav.xml*: removed the + error test, 'DAV:' is a correct URI under 3986 + * Makefile.am: small cleanup in make check + +Thu Jul 31 21:49:45 CEST 2008 Daniel Veillard + + * runxmlconf.c: more progresses against the official regression tests + * runsuite.c: small cleanup for non-leak reports + * include/libxml/tree.h: parsing flags and other properties are + now added to the document node, this is generally useful and + allow to make Name and NmToken validations based on the parser + flags, more specifically the 5th edition of XML or not + * HTMLparser.c tree.c: small side effects for the previous changes + * parser.c SAX2.c valid.c: the bulk of teh changes are here, + the parser and validation behaviour can be affected, parsing + flags need to be copied, lot of changes. Also fixing various + validation problems in the regression tests. + +Thu Jul 31 10:15:53 CEST 2008 Daniel Veillard + + * runxmlconf.c: added a skipped list, insert rmt-ns10-035 + * Makefile.am: improve 'make check' + * include/libxml/xmlerror.h parser.c: clean up namespace errors + checking and reporting, errors when a document is labelled + as UTF-16 while it is parsed as UTF-8 and no encoding was given + explicitely. + * result/errors/webdav.xml.*: some warnings are no recategorized + as Namespace errors + +Wed Jul 30 14:55:54 CEST 2008 Daniel Veillard + + * include/libxml/xmlmemory.h xmlmemory.c: add xmlMemDisplayLast to + help debug incremental memory leaks, and some cleanups + * runxmlconf.c: use that new call and avoid ever touching the + system catalog in the regression tests + +Wed Jul 30 14:33:33 CEST 2008 Daniel Veillard + + * parser.c include/libxml/xmlerror.h: an XML-1.0 document can't load + an 1.1 entity + * runxmlconf.c: when using entities make sure we load them + +Tue Jul 29 18:43:07 CEST 2008 Daniel Veillard + + * parser.c: fix a bug not detecting cross entity comments probably + when comment parsing got optimized. + * Makefile.am: add make check + * runxmlconf.c: fix the log file name + +Tue Jul 29 18:09:26 CEST 2008 Daniel Veillard + + * runxmlconf.c Makefile.am: add a C program to run the W3C test + suite, work in progress + * xmllint.c: add a new option --oldxml10 to use the old parser + * parser.c: fix the XML_PARSE_OLD10 processing of the new option + and a bug in version parsing + +Tue Jul 29 11:12:40 CEST 2008 Daniel Veillard + + * xpath.c: space and tabs cleanup + +Tue Jul 29 10:59:36 CEST 2008 Daniel Veillard + + * include/libxml/parser.h include/libxml/xmlerror.h parser.c: + implement XML-1.0 5th edition, add parser option XML_PARSE_OLD10 + to stick to old behaviour + * testapi.c gentest.py: modified slightly and regenerated + * Makefile.am: add testchar + +Thu Jul 24 16:57:20 CEST 2008 Daniel Veillard + + * Makefile.am testchar.c Makefile.tests README.tests: add a + new regression test program for testing character ranges and + UTF8 encoding/decoding + +Wed Jul 23 15:32:39 CEST 2008 Daniel Veillard + + * libxml.spec.in: fix the build root + +Wed Jul 16 22:28:48 PDT 2008 William Brack + + * pattern.c: fix problem with xmlStreamPop when pattern includes + a "." element (see discussion on libxslt list) + +Mon Jul 7 15:49:59 CEST 2008 Daniel Veillard + + * SAX2.c: fix line number on text nodes, problem raised by Ralf Junker + +Sun Jun 29 17:04:28 CEST 2008 Rob Richards + * xmlschemas.c: fix crash with invalid whitespace facet + +Wed Jun 11 10:13:02 CEST 2008 Daniel Veillard + + * doc/xml.html doc/FAQ.html: add a section in the FAQ about + multithread and xmlCleanupParser + +Tue Jun 10 16:52:17 CEST 2008 Daniel Veillard + + * catalog.c: apply a couple of fixes based on a Coverity report + forwarded by Derrick Price. + * VxWorks/README VxWorks/Makefile VxWorks/build.sh: instructions + Makefile, and shell script to build on VxWorks 6.4+ provided by + Jim Wert. + +Tue Jun 3 18:07:13 CEST 2008 Daniel Veillard + + * python/generator.py python/setup.py: apply patch from Martin fixing + python whitespaces + * NEWS: following previous commit rebuilt now in UTF-8 + +Mon Jun 2 17:39:42 CEST 2008 Daniel Veillard + + * ChangeLog: patch from Hans de Goede to switch the file to UTF-8 + * doc/news.xsl: switch to generate the NEWS file in UTF-8 instead of + ISO-8859-1 + +Mon May 12 15:12:44 CEST 2008 Daniel Veillard + + * xmlregexp.c: avoid a regexp crash, should fix #523738 + +Mon May 12 14:56:06 CEST 2008 Daniel Veillard + + * xmlschemas.c runtest.c testapi.c include/libxml/xmlreader.h + python/types.c python/libxml_wrap.h python/libxml.c: fx compilation + when configured without the reader should fix #513110 + * doc/*: regenerated + +Sat May 3 14:33:29 CEST 2008 Rob Richards + + * dict.c: check for stdint.h and define types when using MSVC + +Mon Apr 28 20:06:12 CEST 2008 Daniel Veillard + + * parserInternals.c: applied patch from Ashwin to avoid a potential + double-free + +Thu Apr 24 13:56:53 CEST 2008 Daniel Veillard + + * uri.c: applied patch from Ashwin fixing a number of realloc problems + * HTMLparser.c: improve handling for misplaced html/head/body + +Tue Apr 22 10:27:17 CEST 2008 Daniel Veillard + + * dict.c: improvement on the hashing of the dictionnary, with visible + speed up as the number of strings in the hash increases, work from + Stefan Behnel + +Fri Apr 11 14:44:00 CEST 2008 Daniel Veillard + + * include/libxml/xmlschemas.h xmlschemas.c: added new function + xmlSchemaValidCtxtGetParserCtxt based on Holger Kaelberer patch + * doc/apibuild.py doc/*: regenerated the doc, chased why the new + function didn't got any documentation, added more checking in the + generator + * include/libxml/relaxng.h include/libxml/schematron.h + include/libxml/xmlschemas.h include/libxml/c14n.h + include/libxml/xmlregexp.h include/libxml/globals.h + include/libxml/xmlreader.h threads.c xmlschemas.c: various changes + and cleanups following the new reports + + +Thu Apr 10 10:07:00 CEST 2008 Daniel Veillard + + * Makefile.am: extend the cleanup rule + * xmlschemas.c: space cleanup + +Wed Apr 9 19:43:25 CEST 2008 Rob Richards + + * include/wsockcompat.h: support older win32 platforms when building + with newer versions of VS + +Tue Apr 8 16:56:07 CEST 2008 Daniel Veillard + + * configure.in NEWS doc/*: preparing release of 2.6.32 + Tue Apr 8 10:19:01 CEST 2008 Daniel Veillard * tree.c: fix a bug introduced when fixing #438208 and reported by @@ -481,7 +816,7 @@ Wed Jun 13 13:33:38 PDT 2007 William Brack Tue Jun 12 18:17:28 CEST 2007 Daniel Veillard * doc/* configure.in NEWS: release of libxml2 2.6.29 - * valid.c: patch from Dagfinn I. Mannsåker for idness of name + * valid.c: patch from Dagfinn I. MannsÃ¥ker for idness of name in HTML, c.f. bug #305885. Tue Jun 12 17:14:08 CEST 2007 Daniel Veillard @@ -571,7 +906,7 @@ Wed May 30 22:05:08 PDT 2007 William Brack Mon May 28 16:14:50 CEST 2007 Daniel Veillard - * uri.c: fix bug reported by François Delyon + * uri.c: fix bug reported by François Delyon Tue May 22 08:59:48 PDT 2007 William Brack @@ -602,7 +937,7 @@ Fri May 11 22:45:18 HKT 2007 William Brack Thu May 10 01:52:42 CEST 2007 Daniel Veillard * list.c: applied patch to fix xmlListAppend() from - Georges-André SILBER + Georges-André SILBER * valid.c: also fix the place wher it was called. Wed May 2 18:47:33 CEST 2007 Daniel Veillard @@ -700,7 +1035,7 @@ Wed Mar 21 14:23:08 HKT 2007 William Brack Tue Mar 20 09:58:13 CET 2007 Daniel Veillard - * nanoftp.c: applied patch from Björn Wiberg to try to fix again + * nanoftp.c: applied patch from Björn Wiberg to try to fix again the silly __ss_familly problem on various AIXes, should fix #420184 Wed Mar 14 20:30:38 HKT 2007 William Brack @@ -772,7 +1107,7 @@ Wed Jan 31 10:25:38 PST 2007 William Brack Fri Jan 26 00:05:18 PST 2007 William Brack - * implemented patch from Stéphane Bidoul for uri.c (bug #389767) + * implemented patch from Stéphane Bidoul for uri.c (bug #389767) Thu Jan 25 11:15:08 PST 2007 William Brack @@ -2481,7 +2816,7 @@ Fri Sep 9 12:56:19 CEST 2005 Daniel Veillard Thu Sep 8 23:39:41 CEST 2005 Daniel Veillard - * xmllint.c: patch from Stéphane Bidoul to compile without schematron + * xmllint.c: patch from Stéphane Bidoul to compile without schematron Wed Sep 7 00:16:27 CEST 2005 Daniel Veillard @@ -4314,7 +4649,7 @@ Sun Jan 30 19:27:23 CET 2005 Daniel Veillard * pattern.c include/libxml/pattern.h xmllint.c: added a streaming pattern detector for a subset of XPath, should help Kasimier for identity constraints - * python/generator.py: applied Stephane Bidoul patch to find + * python/generator.py: applied Stéphane Bidoul patch to find paths without breaking. Fri Jan 28 18:53:40 CET 2005 Daniel Veillard @@ -5903,7 +6238,7 @@ Thu Jul 1 14:53:36 CEST 2004 Daniel Veillard * python/libxml.c python/generator.py python/libxml.py python/libxml2-python-api.xml python/libxml2class.txt: - applied patch from Stéphane Bidoul to fix some Python bindings + applied patch from Stéphane Bidoul to fix some Python bindings initialization, then had to change the parserCleanup() to handle memory released there. * xmlmemory.c: added more debugging comments. @@ -6294,7 +6629,7 @@ Tue May 11 23:04:47 HKT 2004 William Brack Tue May 11 09:06:53 CEST 2004 Daniel Veillard * python/tests/tstLastError.py: better portability fix for f(*args), - use apply(f, args) as Stephane Bidoul suggested + use apply(f, args) as Stéphane Bidoul suggested Mon May 10 15:49:22 HKT 2004 William Brack @@ -7159,7 +7494,7 @@ Wed Jan 21 10:59:55 CET 2004 Daniel Veillard Thu Jan 15 00:48:46 CET 2004 Daniel Veillard * python/generator.py python/tests/tstLastError.py: applied - patch from Stephane Bidoul to add enums to the Python bindings. + patch from Stéphane Bidoul to add enums to the Python bindings. Tue Jan 13 21:50:05 CET 2004 Daniel Veillard @@ -7202,7 +7537,7 @@ Tue Jan 6 23:51:46 CET 2004 Daniel Veillard * python/libxml2-python-api.xml python/libxml_wrap.h python/types.c python/tests/Makefile.am python/tests/tstLastError.py: applied - patch from Stephane Bidoul for structured error handling from + patch from Stéphane Bidoul for structured error handling from python, and the associated test Tue Jan 6 23:18:11 HKT 2004 William Brack @@ -7285,7 +7620,7 @@ Sun Jan 4 08:57:51 HKT 2004 William Brack Fri Jan 2 21:22:18 CET 2004 Daniel Veillard - * error.c: applied patch from Stéphane Bidoul for structured error + * error.c: applied patch from Stéphane Bidoul for structured error reporting. Fri Jan 2 21:03:17 CET 2004 Daniel Veillard @@ -7314,7 +7649,7 @@ Wed Dec 31 22:02:37 HKT 2003 William Brack Wed Dec 31 15:55:55 HKT 2003 William Brack * python/generator.py, python/libxml2class.txt: fixed problem - pointed out by Stéphane Bidoul on the list. + pointed out by Stéphane Bidoul on the list. * xinclude.c, xpointer.c, xpath.c, include/libxml/xpointer.h: completed modifications required to fix Bug 129967 (at last!). Now wait to see how long before further trouble... @@ -8204,17 +8539,17 @@ Wed Oct 22 14:33:05 CEST 2003 Daniel Veillard Wed Oct 22 10:50:31 CEST 2003 Daniel Veillard - * chvalid.c genChRanges.py: Stephane Bidoul pointed out another + * chvalid.c genChRanges.py: Stéphane Bidoul pointed out another small glitch missing a const Wed Oct 22 10:43:21 CEST 2003 Daniel Veillard - * chvalid.c genChRanges.py: Stephane Bidoul pointed out that + * chvalid.c genChRanges.py: Stéphane Bidoul pointed out that it doesn't define IN_LIBXML Tue Oct 21 21:14:55 CEST 2003 Daniel Veillard - * win32/Makefile.mingw: typo pointed out by Stephane Bidoul + * win32/Makefile.mingw: typo pointed out by Stéphane Bidoul Tue Oct 21 11:26:36 CEST 2003 Daniel Veillard @@ -8574,7 +8909,7 @@ Tue Oct 7 13:30:39 CEST 2003 Daniel Veillard Mon Oct 6 10:46:35 CEST 2003 Daniel Veillard * win32/Makefile.bcb win32/Makefile.mingw win32/Makefile.msvc - win32/configure.js: applied patch from Stéphane Bidoul to + win32/configure.js: applied patch from Stéphane Bidoul to fix the compilation of 2.6.0 code on Win32 Mon Oct 6 10:16:30 CEST 2003 Daniel Veillard @@ -8820,7 +9155,7 @@ Thu Sep 25 14:16:51 CEST 2003 Daniel Veillard Wed Sep 24 23:42:08 CEST 2003 Daniel Veillard - * win32/configure.js: patch from Stephane Bidoul for configuring + * win32/configure.js: patch from Stéphane Bidoul for configuring the beta2 version #123104 Wed Sep 24 23:17:59 CEST 2003 Daniel Veillard @@ -9117,7 +9452,7 @@ Sat Sep 6 10:55:01 PTD 2003 William Brack Fri Sep 5 10:33:42 CEST 2003 Daniel Veillard - * include/libxml/globals.h: patch from Stéphane Bidoul to export + * include/libxml/globals.h: patch from Stéphane Bidoul to export globals entry points to the python bindings Wed Sep 3 15:24:41 CEST 2003 Daniel Veillard @@ -9842,7 +10177,7 @@ Tue May 20 14:21:23 CEST 2003 Daniel Veillard Sat May 17 12:53:11 CEST 2003 Igor Zlatkovic - * threads.c: applied the patch from Stéphane Bidoul for getting + * threads.c: applied the patch from Stéphane Bidoul for getting rid of extra threads in a dynamic library. * win32/configure.js: threads default to 'native' now. @@ -9854,7 +10189,7 @@ Fri May 16 13:17:52 EDT 2003 Daniel Veillard Thu May 15 18:06:18 EDT 2003 Daniel Veillard * build_glob.py global.data globals.c parser.c - include/libxml/globals.h: patch from Stéphane Bidoul for setting + include/libxml/globals.h: patch from Stéphane Bidoul for setting up threads global defaults. * doc/libxml2-api.xml: this extends the API with new functions * python/tests/Makefile.am python/tests/reader2.py @@ -9911,7 +10246,7 @@ Sun May 11 16:13:20 EDT 2003 Daniel Veillard Sat May 10 16:01:21 EDT 2003 Daniel Veillard - * relaxng.c: Stéphane Bidoul found an off by one addressing + * relaxng.c: Stéphane Bidoul found an off by one addressing error on the error handling. Fri May 9 19:08:20 EDT 2003 Daniel Veillard @@ -9970,7 +10305,7 @@ Mon Apr 28 02:19:00 CEST 2003 Igor Zlatkovic Mon Apr 28 00:12:11 CEST 2003 Daniel Veillard * win32/configure.js python/setup.py.in: applied patch - from Stéphane Bidoul for the Python bindings on the new + from Stéphane Bidoul for the Python bindings on the new release. Sun Apr 27 17:56:21 CEST 2003 Igor Zlatkovic @@ -10001,7 +10336,7 @@ Sat Apr 26 14:00:58 CEST 2003 Daniel Veillard * python/generator.py: fixed a problem in the generator where the way functions are remapped as methods on classes was not symetric and dependant on python internal hash order, - as reported by Stéphane Bidoul + as reported by Stéphane Bidoul Fri Apr 25 21:52:33 MDT 2003 John Fleck @@ -10806,7 +11141,7 @@ Sun Feb 16 16:40:52 CET 2003 Daniel Veillard * relaxng.c: more bug-hunting * testRelax.c include/libxml/relaxng.h: added --tree to dump the intermediate rng tree - * python/generator.py: patch from Stephane Bidoul to fix the generator + * python/generator.py: patch from Stéphane Bidoul to fix the generator on python < 2.2 Fri Feb 14 17:49:26 CET 2003 Daniel Veillard @@ -10942,7 +11277,7 @@ Wed Feb 5 12:00:36 CET 2003 Daniel Veillard Wed Feb 5 11:43:58 CET 2003 Daniel Veillard * SAX.c: added the redefinition of namespaced attribute - check that was missing as Fabrice Desré pointed out. + check that was missing as Fabrice Desré pointed out. Wed Feb 5 11:09:29 CET 2003 Daniel Veillard @@ -11165,7 +11500,7 @@ Thu Jan 23 17:41:37 CET 2003 Daniel Veillard Tue Jan 21 13:19:35 CET 2003 Daniel Veillard * xmlreader.c doc/apibuild.py: applied a new patch from - Stéphane Bidoul for cleanups + Stéphane Bidoul for cleanups * doc/libxml2-api.xml: rebuilt the API description with new entry points @@ -11173,7 +11508,7 @@ Mon Jan 20 23:25:00 CET 2003 Daniel Veillard * xmlreader.c python/drv_libxml2.py python/generator.py python/libxml.c python/libxml.py python/libxml_wrap.h - python/types.c: patch from Stéphane Bidoul for better per + python/types.c: patch from Stéphane Bidoul for better per context error message APIs * python/tests/ctxterror.py python/tests/readererr.py: update of the tests @@ -11187,7 +11522,7 @@ Fri Jan 17 00:31:30 CET 2003 Daniel Veillard * xmlreader.c include/libxml/xmlreader.h python/generator.py python/libxml.c python/libxml.py win32/libxml2.def.src: applied - a patch from Stéphane Bidoul to allow per XMLtextReader error + a patch from Stéphane Bidoul to allow per XMLtextReader error and warning handling * python/tests/Makefile.am python/tests/readererr.py: adding the specific regression test @@ -11199,7 +11534,7 @@ Tue Jan 14 17:00:08 CET 2003 Daniel Veillard Tue Jan 14 15:39:14 CET 2003 Daniel Veillard - * python/libxml.c: cleanup patch from Stéphane Bidoul + * python/libxml.c: cleanup patch from Stéphane Bidoul Tue Jan 14 14:41:18 CET 2003 Daniel Veillard @@ -11209,7 +11544,7 @@ Tue Jan 14 12:40:29 CET 2003 Daniel Veillard * python/generator.py python/libxml.c python/libxml.py python/libxml_wrap.h python/types.c: applied and fixed a patch - from Stéphane Bidoul to provide per parser error handlers at the + from Stéphane Bidoul to provide per parser error handlers at the Python level. * python/tests/Makefile.am python/tests/ctxterror.py: added a regression test for it. @@ -11261,7 +11596,7 @@ Fri Jan 10 00:16:49 CET 2003 Daniel Veillard Thu Jan 9 22:35:31 CET 2003 Daniel Veillard - * python/drv_libxml2.py: update from Stéphane Bidoul: python 2.1 + * python/drv_libxml2.py: update from Stéphane Bidoul: python 2.1 support and improved error handler registration Thu Jan 9 14:16:38 CET 2003 Daniel Veillard @@ -11351,7 +11686,7 @@ Sat Jan 4 17:33:17 CET 2003 Daniel Veillard Sat Jan 4 13:46:14 CET 2003 Daniel Veillard - * python/setup.py.in: patch from Stéphane Bidoul to include + * python/setup.py.in: patch from Stéphane Bidoul to include drv_libxml2.py in setup.py Sat Jan 4 01:43:06 CET 2003 Daniel Veillard @@ -11378,13 +11713,13 @@ Fri Jan 3 02:17:18 CET 2003 Daniel Veillard Thu Jan 2 15:15:26 CET 2003 Daniel Veillard * xmlreader.c python/tests/reader.py: another couple of problem - related to IsEmptyElement reported by Stéphane Bidoul needed + related to IsEmptyElement reported by Stéphane Bidoul needed some fixes. Thu Jan 2 13:57:07 CET 2003 Daniel Veillard * libxml.spec.in python/Makefile.am python/drv_libxml2.py: - integrated drv_libxml2.py Python xml.sax driver from Stéphane Bidoul + integrated drv_libxml2.py Python xml.sax driver from Stéphane Bidoul based on the python XmlTextReader interface. Wed Jan 1 22:05:40 CET 2003 Daniel Veillard @@ -11407,38 +11742,38 @@ Wed Jan 1 20:12:07 CET 2003 Daniel Veillard Wed Jan 1 16:09:57 CET 2003 Daniel Veillard * xmlreader.c python/tests/reader.py: fixed another couple of - xmlreader bugs reported by Stéphane Bidoul and added tests. + xmlreader bugs reported by Stéphane Bidoul and added tests. Wed Jan 1 15:42:54 CET 2003 Daniel Veillard * xmlreader.c python/tests/reader2.py: fixed another validity - checking in external parsed entities raised by Stéphane Bidoul + checking in external parsed entities raised by Stéphane Bidoul and added a specific regression test. * python/tests/reader3.py: cleanup Tue Dec 31 15:44:02 CET 2002 Daniel Veillard * xmlreader.c python/tests/reader2.py: fixed a problem with - validation within entities pointed by Stéphane Bidoul, augmented + validation within entities pointed by Stéphane Bidoul, augmented the tests to catch those. Tue Dec 31 12:15:37 CET 2002 Daniel Veillard * python/generator.py: modified the generator to allow keeping class references when creating new classes, needed to fix a bug - pointed by Stéphane Bidoul where the input buffer of the + pointed by Stéphane Bidoul where the input buffer of the xmlTextReader instance gets destroyed if the python wrapper for the input is not referenced anymore. Mon Dec 30 19:39:36 CET 2002 Daniel Veillard * xmlreader.c python/tests/reader.py: fixed another pair of problem - pointed by Stéphane Bidoul: depth start at 0 and a parse problem. + pointed by Stéphane Bidoul: depth start at 0 and a parse problem. Mon Dec 30 13:36:50 CET 2002 Daniel Veillard * xmlreader.c python/tests/reader.py: fixed another problem - pointed by Stéphane Bidoul + pointed by Stéphane Bidoul Mon Dec 30 12:39:55 CET 2002 Daniel Veillard @@ -11460,7 +11795,7 @@ Mon Dec 30 00:59:07 CET 2002 Daniel Veillard Sun Dec 29 12:13:18 CET 2002 Daniel Veillard * xmlreader.c python/tests/reader.py: fixed a bug pointed out - by Stéphane Bidoul and integrated it into the tests + by Stéphane Bidoul and integrated it into the tests Sat Dec 28 23:49:12 CET 2002 Daniel Veillard @@ -11522,7 +11857,7 @@ Mon Dec 23 16:54:22 CET 2002 Daniel Veillard Mon Dec 23 15:42:24 CET 2002 Daniel Veillard - * python/libxml.c python/setup.py.in: patch from Stéphane Bidoul + * python/libxml.c python/setup.py.in: patch from Stéphane Bidoul for Python 2.1 Sun Dec 22 11:24:06 CET 2002 Daniel Veillard @@ -11724,7 +12059,7 @@ Wed Nov 27 12:40:16 CET 2002 Daniel Veillard Wed Nov 27 09:00:00 CET 2002 Daniel Veillard - * python/setup.py.in: another patch from Stéphane Bidoul for + * python/setup.py.in: another patch from Stéphane Bidoul for Python bindings on Windows * doc/parsedecl.py: small cleanup @@ -11749,7 +12084,7 @@ Sat Nov 23 17:22:22 CET 2002 Daniel Veillard Sat Nov 23 12:21:24 CET 2002 Daniel Veillard * python/generator.py python/libxml.c python/setup.py.in: trying - to fix the Python bindings build on Windows (Stéphane Bidoul) + to fix the Python bindings build on Windows (Stéphane Bidoul) Fri Nov 22 22:41:34 CEST 2002 Igor Zlatkovic @@ -13139,7 +13474,7 @@ Mon Apr 1 10:02:57 CEST 2002 Daniel Veillard Fri Mar 29 23:41:53 CET 2002 Daniel Veillard - * libxml.m4: Frédéric Crozat gave a patch related to the change + * libxml.m4: Frédéric Crozat gave a patch related to the change of Include paths breaking the libxml.m4 Fri Mar 29 18:25:54 CET 2002 Daniel Veillard @@ -15981,7 +16316,7 @@ Fri May 11 19:37:30 CEST 2001 Daniel Veillard Fri May 11 16:07:13 CEST 2001 Daniel Veillard - * HTMLparser.c: Patch from Jonas Borgström + * HTMLparser.c: Patch from Jonas Borgström (htmlGetEndPriority): New function, returns the priority of a certain element. (htmlAutoCloseOnClose): Only close inline elements if they @@ -16049,7 +16384,7 @@ Thu May 3 12:47:46 CEST 2001 Daniel Veillard Thu May 3 10:25:19 CEST 2001 Daniel Veillard - * HTMLparser.c: trying to fix the problem reported by Jonas Borgström + * HTMLparser.c: trying to fix the problem reported by Jonas Borgström * results/HTML/ : a few changes in the output of the HTML tests as a result. * configure.in: tying to fix -liconv where needed @@ -16065,7 +16400,7 @@ Wed May 2 18:39:39 CEST 2001 Daniel Veillard Wed May 2 14:39:57 CEST 2001 Daniel Veillard - * DOCBparser.c: patche from László Kovács, fixed entities refs + * DOCBparser.c: patche from László Kovács, fixed entities refs in attributes handling Wed May 2 12:56:04 CEST 2001 Daniel Veillard @@ -16147,7 +16482,7 @@ Thu Apr 26 16:35:53 CEST 2001 Daniel Veillard Thu Apr 26 12:57:58 CEST 2001 Daniel Veillard - * DOCBparser.c: patche from László Kovács + * DOCBparser.c: patche from László Kovács Thu Apr 26 11:31:54 CEST 2001 Daniel Veillard @@ -16155,7 +16490,7 @@ Thu Apr 26 11:31:54 CEST 2001 Daniel Veillard Thu Apr 26 11:14:56 CEST 2001 Daniel Veillard - * error.c: Jean François Lecomte provided a complete description + * error.c: Jean François Lecomte provided a complete description and a fix to bug #53537 Thu Apr 26 09:42:58 CEST 2001 Daniel Veillard @@ -16169,7 +16504,7 @@ Wed Apr 25 21:05:31 CEST 2001 Daniel Veillard Wed Apr 25 17:52:27 CEST 2001 Daniel Veillard - * DOCBparser.c include/Makefile.am: two patches from László Kovács + * DOCBparser.c include/Makefile.am: two patches from László Kovács Wed Apr 25 14:56:26 CEST 2001 Daniel Veillard @@ -16211,7 +16546,7 @@ Tue Apr 24 14:10:38 CEST 2001 Daniel Veillard Tue Apr 24 13:21:36 CEST 2001 Daniel Veillard - * HTMLparser.c: Jonas Borgström patch, the
        , and elements + * HTMLparser.c: Jonas Borgström patch, the , and elements now means the end of any open ,,,,,. Mon Apr 23 15:40:04 CEST 2001 Daniel Veillard @@ -17013,7 +17348,7 @@ Wed Jan 3 21:51:13 CET 2001 Daniel Veillard Wed Jan 3 18:56:00 CET 2001 Daniel Veillard * HTMLparser.c: htmlCheckParagraph to check htmlOmittedDefaultValue, - reported by Jonas Borgström + reported by Jonas Borgström * nanohttp.c: Applied Bjorn Reese' IPV6 first patch Wed Jan 3 16:19:39 CET 2001 Daniel Veillard @@ -18636,7 +18971,7 @@ Sun Jul 11 18:16:34 CEST 1999 Daniel Veillard * example/Makefile.am, configure.in: added the makefile for the gjobread example -Sat Jul 10 14:19:11 CEST 1999 Tomasz K³oczko +Sat Jul 10 14:19:11 CEST 1999 Tomasz KÅ‚oczko * doc/Makefile.am: - fix which allow "make install DESTDIR=". @@ -18739,7 +19074,7 @@ Wed Mar 24 21:37:02 CET 1999 Daniel Veillard * parser.c, parserInternals.h: moved the chars macro definitions to parserInternals.h - * parser.c, error.c: applied patches from "Knut Åkesson" + * parser.c, error.c: applied patches from "Knut Ã…kesson" for clean compilation under MSVC 6 :-o Tue Mar 23 11:10:15 CET 1999 Daniel Veillard @@ -19046,3 +19381,6 @@ Fri Jul 24 16:47:14 1998 Daniel Veillard * migrated to automake * prefixed the filenames by xml_ to avoid filename clashes +# +# vim: set enc=utf-8 +# diff --git a/HTMLparser.c b/HTMLparser.c index 92503a1..57e64df 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -2143,6 +2143,7 @@ htmlNewDocNoDtD(const xmlChar *URI, const xmlChar *ExternalID) { cur->refs = NULL; cur->_private = NULL; cur->charset = XML_CHAR_ENCODING_UTF8; + cur->properties = XML_DOC_HTML | XML_DOC_USERBUILT; if ((ExternalID != NULL) || (URI != NULL)) xmlCreateIntSubset(cur, BAD_CAST "html", ExternalID, URI); @@ -3482,6 +3483,7 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) { "htmlParseStartTag: misplaced tag\n", name, NULL); discardtag = 1; + ctxt->depth++; } if ((ctxt->nameNr != 1) && (xmlStrEqual(name, BAD_CAST"head"))) { @@ -3489,6 +3491,7 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) { "htmlParseStartTag: misplaced tag\n", name, NULL); discardtag = 1; + ctxt->depth++; } if (xmlStrEqual(name, BAD_CAST"body")) { int indx; @@ -3498,6 +3501,7 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) { "htmlParseStartTag: misplaced tag\n", name, NULL); discardtag = 1; + ctxt->depth++; } } } @@ -3648,7 +3652,6 @@ htmlParseEndTag(htmlParserCtxtPtr ctxt) name = htmlParseHTMLName(ctxt); if (name == NULL) return (0); - /* * We should definitely be at the ending "S? '>'" part */ @@ -3668,6 +3671,18 @@ htmlParseEndTag(htmlParserCtxtPtr ctxt) } else NEXT; + /* + * if we ignored misplaced tags in htmlParseStartTag don't pop them + * out now. + */ + if ((ctxt->depth > 0) && + (xmlStrEqual(name, BAD_CAST "html") || + xmlStrEqual(name, BAD_CAST "body") || + xmlStrEqual(name, BAD_CAST "head"))) { + ctxt->depth--; + return (0); + } + /* * If the name read is not one of the element in the parsing stack * then return, it's just an error. @@ -5958,8 +5973,12 @@ htmlDoRead(htmlParserCtxtPtr ctxt, const char *URL, const char *encoding, xmlCharEncodingHandlerPtr hdlr; hdlr = xmlFindCharEncodingHandler(encoding); - if (hdlr != NULL) + if (hdlr != NULL) { xmlSwitchToEncoding(ctxt, hdlr); + if (ctxt->input->encoding != NULL) + xmlFree((xmlChar *) ctxt->input->encoding); + ctxt->input->encoding = xmlStrdup((xmlChar *)encoding); + } } if ((URL != NULL) && (ctxt->input != NULL) && (ctxt->input->filename == NULL)) diff --git a/Makefile.am b/Makefile.am index 5061f46..de57c46 100644 --- a/Makefile.am +++ b/Makefile.am @@ -8,7 +8,8 @@ INCLUDES = -I$(top_builddir)/include -I@srcdir@/include @THREAD_CFLAGS@ @Z_CFLAG noinst_PROGRAMS=testSchemas testRelax testSAX testHTML testXPath testURI \ testThreads testC14N testAutomata testRegexp \ - testReader testapi testModule runtest runsuite + testReader testapi testModule runtest runsuite testchar \ + testdict runxmlconf testrecurse bin_PROGRAMS = xmllint xmlcatalog @@ -55,6 +56,21 @@ runtest_LDFLAGS = runtest_DEPENDENCIES = $(DEPS) runtest_LDADD= @BASE_THREAD_LIBS@ @RDL_LIBS@ $(LDADDS) +testrecurse_SOURCES=testrecurse.c +testrecurse_LDFLAGS = +testrecurse_DEPENDENCIES = $(DEPS) +testrecurse_LDADD= @BASE_THREAD_LIBS@ @RDL_LIBS@ $(LDADDS) + +testchar_SOURCES=testchar.c +testchar_LDFLAGS = +testchar_DEPENDENCIES = $(DEPS) +testchar_LDADD= @RDL_LIBS@ $(LDADDS) + +testdict_SOURCES=testdict.c +testdict_LDFLAGS = +testdict_DEPENDENCIES = $(DEPS) +testdict_LDADD= @RDL_LIBS@ $(LDADDS) + runsuite_SOURCES=runsuite.c runsuite_LDFLAGS = runsuite_DEPENDENCIES = $(DEPS) @@ -150,12 +166,25 @@ testapi_LDFLAGS = testapi_DEPENDENCIES = $(DEPS) testapi_LDADD= $(LDADDS) +runxmlconf_SOURCES=runxmlconf.c +runxmlconf_LDFLAGS = +runxmlconf_DEPENDENCIES = $(DEPS) +runxmlconf_LDADD= $(LDADDS) + #testOOM_SOURCES=testOOM.c testOOMlib.h testOOMlib.c #testOOM_LDFLAGS = #testOOM_DEPENDENCIES = $(DEPS) #testOOM_LDADD= $(LDADDS) -check-local: all tests +runtests: + $(CHECKER) ./runtest$(EXEEXT) && $(CHECKER) ./testrecurse$(EXEEXT) &&$(CHECKER) ./testapi$(EXEEXT) && $(CHECKER) ./testchar$(EXEEXT)&& $(CHECKER) ./testdict$(EXEEXT) && $(CHECKER) ./runxmlconf$(EXEEXT) + +check: all runtests + +check-valgrind: all + @echo '## Running the regression tests under Valgrind' + @echo '## Go get a cup of coffee it is gonna take a while ...' + $(MAKE) CHECKER='valgrind -q' check testall : tests SVGtests SAXtests @@ -1105,6 +1134,8 @@ ModuleTests: testModule$(EXEEXT) testdso.la cleanup: -@(find . -name .\#\* -exec rm {} \;) + -@(find . -name \*.gcda -o *.gcno -exec rm {} \;) + -@(find . -name \*.orig -o -name \*.rej -o -name \*.old -exec rm {} \;) dist-hook: cleanup libxml2.spec -cp libxml2.spec $(distdir) @@ -1139,7 +1170,7 @@ xml2Conf.sh: xml2Conf.sh.in Makefile < $(srcdir)/xml2Conf.sh.in > xml2Conf.tmp \ && mv xml2Conf.tmp xml2Conf.sh -CLEANFILES=xml2Conf.sh +CLEANFILES=xml2Conf.sh *.gcda *.gcno confexecdir=$(libdir) confexec_DATA = xml2Conf.sh @@ -1191,3 +1222,28 @@ tst: tst.c sparse: clean $(MAKE) CC=cgcc + +# +# Coverage support, largely borrowed from libvirt +# Both binaries comes from the lcov package in Fedora +# +LCOV = /usr/bin/lcov +GENHTML = /usr/bin/genhtml + +cov: clean-cov + if [ "`echo $(LDFLAGS) | grep coverage`" = "" ] ; then \ + echo not configured with coverage; exit 1 ; fi + if [ ! -x $(LCOV) -o ! -x $(GENHTML) ] ; then \ + echo Need $(LCOV) and $(GENHTML) excecutables; exit 1 ; fi + -@($(MAKE) check) + -@(./runsuite$(EXEEXT)) + mkdir $(top_builddir)/coverage + $(LCOV) -c -o $(top_builddir)/coverage/libxml2.info.tmp -d $(top_srcdir) + $(LCOV) -r $(top_builddir)/coverage/libxml2.info.tmp -o $(top_builddir)/coverage/libxml2.info *usr* + rm $(top_builddir)/coverage/libxml2.info.tmp + $(GENHTML) -s -t "libxml2" -o $(top_builddir)/coverage --legend $(top_builddir)/coverage/libxml2.info + echo "Coverage report is in $(top_builddir)/coverage/index.html" + +clean-cov: + rm -rf $(top_builddir)/coverage + diff --git a/Makefile.in b/Makefile.in index 5fb6611..d986d7b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -40,7 +40,8 @@ noinst_PROGRAMS = testSchemas$(EXEEXT) testRelax$(EXEEXT) \ testURI$(EXEEXT) testThreads$(EXEEXT) testC14N$(EXEEXT) \ testAutomata$(EXEEXT) testRegexp$(EXEEXT) testReader$(EXEEXT) \ testapi$(EXEEXT) testModule$(EXEEXT) runtest$(EXEEXT) \ - runsuite$(EXEEXT) + runsuite$(EXEEXT) testchar$(EXEEXT) testdict$(EXEEXT) \ + runxmlconf$(EXEEXT) testrecurse$(EXEEXT) bin_PROGRAMS = xmllint$(EXEEXT) xmlcatalog$(EXEEXT) subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ @@ -138,6 +139,11 @@ runtest_OBJECTS = $(am_runtest_OBJECTS) runtest_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(runtest_LDFLAGS) \ $(LDFLAGS) -o $@ +am_runxmlconf_OBJECTS = runxmlconf.$(OBJEXT) +runxmlconf_OBJECTS = $(am_runxmlconf_OBJECTS) +runxmlconf_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(runxmlconf_LDFLAGS) $(LDFLAGS) -o $@ am_testAutomata_OBJECTS = testAutomata.$(OBJEXT) testAutomata_OBJECTS = $(am_testAutomata_OBJECTS) testAutomata_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ @@ -203,6 +209,21 @@ testapi_OBJECTS = $(am_testapi_OBJECTS) testapi_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(testapi_LDFLAGS) \ $(LDFLAGS) -o $@ +am_testchar_OBJECTS = testchar.$(OBJEXT) +testchar_OBJECTS = $(am_testchar_OBJECTS) +testchar_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(testchar_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_testdict_OBJECTS = testdict.$(OBJEXT) +testdict_OBJECTS = $(am_testdict_OBJECTS) +testdict_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(testdict_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_testrecurse_OBJECTS = testrecurse.$(OBJEXT) +testrecurse_OBJECTS = $(am_testrecurse_OBJECTS) +testrecurse_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(testrecurse_LDFLAGS) $(LDFLAGS) -o $@ am_xmlcatalog_OBJECTS = xmlcatalog.$(OBJEXT) xmlcatalog_OBJECTS = $(am_xmlcatalog_OBJECTS) xmlcatalog_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ @@ -228,19 +249,25 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libxml2_la_SOURCES) $(testdso_la_SOURCES) \ - $(runsuite_SOURCES) $(runtest_SOURCES) $(testAutomata_SOURCES) \ - $(testC14N_SOURCES) $(testHTML_SOURCES) $(testModule_SOURCES) \ + $(runsuite_SOURCES) $(runtest_SOURCES) $(runxmlconf_SOURCES) \ + $(testAutomata_SOURCES) $(testC14N_SOURCES) \ + $(testHTML_SOURCES) $(testModule_SOURCES) \ $(testReader_SOURCES) $(testRegexp_SOURCES) \ $(testRelax_SOURCES) $(testSAX_SOURCES) $(testSchemas_SOURCES) \ $(testThreads_SOURCES) $(testURI_SOURCES) $(testXPath_SOURCES) \ - $(testapi_SOURCES) $(xmlcatalog_SOURCES) $(xmllint_SOURCES) + $(testapi_SOURCES) $(testchar_SOURCES) $(testdict_SOURCES) \ + $(testrecurse_SOURCES) $(xmlcatalog_SOURCES) \ + $(xmllint_SOURCES) DIST_SOURCES = $(am__libxml2_la_SOURCES_DIST) $(testdso_la_SOURCES) \ - $(runsuite_SOURCES) $(runtest_SOURCES) $(testAutomata_SOURCES) \ - $(testC14N_SOURCES) $(testHTML_SOURCES) $(testModule_SOURCES) \ + $(runsuite_SOURCES) $(runtest_SOURCES) $(runxmlconf_SOURCES) \ + $(testAutomata_SOURCES) $(testC14N_SOURCES) \ + $(testHTML_SOURCES) $(testModule_SOURCES) \ $(testReader_SOURCES) $(testRegexp_SOURCES) \ $(testRelax_SOURCES) $(testSAX_SOURCES) $(testSchemas_SOURCES) \ $(testThreads_SOURCES) $(testURI_SOURCES) $(testXPath_SOURCES) \ - $(testapi_SOURCES) $(xmlcatalog_SOURCES) $(xmllint_SOURCES) + $(testapi_SOURCES) $(testchar_SOURCES) $(testdict_SOURCES) \ + $(testrecurse_SOURCES) $(xmlcatalog_SOURCES) \ + $(xmllint_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ @@ -522,6 +549,18 @@ runtest_SOURCES = runtest.c runtest_LDFLAGS = runtest_DEPENDENCIES = $(DEPS) runtest_LDADD = @BASE_THREAD_LIBS@ @RDL_LIBS@ $(LDADDS) +testrecurse_SOURCES = testrecurse.c +testrecurse_LDFLAGS = +testrecurse_DEPENDENCIES = $(DEPS) +testrecurse_LDADD = @BASE_THREAD_LIBS@ @RDL_LIBS@ $(LDADDS) +testchar_SOURCES = testchar.c +testchar_LDFLAGS = +testchar_DEPENDENCIES = $(DEPS) +testchar_LDADD = @RDL_LIBS@ $(LDADDS) +testdict_SOURCES = testdict.c +testdict_LDFLAGS = +testdict_DEPENDENCIES = $(DEPS) +testdict_LDADD = @RDL_LIBS@ $(LDADDS) runsuite_SOURCES = runsuite.c runsuite_LDFLAGS = runsuite_DEPENDENCIES = $(DEPS) @@ -589,7 +628,11 @@ testapi_SOURCES = testapi.c testapi_LDFLAGS = testapi_DEPENDENCIES = $(DEPS) testapi_LDADD = $(LDADDS) -CLEANFILES = xml2Conf.sh +runxmlconf_SOURCES = runxmlconf.c +runxmlconf_LDFLAGS = +runxmlconf_DEPENDENCIES = $(DEPS) +runxmlconf_LDADD = $(LDADDS) +CLEANFILES = xml2Conf.sh *.gcda *.gcno confexecdir = $(libdir) confexec_DATA = xml2Conf.sh CVS_EXTRA_DIST = @@ -615,6 +658,13 @@ pkgconfig_DATA = libxml-2.0.pc BASE_DIR = $(datadir)/doc DOC_MODULE = libxml2-$(VERSION) EXAMPLES_DIR = $(BASE_DIR)/$(DOC_MODULE)/examples + +# +# Coverage support, largely borrowed from libvirt +# Both binaries comes from the lcov package in Fedora +# +LCOV = /usr/bin/lcov +GENHTML = /usr/bin/genhtml all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive @@ -684,8 +734,8 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done @@ -693,8 +743,8 @@ uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ done clean-libLTLIBRARIES: @@ -727,8 +777,8 @@ install-binPROGRAMS: $(bin_PROGRAMS) || test -f $$p1 \ ; then \ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ else :; fi; \ done @@ -759,6 +809,9 @@ runsuite$(EXEEXT): $(runsuite_OBJECTS) $(runsuite_DEPENDENCIES) runtest$(EXEEXT): $(runtest_OBJECTS) $(runtest_DEPENDENCIES) @rm -f runtest$(EXEEXT) $(runtest_LINK) $(runtest_OBJECTS) $(runtest_LDADD) $(LIBS) +runxmlconf$(EXEEXT): $(runxmlconf_OBJECTS) $(runxmlconf_DEPENDENCIES) + @rm -f runxmlconf$(EXEEXT) + $(runxmlconf_LINK) $(runxmlconf_OBJECTS) $(runxmlconf_LDADD) $(LIBS) testAutomata$(EXEEXT): $(testAutomata_OBJECTS) $(testAutomata_DEPENDENCIES) @rm -f testAutomata$(EXEEXT) $(testAutomata_LINK) $(testAutomata_OBJECTS) $(testAutomata_LDADD) $(LIBS) @@ -798,6 +851,15 @@ testXPath$(EXEEXT): $(testXPath_OBJECTS) $(testXPath_DEPENDENCIES) testapi$(EXEEXT): $(testapi_OBJECTS) $(testapi_DEPENDENCIES) @rm -f testapi$(EXEEXT) $(testapi_LINK) $(testapi_OBJECTS) $(testapi_LDADD) $(LIBS) +testchar$(EXEEXT): $(testchar_OBJECTS) $(testchar_DEPENDENCIES) + @rm -f testchar$(EXEEXT) + $(testchar_LINK) $(testchar_OBJECTS) $(testchar_LDADD) $(LIBS) +testdict$(EXEEXT): $(testdict_OBJECTS) $(testdict_DEPENDENCIES) + @rm -f testdict$(EXEEXT) + $(testdict_LINK) $(testdict_OBJECTS) $(testdict_LDADD) $(LIBS) +testrecurse$(EXEEXT): $(testrecurse_OBJECTS) $(testrecurse_DEPENDENCIES) + @rm -f testrecurse$(EXEEXT) + $(testrecurse_LINK) $(testrecurse_OBJECTS) $(testrecurse_LDADD) $(LIBS) xmlcatalog$(EXEEXT): $(xmlcatalog_OBJECTS) $(xmlcatalog_DEPENDENCIES) @rm -f xmlcatalog$(EXEEXT) $(xmlcatalog_LINK) $(xmlcatalog_OBJECTS) $(xmlcatalog_LDADD) $(LIBS) @@ -855,6 +917,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/relaxng.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runsuite.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runtest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runxmlconf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/schematron.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testAutomata.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testC14N.Po@am__quote@ @@ -869,7 +932,10 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testURI.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testXPath.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testapi.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testchar.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testdict.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testdso.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testrecurse.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/threads.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tree.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trio.Plo@am__quote@ @@ -1140,8 +1206,8 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS @@ -1166,8 +1232,8 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ @@ -1177,13 +1243,12 @@ ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ - here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique @@ -1257,6 +1322,10 @@ dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) +dist-lzma: distdir + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma + $(am__remove_distdir) + dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) @@ -1283,6 +1352,8 @@ distcheck: dist GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lzma*) \ + unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ @@ -1342,7 +1413,6 @@ distcleancheck: distclean $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) check-local check: check-recursive all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(MANS) $(DATA) \ config.h @@ -1452,11 +1522,11 @@ uninstall-man: uninstall-man1 uninstall-man3 install-strip .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ - all all-am am--refresh check check-am check-local clean \ - clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ - clean-libtool clean-noinstLTLIBRARIES clean-noinstPROGRAMS \ - ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ - dist-hook dist-shar dist-tarZ dist-zip distcheck distclean \ + all all-am am--refresh check check-am clean clean-binPROGRAMS \ + clean-generic clean-libLTLIBRARIES clean-libtool \ + clean-noinstLTLIBRARIES clean-noinstPROGRAMS ctags \ + ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-hook \ + dist-lzma dist-shar dist-tarZ dist-zip distcheck distclean \ distclean-compile distclean-generic distclean-hdr \ distclean-libtool distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ @@ -1494,7 +1564,15 @@ testapi.c: #testOOM_DEPENDENCIES = $(DEPS) #testOOM_LDADD= $(LDADDS) -check-local: all tests +runtests: + $(CHECKER) ./runtest$(EXEEXT) && $(CHECKER) ./testrecurse$(EXEEXT) &&$(CHECKER) ./testapi$(EXEEXT) && $(CHECKER) ./testchar$(EXEEXT)&& $(CHECKER) ./testdict$(EXEEXT) && $(CHECKER) ./runxmlconf$(EXEEXT) + +check: all runtests + +check-valgrind: all + @echo '## Running the regression tests under Valgrind' + @echo '## Go get a cup of coffee it is gonna take a while ...' + $(MAKE) CHECKER='valgrind -q' check testall : tests SVGtests SAXtests @@ -2444,6 +2522,8 @@ ModuleTests: testModule$(EXEEXT) testdso.la cleanup: -@(find . -name .\#\* -exec rm {} \;) + -@(find . -name \*.gcda -o *.gcno -exec rm {} \;) + -@(find . -name \*.orig -o -name \*.rej -o -name \*.old -exec rm {} \;) dist-hook: cleanup libxml2.spec -cp libxml2.spec $(distdir) @@ -2495,6 +2575,23 @@ tst: tst.c sparse: clean $(MAKE) CC=cgcc + +cov: clean-cov + if [ "`echo $(LDFLAGS) | grep coverage`" = "" ] ; then \ + echo not configured with coverage; exit 1 ; fi + if [ ! -x $(LCOV) -o ! -x $(GENHTML) ] ; then \ + echo Need $(LCOV) and $(GENHTML) excecutables; exit 1 ; fi + -@($(MAKE) check) + -@(./runsuite$(EXEEXT)) + mkdir $(top_builddir)/coverage + $(LCOV) -c -o $(top_builddir)/coverage/libxml2.info.tmp -d $(top_srcdir) + $(LCOV) -r $(top_builddir)/coverage/libxml2.info.tmp -o $(top_builddir)/coverage/libxml2.info *usr* + rm $(top_builddir)/coverage/libxml2.info.tmp + $(GENHTML) -s -t "libxml2" -o $(top_builddir)/coverage --legend $(top_builddir)/coverage/libxml2.info + echo "Coverage report is in $(top_builddir)/coverage/index.html" + +clean-cov: + rm -rf $(top_builddir)/coverage # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/Makefile.tests b/Makefile.tests index bd223ca..619cbfb 100644 --- a/Makefile.tests +++ b/Makefile.tests @@ -8,12 +8,12 @@ LIBS=`xml2-config --libs` THREADLIB= -lpthread EXEEXT= -all: runtest$(EXEEXT) runsuite$(EXEEXT) testapi$(EXEEXT) +all: runtest$(EXEEXT) runsuite$(EXEEXT) testapi$(EXEEXT) testchar$(EXEEXT) clean: $(RM) runtest$(EXEEXT) runsuite$(EXEEXT) testapi$(EXEEXT) -check: do_runtest do_runsuite do_testapi +check: do_runtest do_testchar do_testapi do_runsuite runtest$(EXEEXT): runtest.c $(CC) -o runtest$(EXEEXT) $(CFLAGS) runtest.c $(LIBS) $(THREADLIB) @@ -33,3 +33,9 @@ testapi$(EXEEXT): testapi.c do_testapi: testapi$(EXEEXT) ./testapi +testchar$(EXEEXT): testchar.c + $(CC) -o testchar$(EXEEXT) $(CFLAGS) testchar.c $(LIBS) + +do_testchar: testchar$(EXEEXT) + ./testchar + diff --git a/NEWS b/NEWS index bd96196..2d6a794 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,42 @@ ChangeLog.html to the SVN at http://svn.gnome.org/viewcvs/libxml2/trunk/ code base.Here is the list of public releases: +2.6.32: Apr 8 2008: + - Documentation: returning heap memory to kernel (Wolfram Sang), + trying to clarify xmlCleanupParser() use, xmlXPathContext improvement + (Jack Jansen), improve the *Recover* functions documentation, + XmlNodeType doc link fix (Martijn Arts) + - Bug fixes: internal subset memory leak (Ashwin), avoid problem with + paths starting with // (Petr Sumbera), streaming XSD validation callback + patches (Ashwin), fix redirection on port other than 80 (William Brack), + SAX2 leak (Ashwin), XInclude fragment of own document (Chris Ryan), + regexp bug with '.' (Andrew Tosh), flush the writer at the end of the + document (Alfred Mickautsch), output I/O bug fix (William Brack), + writer CDATA output after a text node (Alex Khesin), UTF-16 encoding + detection (William Brack), fix handling of empty CDATA nodes for Safari + team, python binding problem with namespace nodes, improve HTML parsing + (Arnold Hendriks), regexp automata build bug, memory leak fix (Vasily + Chekalkin), XSD test crash, weird system parameter entity parsing problem, + allow save to file:///X:/ windows paths, various attribute normalisation + problems, externalSubsetSplit fix (Ashwin), attribute redefinition in + the DTD (Ashwin), fix in char ref parsing check (Alex Khesin), many + out of memory handling fixes (Ashwin), XPath out of memory handling fixes + (Alvaro Herrera), various realloc problems (Ashwin), UCS4 encoding + conversion buffer size (Christian Fruth), problems with EatName + functions on memory errors, BOM handling in external parsed entities + (Mark Rowe) + - Code cleanup: fix build under VS 2008 (David Wimsey), remove useless + mutex in xmlDict (Florent Guilian), Mingw32 compilation fix (Carlo + Bramini), Win and MacOS EOL cleanups (Florent Guiliani), iconv need + a const detection (Roumen Petrov), simplify xmlSetProp (Julien Charbon), + cross compilation fixes for Mingw (Roumen Petrov), SCO Openserver build + fix (Florent Guiliani), iconv uses const on Win32 (Rob Richards), + duplicate code removal (Ashwin), missing malloc test and error reports + (Ashwin), VMS makefile fix (Tycho Hilhorst) + - improvements: better plug of schematron in the normal error handling + (Tobias Minich) + + 2.6.31: Jan 11 2008: - Security fix: missing of checks in UTF-8 parsing - Bug fixes: regexp bug, dump attribute from XHTML document, fix @@ -59,9 +95,9 @@ http://svn.gnome.org/viewcvs/libxml2/trunk/ flag fix (Richard Jones), regexp interpretation of \, htmlCreateDocParserCtxt (Jean-Daniel Dupas), configure.in typo (Bjorn Reese), entity content failure, xmlListAppend() fix - (Georges-André Silber), XPath number serialization (William Brack), + (Georges-André Silber), XPath number serialization (William Brack), nanohttp gzipped stream fix (William Brack and Alex Cornejo), - xmlCharEncFirstLine typo (Mark Rowe), uri bug (François Delyon), + xmlCharEncFirstLine typo (Mark Rowe), uri bug (François Delyon), XPath string value of PI nodes (William Brack), XPath node set sorting bugs (William Brack), avoid outputting namespace decl dups in the writer (Rob Richards), xmlCtxtReset bug, UTF-8 encoding @@ -69,7 +105,7 @@ http://svn.gnome.org/viewcvs/libxml2/trunk/ workaround wrong file: URIs, htmlNodeDumpFormatOutput on attributes, invalid character in attribute detection bug, big comments before internal subset streaming bug, HTML parsing of attributes with : in - the name, IDness of name in HTML (Dagfinn I. Mannsåker) + the name, IDness of name in HTML (Dagfinn I. MannsÃ¥ker) - Improvement: keep URI query parts in raw form (Richard Jones), embed tag support in HTML (Michael Day) @@ -84,7 +120,7 @@ http://svn.gnome.org/viewcvs/libxml2/trunk/ (Steven Rainwater), user data propagation in XInclude (Michael Day), standalone and XML decl detection (Michael Day), Python id ouptut for some id, fix the big python string memory leak, URI parsing fixes - (Stéphane Bidoul and William), long comments parsing bug (William), + (Stéphane Bidoul and William), long comments parsing bug (William), concurrent threads initialization (Ted Phelps), invalid char in text XInclude (William), XPath memory leak (William), tab in python problems (Andreas Hanke), XPath node comparison error @@ -94,7 +130,7 @@ http://svn.gnome.org/viewcvs/libxml2/trunk/ min occurs of 0 (William), HTML script/style parsing (Mike Day) - Improvement: make xmlTextReaderSetup() public - Compilation and postability: fix a missing include problem (William), - __ss_familly on AIX again (Björn Wiberg), compilation without zlib + __ss_familly on AIX again (Björn Wiberg), compilation without zlib (Michael Day), catalog patch for Win32 (Christian Ehrlicher), Windows CE fixes (Andreas Stricke) - Various CVS to SVN infrastructure changes @@ -241,7 +277,7 @@ Do not use or package 2.6.25 2.6.22: Sep 12 2005: - - build fixes: compile without schematron (Stéphane Bidoul) + - build fixes: compile without schematron (Stéphane Bidoul) - bug fixes: xmlDebugDumpNode on namespace node (Oleg Paraschenko)i, CDATA push parser bug, xmlElemDump problem with XHTML1 doc, XML_FEATURE_xxx clash with expat headers renamed XML_WITH_xxx, fix some @@ -514,7 +550,7 @@ Do not use or package 2.6.25 streaming problem (Steve Ball), DTD serialization problem (William), libxml.m4 fixes (Mike Hommey), do not provide destructors as methods on Python classes, xmlReader buffer bug, Python bindings memory interfaces - improvement (with Stéphane Bidoul), Fixed the push parser to be back to + improvement (with Stéphane Bidoul), Fixed the push parser to be back to synchronous behaviour. - improvement: custom per-thread I/O enhancement (Rob Richards), register namespace in debug shell (Stefano Debenedetti), Python based regression @@ -640,8 +676,8 @@ Do not use or package 2.6.25 callbacks order for XPath callbacks (Frederic Peters) - Documentation: python scripts (William Brack), xslt stylesheets (John Fleck), doc (Sven Zimmerman), I/O example. - - Python bindings: fixes (William), enum support (Stéphane Bidoul), - structured error reporting (Stéphane Bidoul) + - Python bindings: fixes (William), enum support (Stéphane Bidoul), + structured error reporting (Stéphane Bidoul) - XInclude: various fixes for conformance, problem related to dictionnary references (William & me), recursion (William) - xmlWriter: indentation (Lucas Brasilino), memory leaks (Alfred @@ -771,7 +807,7 @@ Do not use or package 2.6.25 and charset information if available. - Relax-NG: bug fixes including the one reported by Martijn Faassen and zeroOrMore, better error reporting. - - Python bindings (Stéphane Bidoul), never use stdout for errors + - Python bindings (Stéphane Bidoul), never use stdout for errors output - Portability: all the headers have macros for export and calling convention definitions (Igor Zlatkovic), VMS update (Craig A. Berry), @@ -852,11 +888,11 @@ A bugfixes only release - Windows Makefiles (William Brack) - portability: DJGPP (MsDos) , OpenVMS (Craig A. Berry) - William Brack fixed multithreading lock problems - IPv6 patch for FTP and HTTP accesses (Archana Shah/Wipro) - - Windows fixes (Igor Zlatkovic, Eric Zurcher), threading (Stéphane + - Windows fixes (Igor Zlatkovic, Eric Zurcher), threading (Stéphane Bidoul) - A few W3C Schemas Structure improvements - W3C Schemas Datatype improvements (Charlie Bozeman) - - Python bindings for thread globals (Stéphane Bidoul), and method/class + - Python bindings for thread globals (Stéphane Bidoul), and method/class generator - added --nonet option to xmllint - documentation improvements (John Fleck) @@ -932,7 +968,7 @@ A bugfixes only release - Windows Makefiles (William Brack) - First implementation of RelaxNG, added --relaxng flag to xmllint - Schemas support now compiled in by default. - Bug fixes: DTD validation, namespace checking, XInclude and entities, - delegateURI in XML Catalogs, HTML parser, XML reader (Stéphane Bidoul), + delegateURI in XML Catalogs, HTML parser, XML reader (Stéphane Bidoul), XPath parser and evaluation, UTF8ToUTF8 serialization, XML reader memory consumption, HTML parser, HTML serialization in the presence of namespaces @@ -941,7 +977,7 @@ A bugfixes only release - Windows Makefiles (William Brack) patches (Stefan Kost) - Portability fixes: NetBSD (Julio Merino), Windows (Igor Zlatkovic) - Added python bindings for XPointer, contextual error reporting - (Stéphane Bidoul) + (Stéphane Bidoul) - URI/file escaping problems (Stefano Zacchiroli) @@ -953,11 +989,11 @@ A bugfixes only release - Windows Makefiles (William Brack) 2.5.0: Jan 6 2003: - New XmltextReader interface based on C# - API (with help of Stéphane Bidoul) + API (with help of Stéphane Bidoul) - Windows: more exports, including the new API (Igor) - XInclude fallback fix - - Python: bindings for the new API, packaging (Stéphane Bidoul), - drv_libxml2.py Python xml.sax driver (Stéphane Bidoul), fixes, speedup + - Python: bindings for the new API, packaging (Stéphane Bidoul), + drv_libxml2.py Python xml.sax driver (Stéphane Bidoul), fixes, speedup and iterators for Python-2.2 (Hannu Krosing) - Tutorial fixes (john Fleck and Niraj Tolia) xmllint man update (John) @@ -977,7 +1013,7 @@ A bugfixes only release - Windows Makefiles (William Brack) 2.4.29: Dec 11 2002: - Windows fixes (Igor): Windows CE port, pthread linking, python bindings - (Stéphane Bidoul), Mingw (Magnus Henoch), and export list updates + (Stéphane Bidoul), Mingw (Magnus Henoch), and export list updates - Fix for prev in python bindings (ERDI Gergo) - Fix for entities handling (Marcus Clarke) - Refactored the XML and HTML dumps to a single code path, fixed XHTML1 @@ -1324,7 +1360,7 @@ it's actually not compiled in by default. The real fixes are: - a couple of bu 2.3.9: May 19 2001: -Lots of bugfixes, and added a basic SGML catalog support: - HTML push bugfix #54891 and another patch from Jonas Borgström +Lots of bugfixes, and added a basic SGML catalog support: - HTML push bugfix #54891 and another patch from Jonas Borgström - some serious speed optimization again - some documentation cleanups - trying to get better linking on Solaris (-R) diff --git a/README.tests b/README.tests index eb7223d..66522ab 100644 --- a/README.tests +++ b/README.tests @@ -10,13 +10,14 @@ program has a different testing purpose: runtest.c : runs libxml2 basic internal regression tests runsuite.c: runs libxml2 against external regression tests testapi.c : exercises the library public entry points + testchar.c: exercise the check of character ranges and UTF-8 validation The command: - make -f Makefile.tests + make -f Makefile.tests check should be sufficient on an Unix system to build and exercise the tests -for the version of the library installed on the system. Note however +for the version of the library installed on the system. Note however that there isn't backward compatibility provided so if the installed version is older to the testsuite one, failing to compile or run the tests is likely. In any event this won't work with an installed libxml2 older @@ -26,4 +27,4 @@ like any other program using libxml2, running the test should be done simply by launching the resulting executables. Daniel Veillard -Sun Jul 10 2005 +Thu Jul 24 2008 diff --git a/SAX2.c b/SAX2.c index 7dbc2b2..80cd1bd 100644 --- a/SAX2.c +++ b/SAX2.c @@ -580,7 +580,8 @@ xmlSAX2GetEntity(void *ctx, const xmlChar *name) return(NULL); } ret->owner = 1; - ret->checked = 1; + if (ret->checked == 0) + ret->checked = 1; } return(ret); } @@ -957,6 +958,8 @@ xmlSAX2StartDocument(void *ctx) #ifdef LIBXML_HTML_ENABLED if (ctxt->myDoc == NULL) ctxt->myDoc = htmlNewDocNoDtD(NULL, NULL); + ctxt->myDoc->properties = XML_DOC_HTML; + ctxt->myDoc->parseFlags = ctxt->options; if (ctxt->myDoc == NULL) { xmlSAX2ErrMemory(ctxt, "xmlSAX2StartDocument"); return; @@ -972,6 +975,10 @@ xmlSAX2StartDocument(void *ctx) } else { doc = ctxt->myDoc = xmlNewDoc(ctxt->version); if (doc != NULL) { + doc->properties = 0; + if (ctxt->options & XML_PARSE_OLD10) + doc->properties |= XML_DOC_OLD10; + doc->parseFlags = ctxt->options; if (ctxt->encoding != NULL) doc->encoding = xmlStrdup(ctxt->encoding); else @@ -1837,6 +1844,9 @@ skip: } else ret->content = (xmlChar *) intern; + if (ctxt->input != NULL) + ret->line = ctxt->input->line; + if ((__xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue)) xmlRegisterNodeDefaultValue(ret); return(ret); diff --git a/aclocal.m4 b/aclocal.m4 index 6da47d8..190c670 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.10 -*- Autoconf -*- +# generated automatically by aclocal 1.10.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006 Free Software Foundation, Inc. +# 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -11,10 +11,13 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -m4_if(m4_PACKAGE_VERSION, [2.61],, -[m4_fatal([this file was generated for autoconf 2.61. -You have another version of autoconf. If you want to use that, -you should regenerate the build system entirely.], [63])]) +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(AC_AUTOCONF_VERSION, [2.61],, +[m4_warning([this file was generated for autoconf 2.61. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically `autoreconf'.])]) # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- @@ -6584,7 +6587,7 @@ AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ]) -# Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -6599,7 +6602,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.10' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.10], [], +m4_if([$1], [1.10.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -6615,8 +6618,10 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.10])dnl -_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)]) +[AM_AUTOMAKE_VERSION([1.10.1])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- @@ -6888,7 +6893,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue @@ -6948,13 +6953,13 @@ AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006 Free Software Foundation, Inc. +# 2005, 2006, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 12 +# serial 13 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. @@ -7059,16 +7064,17 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJC], # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. +_am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in - $1 | $1:* ) + $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done -echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # @@ -7366,7 +7372,7 @@ AC_SUBST([INSTALL_STRIP_PROGRAM])]) # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- -# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in. +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) diff --git a/catalog.c b/catalog.c index ee3f8f2..af84b7c 100644 --- a/catalog.c +++ b/catalog.c @@ -2616,6 +2616,8 @@ xmlCatalogSGMLResolve(xmlCatalogPtr catal, const xmlChar *pubID, return(ret); if (sysID != NULL) ret = xmlCatalogGetSGMLSystem(catal->sgml, sysID); + if (ret != NULL) + return(ret); return(NULL); } @@ -2912,7 +2914,7 @@ xmlACatalogResolveURI(xmlCatalogPtr catal, const xmlChar *URI) { sgml = xmlCatalogSGMLResolve(catal, NULL, URI); if (sgml != NULL) - sgml = xmlStrdup(sgml); + ret = xmlStrdup(sgml); } return(ret); } diff --git a/configure b/configure index e80c4a9..5360aa8 100755 --- a/configure +++ b/configure @@ -1633,6 +1633,7 @@ Optional Packages: --with-xptr add the XPointer support (on) --with-modules add the dynamic modules support (on) --with-zlib[=DIR] use libz in DIR + --with-coverage build for code coverage with GCC (off) Some influential environment variables: CC C compiler command @@ -2189,8 +2190,8 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac LIBXML_MAJOR_VERSION=2 -LIBXML_MINOR_VERSION=6 -LIBXML_MICRO_VERSION=32 +LIBXML_MINOR_VERSION=7 +LIBXML_MICRO_VERSION=0 LIBXML_MICRO_VERSION_SUFFIX= LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION @@ -5507,7 +5508,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5510 "configure"' > conftest.$ac_ext + echo '#line 5511 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -8061,11 +8062,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8064: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8065: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:8068: \$? = $ac_status" >&5 + echo "$as_me:8069: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -8351,11 +8352,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8354: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8355: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:8358: \$? = $ac_status" >&5 + echo "$as_me:8359: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -8455,11 +8456,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8458: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8459: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:8462: \$? = $ac_status" >&5 + echo "$as_me:8463: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -10806,7 +10807,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:13330: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13333: \$? = $ac_status" >&5 + echo "$as_me:13334: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -13430,11 +13431,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13433: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13434: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13437: \$? = $ac_status" >&5 + echo "$as_me:13438: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -14994,11 +14995,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14997: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14998: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15001: \$? = $ac_status" >&5 + echo "$as_me:15002: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -15098,11 +15099,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15101: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15102: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15105: \$? = $ac_status" >&5 + echo "$as_me:15106: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17287,11 +17288,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17290: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17291: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:17294: \$? = $ac_status" >&5 + echo "$as_me:17295: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17577,11 +17578,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17580: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17581: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:17584: \$? = $ac_status" >&5 + echo "$as_me:17585: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -17681,11 +17682,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17684: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17685: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:17688: \$? = $ac_status" >&5 + echo "$as_me:17689: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -20581,6 +20582,12 @@ if test "${with_zlib+set}" = set; then fi +# Check whether --with-coverage was given. +if test "${with_coverage+set}" = set; then + withval=$with_coverage; +fi + + if test "$with_schemas" = "yes" then with_pattern=yes @@ -26375,7 +26382,7 @@ fi { echo "$as_me:$LINENO: checking for type of socket length (socklen_t)" >&5 echo $ECHO_N "checking for type of socket length (socklen_t)... $ECHO_C" >&6; } cat > conftest.$ac_ext < @@ -26386,7 +26393,7 @@ int main(void) { (void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL) ; return 0; } EOF -if { (eval echo configure:26389: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then +if { (eval echo configure:26396: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then rm -rf conftest* { echo "$as_me:$LINENO: result: socklen_t *" >&5 @@ -26398,7 +26405,7 @@ else rm -rf conftest* cat > conftest.$ac_ext < @@ -26409,7 +26416,7 @@ int main(void) { (void)getsockopt (1, 1, 1, NULL, (size_t *)NULL) ; return 0; } EOF -if { (eval echo configure:26412: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then +if { (eval echo configure:26419: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then rm -rf conftest* { echo "$as_me:$LINENO: result: size_t *" >&5 @@ -26421,7 +26428,7 @@ else rm -rf conftest* cat > conftest.$ac_ext < @@ -26432,7 +26439,7 @@ int main(void) { (void)getsockopt (1, 1, 1, NULL, (int *)NULL) ; return 0; } EOF -if { (eval echo configure:26435: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then +if { (eval echo configure:26442: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then rm -rf conftest* { echo "$as_me:$LINENO: result: int *" >&5 @@ -29259,6 +29266,16 @@ esac +if test "$with_coverage" = "yes" -a "${GCC}" = "yes" +then + echo Enabling code coverage for GCC + CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage" + LDFLAGS="$LDFLAGS -fprofile-arcs -ftest-coverage" +else + echo Disabling code coverage for GCC +fi + + @@ -30670,21 +30687,22 @@ echo "$as_me: $ac_file is unchanged" >&6;} fi rm -f "$tmp/out12" # Compute $ac_file's index in $config_headers. +_am_arg=$ac_file _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in - $ac_file | $ac_file:* ) + $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done -echo "timestamp for $ac_file" >`$as_dirname -- $ac_file || -$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X$ac_file : 'X\(//\)[^/]' \| \ - X$ac_file : 'X\(//\)$' \| \ - X$ac_file : 'X\(/\)' \| . 2>/dev/null || -echo X$ac_file | +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -30721,7 +30739,7 @@ echo "$as_me: executing $ac_file commands" >&6;} # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ diff --git a/configure.in b/configure.in index 8fc76e5..65824f3 100644 --- a/configure.in +++ b/configure.in @@ -4,8 +4,8 @@ AM_CONFIG_HEADER(config.h) AC_CANONICAL_HOST LIBXML_MAJOR_VERSION=2 -LIBXML_MINOR_VERSION=6 -LIBXML_MICRO_VERSION=32 +LIBXML_MINOR_VERSION=7 +LIBXML_MICRO_VERSION=0 LIBXML_MICRO_VERSION_SUFFIX= LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION @@ -163,6 +163,8 @@ AC_ARG_WITH(zlib, LDFLAGS="${LDFLAGS} -L$withval/lib" fi ]) +AC_ARG_WITH(coverage, +[ --with-coverage build for code coverage with GCC (off)]) dnl dnl hard dependancies on options @@ -1371,8 +1373,18 @@ AC_SUBST(WIN32_EXTRA_LDFLAGS) AC_SUBST(CYGWIN_EXTRA_LDFLAGS) AC_SUBST(CYGWIN_EXTRA_PYTHON_LIBADD) +if test "$with_coverage" = "yes" -a "${GCC}" = "yes" +then + echo Enabling code coverage for GCC + CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage" + LDFLAGS="$LDFLAGS -fprofile-arcs -ftest-coverage" +else + echo Disabling code coverage for GCC +fi + AC_SUBST(CPPFLAGS) AC_SUBST(CFLAGS) +AC_SUBST(LDFLAGS) AC_SUBST(XML_CFLAGS) AC_SUBST(XML_LIBDIR) diff --git a/depcomp b/depcomp index ca5ea4e..e5f9736 100755 --- a/depcomp +++ b/depcomp @@ -1,9 +1,9 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2006-10-15.18 +scriptversion=2007-03-29.01 -# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software # Foundation, Inc. # This program is free software; you can redistribute it and/or modify @@ -215,34 +215,39 @@ aix) # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. - stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` - tmpdepfile="$stripped.u" + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then + tmpdepfile1=$dir$base.u + tmpdepfile2=$base.u + tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else + tmpdepfile1=$dir$base.u + tmpdepfile2=$dir$base.u + tmpdepfile3=$dir$base.u "$@" -M fi stat=$? - if test -f "$tmpdepfile"; then : - else - stripped=`echo "$stripped" | sed 's,^.*/,,'` - tmpdepfile="$stripped.u" - fi - if test $stat -eq 0; then : else - rm -f "$tmpdepfile" + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done if test -f "$tmpdepfile"; then - outname="$stripped.o" # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. - sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" - sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile diff --git a/dict.c b/dict.c index c071887..20bd310 100644 --- a/dict.c +++ b/dict.c @@ -20,18 +20,44 @@ #include "libxml.h" #include +#ifdef HAVE_STDINT_H +#include +#elif defined(WIN32) +typedef unsigned __int32 uint32_t; +#endif #include #include #include #include #include -#define MAX_HASH_LEN 4 +/* #define DEBUG_GROW */ +/* #define DICT_DEBUG_PATTERNS */ + +#define MAX_HASH_LEN 3 #define MIN_DICT_SIZE 128 #define MAX_DICT_HASH 8 * 2048 - -/* #define ALLOW_REMOVAL */ -/* #define DEBUG_GROW */ +#define WITH_BIG_KEY + +#ifdef WITH_BIG_KEY +#define xmlDictComputeKey(dict, name, len) \ + (((dict)->size == MIN_DICT_SIZE) ? \ + xmlDictComputeFastKey(name, len) : \ + xmlDictComputeBigKey(name, len)) + +#define xmlDictComputeQKey(dict, prefix, plen, name, len) \ + (((prefix) == NULL) ? \ + (xmlDictComputeKey(dict, name, len)) : \ + (((dict)->size == MIN_DICT_SIZE) ? \ + xmlDictComputeFastQKey(prefix, plen, name, len) : \ + xmlDictComputeBigQKey(prefix, plen, name, len))) + +#else /* !WITH_BIG_KEY */ +#define xmlDictComputeKey(dict, name, len) \ + xmlDictComputeFastKey(name, len) +#define xmlDictComputeQKey(dict, prefix, plen, name, len) \ + xmlDictComputeFastQKey(prefix, plen, name, len) +#endif /* WITH_BIG_KEY */ /* * An entry in the dictionnary @@ -43,6 +69,7 @@ struct _xmlDictEntry { const xmlChar *name; int len; int valid; + unsigned long okey; }; typedef struct _xmlDictStrings xmlDictStrings; @@ -129,6 +156,9 @@ xmlDictAddString(xmlDictPtr dict, const xmlChar *name, int namelen) { const xmlChar *ret; int size = 0; /* + sizeof(_xmlDictStrings) == 1024 */ +#ifdef DICT_DEBUG_PATTERNS + fprintf(stderr, "-"); +#endif pool = dict->strings; while (pool != NULL) { if (pool->end - pool->free > namelen) @@ -153,12 +183,16 @@ xmlDictAddString(xmlDictPtr dict, const xmlChar *name, int namelen) { pool->end = &pool->array[size]; pool->next = dict->strings; dict->strings = pool; +#ifdef DICT_DEBUG_PATTERNS + fprintf(stderr, "+"); +#endif } found_pool: ret = pool->free; memcpy(pool->free, name, namelen); pool->free += namelen; *(pool->free++) = 0; + pool->nbStrings++; return(ret); } @@ -166,6 +200,7 @@ found_pool: * xmlDictAddQString: * @dict: the dictionnary * @prefix: the prefix of the userdata + * @plen: the prefix length * @name: the name of the userdata * @len: the length of the name, if -1 it is recomputed * @@ -174,20 +209,21 @@ found_pool: * Returns the pointer of the local string, or NULL in case of error. */ static const xmlChar * -xmlDictAddQString(xmlDictPtr dict, const xmlChar *prefix, +xmlDictAddQString(xmlDictPtr dict, const xmlChar *prefix, int plen, const xmlChar *name, int namelen) { xmlDictStringsPtr pool; const xmlChar *ret; int size = 0; /* + sizeof(_xmlDictStrings) == 1024 */ - int plen; if (prefix == NULL) return(xmlDictAddString(dict, name, namelen)); - plen = xmlStrlen(prefix); +#ifdef DICT_DEBUG_PATTERNS + fprintf(stderr, "="); +#endif pool = dict->strings; while (pool != NULL) { - if (pool->end - pool->free > namelen) + if (pool->end - pool->free > namelen + plen + 1) goto found_pool; if (pool->size > size) size = pool->size; pool = pool->next; @@ -198,8 +234,8 @@ xmlDictAddQString(xmlDictPtr dict, const xmlChar *prefix, if (pool == NULL) { if (size == 0) size = 1000; else size *= 4; /* exponential growth */ - if (size < 4 * namelen) - size = 4 * namelen; /* just in case ! */ + if (size < 4 * (namelen + plen + 1)) + size = 4 * (namelen + plen + 1); /* just in case ! */ pool = (xmlDictStringsPtr) xmlMalloc(sizeof(xmlDictStrings) + size); if (pool == NULL) return(NULL); @@ -209,27 +245,106 @@ xmlDictAddQString(xmlDictPtr dict, const xmlChar *prefix, pool->end = &pool->array[size]; pool->next = dict->strings; dict->strings = pool; +#ifdef DICT_DEBUG_PATTERNS + fprintf(stderr, "+"); +#endif } found_pool: ret = pool->free; memcpy(pool->free, prefix, plen); pool->free += plen; *(pool->free++) = ':'; - namelen -= plen + 1; memcpy(pool->free, name, namelen); pool->free += namelen; *(pool->free++) = 0; + pool->nbStrings++; return(ret); } +#ifdef WITH_BIG_KEY +/* + * xmlDictComputeBigKey: + * + * Calculate a hash key using a good hash function that works well for + * larger hash table sizes. + * + * Hash function by "One-at-a-Time Hash" see + * http://burtleburtle.net/bob/hash/doobs.html + */ + +static uint32_t +xmlDictComputeBigKey(const xmlChar* data, int namelen) { + uint32_t hash; + int i; + + if (namelen <= 0 || data == NULL) return(0); + + hash = 0; + + for (i = 0;i < namelen; i++) { + hash += data[i]; + hash += (hash << 10); + hash ^= (hash >> 6); + } + hash += (hash << 3); + hash ^= (hash >> 11); + hash += (hash << 15); + + return hash; +} + +/* + * xmlDictComputeBigQKey: + * + * Calculate a hash key for two strings using a good hash function + * that works well for larger hash table sizes. + * + * Hash function by "One-at-a-Time Hash" see + * http://burtleburtle.net/bob/hash/doobs.html + * + * Neither of the two strings must be NULL. + */ +static unsigned long +xmlDictComputeBigQKey(const xmlChar *prefix, int plen, + const xmlChar *name, int len) +{ + uint32_t hash; + int i; + + hash = 0; + + for (i = 0;i < plen; i++) { + hash += prefix[i]; + hash += (hash << 10); + hash ^= (hash >> 6); + } + hash += ':'; + hash += (hash << 10); + hash ^= (hash >> 6); + + for (i = 0;i < len; i++) { + hash += name[i]; + hash += (hash << 10); + hash ^= (hash >> 6); + } + hash += (hash << 3); + hash ^= (hash >> 11); + hash += (hash << 15); + + return hash; +} +#endif /* WITH_BIG_KEY */ + /* - * xmlDictComputeKey: - * Calculate the hash key + * xmlDictComputeFastKey: + * + * Calculate a hash key using a fast hash function that works well + * for low hash table fill. */ static unsigned long -xmlDictComputeKey(const xmlChar *name, int namelen) { +xmlDictComputeFastKey(const xmlChar *name, int namelen) { unsigned long value = 0L; - + if (name == NULL) return(0); value = *name; value <<= 5; @@ -253,24 +368,24 @@ xmlDictComputeKey(const xmlChar *name, int namelen) { } /* - * xmlDictComputeQKey: - * Calculate the hash key + * xmlDictComputeFastQKey: + * + * Calculate a hash key for two strings using a fast hash function + * that works well for low hash table fill. + * + * Neither of the two strings must be NULL. */ static unsigned long -xmlDictComputeQKey(const xmlChar *prefix, const xmlChar *name, int len) +xmlDictComputeFastQKey(const xmlChar *prefix, int plen, + const xmlChar *name, int len) { unsigned long value = 0L; - int plen; - - if (prefix == NULL) - return(xmlDictComputeKey(name, len)); - plen = xmlStrlen(prefix); if (plen == 0) value += 30 * (unsigned long) ':'; else value += 30 * (*prefix); - + if (len > 10) { value += name[len - (plen + 1 + 1)]; len = 10; @@ -325,7 +440,11 @@ xmlDictCreate(void) { if (!xmlDictInitialized) if (!xmlInitializeDict()) return(NULL); - + +#ifdef DICT_DEBUG_PATTERNS + fprintf(stderr, "C"); +#endif + dict = xmlMalloc(sizeof(xmlDict)); if (dict) { dict->ref_counter = 1; @@ -358,8 +477,11 @@ xmlDictCreate(void) { xmlDictPtr xmlDictCreateSub(xmlDictPtr sub) { xmlDictPtr dict = xmlDictCreate(); - + if ((dict != NULL) && (sub != NULL)) { +#ifdef DICT_DEBUG_PATTERNS + fprintf(stderr, "R"); +#endif dict->subdict = sub; xmlDictReference(dict->subdict); } @@ -398,14 +520,16 @@ xmlDictReference(xmlDictPtr dict) { */ static int xmlDictGrow(xmlDictPtr dict, int size) { - unsigned long key; + unsigned long key, okey; int oldsize, i; xmlDictEntryPtr iter, next; struct _xmlDictEntry *olddict; #ifdef DEBUG_GROW unsigned long nbElem = 0; #endif - + int ret = 0; + int keep_keys = 1; + if (dict == NULL) return(-1); if (size < 8) @@ -413,11 +537,17 @@ xmlDictGrow(xmlDictPtr dict, int size) { if (size > 8 * 2048) return(-1); +#ifdef DICT_DEBUG_PATTERNS + fprintf(stderr, "*"); +#endif + oldsize = dict->size; olddict = dict->dict; if (olddict == NULL) return(-1); - + if (oldsize == MIN_DICT_SIZE) + keep_keys = 0; + dict->dict = xmlMalloc(size * sizeof(xmlDictEntry)); if (dict->dict == NULL) { dict->dict = olddict; @@ -427,17 +557,44 @@ xmlDictGrow(xmlDictPtr dict, int size) { dict->size = size; /* If the two loops are merged, there would be situations where - a new entry needs to allocated and data copied into it from - the main dict. So instead, we run through the array twice, first - copying all the elements in the main array (where we can't get - conflicts) and then the rest, so we only free (and don't allocate) + a new entry needs to allocated and data copied into it from + the main dict. It is nicer to run through the array twice, first + copying all the elements in the main array (less probability of + allocate) and then the rest, so we only free in the second loop. */ for (i = 0; i < oldsize; i++) { - if (olddict[i].valid == 0) + if (olddict[i].valid == 0) continue; - key = xmlDictComputeKey(olddict[i].name, olddict[i].len) % dict->size; - memcpy(&(dict->dict[key]), &(olddict[i]), sizeof(xmlDictEntry)); - dict->dict[key].next = NULL; + + if (keep_keys) + okey = olddict[i].okey; + else + okey = xmlDictComputeKey(dict, olddict[i].name, olddict[i].len); + key = okey % dict->size; + + if (dict->dict[key].valid == 0) { + memcpy(&(dict->dict[key]), &(olddict[i]), sizeof(xmlDictEntry)); + dict->dict[key].next = NULL; + dict->dict[key].okey = okey; + } else { + xmlDictEntryPtr entry; + + entry = xmlMalloc(sizeof(xmlDictEntry)); + if (entry != NULL) { + entry->name = olddict[i].name; + entry->len = olddict[i].len; + entry->okey = okey; + entry->next = dict->dict[key].next; + entry->valid = 1; + dict->dict[key].next = entry; + } else { + /* + * we don't have much ways to alert from herei + * result is loosing an entry and unicity garantee + */ + ret = -1; + } + } #ifdef DEBUG_GROW nbElem++; #endif @@ -452,15 +609,21 @@ xmlDictGrow(xmlDictPtr dict, int size) { * put back the entry in the new dict */ - key = xmlDictComputeKey(iter->name, iter->len) % dict->size; + if (keep_keys) + okey = iter->okey; + else + okey = xmlDictComputeKey(dict, iter->name, iter->len); + key = okey % dict->size; if (dict->dict[key].valid == 0) { memcpy(&(dict->dict[key]), iter, sizeof(xmlDictEntry)); dict->dict[key].next = NULL; dict->dict[key].valid = 1; + dict->dict[key].okey = okey; xmlFree(iter); } else { - iter->next = dict->dict[key].next; - dict->dict[key].next = iter; + iter->next = dict->dict[key].next; + iter->okey = okey; + dict->dict[key].next = iter; } #ifdef DEBUG_GROW @@ -478,7 +641,7 @@ xmlDictGrow(xmlDictPtr dict, int size) { "xmlDictGrow : from %d to %d, %d elems\n", oldsize, size, nbElem); #endif - return(0); + return(ret); } /** @@ -565,12 +728,12 @@ xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len) { return(NULL); if (len < 0) - len = xmlStrlen(name); + len = strlen((const char *) name); /* * Check for duplicate and insertion location. */ - okey = xmlDictComputeKey(name, len); + okey = xmlDictComputeKey(dict, name, len); key = okey % dict->size; if (dict->dict[key].valid == 0) { insert = NULL; @@ -578,55 +741,66 @@ xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len) { for (insert = &(dict->dict[key]); insert->next != NULL; insert = insert->next) { #ifdef __GNUC__ - if (insert->len == len) { + if ((insert->okey == okey) && (insert->len == len)) { if (!memcmp(insert->name, name, len)) return(insert->name); } #else - if ((insert->len == len) && + if ((insert->okey == okey) && (insert->len == len) && (!xmlStrncmp(insert->name, name, len))) return(insert->name); #endif nbi++; } #ifdef __GNUC__ - if (insert->len == len) { + if ((insert->okey == okey) && (insert->len == len)) { if (!memcmp(insert->name, name, len)) return(insert->name); } #else - if ((insert->len == len) && + if ((insert->okey == okey) && (insert->len == len) && (!xmlStrncmp(insert->name, name, len))) return(insert->name); #endif } if (dict->subdict) { - key = okey % dict->subdict->size; + unsigned long skey; + + /* we cannot always reuse the same okey for the subdict */ + if (((dict->size == MIN_DICT_SIZE) && + (dict->subdict->size != MIN_DICT_SIZE)) || + ((dict->size != MIN_DICT_SIZE) && + (dict->subdict->size == MIN_DICT_SIZE))) + skey = xmlDictComputeKey(dict->subdict, name, len); + else + skey = okey; + + key = skey % dict->subdict->size; if (dict->subdict->dict[key].valid != 0) { xmlDictEntryPtr tmp; for (tmp = &(dict->subdict->dict[key]); tmp->next != NULL; tmp = tmp->next) { #ifdef __GNUC__ - if (tmp->len == len) { + if ((tmp->okey == skey) && (tmp->len == len)) { if (!memcmp(tmp->name, name, len)) return(tmp->name); } #else - if ((tmp->len == len) && + if ((tmp->okey == skey) && (tmp->len == len) && (!xmlStrncmp(tmp->name, name, len))) return(tmp->name); #endif nbi++; } #ifdef __GNUC__ - if (tmp->len == len) { + if ((tmp->okey == skey) && (tmp->len == len)) { if (!memcmp(tmp->name, name, len)) return(tmp->name); } #else - if ((tmp->len == len) && + if ((tmp->okey == skey) && (tmp->len == len) && (!xmlStrncmp(tmp->name, name, len))) return(tmp->name); #endif @@ -648,6 +822,7 @@ xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len) { entry->len = len; entry->next = NULL; entry->valid = 1; + entry->okey = okey; if (insert != NULL) @@ -656,8 +831,10 @@ xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len) { dict->nbElems++; if ((nbi > MAX_HASH_LEN) && - (dict->size <= ((MAX_DICT_HASH / 2) / MAX_HASH_LEN))) - xmlDictGrow(dict, MAX_HASH_LEN * 2 * dict->size); + (dict->size <= ((MAX_DICT_HASH / 2) / MAX_HASH_LEN))) { + if (xmlDictGrow(dict, MAX_HASH_LEN * 2 * dict->size) != 0) + return(NULL); + } /* Note that entry may have been freed at this point by xmlDictGrow */ return(ret); @@ -682,12 +859,12 @@ xmlDictExists(xmlDictPtr dict, const xmlChar *name, int len) { return(NULL); if (len < 0) - len = xmlStrlen(name); + len = strlen((const char *) name); /* * Check for duplicate and insertion location. */ - okey = xmlDictComputeKey(name, len); + okey = xmlDictComputeKey(dict, name, len); key = okey % dict->size; if (dict->dict[key].valid == 0) { insert = NULL; @@ -695,60 +872,70 @@ xmlDictExists(xmlDictPtr dict, const xmlChar *name, int len) { for (insert = &(dict->dict[key]); insert->next != NULL; insert = insert->next) { #ifdef __GNUC__ - if (insert->len == len) { + if ((insert->okey == okey) && (insert->len == len)) { if (!memcmp(insert->name, name, len)) return(insert->name); } #else - if ((insert->len == len) && + if ((insert->okey == okey) && (insert->len == len) && (!xmlStrncmp(insert->name, name, len))) return(insert->name); #endif nbi++; } #ifdef __GNUC__ - if (insert->len == len) { + if ((insert->okey == okey) && (insert->len == len)) { if (!memcmp(insert->name, name, len)) return(insert->name); } #else - if ((insert->len == len) && + if ((insert->okey == okey) && (insert->len == len) && (!xmlStrncmp(insert->name, name, len))) return(insert->name); #endif } if (dict->subdict) { - key = okey % dict->subdict->size; + unsigned long skey; + + /* we cannot always reuse the same okey for the subdict */ + if (((dict->size == MIN_DICT_SIZE) && + (dict->subdict->size != MIN_DICT_SIZE)) || + ((dict->size != MIN_DICT_SIZE) && + (dict->subdict->size == MIN_DICT_SIZE))) + skey = xmlDictComputeKey(dict->subdict, name, len); + else + skey = okey; + + key = skey % dict->subdict->size; if (dict->subdict->dict[key].valid != 0) { xmlDictEntryPtr tmp; for (tmp = &(dict->subdict->dict[key]); tmp->next != NULL; tmp = tmp->next) { #ifdef __GNUC__ - if (tmp->len == len) { + if ((tmp->okey == skey) && (tmp->len == len)) { if (!memcmp(tmp->name, name, len)) return(tmp->name); } #else - if ((tmp->len == len) && + if ((tmp->okey == skey) && (tmp->len == len) && (!xmlStrncmp(tmp->name, name, len))) return(tmp->name); #endif nbi++; } #ifdef __GNUC__ - if (tmp->len == len) { + if ((tmp->okey == skey) && (tmp->len == len)) { if (!memcmp(tmp->name, name, len)) return(tmp->name); } #else - if ((tmp->len == len) && + if ((tmp->okey == skey) && (tmp->len == len) && (!xmlStrncmp(tmp->name, name, len))) return(tmp->name); #endif } - key = okey % dict->size; } /* not found */ @@ -758,7 +945,7 @@ xmlDictExists(xmlDictPtr dict, const xmlChar *name, int len) { /** * xmlDictQLookup: * @dict: the dictionnary - * @prefix: the prefix + * @prefix: the prefix * @name: the name * * Add the QName @prefix:@name to the hash @dict if not present. @@ -771,54 +958,67 @@ xmlDictQLookup(xmlDictPtr dict, const xmlChar *prefix, const xmlChar *name) { xmlDictEntryPtr entry; xmlDictEntryPtr insert; const xmlChar *ret; - int len; + int len, plen, l; if ((dict == NULL) || (name == NULL)) return(NULL); + if (prefix == NULL) + return(xmlDictLookup(dict, name, -1)); - len = xmlStrlen(name); - if (prefix != NULL) - len += 1 + xmlStrlen(prefix); + l = len = strlen((const char *) name); + plen = strlen((const char *) prefix); + len += 1 + plen; /* * Check for duplicate and insertion location. */ - okey = xmlDictComputeQKey(prefix, name, len); + okey = xmlDictComputeQKey(dict, prefix, plen, name, l); key = okey % dict->size; if (dict->dict[key].valid == 0) { insert = NULL; } else { for (insert = &(dict->dict[key]); insert->next != NULL; insert = insert->next) { - if ((insert->len == len) && + if ((insert->okey == okey) && (insert->len == len) && (xmlStrQEqual(prefix, name, insert->name))) return(insert->name); nbi++; } - if ((insert->len == len) && + if ((insert->okey == okey) && (insert->len == len) && (xmlStrQEqual(prefix, name, insert->name))) return(insert->name); } if (dict->subdict) { - key = okey % dict->subdict->size; + unsigned long skey; + + /* we cannot always reuse the same okey for the subdict */ + if (((dict->size == MIN_DICT_SIZE) && + (dict->subdict->size != MIN_DICT_SIZE)) || + ((dict->size != MIN_DICT_SIZE) && + (dict->subdict->size == MIN_DICT_SIZE))) + skey = xmlDictComputeQKey(dict->subdict, prefix, plen, name, l); + else + skey = okey; + + key = skey % dict->subdict->size; if (dict->subdict->dict[key].valid != 0) { xmlDictEntryPtr tmp; for (tmp = &(dict->subdict->dict[key]); tmp->next != NULL; tmp = tmp->next) { - if ((tmp->len == len) && + if ((tmp->okey == skey) && (tmp->len == len) && (xmlStrQEqual(prefix, name, tmp->name))) return(tmp->name); nbi++; } - if ((tmp->len == len) && + if ((tmp->okey == skey) && (tmp->len == len) && (xmlStrQEqual(prefix, name, tmp->name))) return(tmp->name); } key = okey % dict->size; } - ret = xmlDictAddQString(dict, prefix, name, len); + ret = xmlDictAddQString(dict, prefix, plen, name, l); if (ret == NULL) return(NULL); if (insert == NULL) { @@ -832,6 +1032,7 @@ xmlDictQLookup(xmlDictPtr dict, const xmlChar *prefix, const xmlChar *name) { entry->len = len; entry->next = NULL; entry->valid = 1; + entry->okey = okey; if (insert != NULL) insert->next = entry; diff --git a/doc/APIchunk1.html b/doc/APIchunk1.html index bedf943..eacab4b 100644 --- a/doc/APIchunk1.html +++ b/doc/APIchunk1.html @@ -39,6 +39,7 @@ A:link, A:visited, A:active { text-decoration: underline } y-z

        Letter C:

        C14N
        xmlC14NDocSaveTo
        xmlC14NExecute
        +xmlC14NIsVisibleCallback
        CATALOG
        xmlLoadACatalog
        xmlLoadCatalog
        xmlLoadSGMLSuperCatalog
        @@ -108,6 +109,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlOutputOpenCallback
        xmlOutputWriteCallback
        xmlParserInputDeallocate
        +xmlRegExecCallbacks
        xmlSAX2ExternalSubset
        xmlSAX2InternalSubset
        xmlValidityErrorFunc
        diff --git a/doc/APIchunk10.html b/doc/APIchunk10.html index cbcc86b..94fd2fa 100644 --- a/doc/APIchunk10.html +++ b/doc/APIchunk10.html @@ -41,7 +41,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlURIEscapeStr
        a-zA-Z
        IS_ASCII_LETTER
        a-zA-Z0-9
        IS_PUBIDCHAR
        -
        a-zA-Z0-9_
        xmlParseVersionNum
        a@b
        xmlNanoFTPProxy
        abc
        xmlXPathTranslateFunction
        abc-
        xmlXPathTranslateFunction
        @@ -62,8 +61,6 @@ A:link, A:visited, A:active { text-decoration: underline } XML_SCHEMAS_ELEM_FINAL_ABSENT
        XML_SCHEMAS_TYPE_VARIETY_ABSENT
        absoluteURI
        xmlParseURI
        -xmlParseURIRaw
        -xmlParseURIReference
        abstract
        XML_SCHEMAS_ELEM_ABSTRACT
        XML_SCHEMAS_TYPE_ABSTRACT
        accept
        xmlExpMaxToken
        @@ -88,6 +85,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlMemSetup
        xmlNewMutex
        xmlNewRMutex
        +xmlSchemaValidCtxtGetParserCtxt
        accessed
        xmlTextReaderCurrentDoc
        xmlTextReaderCurrentNode
        accesses
        xmlCreateURLParserCtxt
        @@ -315,6 +313,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlKeepBlanksDefault
        xmlNewDocNode
        xmlNewDocNodeEatName
        +xmlParseVersionNum
        +xmlSchemaValidCtxtGetParserCtxt
        xmlSearchNs
        xmlShell
        xmlValidateNCName
        @@ -372,7 +372,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlReplaceNode
        xmlXPathNodeSetAddUnique
        xmlXPtrLocationSetAdd
        -
        also
        xmlCharEncodingOutputFunc
        +
        also
        _xmlEntity
        +xmlCharEncodingOutputFunc
        xmlCheckHTTPInput
        xmlCleanupParser
        xmlHasProp
        @@ -398,6 +399,7 @@ A:link, A:visited, A:active { text-decoration: underline }
        amd
        xmlCatalogIsEmpty
        amount
        INPUT_CHUNK
        _xmlParserInputBuffer
        +xmlMemDisplayLast
        xmlMemUsed
        xmlParserInputBufferGrow
        xmlParserInputBufferRead
        @@ -437,6 +439,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNamespaceParseNCName
        xmlNamespaceParseNSDef
        xmlNamespaceParseQName
        +xmlNewEntity
        anyway
        xmlRecoverDoc
        xmlRecoverFile
        xmlRecoverMemory
        diff --git a/doc/APIchunk11.html b/doc/APIchunk11.html index bcb58cf..7062e5e 100644 --- a/doc/APIchunk11.html +++ b/doc/APIchunk11.html @@ -56,8 +56,14 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNewEntityInputStream
        xmlNewInputFromFile
        xmlNewStringInputStream
        +xmlParseURI
        +xmlParseURIReference
        xmlRelaxNGNewValidCtxt
        xmlSchemaNewStringValue
        +xmlSchemaNewValidCtxt
        +xmlSchemaSAXPlug
        +xmlSchemaSAXUnplug
        +xmlSchemaValidateStream
        xmlSchematronNewValidCtxt
        xmlSetCompressMode
        xmlSetDocCompressMode
        @@ -142,6 +148,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlAutomataNewOnceTrans
        xmlAutomataNewOnceTrans2
        xmlCatalogSetDefaultPrefer
        +xmlMemDisplayLast
        xmlParseQuotedString
        xmlXPathDifference
        beyond
        xmlXPathStringFunction
        @@ -192,6 +199,7 @@ A:link, A:visited, A:active { text-decoration: underline }
        bracket
        xmlParseCharData
        branch
        xmlDOMWrapCloneNode
        xmlDOMWrapRemoveNode
        +xmlSchemaValidateOneElement
        break
        _xmlError
        xmlDOMWrapAdoptNode
        xmlDOMWrapCloneNode
        diff --git a/doc/APIchunk12.html b/doc/APIchunk12.html index 769619b..ff1be47 100644 --- a/doc/APIchunk12.html +++ b/doc/APIchunk12.html @@ -55,6 +55,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXPathSubValues
        xmlXPathValueFlipSign
        calls
        xlinkNodeDetectFunc
        +xmlSchemaSAXPlug
        xmlXPathAxisFunc
        came
        xmlPopInput
        cannot
        xmlParseAttribute
        @@ -769,6 +770,8 @@ A:link, A:visited, A:active { text-decoration: underline }
        corresponding
        xmlGetDocEntity
        xmlGetDtdEntity
        xmlGetParameterEntity
        +xmlOutputBufferCreateFilenameFunc
        +xmlParserInputBufferCreateFilenameFunc
        xmlSetProp
        xmlXPathTranslateFunction
        cost
        xmlByteConsumed
        @@ -788,7 +791,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlTextReaderSchemaValidateCtxt
        xmlTextReaderSetSchema
        xmlValidateDtd
        -
        count
        ftpListCallback
        +
        count
        _xmlEntity
        +ftpListCallback
        xmlExpRef
        xmlLsCountNode
        xmlSaveDoc
        @@ -849,12 +853,14 @@ A:link, A:visited, A:active { text-decoration: underline } xmlValidityErrorFunc
        xmlValidityWarningFunc
        cur
        xmlXPathAxisFunc
        +
        curent
        xmlC14NIsVisibleCallback
        currently
        XML_SCHEMAS_INCLUDING_CONVERT_NS
        xmlGcMemGet
        xmlMemBlocks
        xmlMemGet
        xmlMemUsed
        xmlOutputBufferCreateFilename
        +xmlSchemaValidateFile
        xmlXPathContextSetCache
        custom
        xmlDOMWrapAdoptNode
        xmlDOMWrapCloneNode
        diff --git a/doc/APIchunk13.html b/doc/APIchunk13.html index c86ff16..2e8417f 100644 --- a/doc/APIchunk13.html +++ b/doc/APIchunk13.html @@ -178,6 +178,7 @@ A:link, A:visited, A:active { text-decoration: underline } _xmlXPathContext
        xmlGetNsList
        xmlHandleEntity
        +xmlNewEntity
        xmlNewNs
        xmlNodeGetBase
        xmlParseBalancedChunkMemory
        @@ -248,6 +249,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlPatternMinDepth
        xmlTextReaderDepth
        deregistration
        xmlDeregisterNodeDefault
        +xmlDeregisterNodeFunc
        derivation
        XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION
        XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION
        xmlExpExpDerive
        @@ -301,6 +303,7 @@ A:link, A:visited, A:active { text-decoration: underline } htmlReadFd
        xmlCtxtReadFd
        xmlMemDisplay
        +xmlMemDisplayLast
        xmlMemShow
        xmlOutputBufferCreateFd
        xmlParserInputBufferCreateFd
        @@ -356,6 +359,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSAX2EndElementNs
        xmlSAX2Reference
        xmlSAX2StartElementNs
        +xmlSchemaIsValid
        detection
        docbCreatePushParserCtxt
        xlinkExtendedLinkFunk
        xlinkExtendedLinkSetFunk
        @@ -400,7 +404,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlTextReaderGetRemainder
        xmlTextReaderStandalone
        difference
        xmlXPathDifference
        -
        different
        xmlACatalogAdd
        +
        different
        _xmlBuffer
        +xmlACatalogAdd
        xmlBuildQName
        xmlCatalogAdd
        xmlNodeGetBase
        @@ -408,6 +413,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlStrQEqual
        differentiate
        xmlXPathOrderDocElems
        differently
        xmlTextReaderGetRemainder
        +
        differs
        xmlNewEntity
        digit
        xmlXPathStringFunction
        digits
        xmlXPathStringFunction
        dir
        xmlShellDir
        @@ -462,6 +468,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_SCHEMAS_ELEM_BLOCK_RESTRICTION
        XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION
        discard
        xmlParserInputRead
        +
        discarded
        xmlDeregisterNodeFunc
        discarding
        xmlParseAttValue
        xmlValidCtxtNormalizeAttributeValue
        xmlValidNormalizeAttributeValue
        @@ -526,6 +533,9 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXPathNodeTrailingSorted
        xmlXPathTrailing
        xmlXPathTrailingSorted
        +
        doing
        xmlOutputBufferCreateFilenameFunc
        +xmlParserInputBufferCreateFilenameFunc
        +xmlRegExecCallbacks
        don
        XML_SCHEMAS_ANY_LAX
        xlinkIsLink
        xmlCreatePushParserCtxt
        @@ -584,9 +594,11 @@ A:link, A:visited, A:active { text-decoration: underline } xmlDumpNotationDecl
        xmlDumpNotationTable
        xmlLsOneNode
        +xmlMemDisplayLast
        xmlMemShow
        xmlSnprintfElementContent
        xmlXPathDebugDumpObject
        +
        dumping
        xmlMemDisplayLast
        dumps
        xmlShellBase
        xmlShellCat
        xmlShellDir
        @@ -597,7 +609,9 @@ A:link, A:visited, A:active { text-decoration: underline }
        duplicates
        xmlSchemaCopyValue
        duration
        xmlSchemaGetCanonValue
        during
        xmlSAXDefaultVersion
        +xmlSchemaIsValid
        xmlSchemaNewDocParserCtxt
        +xmlSchemaSetValidOptions
        xmlSchematronNewDocParserCtxt
        dynamic
        LIBXML_MODULE_EXTENSION

        A-B diff --git a/doc/APIchunk14.html b/doc/APIchunk14.html index 61e35fc..0973657 100644 --- a/doc/APIchunk14.html +++ b/doc/APIchunk14.html @@ -186,6 +186,7 @@ A:link, A:visited, A:active { text-decoration: underline }
        ensuring
        xmlDOMWrapRemoveNode
        entire
        xmlCleanupInputCallbacks
        xmlCleanupOutputCallbacks
        +
        entites
        _xmlEntity
        entities:
        xmlParseEntityRef
        xmlParserHandleReference
        entproc
        xmlParserHandlePEReference
        @@ -321,7 +322,11 @@ A:link, A:visited, A:active { text-decoration: underline } xmlParseBalancedChunkMemoryRecover
        xmlTextWriterFullEndElement
        xmlXPathRoundFunction
        +
        event
        xmlSchemaSAXPlug
        +xmlSchemaSAXUnplug
        +xmlSchemaValidateStream
        events
        htmlSAXParseDoc
        +xmlSchemaValidateStream
        ever
        xmlExpCtxtNbCons
        everywhere
        xmlSAXParseFileWithData
        xmlSAXParseMemoryWithData
        diff --git a/doc/APIchunk15.html b/doc/APIchunk15.html index 03616a5..d8ac416 100644 --- a/doc/APIchunk15.html +++ b/doc/APIchunk15.html @@ -105,6 +105,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSAXParseMemoryWithData
        far
        _xmlParserCtxt
        fatalErrorSAXFunc
        +xmlSchemaIsValid
        fashion
        xmlNewRMutex
        fast
        htmlInitAutoClose
        faster
        htmlNodeStatus
        @@ -231,6 +232,9 @@ A:link, A:visited, A:active { text-decoration: underline } xmlStringLenGetNodeList
        floor
        xmlXPathFloorFunction
        flow
        xmlScanName
        +xmlSchemaSAXPlug
        +xmlSchemaSAXUnplug
        +xmlSchemaValidateStream
        flushed
        xmlTextWriterEndDocument
        flushes
        xmlOutputBufferClose
        xmlOutputBufferFlush
        @@ -316,12 +320,11 @@ A:link, A:visited, A:active { text-decoration: underline } htmlSAXParseFile
        xmlParseCtxtExternalEntity
        xmlParseExternalEntity
        +
        forward
        xmlSchemaValidateStream
        fptr
        XML_CAST_FPTR
        fragment
        _xmlURI
        xmlNewDocFragment
        xmlParseURI
        -xmlParseURIRaw
        -xmlParseURIReference
        xmlPushInput
        fragments
        xmlParseURIRaw
        freeing
        xmlCanonicPath
        @@ -392,8 +395,11 @@ A:link, A:visited, A:active { text-decoration: underline } xmlRelaxNGSetParserStructuredErrors
        xmlRelaxNGSetValidErrors
        xmlRelaxNGSetValidStructuredErrors
        +xmlSchemaGetValidErrors
        xmlSchemaSetParserErrors
        xmlSchemaSetParserStructuredErrors
        +xmlSchemaSetValidErrors
        +xmlSchemaSetValidStructuredErrors
        xmlSchematronSetValidStructuredErrors
        xmlShellCmd
        xmlSwitchEncoding
        @@ -407,6 +413,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlValidNormalizeAttributeValue
        xmlXIncludeSetFlags
        future
        _xmlDOMWrapCtxt
        +xmlSchemaValidateFile

        A-B C-C D-E diff --git a/doc/APIchunk17.html b/doc/APIchunk17.html index 548d945..633240e 100644 --- a/doc/APIchunk17.html +++ b/doc/APIchunk17.html @@ -144,6 +144,7 @@ A:link, A:visited, A:active { text-decoration: underline }
        included
        xmlC14NDocDumpMemory
        xmlC14NDocSave
        xmlC14NDocSaveTo
        +xmlC14NIsVisibleCallback
        xmlDocDumpMemory
        xmlFreeDoc
        xmlNanoHTTPContentLength
        @@ -201,6 +202,7 @@ A:link, A:visited, A:active { text-decoration: underline } nodePush
        xmlByteConsumed
        xmlParserFindNodeInfoIndex
        +xmlPushInput
        xmlStrsub
        xmlTextReaderByteConsumed
        xmlTextReaderGetAttributeNo
        @@ -236,6 +238,7 @@ A:link, A:visited, A:active { text-decoration: underline }
        indicating
        xmlParseCharData
        xmlParserFindNodeInfoIndex
        xmlShellCmd
        +xmlTextReaderErrorFunc
        xmlTextReaderNormalization
        xmlXPathAxisFunc
        indication
        xmlNanoFTPRead
        @@ -293,6 +296,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNewTextReader
        xmlRelaxNGGetParserErrors
        xmlSchemaGetParserErrors
        +xmlSchemaValidateStream
        xmlTextReaderByteConsumed
        xmlXPathOrderDocElems
        informations
        _xmlAttr
        @@ -317,6 +321,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlRelaxParserSetFlag
        xmlSAX2EndElementNs
        xmlSAX2StartElementNs
        +xmlSchemaGetValidErrors
        +xmlSchemaSetValidErrors
        xmlShellDir
        xmlXIncludeProcessNode
        informative
        _xmlError
        @@ -472,6 +478,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlRelaxNGNewDocParserCtxt
        xmlRemoveID
        xmlRemoveRef
        +xmlSchemaValidateFile
        xmlXPathContextSetCache
        interned
        xmlPatterncompile
        xmlTextReaderConstString
        diff --git a/doc/APIchunk18.html b/doc/APIchunk18.html index fcdce05..78b4480 100644 --- a/doc/APIchunk18.html +++ b/doc/APIchunk18.html @@ -125,6 +125,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlHashUpdateEntry2
        xmlHashUpdateEntry3
        xmlKeepBlanksDefault
        +xmlNewEntity
        xmlParseAttValue
        latest
        xmlNanoHTTPReturnCode
        layer
        xmlChildrenNode
        @@ -136,6 +137,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlRootNode
        xmlSaveFileTo
        xmlSaveFormatFileTo
        +xmlSchemaSAXPlug
        +xmlSchemaSAXUnplug
        leading
        xmlParseAttValue
        xmlParseElementChildrenContentDecl
        xmlParseElementMixedContentDecl
        @@ -152,6 +155,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXPathStringFunction
        left
        xmlExpNewOr
        xmlExpNewSeq
        +xmlMemDisplayLast
        xmlTextReaderGetRemainder
        legacy
        htmlNodeStatus
        len
        xmlBufferAdd
        @@ -194,6 +198,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlDebugDumpOneNode
        xmlNodeDump
        xmlNodeDumpOutput
        +xmlParseVersionNum
        xmlShellPwd
        xmlStreamPop
        xmlXPathDebugDumpCompExpr
        @@ -348,6 +353,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlCanonicPath
        xmlPathToURI
        xmlSAX2SetDocumentLocator
        +xmlTextReaderErrorFunc
        xmlTextReaderLocatorBaseURI
        xmlTextReaderLocatorLineNumber
        locators
        xlinkExtendedLinkFunk
        diff --git a/doc/APIchunk19.html b/doc/APIchunk19.html index a5db809..eccf3d3 100644 --- a/doc/APIchunk19.html +++ b/doc/APIchunk19.html @@ -51,6 +51,7 @@ A:link, A:visited, A:active { text-decoration: underline }
        main
        xmlIsMainThread
        maintained
        xmlRemoveID
        xmlRemoveRef
        +xmlSchemaSAXPlug
        major
        xmlDecodeEntities
        make
        xmlCreateEntitiesTable
        xmlNewNode
        @@ -72,7 +73,6 @@ A:link, A:visited, A:active { text-decoration: underline }
        manage
        xmlBufferWriteChar
        xmlBufferWriteQuotedString
        manages
        xmlBufferWriteCHAR
        -
        mandatory
        xmlParseTextDecl
        manipulated
        xmlNewRMutex
        manipulating
        xmlExpNewCtxt
        xmlLoadSGMLSuperCatalog
        @@ -185,6 +185,7 @@ A:link, A:visited, A:active { text-decoration: underline }
        memo
        getSystemId
        xmlSAX2GetSystemId
        memorylist
        xmlMemDisplay
        +xmlMemDisplayLast
        xmlMemoryDump
        merged
        xmlTextMerge
        merging
        xmlAddChild
        @@ -192,20 +193,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlAddNextSibling
        xmlAddPrevSibling
        xmlAddSibling
        -
        message
        _xmlError
        -errorSAXFunc
        -fatalErrorSAXFunc
        -warningSAXFunc
        -xmlGenericErrorFunc
        -xmlParserError
        -xmlParserValidityError
        -xmlParserValidityWarning
        -xmlParserWarning
        -xmlStrPrintf
        -xmlStrVPrintf
        -xmlValidityErrorFunc
        -xmlValidityWarningFunc
        -xmlXPatherror
        messages
        errorSAXFunc
        fatalErrorSAXFunc
        warningSAXFunc
        @@ -220,6 +207,8 @@ A:link, A:visited, A:active { text-decoration: underline } _xmlBuffer
        xmlNanoHTTPMethod
        xmlNanoHTTPMethodRedir
        +xmlOutputBufferCreateFilenameFunc
        +xmlParserInputBufferCreateFilenameFunc
        xmlRegisterHTTPPostCallbacks
        xmlSetBufferAllocationScheme
        xmlTextReaderClose
        @@ -251,7 +240,8 @@ A:link, A:visited, A:active { text-decoration: underline }
        mixed-content
        xmlParseElementMixedContentDecl
        mmap
        xmlParserInputBufferCreateStatic
        mod
        xmlXPathModValues
        -
        mode
        _xmlParserCtxt
        +
        mode
        _xmlBuffer
        +_xmlParserCtxt
        docbCreatePushParserCtxt
        htmlCreatePushParserCtxt
        xmlCreatePushParserCtxt
        diff --git a/doc/APIchunk2.html b/doc/APIchunk2.html index 214bf62..1923889 100644 --- a/doc/APIchunk2.html +++ b/doc/APIchunk2.html @@ -227,13 +227,11 @@ A:link, A:visited, A:active { text-decoration: underline }

        Letter E:

        ELEMENT
        _xmlElementContent
        EMPTY
        xmlParseElementContentDecl
        ENTITIES
        xmlParseAttributeType
        -xmlValidateAttributeValue
        xmlValidateDtdFinal
        ENTITY
        htmlParseEntityRef
        xmlParseAttributeType
        xmlParseEntityRef
        xmlParseEntityValue
        -xmlValidateAttributeValue
        xmlValidateDtdFinal
        ENTITY_REF
        xmlNodeBufGetContent
        xmlNodeGetContent
        @@ -322,7 +320,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlParsePEReference
        xmlParserHandlePEReference
        xmlParserHandleReference
        -xmlValidateAttributeValue
        xmlValidateOneAttribute
        xmlValidateOneNamespace
        EntityDecl
        xmlParseEntityDecl
        diff --git a/doc/APIchunk20.html b/doc/APIchunk20.html index 1f00aa3..3bd1894 100644 --- a/doc/APIchunk20.html +++ b/doc/APIchunk20.html @@ -73,6 +73,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlReconciliateNs
        naming
        xmlChildrenNode
        xmlRootNode
        +
        nbBytes
        xmlMemDisplayLast
        nbval
        xmlRegExecErrInfo
        xmlRegExecNextValues
        ncname
        xmlBuildQName
        @@ -120,10 +121,12 @@ A:link, A:visited, A:active { text-decoration: underline } xmlDOMWrapReconcileNamespaces
        xmlGetBufferAllocationScheme
        xmlLoadSGMLSuperCatalog
        +xmlNewEntity
        xmlNewNodeEatName
        xmlParseElementChildrenContentDecl
        xmlParseElementMixedContentDecl
        xmlReconciliateNs
        +xmlSchemaSAXPlug
        xmlSetBufferAllocationScheme
        xmlShellPwd
        xmlStrncat
        diff --git a/doc/APIchunk21.html b/doc/APIchunk21.html index 05eab1d..cff8e69 100644 --- a/doc/APIchunk21.html +++ b/doc/APIchunk21.html @@ -67,6 +67,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlHashCreateDict
        xmlListRemoveFirst
        xmlListRemoveLast
        +xmlTextReaderErrorFunc
        occurences
        xmlAutomataNewCountTrans
        xmlAutomataNewCountTrans2
        xmlAutomataNewOnceTrans
        @@ -233,6 +234,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlDOMWrapCloneNode
        xmlDOMWrapReconcileNamespaces
        xmlGetLineNo
        +xmlSchemaValidCtxtGetOptions
        options
        htmlCtxtUseOptions
        xmlCtxtUseOptions
        xmlDOMWrapRemoveNode
        @@ -241,6 +243,9 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSaveToFd
        xmlSaveToFilename
        xmlSaveToIO
        +xmlSchemaSetValidOptions
        +xmlSchemaValidCtxtGetOptions
        +xmlSchemaValidateFile
        xmlTextReaderSchemaValidateCtxt
        xmlTextReaderSetup
        xmlXPathContextSetCache
        @@ -272,6 +277,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlListMerge
        xmlParseEntityValue
        xmlParseURIRaw
        +xmlSchemaSAXPlug
        +xmlSchemaSAXUnplug
        xmlShellSave
        xmlStrcat
        xmlStrncat
        diff --git a/doc/APIchunk22.html b/doc/APIchunk22.html index 1fcc6c9..c84804c 100644 --- a/doc/APIchunk22.html +++ b/doc/APIchunk22.html @@ -170,7 +170,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlGcMemGet
        xmlMemGet
        xmlReplaceNode
        -
        places
        xmlStrPrintf
        +
        places
        xmlMemDisplayLast
        +xmlStrPrintf
        xmlStrVPrintf
        plug
        xmlXPathFuncLookupFunc
        xmlXPathVariableLookupFunc
        @@ -184,6 +185,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlReconciliateNs
        xmlRegExecErrInfo
        xmlRegExecNextValues
        +xmlSchemaSAXPlug
        +xmlSchemaSAXUnplug
        xmlValidGetValidElements
        points
        _xmlChRangeGroup
        pop
        xmlPopInput
        @@ -202,35 +205,6 @@ A:link, A:visited, A:active { text-decoration: underline }
        positioned
        xmlTextReaderReadString
        positionned
        xmlTextReaderReadAttributeValue
        positions
        xmlUTF8Strsub
        -
        positive
        UTF8ToHtml
        -UTF8Toisolat1
        -docbEncodeEntities
        -htmlEncodeEntities
        -isolat1ToUTF8
        -xmlBufferAdd
        -xmlBufferAddHead
        -xmlBufferCCat
        -xmlBufferCat
        -xmlCharEncodingInputFunc
        -xmlCharEncodingOutputFunc
        -xmlRelaxNGValidateDoc
        -xmlSchemaCheckFacet
        -xmlSchemaValPredefTypeNode
        -xmlSchemaValPredefTypeNodeNoNorm
        -xmlSchemaValidateFacet
        -xmlSchemaValidateFacetWhtsp
        -xmlSchemaValidateLengthFacet
        -xmlSchemaValidateLengthFacetWhtsp
        -xmlSchemaValidateListSimpleTypeFacet
        -xmlSchemaValidatePredefinedType
        -xmlTextReaderPreservePattern
        -xmlValidateNCName
        -xmlValidateNMToken
        -xmlValidateName
        -xmlValidateQName
        -xmlXPathBooleanFunction
        -xmlXPathFloorFunction
        -xmlXPathStringFunction
        possible
        xmlCopyNodeList
        xmlCreateEntityParserCtxt
        xmlParseDefaultDecl
        @@ -256,6 +230,7 @@ A:link, A:visited, A:active { text-decoration: underline }
        potential
        xmlDebugCheckDocument
        xmlValidGetPotentialChildren
        potentially
        _xmlURI
        +
        practice
        xmlParseVersionNum
        pre-interned
        _xmlParserCtxt
        preallocated
        xmlBuildQName
        precede
        xmlParseEntityRef
        @@ -281,6 +256,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlPatternStreamable
        xmlRegNewExecCtxt
        xmlRelaxNGNewValidCtxt
        +xmlSchemaNewValidCtxt
        xmlSchematronNewValidCtxt
        xmlTextReaderRelaxNGSetSchema
        xmlTextReaderSetSchema
        @@ -453,6 +429,32 @@ A:link, A:visited, A:active { text-decoration: underline }
        produced
        xmlCharEncodingOutputFunc
        xmlCurrentChar
        producing
        xmlCheckUTF8
        +
        production
        IS_BASECHAR
        +IS_BLANK
        +IS_BYTE_CHAR
        +IS_CHAR
        +IS_COMBINING
        +IS_DIGIT
        +IS_EXTENDER
        +IS_IDEOGRAPHIC
        +IS_LETTER
        +IS_PUBIDCHAR
        +xmlIsLetter
        +xmlParseAttributeType
        +xmlParseBalancedChunkMemory
        +xmlParseBalancedChunkMemoryRecover
        +xmlParseCharRef
        +xmlParseCtxtExternalEntity
        +xmlParseExtParsedEnt
        +xmlParseExternalEntity
        +xmlParseExternalID
        +xmlParseInNodeContext
        +xmlValidateNameValue
        +xmlValidateNamesValue
        +xmlValidateNmtokenValue
        +xmlValidateNmtokensValue
        +xmlXPathIdFunction
        +xmlXPathNormalizeFunction
        production:
        xmlCheckLanguageID
        productions
        xmlCheckLanguageID
        program
        xmlXPtrNewContext
        @@ -479,7 +481,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXPathIsNaN
        prolog
        xmlParseDocument
        prompt
        xmlShellReadlineFunc
        -
        proper
        xmlValidateAttributeValue
        properly
        xmlParseElementChildrenContentDecl
        xmlParseMarkupDecl
        xmlReconciliateNs
        @@ -521,6 +522,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlOutputMatchCallback
        xmlSaveFormatFile
        xmlSaveFormatFileEnc
        +xmlSchemaValidateStream
        xmlUTF8Strloc
        xmlUTF8Strpos
        provides
        endElementNsSAX2Func
        diff --git a/doc/APIchunk23.html b/doc/APIchunk23.html index 4d76cc6..b7b26c2 100644 --- a/doc/APIchunk23.html +++ b/doc/APIchunk23.html @@ -118,7 +118,8 @@ A:link, A:visited, A:active { text-decoration: underline }
        read-only
        xmlDictCreateSub
        readable
        xmlStrEqual
        reader-
        xmlTextReaderGetRemainder
        -
        reading
        xmlShell
        +
        reading
        xmlSchemaValidateStream
        +xmlShell
        ready
        INPUT_CHUNK
        xmlAutomataCompile
        realloc
        _xmlBuffer
        @@ -238,32 +239,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNewCharRef
        referenced
        xmlLinkGetData
        xmlParseAttValue
        -
        references
        XML_SCHEMAS_ATTRGROUP_HAS_REFS
        -XML_SCHEMAS_ATTR_INTERNAL_RESOLVED
        -XML_SCHEMAS_ELEM_CIRCULAR
        -XML_SCHEMAS_ELEM_INTERNAL_RESOLVED
        -htmlParseEntityRef
        -xmlGetRefs
        -xmlLoadSGMLSuperCatalog
        -xmlNewChild
        -xmlNewDocNode
        -xmlNewDocNodeEatName
        -xmlNodeAddContent
        -xmlNodeAddContentLen
        -xmlNodeBufGetContent
        -xmlNodeGetContent
        -xmlNodeSetContent
        -xmlNodeSetContentLen
        -xmlParseAttribute
        -xmlParseCharRef
        -xmlParseEntityRef
        -xmlParseMarkupDecl
        -xmlParsePEReference
        -xmlParseReference
        -xmlParseSDDecl
        -xmlParserHandlePEReference
        -xmlScanName
        -xmlSubstituteEntitiesDefault
        referencing
        xmlGetDocEntity
        xmlGetDtdEntity
        xmlGetParameterEntity
        @@ -305,7 +280,9 @@ A:link, A:visited, A:active { text-decoration: underline } xmlOutputBufferCreateFilenameDefault
        xmlParserInputBufferCreateFilenameDefault
        xmlRegisterNodeDefault
        +xmlRegisterNodeFunc
        regular
        LIBXML_REGEXP_ENABLED
        +xmlRegExecCallbacks
        xmlRegFreeExecCtxt
        xmlRegNewExecCtxt
        xmlRegexpCompile
        @@ -331,9 +308,9 @@ A:link, A:visited, A:active { text-decoration: underline } xmlTextReaderMoveToAttributeNo
        xmlUTF8Strloc
        xmlUTF8Strsub
        -
        relativeURI
        xmlParseURI
        -xmlParseURIRaw
        +
        relative-ref
        xmlParseURIRaw
        xmlParseURIReference
        +
        relativeURI
        xmlParseURI
        release
        xmlClearNodeInfoSeq
        xmlClearParserCtxt
        xmlDecodeEntities
        @@ -406,6 +383,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlHashUpdateEntry2
        xmlHashUpdateEntry3
        xmlNewTextChild
        +xmlSchemaSAXPlug
        xmlXPathTranslateFunction
        replacement
        xmlACatalogAdd
        xmlCatalogAdd
        @@ -453,6 +431,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlHasFeature
        xmlIsID
        xmlMallocFunc
        +xmlParserInputBufferCreateFilenameFunc
        xmlReallocFunc
        requests
        xmlRegisterHTTPPostCallbacks
        required
        XML_SCHEMAS_ATTR_USE_REQUIRED
        @@ -514,6 +493,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlRelaxNGFreeParserCtxt
        xmlRelaxNGFreeValidCtxt
        xmlSchemaFreeParserCtxt
        +xmlSchemaFreeValidCtxt
        xmlSchematronFreeParserCtxt
        xmlSchematronFreeValidCtxt
        xmlTextReaderClose
        @@ -522,13 +502,15 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNodeSetContentLen
        respect
        xmlExpStringDerive
        respecting
        xmlValidGetValidElements
        +
        responsability
        xmlNewEntity
        response
        xmlNanoFTPCheckResponse
        xmlNanoFTPGetResponse
        xmlNanoHTTPContentLength
        responsible
        xmlC14NDocDumpMemory
        xmlCanonicPath
        xmlPathToURI
        -
        restored
        xmlTextReaderSetErrorHandler
        +
        restored
        xmlSchemaSAXUnplug
        +xmlTextReaderSetErrorHandler
        xmlTextReaderSetStructuredErrorHandler
        restrict
        xmlParseExternalID
        restriction
        XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION
        @@ -636,6 +618,7 @@ A:link, A:visited, A:active { text-decoration: underline }
        running
        xmlKeepBlanksDefault
        runtime
        LIBXML_DEBUG_RUNTIME
        XML_MAX_NAMELEN
        +xmlMemDisplayLast

        A-B C-C D-E diff --git a/doc/APIchunk24.html b/doc/APIchunk24.html index 0a798e6..83f5111 100644 --- a/doc/APIchunk24.html +++ b/doc/APIchunk24.html @@ -128,8 +128,11 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSchemaGetFacetValueAsULong
        xmlSchemaGetValType
        xmlSchemaNewMemParserCtxt
        +xmlSchemaValidateDoc
        xmlSchemaValidateFacet
        xmlSchemaValidateFacetWhtsp
        +xmlSchemaValidateFile
        +xmlSchemaValidateStream
        xmlSchematronNewMemParserCtxt
        xmlTextReaderSchemaValidate
        xmlTextReaderSchemaValidateCtxt
        @@ -266,6 +269,7 @@ A:link, A:visited, A:active { text-decoration: underline }
        setting
        xmlSetGenericErrorFunc
        xmlXPathContextSetCache
        setups
        xmlParseEncodingDecl
        +
        severity
        xmlTextReaderErrorFunc
        sgmlsource
        getSystemId
        xmlSAX2GetSystemId
        shadowed
        xmlDOMWrapAdoptNode
        @@ -448,6 +452,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlCopyError
        xmlCtxtReadIO
        xmlNewTextReader
        +xmlParserInputBufferCreateFilenameFunc
        xmlReadIO
        xmlReaderForIO
        xmlReaderNewIO
        @@ -584,6 +589,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNewCharRef
        xmlNewTextWriterTree
        xmlSaveTree
        +xmlSchemaValidateOneElement
        xmlXPathOrderDocElems
        xmlXPathSubstringFunction
        xmlXPtrNewCollapsedRange
        @@ -674,6 +680,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlStrdup
        xmlStrdupFunc
        streamable
        xmlPatternStreamable
        +xmlSchemaValidateFile
        streaming
        xmlPatternGetStreamCtxt
        xmlStreamWantsAnyNode
        streams
        _xmlParserCtxt
        @@ -721,6 +728,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSchemaNewStringValue
        structured
        xmlRelaxNGSetValidStructuredErrors
        xmlSchemaSetParserStructuredErrors
        +xmlSchemaSetValidStructuredErrors
        xmlSchematronSetValidStructuredErrors
        xmlSetStructuredErrorFunc
        structures
        xmlFreeDoc
        @@ -793,6 +801,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlReconciliateNs
        xmlRelaxNGValidateFullElement
        xmlSaveTree
        +xmlSchemaValidateOneElement
        xmlShellDu
        xmlShellWrite
        xmlTextReaderExpand
        @@ -861,6 +870,8 @@ A:link, A:visited, A:active { text-decoration: underline }
        suffix
        LIBXML_MODULE_EXTENSION
        suggested
        _htmlElemDesc
        suitable
        xmlNewIOInputStream
        +xmlOutputBufferCreateFilenameFunc
        +xmlParserInputBufferCreateFilenameFunc
        xmlRegexpCompile
        sum
        xmlXPathSubstringFunction
        xmlXPathSumFunction
        diff --git a/doc/APIchunk25.html b/doc/APIchunk25.html index aa590d2..2dce6a0 100644 --- a/doc/APIchunk25.html +++ b/doc/APIchunk25.html @@ -216,6 +216,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlMutexLock
        xmlMutexUnlock
        xmlNewMutex
        +xmlRegExecCallbacks
        xmlRegExecPushString
        xmlRegExecPushString2
        token_r
        xmlNewRMutex
        @@ -400,6 +401,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlHasProp
        xmlLineNumbersDefault
        two
        _xmlParserCtxt
        +xmlMemDisplayLast
        xmlStrncatNew
        xmlTextMerge
        xmlUTF8Charcmp
        @@ -421,7 +423,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSchemaNewStringValue
        xmlSchemaValidateFacetWhtsp
        xmlStreamWantsAnyNode
        -
        typo
        xmlParseTextDecl

        A-B C-C D-E diff --git a/doc/APIchunk26.html b/doc/APIchunk26.html index ed2a00d..4fca766 100644 --- a/doc/APIchunk26.html +++ b/doc/APIchunk26.html @@ -107,6 +107,7 @@ A:link, A:visited, A:active { text-decoration: underline }
        unlinked
        xmlAddNextSibling
        xmlAddPrevSibling
        xmlAddSibling
        +xmlNewEntity
        xmlReplaceNode
        unload
        xmlModuleClose
        xmlModuleFree
        @@ -121,6 +122,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlParseEntityRef
        xmlParserHandleReference
        xmlSAX2UnparsedEntityDecl
        +
        unplug
        xmlSchemaSAXPlug
        unpredictable
        UTF8ToHtml
        UTF8Toisolat1
        docbEncodeEntities
        @@ -155,6 +157,7 @@ A:link, A:visited, A:active { text-decoration: underline } _xmlXPathContext
        xmlDOMWrapReconcileNamespaces
        xmlDOMWrapRemoveNode
        +xmlSchemaValidateFile
        xmlShellBase
        xmlShellCat
        xmlShellDir
        @@ -190,6 +193,7 @@ A:link, A:visited, A:active { text-decoration: underline } _xmlSchemaElement
        useful
        xmlGcMemGet
        xmlGcMemSetup
        +xmlMemDisplayLast
        xmlNewRMutex
        xmlParserInputBufferCreateStatic
        useless
        setDocumentLocator
        @@ -275,6 +279,7 @@ A:link, A:visited, A:active { text-decoration: underline }
        view
        xmlShell
        violated
        XML_CAST_FPTR
        visible
        xmlC14NExecute
        +xmlC14NIsVisibleCallback
        void
        XML_CAST_FPTR
        xmlSAXParseFileWithData
        xmlSAXParseMemoryWithData
        diff --git a/doc/APIchunk27.html b/doc/APIchunk27.html index d2272eb..d9fe323 100644 --- a/doc/APIchunk27.html +++ b/doc/APIchunk27.html @@ -62,9 +62,14 @@ A:link, A:visited, A:active { text-decoration: underline } xmlRelaxNGGetValidErrors
        xmlRelaxNGSetParserErrors
        xmlRelaxNGSetValidErrors
        +xmlRelaxNGValidityWarningFunc
        xmlSAX2InitDefaultSAXHandler
        xmlSchemaGetParserErrors
        +xmlSchemaGetValidErrors
        xmlSchemaSetParserErrors
        +xmlSchemaSetValidErrors
        +xmlSchemaValidityWarningFunc
        +xmlSchematronValidityWarningFunc
        xmlSearchNs
        xmlTextReaderSetErrorHandler
        xmlTextReaderSetStructuredErrorHandler
        @@ -115,6 +120,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlCheckLanguageID
        xmlKeepBlanksDefault
        xmlMemShow
        +xmlSchemaIsValid
        xmlXIncludeProcess
        xmlXIncludeProcessFlags
        xmlXIncludeProcessFlagsData
        @@ -143,6 +149,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNewNs
        xmlParseMarkupDecl
        xmlParseSDDecl
        +xmlTextReaderErrorFunc
        while
        xmlInitCharEncodingHandlers
        xmlParseAttributeType
        xmlParseEnumeratedType
        @@ -268,6 +275,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlIOFTPRead
        xmlIOHTTPRead
        xmlNewCharEncodingHandler
        +xmlOutputBufferCreateFilenameFunc
        xmlOutputBufferCreateIO
        xmlOutputWriteCallback
        xmlSaveToIO
        diff --git a/doc/APIchunk28.html b/doc/APIchunk28.html index bc198ee..5fbd28f 100644 --- a/doc/APIchunk28.html +++ b/doc/APIchunk28.html @@ -98,6 +98,7 @@ A:link, A:visited, A:active { text-decoration: underline }
        xml:space
        _xmlParserCtxt
        xmlNodeGetSpacePreserve
        xmlNodeSetSpacePreserve
        +
        xmlAddDocEntity
        xmlNewEntity
        xmlAttr
        attribute
        attributeSAXFunc
        xmlAttrPtr
        xmlCopyProp
        @@ -141,6 +142,7 @@ A:link, A:visited, A:active { text-decoration: underline }
        xmlDoc
        _xmlNs
        xmlDocCopyNodeList
        xmlCopyNodeList
        xmlDocNewPI
        xmlNewPI
        +
        xmlDocProperties
        _xmlDoc
        xmlDocPtr
        xmlCopyDoc
        xmlNewTextWriterDoc
        xmlNewTextWriterTree
        @@ -312,6 +314,7 @@ A:link, A:visited, A:active { text-decoration: underline }
        xmlOutputBufferClose
        xmlSaveFileTo
        xmlSaveFormatFileTo
        xmlOutputBufferPtr
        xmlNewTextWriter
        +xmlOutputBufferCreateFilenameFunc
        xmlOutputCloseCallback
        xmlRegisterOutputCallbacks
        xmlOutputMatchCallback
        xmlRegisterOutputCallbacks
        xmlOutputOpenCallback
        xmlRegisterOutputCallbacks
        @@ -336,6 +339,7 @@ A:link, A:visited, A:active { text-decoration: underline }
        xmlParserFindNodeInfoIndex
        xmlParserFindNodeInfoIndex
        xmlParserHandleReference
        xmlScanName
        xmlParserInputBufferPtr
        xmlNewTextReader
        +xmlParserInputBufferCreateFilenameFunc
        xmlTextReaderGetRemainder
        xmlTextReaderSetup
        xmlParserInputPtr
        resolveEntity
        @@ -401,12 +405,15 @@ A:link, A:visited, A:active { text-decoration: underline }
        xmlSAX2StartDocument
        startDocument
        xmlSAX2StartElement
        startElement
        xmlSAX2UnparsedEntityDecl
        unparsedEntityDecl
        +
        xmlSAXHandlerPtr
        xmlSchemaSAXPlug
        xmlSAXVersion
        xmlSAXDefaultVersion
        xmlSaveOptions
        xmlSaveToBuffer
        xmlSaveToFd
        xmlSaveToFilename
        xmlSaveToIO
        +
        xmlSchemaSAXPlug
        xmlSchemaSAXUnplug
        xmlSchemaValType
        xmlSchemaGetValType
        +
        xmlSchemaValidOption
        xmlSchemaSetValidOptions
        xmlSchematronValidOptions
        xmlSchematronNewValidCtxt
        xmlSetExternalEntityLoader
        resolveEntity
        resolveEntitySAXFunc
        diff --git a/doc/APIchunk3.html b/doc/APIchunk3.html index e8d2266..3f5646a 100644 --- a/doc/APIchunk3.html +++ b/doc/APIchunk3.html @@ -192,14 +192,12 @@ A:link, A:visited, A:active { text-decoration: underline } xmlParserInputBufferRead
        IDREF
        xmlParseAttributeType
        xmlValidateAttributeDecl
        -xmlValidateAttributeValue
        xmlValidateDocumentFinal
        xmlValidateDtd
        xmlValidateOneAttribute
        xmlValidateOneElement
        xmlValidateOneNamespace
        IDREFS
        xmlParseAttributeType
        -xmlValidateAttributeValue
        xmlValidateDocumentFinal
        IDREFs
        _xmlDoc
        IDs
        xmlXPathIdFunction
        diff --git a/doc/APIchunk4.html b/doc/APIchunk4.html index b954f38..924c236 100644 --- a/doc/APIchunk4.html +++ b/doc/APIchunk4.html @@ -182,9 +182,7 @@ A:link, A:visited, A:active { text-decoration: underline }
        NDataDecl
        xmlParseEntityDecl
        NDataDecl?
        xmlParseEntityDecl
        NMTOKEN
        xmlParseAttributeType
        -xmlValidateAttributeValue
        NMTOKENS
        xmlParseAttributeType
        -xmlValidateAttributeValue
        NMToken
        xmlValidateNMToken
        NOTATION
        xmlParseEnumeratedType
        xmlParseNotationType
        @@ -234,7 +232,6 @@ A:link, A:visited, A:active { text-decoration: underline }
        Names
        xmlParseAttributeType
        xmlParseName
        xmlScanName
        -xmlValidateAttributeValue
        xmlValidateNamesValue
        Namespace
        XML_XML_NAMESPACE
        _xmlElementContent
        @@ -251,11 +248,9 @@ A:link, A:visited, A:active { text-decoration: underline }
        Nmtoken
        xmlParseAttributeType
        xmlParseEnumerationType
        xmlParseNmtoken
        -xmlValidateAttributeValue
        xmlValidateNmtokenValue
        Nmtokens
        xmlParseAttributeType
        xmlParseNmtoken
        -xmlValidateAttributeValue
        xmlValidateNmtokensValue
        Node
        _xmlParserCtxt
        _xmlValidCtxt
        diff --git a/doc/APIchunk5.html b/doc/APIchunk5.html index 72067ed..0c4f510 100644 --- a/doc/APIchunk5.html +++ b/doc/APIchunk5.html @@ -153,6 +153,7 @@ A:link, A:visited, A:active { text-decoration: underline }
        People
        xmlEncodeEntities
        PhoneticExtensions
        xmlUCSIsPhoneticExtensions
        Please
        xmlNormalizeWindowsPath
        +
        Plug
        xmlSchemaSAXPlug
        Pointer
        xmlCheckUTF8
        Points
        xmlXPtrNewRangePoints
        Pop
        xmlRelaxNGValidatePopElement
        diff --git a/doc/APIchunk6.html b/doc/APIchunk6.html index 6e4a169..f598093 100644 --- a/doc/APIchunk6.html +++ b/doc/APIchunk6.html @@ -61,7 +61,6 @@ A:link, A:visited, A:active { text-decoration: underline }
        Query
        xmlDictSize
        xmlHashSize
        xmlStreamWantsAnyNode
        -
        Question:
        xmlParseTextDecl

        Letter R:

        REC
        IS_BASECHAR
        IS_COMBINING
        IS_DIGIT
        @@ -75,6 +74,8 @@ A:link, A:visited, A:active { text-decoration: underline }
        RFC
        xmlBuildURI
        xmlNodeGetBase
        xmlNormalizeURIPath
        +xmlParseURI
        +xmlParseURIReference
        RFC2396
        xmlURIEscape
        Raises
        xmlXPathSetArityError
        xmlXPathSetError
        @@ -176,6 +177,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlRelaxNGSetValidErrors
        xmlRelaxNGSetValidStructuredErrors
        xmlRelaxNGValidateDoc
        +xmlRelaxNGValidityErrorFunc
        +xmlRelaxNGValidityWarningFunc
        RelaxNG
        _xmlSchemaElement
        xmlRelaxNGCleanupTypes
        xmlRelaxNGDump
        diff --git a/doc/APIchunk7.html b/doc/APIchunk7.html index df878bf..f9550fc 100644 --- a/doc/APIchunk7.html +++ b/doc/APIchunk7.html @@ -50,6 +50,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSAX2InitDocbDefaultSAXHandler
        xmlSAX2InitHtmlDefaultSAXHandler
        xmlSAX2StartElementNs
        +xmlSchemaValidateStream
        SAX::substituteEntities
        xmlSubstituteEntitiesDefault
        SDDecl
        xmlParseSDDecl
        SDDecl?
        xmlParseXMLDecl
        @@ -119,10 +120,13 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSchemaNewDocParserCtxt
        xmlSchemaNewMemParserCtxt
        xmlSchemaNewParserCtxt
        +xmlSchemaNewValidCtxt
        Schematron
        LIBXML_SCHEMATRON_ENABLED
        xmlSchematronFree
        xmlSchematronParse
        xmlSchematronSetValidStructuredErrors
        +xmlSchematronValidityErrorFunc
        +xmlSchematronValidityWarningFunc
        Schematrons
        xmlSchematronNewDocParserCtxt
        xmlSchematronNewMemParserCtxt
        xmlSchematronNewParserCtxt
        @@ -163,13 +167,13 @@ A:link, A:visited, A:active { text-decoration: underline } xmlLinkGetData
        xmlParseNotationDecl
        xmlTextReaderByteConsumed
        -
        Seems
        xmlParseTextDecl
        Semi
        xmlRelaxParserSetFlag
        Send
        xmlNanoFTPQuit
        Serialize
        xmlAttrSerializeTxtContent
        xmlExpDump
        Sets
        htmlSetMetaEncoding
        xmlBufferSetAllocationScheme
        +xmlSchemaSetValidOptions
        xmlXPathDifference
        xmlXPathDistinct
        xmlXPathDistinctSorted
        @@ -205,12 +209,24 @@ A:link, A:visited, A:active { text-decoration: underline } xmlStringGetNodeList
        xmlStringLenGetNodeList
        Show
        xmlShellPwd
        -
        Signature
        xmlFreeFunc
        +
        Signature
        xmlC14NIsVisibleCallback
        +xmlDeregisterNodeFunc
        +xmlFreeFunc
        xmlGenericErrorFunc
        xmlMallocFunc
        +xmlOutputBufferCreateFilenameFunc
        +xmlParserInputBufferCreateFilenameFunc
        xmlReallocFunc
        +xmlRegisterNodeFunc
        +xmlRelaxNGValidityErrorFunc
        +xmlRelaxNGValidityWarningFunc
        +xmlSchemaValidityErrorFunc
        +xmlSchemaValidityWarningFunc
        +xmlSchematronValidityErrorFunc
        +xmlSchematronValidityWarningFunc
        xmlStrdupFunc
        xmlStructuredErrorFunc
        +xmlTextReaderErrorFunc
        Similarly
        xmlParseEntityRef
        Simply
        xmlCreateURI
        Since
        xmlStrcat
        diff --git a/doc/APIchunk8.html b/doc/APIchunk8.html index 316f827..10e852a 100644 --- a/doc/APIchunk8.html +++ b/doc/APIchunk8.html @@ -119,7 +119,6 @@ A:link, A:visited, A:active { text-decoration: underline }
        Thus:
        xmlXPathSubstringFunction
        Tibetan
        xmlUCSIsTibetan
        Token
        xmlParseAttributeType
        -xmlValidateAttributeValue
        xmlValidateNmtokenValue
        xmlValidateNmtokensValue
        xmlValidateOneAttribute
        @@ -222,6 +221,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlReplaceNode
        xmlUnlinkNode
        Unlinks
        xmlDOMWrapRemoveNode
        +
        Unplug
        xmlSchemaSAXUnplug
        Unregisters
        xmlCleanupEncodingAliases
        xmlDelEncodingAlias
        Update
        xmlNanoFTPUpdateURL
        diff --git a/doc/APIchunk9.html b/doc/APIchunk9.html index cf7f9d9..fb32180 100644 --- a/doc/APIchunk9.html +++ b/doc/APIchunk9.html @@ -41,9 +41,11 @@ A:link, A:visited, A:active { text-decoration: underline }
        Validate
        XML_SCHEMAS_ANY_LAX
        xmlRelaxNGValidateDoc
        xmlRelaxNGValidateFullElement
        +xmlSchemaValidateDoc
        +xmlSchemaValidateOneElement
        +xmlSchemaValidateStream
        xmlSchematronValidateDoc
        xmlShellValidate
        -xmlValidateAttributeValue
        xmlValidateNameValue
        xmlValidateNamesValue
        xmlValidateNmtokenValue
        @@ -60,7 +62,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlParseDefaultDecl
        xmlParseEnumerationType
        xmlParseNotationType
        -xmlValidateAttributeValue
        Variable
        xmlXPathVariableLookup
        xmlXPathVariableLookupNS
        VariationSelectors
        xmlUCSIsVariationSelectors
        @@ -154,6 +155,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlValidateOneElement
        xmlValidateOneNamespace
        xmlValidateRoot
        +
        XML-Schema
        xmlSchemaGetValidErrors
        XMLDecl
        xmlParseXMLDecl
        XMLDecl?
        xmlParseDocument
        XMLSchema
        xmlSchemaGetPredefinedType
        @@ -193,6 +195,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlStringLenDecodeEntities
        XML_xxx_yyy_ENTITY
        xmlAddDocEntity
        xmlAddDtdEntity
        +xmlNewEntity
        XMl-Schema
        xmlSchemaGetParserErrors
        XPATH
        xmlXPathFreeCompExpr
        XPATH_INVALID_ARITY
        xmlXPathSetArityError
        @@ -206,6 +209,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXPtrNewContext
        xmlXPtrRangeToFunction
        XSD
        xmlAutomataNewNegTrans
        +xmlSchemaValidityErrorFunc
        +xmlSchemaValidityWarningFunc
        xmlTextReaderSchemaValidate
        xmlTextReaderSchemaValidateCtxt
        xmlTextReaderSetSchema
        diff --git a/doc/APIconstructors.html b/doc/APIconstructors.html index 8ccc8a6..300fc03 100644 --- a/doc/APIconstructors.html +++ b/doc/APIconstructors.html @@ -318,6 +318,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlGetDtdEntity
        xmlGetParameterEntity
        xmlGetPredefinedEntity
        +xmlNewEntity
        xmlParseEntityRef
        xmlSAX2GetEntity
        xmlSAX2GetParameterEntity
        @@ -447,6 +448,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlCreatePushParserCtxt
        xmlCreateURLParserCtxt
        xmlNewParserCtxt
        +xmlSchemaValidCtxtGetParserCtxt

        Type xmlParserErrors:

        xmlParseInNodeContext

        Type xmlParserInputBufferCreateFilenameFunc:

        xmlParserInputBufferCreateFilenameDefault
        xmlThrDefParserInputBufferCreateFilenameDefault
        diff --git a/doc/APIfiles.html b/doc/APIfiles.html index 30d650a..479d244 100644 --- a/doc/APIfiles.html +++ b/doc/APIfiles.html @@ -405,6 +405,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlGetParameterEntity
        xmlGetPredefinedEntity
        xmlInitializePredefinedEntities
        +xmlNewEntity

        Module globals:

        _xmlGlobalState
        docbDefaultSAXHandler
        htmlDefaultSAXHandler
        @@ -601,6 +602,8 @@ A:link, A:visited, A:active { text-decoration: underline } XML_PARSE_DTDATTR
        XML_PARSE_DTDLOAD
        XML_PARSE_DTDVALID
        +XML_PARSE_HUGE
        +XML_PARSE_NOBASEFIX
        XML_PARSE_NOBLANKS
        XML_PARSE_NOCDATA
        XML_PARSE_NODICT
        @@ -610,6 +613,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_PARSE_NOWARNING
        XML_PARSE_NOXINCNODE
        XML_PARSE_NSCLEAN
        +XML_PARSE_OLD10
        XML_PARSE_PEDANTIC
        XML_PARSE_PUSH_DOM
        XML_PARSE_PUSH_SAX
        @@ -1283,12 +1287,21 @@ A:link, A:visited, A:active { text-decoration: underline } XML_BUFFER_ALLOC_DOUBLEIT
        XML_BUFFER_ALLOC_EXACT
        XML_BUFFER_ALLOC_IMMUTABLE
        +XML_BUFFER_ALLOC_IO
        XML_CDATA_SECTION_NODE
        XML_COMMENT_NODE
        XML_DOCB_DOCUMENT_NODE
        XML_DOCUMENT_FRAG_NODE
        XML_DOCUMENT_NODE
        XML_DOCUMENT_TYPE_NODE
        +XML_DOC_DTDVALID
        +XML_DOC_HTML
        +XML_DOC_INTERNAL
        +XML_DOC_NSVALID
        +XML_DOC_OLD10
        +XML_DOC_USERBUILT
        +XML_DOC_WELLFORMED
        +XML_DOC_XINCLUDE
        XML_DTD_NODE
        XML_ELEMENT_CONTENT_ELEMENT
        XML_ELEMENT_CONTENT_MULT
        @@ -1398,6 +1411,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlDocDumpMemoryEnc
        xmlDocFormatDump
        xmlDocGetRootElement
        +xmlDocProperties
        xmlDocPtr
        xmlDocSetRootElement
        xmlDtd
        @@ -1835,6 +1849,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_DTD_CONTENT_MODEL
        XML_DTD_CONTENT_NOT_DETERMINIST
        XML_DTD_DIFFERENT_PREFIX
        +XML_DTD_DUP_TOKEN
        XML_DTD_ELEM_DEFAULT_NAMESPACE
        XML_DTD_ELEM_NAMESPACE
        XML_DTD_ELEM_REDEFINED
        @@ -1963,11 +1978,13 @@ A:link, A:visited, A:active { text-decoration: underline } XML_ERR_TAG_NOT_FINISHED
        XML_ERR_UNDECLARED_ENTITY
        XML_ERR_UNKNOWN_ENCODING
        +XML_ERR_UNKNOWN_VERSION
        XML_ERR_UNPARSED_ENTITY
        XML_ERR_UNSUPPORTED_ENCODING
        XML_ERR_URI_FRAGMENT
        XML_ERR_URI_REQUIRED
        XML_ERR_VALUE_REQUIRED
        +XML_ERR_VERSION_MISMATCH
        XML_ERR_VERSION_MISSING
        XML_ERR_WARNING
        XML_ERR_XMLDECL_NOT_FINISHED
        @@ -2075,6 +2092,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_MODULE_CLOSE
        XML_MODULE_OPEN
        XML_NS_ERR_ATTRIBUTE_REDEFINED
        +XML_NS_ERR_COLON
        XML_NS_ERR_EMPTY
        XML_NS_ERR_QNAME
        XML_NS_ERR_UNDEFINED_NAMESPACE
        @@ -2581,6 +2599,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlMallocLoc
        xmlMemBlocks
        xmlMemDisplay
        +xmlMemDisplayLast
        xmlMemFree
        xmlMemGet
        xmlMemMalloc
        @@ -2849,6 +2868,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSchemaSetValidStructuredErrors
        xmlSchemaValidCtxt
        xmlSchemaValidCtxtGetOptions
        +xmlSchemaValidCtxtGetParserCtxt
        xmlSchemaValidCtxtPtr
        xmlSchemaValidError
        xmlSchemaValidOption
        diff --git a/doc/APIfunctions.html b/doc/APIfunctions.html index 9e83889..3cf9ced 100644 --- a/doc/APIfunctions.html +++ b/doc/APIfunctions.html @@ -59,6 +59,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlElemDump
        xmlLsOneNode
        xmlMemDisplay
        +xmlMemDisplayLast
        xmlMemShow
        xmlOutputBufferCreateFile
        xmlParserInputBufferCreateFile
        @@ -276,6 +277,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNewDocTextLen
        xmlNewDtd
        xmlNewElementContent
        +xmlNewEntity
        xmlNewGlobalNs
        xmlNewNode
        xmlNewNs
        @@ -577,6 +579,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSplitQName3
        xmlStringCurrentChar
        xmlValidGetPotentialChildren
        +

        Type long:

        xmlMemDisplayLast

        Type size_t:

        xmlBufferCreateSize
        xmlBufferCreateStatic
        xmlMallocAtomicLoc
        @@ -1161,6 +1164,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNewDocText
        xmlNewDocTextLen
        xmlNewDtd
        +xmlNewEntity
        xmlNewGlobalNs
        xmlNewReference
        xmlNewTextWriterTree
        @@ -1934,6 +1938,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSchemaSetValidOptions
        xmlSchemaSetValidStructuredErrors
        xmlSchemaValidCtxtGetOptions
        +xmlSchemaValidCtxtGetParserCtxt
        xmlSchemaValidateDoc
        xmlSchemaValidateFile
        xmlSchemaValidateOneElement
        diff --git a/doc/APIsymbols.html b/doc/APIsymbols.html index af09644..952abf5 100644 --- a/doc/APIsymbols.html +++ b/doc/APIsymbols.html @@ -146,6 +146,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_BUFFER_ALLOC_DOUBLEIT
        XML_BUFFER_ALLOC_EXACT
        XML_BUFFER_ALLOC_IMMUTABLE
        +XML_BUFFER_ALLOC_IO
        XML_C14N_CREATE_CTXT
        XML_C14N_CREATE_STACK
        XML_C14N_INVALID_NODE
        @@ -242,6 +243,14 @@ A:link, A:visited, A:active { text-decoration: underline } XML_DOCUMENT_FRAG_NODE
        XML_DOCUMENT_NODE
        XML_DOCUMENT_TYPE_NODE
        +XML_DOC_DTDVALID
        +XML_DOC_HTML
        +XML_DOC_INTERNAL
        +XML_DOC_NSVALID
        +XML_DOC_OLD10
        +XML_DOC_USERBUILT
        +XML_DOC_WELLFORMED
        +XML_DOC_XINCLUDE
        XML_DTD_ATTRIBUTE_DEFAULT
        XML_DTD_ATTRIBUTE_REDEFINED
        XML_DTD_ATTRIBUTE_VALUE
        @@ -249,6 +258,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_DTD_CONTENT_MODEL
        XML_DTD_CONTENT_NOT_DETERMINIST
        XML_DTD_DIFFERENT_PREFIX
        +XML_DTD_DUP_TOKEN
        XML_DTD_ELEM_DEFAULT_NAMESPACE
        XML_DTD_ELEM_NAMESPACE
        XML_DTD_ELEM_REDEFINED
        @@ -396,11 +406,13 @@ A:link, A:visited, A:active { text-decoration: underline } XML_ERR_TAG_NOT_FINISHED
        XML_ERR_UNDECLARED_ENTITY
        XML_ERR_UNKNOWN_ENCODING
        +XML_ERR_UNKNOWN_VERSION
        XML_ERR_UNPARSED_ENTITY
        XML_ERR_UNSUPPORTED_ENCODING
        XML_ERR_URI_FRAGMENT
        XML_ERR_URI_REQUIRED
        XML_ERR_VALUE_REQUIRED
        +XML_ERR_VERSION_MISMATCH
        XML_ERR_VERSION_MISSING
        XML_ERR_WARNING
        XML_ERR_XMLDECL_NOT_FINISHED
        @@ -529,6 +541,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_NAMESPACE_DECL
        XML_NOTATION_NODE
        XML_NS_ERR_ATTRIBUTE_REDEFINED
        +XML_NS_ERR_COLON
        XML_NS_ERR_EMPTY
        XML_NS_ERR_QNAME
        XML_NS_ERR_UNDEFINED_NAMESPACE
        @@ -564,6 +577,8 @@ A:link, A:visited, A:active { text-decoration: underline } XML_PARSE_DTDATTR
        XML_PARSE_DTDLOAD
        XML_PARSE_DTDVALID
        +XML_PARSE_HUGE
        +XML_PARSE_NOBASEFIX
        XML_PARSE_NOBLANKS
        XML_PARSE_NOCDATA
        XML_PARSE_NODICT
        @@ -573,6 +588,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_PARSE_NOWARNING
        XML_PARSE_NOXINCNODE
        XML_PARSE_NSCLEAN
        +XML_PARSE_OLD10
        XML_PARSE_PEDANTIC
        XML_PARSE_PUSH_DOM
        XML_PARSE_PUSH_SAX
        @@ -1908,6 +1924,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlDocDumpMemoryEnc
        xmlDocFormatDump
        xmlDocGetRootElement
        +xmlDocProperties
        xmlDocPtr
        xmlDocSetRootElement
        xmlDtd
        @@ -2206,6 +2223,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlMallocLoc
        xmlMemBlocks
        xmlMemDisplay
        +xmlMemDisplayLast
        xmlMemFree
        xmlMemGet
        xmlMemMalloc
        @@ -2290,6 +2308,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNewDocTextLen
        xmlNewDtd
        xmlNewElementContent
        +xmlNewEntity
        xmlNewEntityInputStream
        xmlNewGlobalNs
        xmlNewIOInputStream
        @@ -2747,6 +2766,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSchemaValType
        xmlSchemaValidCtxt
        xmlSchemaValidCtxtGetOptions
        +xmlSchemaValidCtxtGetParserCtxt
        xmlSchemaValidCtxtPtr
        xmlSchemaValidError
        xmlSchemaValidOption
        diff --git a/doc/FAQ.html b/doc/FAQ.html index 3b43432..6454942 100644 --- a/doc/FAQ.html +++ b/doc/FAQ.html @@ -217,9 +217,11 @@ pnode=pxmlDoc->children->children; and libxml2, but you need to install a more recent version: libxml(-devel) >= 1.8.8 or libxml2(-devel) >= 2.1.0

        -
      3. XPath implementation looks seriously broken -

        XPath implementation prior to 2.3.0 was really incomplete. Upgrade to - a recent version, there are no known bugs in the current version.

        +
      4. Random crashes in threaded applications +

        Read and follow all advices on the thread + safety page, and make 100% sure you never call xmlCleanupParser() + while the library or an XML document might still be in use by another + thread.

      5. The example provided in the web page does not compile.

        It's hard to maintain the documentation in sync with the code @@ -235,16 +237,8 @@ pnode=pxmlDoc->children->children; generated doc

      6. have a look at the set of examples.
      7. -
      8. look for examples of use for libxml2 function using the Gnome code. - -
      9. +
      10. look for examples of use for libxml2 function using the Gnome code + or by asking on Google.
      11. Browse the libxml2 source , I try to write code as clean and documented as possible, so looking at it may be helpful. In particular the code @@ -261,12 +255,6 @@ pnode=pxmlDoc->children->children;

        Website: http://libxmlplusplus.sourceforge.net/

        Download: http://sourceforge.net/project/showfiles.php?group_id=12999

      12. -
      13. How to validate a document a posteriori ?

        It is possible to validate documents which had not been validated at diff --git a/doc/Makefile.in b/doc/Makefile.in index 2310c52..62f96dc 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -460,8 +460,8 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS @@ -486,8 +486,8 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ @@ -497,13 +497,12 @@ ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ - here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique diff --git a/doc/apibuild.py b/doc/apibuild.py index 1e73725..3c38061 100755 --- a/doc/apibuild.py +++ b/doc/apibuild.py @@ -51,6 +51,7 @@ ignored_files = { "tst.c": "not part of the library", "test.c": "not part of the library", "testdso.c": "test for dynamid shared libraries", + "testrecurse.c": "test for entities recursions", } ignored_words = { @@ -356,7 +357,7 @@ class index: self.analyze_dict("structs", self.structs) self.analyze_dict("typedefs", self.typedefs) self.analyze_dict("macros", self.macros) - + class CLexer: """A lexer for the C language, tokenize the input by reading and analyzing it line by line""" @@ -388,7 +389,7 @@ class CLexer: else: line = line + n return line - + def getlineno(self): return self.lineno @@ -557,12 +558,12 @@ class CLexer: else: break self.tokens.append(('name', line[s:i])) - + tok = self.tokens[0] self.tokens = self.tokens[1:] self.last = tok return tok - + class CParser: """The C module parser""" def __init__(self, filename, idx = None): @@ -717,7 +718,7 @@ class CParser: l = string.strip(l) desc = desc + " " + l del lines[0] - + desc = string.strip(desc) if quiet == 0: @@ -787,7 +788,7 @@ class CParser: l = string.strip(l) desc = desc + " " + l del lines[0] - + desc = string.strip(desc) if quiet == 0: @@ -888,7 +889,7 @@ class CParser: else: desc = desc + " " + l del lines[0] - + retdesc = string.strip(retdesc) desc = string.strip(desc) @@ -898,7 +899,8 @@ class CParser: # i = 0 while i < nbargs: - if args[i][2] == None and args[i][0] != "void" and args[i][1] != None: + if args[i][2] == None and args[i][0] != "void" and \ + ((args[i][1] != None) or (args[i][1] == '')): self.warning("Function comment for %s lacks description of arg %s" % (name, args[i][1])) i = i + 1 if retdesc == "" and ret[0] != "void": @@ -906,7 +908,6 @@ class CParser: if desc == "": self.warning("Function comment for %s lacks description of the function" % (name)) - return(((ret[0], retdesc), args, desc)) def parsePreproc(self, token): @@ -966,7 +967,7 @@ class CParser: try: self.defines.append(apstr) if string.find(apstr, 'ENABLED') != -1: - self.conditionals.append("defined(%s)" % apstr) + self.conditionals.append("defined(%s)" % apstr) except: pass elif name == "#ifndef": @@ -974,7 +975,7 @@ class CParser: try: self.defines.append(apstr) if string.find(apstr, 'ENABLED') != -1: - self.conditionals.append("!defined(%s)" % apstr) + self.conditionals.append("!defined(%s)" % apstr) except: pass elif name == "#if": @@ -1096,7 +1097,7 @@ class CParser: return token token = self.token() return token - + # # Parse a C code block, used for functions it parse till # the balancing } included @@ -1131,7 +1132,7 @@ class CParser: elif oldtok[0] == "name" and oldtok[1][0:7] == "LIBXML_": self.index_add_ref(oldtok[1], self.filename, 0, "typedef") - + else: token = self.token() return token @@ -1264,7 +1265,7 @@ class CParser: if token == None: return token - while token[0] == "name" and ( + while token[0] == "name" and ( token[1] == "const" or \ token[1] == "unsigned" or \ token[1] == "signed"): @@ -1284,7 +1285,7 @@ class CParser: self.type = tmp[1] else: self.type = self.type + " " + tmp[1] - + elif token[0] == "name" and token[1] == "struct": if self.type == "": self.type = token[1] @@ -1574,7 +1575,7 @@ class CParser: token = self.token() else: break - + return token def parse(self): @@ -1590,7 +1591,7 @@ class CParser: return self.parseTopComment(self.top_comment) return self.index - + class docBuilder: """A documentation builder""" @@ -1687,7 +1688,7 @@ class docBuilder: self.headers[file] = None; self.scanHeaders() self.scanModules() - + def modulename_file(self, file): module = os.path.basename(file) if module[-2:] == '.h': @@ -1781,7 +1782,7 @@ class docBuilder: else: output.write(" \n" % ( name, self.modulename_file(id.header))) - + def serialize_function(self, output, name): id = self.idx.functions[name] if name == debugsym: @@ -1802,6 +1803,11 @@ class docBuilder: output.write(" %s\n"% (apstr)); try: (ret, params, desc) = id.info + if (desc == None or desc == '') and \ + name[0:9] != "xmlThrDef" and name != "xmlDllMain": + print "%s %s from %s has no description" % (id.type, name, + self.modulename_file(id.module)) + output.write(" %s\n" % (escape(desc))) self.indexString(name, desc) if ret[0] != None: diff --git a/doc/devhelp/Makefile.in b/doc/devhelp/Makefile.in index 169521d..1257ad4 100644 --- a/doc/devhelp/Makefile.in +++ b/doc/devhelp/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. diff --git a/doc/devhelp/libxml2-c14n.html b/doc/devhelp/libxml2-c14n.html index 72f53b6..e60f229 100644 --- a/doc/devhelp/libxml2-c14n.html +++ b/doc/devhelp/libxml2-c14n.html @@ -57,8 +57,8 @@ int xmlC14NDocDumpMemory (

        +

        Signature for a C14N callback on visible nodes

        +
        user_data:user data
        node:the curent node
        parent:the parent node
        Returns:1 if the node should be included

        xmlC14NDocDumpMemory ()

        int	xmlC14NDocDumpMemory		(xmlDocPtr doc, 
        xmlNodeSetPtr nodes,
        int exclusive,
        xmlChar ** inclusive_ns_prefixes,
        int with_comments,
        xmlChar ** doc_txt_ptr)

        Dumps the canonized image of given XML document into memory. For details see "Canonical XML" (http://www.w3.org/TR/xml-c14n) or "Exclusive XML Canonicalization" (http://www.w3.org/TR/xml-exc-c14n)

        diff --git a/doc/devhelp/libxml2-entities.html b/doc/devhelp/libxml2-entities.html index cd1e9a8..0d0effb 100644 --- a/doc/devhelp/libxml2-entities.html +++ b/doc/devhelp/libxml2-entities.html @@ -47,6 +47,7 @@ typedef struct _xmlHashTable xmlEntitiesTable; typedef xmlEntitiesTable * xmlEntitiesTablePtr; xmlEntityPtr xmlAddDocEntity (xmlDocPtr doc,
        const xmlChar * name,
        int type,
        const xmlChar * ExternalID,
        const xmlChar * SystemID,
        const xmlChar * content); +xmlEntityPtr xmlNewEntity (xmlDocPtr doc,
        const xmlChar * name,
        int type,
        const xmlChar * ExternalID,
        const xmlChar * SystemID,
        const xmlChar * content); xmlChar * xmlEncodeEntitiesReentrant (xmlDocPtr doc,
        const xmlChar * input); xmlEntityPtr xmlGetDocEntity (xmlDocPtr doc,
        const xmlChar * name); xmlEntityPtr xmlGetDtdEntity (xmlDocPtr doc,
        const xmlChar * name); @@ -155,6 +156,10 @@ The content of this structure is not made public by the API.

        Set up the predefined entities. Deprecated call


        +

        xmlNewEntity ()

        xmlEntityPtr	xmlNewEntity		(xmlDocPtr doc, 
        const xmlChar * name,
        int type,
        const xmlChar * ExternalID,
        const xmlChar * SystemID,
        const xmlChar * content)
        +

        Create a new entity, this differs from xmlAddDocEntity() that if the document is NULL or has no internal subset defined, then an unlinked entity structure will be returned, it is then the responsability of the caller to link it to the document later or free it when not needed anymore.

        +
        doc:the document
        name:the entity name
        type:the entity type XML_xxx_yyy_ENTITY
        ExternalID:the entity external ID if available
        SystemID:the entity system ID if available
        content:the entity content
        Returns:a pointer to the entity or NULL in case of error
        +
        diff --git a/doc/devhelp/libxml2-globals.html b/doc/devhelp/libxml2-globals.html index c7f396e..449049e 100644 --- a/doc/devhelp/libxml2-globals.html +++ b/doc/devhelp/libxml2-globals.html @@ -125,20 +125,20 @@ const char * xmlThrDefTreeIndentString
        +

        Signature for the deregistration callback of a discarded node

        +
        node:the current node

        Function type xmlOutputBufferCreateFilenameFunc

        xmlOutputBufferPtr	xmlOutputBufferCreateFilenameFunc	(const char * URI, 
        xmlCharEncodingHandlerPtr encoder,
        int compression)
        -

        -

        URI:
        encoder:
        compression:
        Returns:
        +

        Signature for the function doing the lookup for a suitable output method corresponding to an URI.

        +
        URI:the URI to write to
        encoder:
        compression:
        Returns:the new xmlOutputBufferPtr in case of success or NULL if no method was found.

        Function type xmlParserInputBufferCreateFilenameFunc

        xmlParserInputBufferPtr	xmlParserInputBufferCreateFilenameFunc	(const char * URI, 
        xmlCharEncoding enc)
        -

        -

        URI:
        enc:
        Returns:
        +

        Signature for the function doing the lookup for a suitable input method corresponding to an URI.

        +
        URI:the URI to read from
        enc:the requested source encoding
        Returns:the new xmlParserInputBufferPtr in case of success or NULL if no method was found.

        +

        Signature for the registration callback of a created node

        +
        node:the current node

        Variable docbDefaultSAXHandler

        xmlSAXHandlerV1 docbDefaultSAXHandler;
         

        diff --git a/doc/devhelp/libxml2-parser.html b/doc/devhelp/libxml2-parser.html index 76b4967..ea0697f 100644 --- a/doc/devhelp/libxml2-parser.html +++ b/doc/devhelp/libxml2-parser.html @@ -302,7 +302,10 @@ void xmlSetExternalEntityLoader (XML_PARSE_NSCLEAN = 8192 /* remove redundant namespaces declarations */ XML_PARSE_NOCDATA = 16384 /* merge CDATA as text nodes */ XML_PARSE_NOXINCNODE = 32768 /* do not generate XINCLUDE START/END nodes */ - XML_PARSE_COMPACT = 65536 /* compact small text nodes; no modification of the tree allowed afterwards (will possibly crash if you try to modify the tree) */ + XML_PARSE_COMPACT = 65536 /* compact small text nodes; no modification of the tree allowed afterwards (will possibly crash if you try to modify the tree) */ + XML_PARSE_OLD10 = 131072 /* parse using XML-1.0 before update 5 */ + XML_PARSE_NOBASEFIX = 262144 /* do not fixup XINCLUDE xml:base uris */ + XML_PARSE_HUGE = 524288 /* relax any hardcoded limit from the parser */ };

        diff --git a/doc/devhelp/libxml2-parserInternals.html b/doc/devhelp/libxml2-parserInternals.html index 1e575f8..cdae32e 100644 --- a/doc/devhelp/libxml2-parserInternals.html +++ b/doc/devhelp/libxml2-parserInternals.html @@ -139,7 +139,7 @@ int xmlParseElementContentDecl (xmlParserInputPtr inputPop (xmlParserCtxtPtr ctxt); xmlChar xmlPopInput (xmlParserCtxtPtr ctxt); xmlChar * xmlParsePubidLiteral (xmlParserCtxtPtr ctxt); -void xmlPushInput (xmlParserCtxtPtr ctxt,
        xmlParserInputPtr input); +int xmlPushInput (xmlParserCtxtPtr ctxt,
        xmlParserInputPtr input); xmlChar * xmlParseEntityValue (xmlParserCtxtPtr ctxt,
        xmlChar ** orig); xmlChar * xmlDecodeEntities (xmlParserCtxtPtr ctxt,
        int len,
        int what,
        xmlChar end,
        xmlChar end2,
        xmlChar end3); xmlChar * xmlParseVersionNum (xmlParserCtxtPtr ctxt); @@ -316,7 +316,7 @@ void xmlParseEntityDecl (

        inputPush ()

        int	inputPush			(xmlParserCtxtPtr ctxt, 
        xmlParserInputPtr value)

        Pushes a new parser input on top of the input stack

        -
        ctxt:an XML parser context
        value:the parser input
        Returns:0 in case of error, the index in the stack otherwise
        +
        ctxt:an XML parser context
        value:the parser input
        Returns:-1 in case of error, the index in the stack otherwise

        namePop ()

        const xmlChar *	namePop			(xmlParserCtxtPtr ctxt)

        Pops the top element name from the name stack

        @@ -332,7 +332,7 @@ void xmlParseEntityDecl (

        nodePush ()

        int	nodePush			(xmlParserCtxtPtr ctxt, 
        xmlNodePtr value)

        Pushes a new element node on top of the node stack

        -
        ctxt:an XML parser context
        value:the element node
        Returns:0 in case of error, the index in the stack otherwise
        +
        ctxt:an XML parser context
        value:the element node
        Returns:-1 in case of error, the index in the stack otherwise

        xmlCheckLanguageID ()

        int	xmlCheckLanguageID		(const xmlChar * lang)

        Checks that the value conforms to the LanguageID production: NOTE: this is somewhat deprecated, those productions were removed from the XML Second edition. [33] LanguageID ::= Langcode ('-' Subcode)* [34] Langcode ::= ISO639Code | IanaCode | UserCode [35] ISO639Code ::= ([a-z] | [A-Z]) ([a-z] | [A-Z]) [36] IanaCode ::= ('i' | 'I') '-' ([a-z] | [A-Z])+ [37] UserCode ::= ('x' | 'X') '-' ([a-z] | [A-Z])+ [38] Subcode ::= ([a-z] | [A-Z])+

        @@ -587,7 +587,7 @@ void xmlParseEntityDecl (
        ctxt:an XML parser context
        Returns:the SystemLiteral parsed or NULL

        xmlParseTextDecl ()

        void	xmlParseTextDecl		(xmlParserCtxtPtr ctxt)
        -

        parse an XML declaration header for external entities [77] TextDecl ::= '<?xml' VersionInfo? EncodingDecl S? '?>' Question: Seems that EncodingDecl is mandatory ? Is that a typo ?

        +

        parse an XML declaration header for external entities [77] TextDecl ::= '<?xml' VersionInfo? EncodingDecl S? '?>'

        ctxt:an XML parser context


        xmlParseVersionNum ()

        xmlChar *	xmlParseVersionNum	(xmlParserCtxtPtr ctxt)
        -

        parse the XML version value. [26] VersionNum ::= ([a-zA-Z0-9_.:] | '-')+

        +

        parse the XML version value. [26] VersionNum ::= '1.' [0-9]+ In practice allow [0-9].[0-9]+ at that level

        ctxt:an XML parser context
        Returns:the string giving the XML version number, or NULL


        -

        xmlPushInput ()

        void	xmlPushInput			(xmlParserCtxtPtr ctxt, 
        xmlParserInputPtr input)
        +

        xmlPushInput ()

        int	xmlPushInput			(xmlParserCtxtPtr ctxt, 
        xmlParserInputPtr input)

        xmlPushInput: switch to a new input stream which is stacked on top of the previous one(s).

        -
        ctxt:an XML parser context
        input:an XML parser input fragment (entity, XML fragment ...).
        +
        ctxt:an XML parser context
        input:an XML parser input fragment (entity, XML fragment ...).
        Returns:-1 in case of error or the index in the input stack

        xmlScanName ()

        xmlChar *	xmlScanName		(xmlParserCtxtPtr ctxt)

        Trickery: parse an XML name but without consuming the input flow Needed for rollback cases. Used only when parsing entities references. TODO: seems deprecated now, only used in the default part of xmlParserHandleReference [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender [5] Name ::= (Letter | '_' | ':') (NameChar)* [6] Names ::= Name (S Name)*

        diff --git a/doc/devhelp/libxml2-relaxng.html b/doc/devhelp/libxml2-relaxng.html index d7da3e5..a89b58f 100644 --- a/doc/devhelp/libxml2-relaxng.html +++ b/doc/devhelp/libxml2-relaxng.html @@ -169,12 +169,12 @@ The content of this structure is not made public by the API.

        +

        Signature of an error callback from a Relax-NG validation

        +
        ctx:the validation context
        msg:the message
        ...:extra arguments

        +

        Signature of a warning callback from a Relax-NG validation

        +
        ctx:the validation context
        msg:the message
        ...:extra arguments


        +

        Signature of an error callback from a Schematron validation

        +
        ctx:the validation context
        msg:the message
        ...:extra arguments

        +

        Signature of a warning callback from a Schematron validation

        +
        ctx:the validation context
        msg:the message
        ...:extra arguments

        xmlSchematronFree ()

        void	xmlSchematronFree		(xmlSchematronPtr schema)

        Deallocate a Schematron structure.

        diff --git a/doc/devhelp/libxml2-tree.html b/doc/devhelp/libxml2-tree.html index d5879f5..188d43b 100644 --- a/doc/devhelp/libxml2-tree.html +++ b/doc/devhelp/libxml2-tree.html @@ -96,6 +96,7 @@ typedef struct _xmlOutputBuffer xmlOutputBuffer; typedef struct _xmlSAXLocator xmlSAXLocator; typedef xmlElementContent * xmlElementContentPtr; typedef enum xmlElementContentType; +typedef enum xmlDocProperties; typedef xmlID * xmlIDPtr; typedef struct _xmlDtd xmlDtd; typedef struct _xmlAttribute xmlAttribute; @@ -369,14 +370,16 @@ void xmlFreeNsList (xmlBufferAllocationScheme alloc : The realloc method + xmlChar * contentIO : in IO mode we may have a different base } xmlBuffer;


        Enum xmlBufferAllocationScheme

        enum xmlBufferAllocationScheme {
        -    XML_BUFFER_ALLOC_DOUBLEIT = 1
        -    XML_BUFFER_ALLOC_EXACT = 2
        -    XML_BUFFER_ALLOC_IMMUTABLE = 3
        +    XML_BUFFER_ALLOC_DOUBLEIT = 1 /* double each time one need to grow */
        +    XML_BUFFER_ALLOC_EXACT = 2 /* grow only to the minimal size */
        +    XML_BUFFER_ALLOC_IMMUTABLE = 3 /* immutable buffer */
        +    XML_BUFFER_ALLOC_IO = 4 /*  special allocation scheme used for I/O */
         };
         

        @@ -421,8 +424,23 @@ void xmlFreeNsList (xmlCharEncoding struct _xmlDict * dict : dict used to allocate names or NULL void * psvi : for type/PSVI informations + int parseFlags : set of xmlParserOption used to parse the document + int properties : set of xmlDocProperties for this document set at the end of parsing } xmlDoc;

        + +


        +

        Enum xmlDocProperties

        enum xmlDocProperties {
        +    XML_DOC_WELLFORMED = 1 /* document is XML well formed */
        +    XML_DOC_NSVALID = 2 /* document is Namespace valid */
        +    XML_DOC_OLD10 = 4 /* parsed with old XML-1.0 parser */
        +    XML_DOC_DTDVALID = 8 /* DTD validation was successful */
        +    XML_DOC_XINCLUDE = 16 /* XInclude substitution was done */
        +    XML_DOC_USERBUILT = 32 /* Document was built using the API and not by parsing an instance */
        +    XML_DOC_INTERNAL = 64 /* built for internal processing */
        +    XML_DOC_HTML = 128 /*  parsed or built HTML document */
        +};
        +


        Typedef xmlDocPtr

        xmlDoc * xmlDocPtr;
        @@ -567,7 +585,7 @@ void	xmlFreeNsList			(xmlChar *	URI	: the full URI as computed
             int	owner	: does the entity own the childrens
        -    int	checked	: was the entity content checked
        +    int	checked	: was the entity content checked this is also used to count entites * r
         } xmlEntity;
         

        @@ -757,6 +775,8 @@ void xmlFreeNsList (xmlAttrPtr freeAttrs : * the complete error informations for the last error. * xmlError lastError xmlParserMode parseMode : the parser mode + unsigned long nbentities : number of entities references + unsigned long sizeentities : size of parsed entities } xmlParserCtxt;

        diff --git a/doc/devhelp/libxml2-uri.html b/doc/devhelp/libxml2-uri.html index c67dacf..8b33c4e 100644 --- a/doc/devhelp/libxml2-uri.html +++ b/doc/devhelp/libxml2-uri.html @@ -113,15 +113,15 @@ int xmlParseURIReference (
        path:pointer to the path string
        Returns:0 or an error code


        xmlParseURI ()

        xmlURIPtr	xmlParseURI		(const char * str)
        -

        Parse an URI URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]

        +

        Parse an URI based on RFC 3986 URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]

        str:the URI string to analyze
        Returns:a newly built xmlURIPtr or NULL in case of error

        xmlParseURIRaw ()

        xmlURIPtr	xmlParseURIRaw		(const char * str, 
        int raw)
        -

        Parse an URI but allows to keep intact the original fragments. URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]

        +

        Parse an URI but allows to keep intact the original fragments. URI-reference = URI / relative-ref

        str:the URI string to analyze
        raw:if 1 unescaping of URI pieces are disabled
        Returns:a newly built xmlURIPtr or NULL in case of error

        xmlParseURIReference ()

        int	xmlParseURIReference		(xmlURIPtr uri, 
        const char * str)
        -

        Parse an URI reference string and fills in the appropriate fields of the @uri structure URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]

        +

        Parse an URI reference string based on RFC 3986 and fills in the appropriate fields of the @uri structure URI-reference = URI / relative-ref

        uri:pointer to an URI structure
        str:the string to analyze
        Returns:0 or the error code

        xmlPathToURI ()

        xmlChar *	xmlPathToURI		(const xmlChar * path)
        diff --git a/doc/devhelp/libxml2-valid.html b/doc/devhelp/libxml2-valid.html index 3480214..15b3371 100644 --- a/doc/devhelp/libxml2-valid.html +++ b/doc/devhelp/libxml2-valid.html @@ -443,8 +443,8 @@ The content of this structure is not made public by the API.
        ctxt:the validation context
        doc:a document instance
        attr:an attribute definition
        Returns:1 if valid or 0 otherwise

        xmlValidateAttributeValue ()

        int	xmlValidateAttributeValue	(xmlAttributeType type, 
        const xmlChar * value)
        -

        Validate that the given attribute value match the proper production [ VC: ID ] Values of type ID must match the Name production.... [ VC: IDREF ] Values of type IDREF must match the Name production, and values of type IDREFS must match Names ... [ VC: Entity Name ] Values of type ENTITY must match the Name production, values of type ENTITIES must match Names ... [ VC: Name Token ] Values of type NMTOKEN must match the Nmtoken production; values of type NMTOKENS must match Nmtokens.

        -
        type:an attribute type
        value:an attribute value
        Returns:1 if valid or 0 otherwise
        +

        +

        type:
        value:
        Returns:

        xmlValidateDocument ()

        int	xmlValidateDocument		(xmlValidCtxtPtr ctxt, 
        xmlDocPtr doc)

        Try to validate the document instance basically it does the all the checks described by the XML Rec i.e. validates the internal and external subset (if present) and validate the document tree.

        diff --git a/doc/devhelp/libxml2-xmlerror.html b/doc/devhelp/libxml2-xmlerror.html index eaacd0b..cf445dd 100644 --- a/doc/devhelp/libxml2-xmlerror.html +++ b/doc/devhelp/libxml2-xmlerror.html @@ -247,11 +247,14 @@ void xmlResetError (XML_ERR_NOTATION_PROCESSING = 105 /* 105 */ XML_WAR_NS_COLUMN = 106 /* 106 */ XML_WAR_ENTITY_REDEFINED = 107 /* 107 */ + XML_ERR_UNKNOWN_VERSION = 108 /* 108 */ + XML_ERR_VERSION_MISMATCH = 109 /* 109 */ XML_NS_ERR_XML_NAMESPACE = 200 XML_NS_ERR_UNDEFINED_NAMESPACE = 201 /* 201 */ XML_NS_ERR_QNAME = 202 /* 202 */ XML_NS_ERR_ATTRIBUTE_REDEFINED = 203 /* 203 */ XML_NS_ERR_EMPTY = 204 /* 204 */ + XML_NS_ERR_COLON = 205 /* 205 */ XML_DTD_ATTRIBUTE_DEFAULT = 500 XML_DTD_ATTRIBUTE_REDEFINED = 501 /* 501 */ XML_DTD_ATTRIBUTE_VALUE = 502 /* 502 */ @@ -293,6 +296,7 @@ void xmlResetError (XML_DTD_STANDALONE_DEFAULTED = 538 /* 538 */ XML_DTD_XMLID_VALUE = 539 /* 539 */ XML_DTD_XMLID_TYPE = 540 /* 540 */ + XML_DTD_DUP_TOKEN = 541 /* 541 */ XML_HTML_STRUCURE_ERROR = 800 XML_HTML_UNKNOWN_TAG = 801 /* 801 */ XML_RNGP_ANYNAME_ATTR_ANCESTOR = 1000 diff --git a/doc/devhelp/libxml2-xmlmemory.html b/doc/devhelp/libxml2-xmlmemory.html index eabbbf9..8610538 100644 --- a/doc/devhelp/libxml2-xmlmemory.html +++ b/doc/devhelp/libxml2-xmlmemory.html @@ -52,6 +52,7 @@ void * xmlMemRealloc (void * ptr,
        size int xmlInitMemory (void); void xmlMemFree (void * ptr); void * xmlMemMalloc (size_t size); +void xmlMemDisplayLast (FILE * fp,
        long nbBytes); int xmlMemGet (xmlFreeFunc * freeFunc,
        xmlMallocFunc * mallocFunc,
        xmlReallocFunc * reallocFunc,
        xmlStrdupFunc * strdupFunc); void xmlMemoryDump (void); void * xmlMallocLoc (size_t size,
        const char * file,
        int line); @@ -130,6 +131,10 @@ char * xmlMemStrdupLoc (const char * str,
        +
        +


        +

        Signature of an error callback from a reader parser

        +
        arg:the user argument
        msg:the message
        severity:the severity of the error
        locator:a locator indicating where the error occured

        xmlFreeTextReader ()

        void	xmlFreeTextReader		(xmlTextReaderPtr reader)

        Deallocate all the resources associated to the reader

        diff --git a/doc/devhelp/libxml2-xmlregexp.html b/doc/devhelp/libxml2-xmlregexp.html index e783648..4d11966 100644 --- a/doc/devhelp/libxml2-xmlregexp.html +++ b/doc/devhelp/libxml2-xmlregexp.html @@ -143,8 +143,8 @@ The content of this structure is not made public by the API.

        Function type xmlRegExecCallbacks

        void	xmlRegExecCallbacks		(xmlRegExecCtxtPtr exec, 
        const xmlChar * token,
        void * transdata,
        void * inputdata)
        -

        -

        exec:
        token:
        transdata:
        inputdata:
        +

        Callback function when doing a transition in the automata

        +
        exec:the regular expression context
        token:the current token string
        transdata:transition data
        inputdata:input data

        Variable emptyExp

        xmlExpNodePtr emptyExp;
         

        diff --git a/doc/devhelp/libxml2-xmlschemas.html b/doc/devhelp/libxml2-xmlschemas.html index 4801ea5..cc49dfa 100644 --- a/doc/devhelp/libxml2-xmlschemas.html +++ b/doc/devhelp/libxml2-xmlschemas.html @@ -68,7 +68,7 @@ void xmlSchemaSetValidStructuredErr void xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt,
        xmlSchemaValidityErrorFunc err,
        xmlSchemaValidityWarningFunc warn,
        void * ctx); int xmlSchemaValidCtxtGetOptions (xmlSchemaValidCtxtPtr ctxt); int xmlSchemaValidateFile (xmlSchemaValidCtxtPtr ctxt,
        const char * filename,
        int options); -int xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt,
        xmlDocPtr instance); +int xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt,
        xmlDocPtr doc); void xmlSchemaFree (xmlSchemaPtr schema); xmlSchemaParserCtxtPtr xmlSchemaNewMemParserCtxt (const char * buffer,
        int size); int xmlSchemaGetValidErrors (xmlSchemaValidCtxtPtr ctxt,
        xmlSchemaValidityErrorFunc * err,
        xmlSchemaValidityWarningFunc * warn,
        void ** ctx); @@ -77,6 +77,7 @@ void xmlSchemaSetParserErrors (xmlSchemaValidityWarningFunc (void * ctx,
        const char * msg,
        ... ...); void xmlSchemaDump (FILE * output,
        xmlSchemaPtr schema); void xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt); +xmlParserCtxtPtr xmlSchemaValidCtxtGetParserCtxt (xmlSchemaValidCtxtPtr ctxt); void xmlSchemaSetParserStructuredErrors (xmlSchemaParserCtxtPtr ctxt,
        xmlStructuredErrorFunc serror,
        void * ctx); xmlSchemaValidCtxtPtr xmlSchemaNewValidCtxt (xmlSchemaPtr schema); @@ -185,12 +186,12 @@ The content of this structure is not made public by the API.


        +

        Signature of an error callback from an XSD validation

        +
        ctx:the validation context
        msg:the message
        ...:extra arguments

        +

        Signature of a warning callback from an XSD validation

        +
        ctx:the validation context
        msg:the message
        ...:extra arguments

        xmlSchemaDump ()

        void	xmlSchemaDump			(FILE * output, 
        xmlSchemaPtr schema)

        Dump a Schema structure.

        @@ -205,20 +206,20 @@ The content of this structure is not made public by the API.
        ctxt:the schema parser context

        +

        Free the resources associated to the schema validation context

        +
        ctxt:the schema validation context

        xmlSchemaGetParserErrors ()

        int	xmlSchemaGetParserErrors	(xmlSchemaParserCtxtPtr ctxt, 
        xmlSchemaValidityErrorFunc * err,
        xmlSchemaValidityWarningFunc * warn,
        void ** ctx)

        Get the callback information used to handle errors for a parser context

        ctxt:a XMl-Schema parser context
        err:the error callback result
        warn:the warning callback result
        ctx:contextual data for the callbacks result
        Returns:-1 in case of failure, 0 otherwise

        +

        Get the error and warning callback informations

        +
        ctxt:a XML-Schema validation context
        err:the error function result
        warn:the warning function result
        ctx:the functions context result
        Returns:-1 in case of error and 0 otherwise

        +

        Check if any error was detected during validation.

        +
        ctxt:the schema validation context
        Returns:1 if valid so far, 0 if errors were detected, and -1 in case of internal error.

        xmlSchemaNewDocParserCtxt ()

        xmlSchemaParserCtxtPtr	xmlSchemaNewDocParserCtxt	(xmlDocPtr doc)

        Create an XML Schemas parse context for that document. NB. The document may be modified during the parsing process.

        @@ -233,20 +234,20 @@ The content of this structure is not made public by the API.
        URL:the location of the schema
        Returns:the parser context or NULL in case of error

        xmlSchemaNewValidCtxt ()

        xmlSchemaValidCtxtPtr	xmlSchemaNewValidCtxt	(xmlSchemaPtr schema)
        -

        -

        schema:
        Returns:
        +

        Create an XML Schemas validation context based on the given schema.

        +
        schema:a precompiled XML Schemas
        Returns:the validation context or NULL in case of error

        xmlSchemaParse ()

        xmlSchemaPtr	xmlSchemaParse		(xmlSchemaParserCtxtPtr ctxt)

        parse a schema definition resource and build an internal XML Shema struture which can be used to validate instances.

        ctxt:a schema validation context
        Returns:the internal XML Schema structure built from the resource or NULL in case of error

        xmlSchemaSAXPlug ()

        xmlSchemaSAXPlugPtr	xmlSchemaSAXPlug	(xmlSchemaValidCtxtPtr ctxt, 
        xmlSAXHandlerPtr * sax,
        void ** user_data)
        -

        -

        ctxt:
        sax:
        user_data:
        Returns:
        +

        Plug a SAX based validation layer in a SAX parsing event flow. The original @saxptr and @dataptr data are replaced by new pointers but the calls to the original will be maintained.

        +
        ctxt:a schema validation context
        sax:a pointer to the original xmlSAXHandlerPtr
        user_data:a pointer to the original SAX user data pointer
        Returns:a pointer to a data structure needed to unplug the validation layer or NULL in case of errors.

        +

        Unplug a SAX based validation layer in a SAX parsing event flow. The original pointers used in the call are restored.

        +
        plug:a data structure returned by xmlSchemaSAXPlug
        Returns:0 in case of success and -1 in case of failure.

        xmlSchemaSetParserErrors ()

        void	xmlSchemaSetParserErrors	(xmlSchemaParserCtxtPtr ctxt, 
        xmlSchemaValidityErrorFunc err,
        xmlSchemaValidityWarningFunc warn,
        void * ctx)

        Set the callback functions used to handle errors for a validation context

        @@ -257,36 +258,40 @@ The content of this structure is not made public by the API.
        ctxt:a schema parser context
        serror:the structured error function
        ctx:the functions context

        +

        Set the error and warning callback informations

        +
        ctxt:a schema validation context
        err:the error function
        warn:the warning function
        ctx:the functions context

        +

        Sets the options to be used during the validation.

        +
        ctxt:a schema validation context
        options:a combination of xmlSchemaValidOption
        Returns:0 in case of success, -1 in case of an API error.

        +

        Set the structured error callback

        +
        ctxt:a schema validation context
        serror:the structured error function
        ctx:the functions context

        +

        Get the validation context options.

        +
        ctxt:a schema validation context
        Returns:the option combination or -1 on error.

        - +

        xmlSchemaValidCtxtGetParserCtxt ()

        xmlParserCtxtPtr	xmlSchemaValidCtxtGetParserCtxt	(xmlSchemaValidCtxtPtr ctxt)
        +

        allow access to the parser context of the schema validation context

        +
        ctxt:a schema validation context
        Returns:the parser context of the schema validation context or NULL in case of error.
        +
        +

        xmlSchemaValidateDoc ()

        int	xmlSchemaValidateDoc		(xmlSchemaValidCtxtPtr ctxt, 
        xmlDocPtr doc)
        +

        Validate a document tree in memory.

        +
        ctxt:a schema validation context
        doc:a parsed document tree
        Returns:0 if the document is schemas valid, a positive error code number otherwise and -1 in case of internal or API error.

        xmlSchemaValidateFile ()

        int	xmlSchemaValidateFile		(xmlSchemaValidCtxtPtr ctxt, 
        const char * filename,
        int options)
        -

        -

        ctxt:
        filename:
        options:
        Returns:
        +

        Do a schemas validation of the given resource, it will use the SAX streamable validation internally.

        +
        ctxt:a schema validation context
        filename:the URI of the instance
        options:a future set of options, currently unused
        Returns:0 if the document is valid, a positive error code number otherwise and -1 in case of an internal or API error.

        +

        Validate a branch of a tree, starting with the given @elem.

        +
        ctxt:a schema validation context
        elem:an element node
        Returns:0 if the element and its subtree is valid, a positive error code number otherwise and -1 in case of an internal or API error.

        +

        Validate an input based on a flow of SAX event from the parser and forward the events to the @sax handler with the provided @user_data the user provided @sax handler must be a SAX2 one.

        +
        ctxt:a schema validation context
        input:the input to use for reading the data
        enc:an optional encoding information
        sax:a SAX handler for the resulting events
        user_data:the context to provide to the SAX handler.
        Returns:0 if the document is schemas valid, a positive error code number otherwise and -1 in case of internal or API error.

        diff --git a/doc/devhelp/libxml2.devhelp b/doc/devhelp/libxml2.devhelp index 499bcb9..1288b18 100644 --- a/doc/devhelp/libxml2.devhelp +++ b/doc/devhelp/libxml2.devhelp @@ -339,6 +339,7 @@ + @@ -427,6 +428,14 @@ + + + + + + + + @@ -434,6 +443,7 @@ + @@ -581,11 +591,13 @@ + + @@ -710,6 +722,7 @@ + @@ -745,6 +758,8 @@ + + @@ -754,6 +769,7 @@ + @@ -1547,6 +1563,7 @@ + @@ -2414,6 +2431,7 @@ + @@ -2492,6 +2510,7 @@ + @@ -2835,6 +2854,7 @@ + diff --git a/doc/examples/Makefile.am b/doc/examples/Makefile.am index d1beee5..d0f42aa 100644 --- a/doc/examples/Makefile.am +++ b/doc/examples/Makefile.am @@ -15,75 +15,65 @@ install-data-local: $(mkinstalldirs) $(DESTDIR)$(HTML_DIR) -@INSTALL@ -m 0644 $(srcdir)/*.html $(srcdir)/*.c $(srcdir)/*.xml $(srcdir)/*.xsl $(srcdir)/*.res $(DESTDIR)$(HTML_DIR) -EXTRA_DIST=examples.xsl index.py examples.xml writer.xml test3.xml tst.xml test1.xml test2.xml io2.res xpath2.res tree1.res reader4.res io1.res tree2.res reader3.res xpath1.res reader1.res +EXTRA_DIST=examples.xsl index.py test1.xml examples.xml test2.xml tst.xml writer.xml test3.xml tree2.res xpath1.res reader1.res reader3.res reader4.res io1.res xpath2.res io2.res tree1.res -noinst_PROGRAMS=xpath2 reader1 reader4 parse2 reader2 parse3 reader3 tree2 parse4 io2 testWriter io1 xpath1 parse1 tree1 +noinst_PROGRAMS=reader2 xpath2 xpath1 parse3 io2 tree2 reader1 testWriter parse4 reader3 io1 parse1 tree1 reader4 parse2 + +reader2_SOURCES=reader2.c +reader2_LDFLAGS= +reader2_DEPENDENCIES= $(DEPS) +reader2_LDADD= @RDL_LIBS@ $(LDADDS) xpath2_SOURCES=xpath2.c xpath2_LDFLAGS= xpath2_DEPENDENCIES= $(DEPS) xpath2_LDADD= @RDL_LIBS@ $(LDADDS) -reader1_SOURCES=reader1.c -reader1_LDFLAGS= -reader1_DEPENDENCIES= $(DEPS) -reader1_LDADD= @RDL_LIBS@ $(LDADDS) - -reader4_SOURCES=reader4.c -reader4_LDFLAGS= -reader4_DEPENDENCIES= $(DEPS) -reader4_LDADD= @RDL_LIBS@ $(LDADDS) - -parse2_SOURCES=parse2.c -parse2_LDFLAGS= -parse2_DEPENDENCIES= $(DEPS) -parse2_LDADD= @RDL_LIBS@ $(LDADDS) - -reader2_SOURCES=reader2.c -reader2_LDFLAGS= -reader2_DEPENDENCIES= $(DEPS) -reader2_LDADD= @RDL_LIBS@ $(LDADDS) +xpath1_SOURCES=xpath1.c +xpath1_LDFLAGS= +xpath1_DEPENDENCIES= $(DEPS) +xpath1_LDADD= @RDL_LIBS@ $(LDADDS) parse3_SOURCES=parse3.c parse3_LDFLAGS= parse3_DEPENDENCIES= $(DEPS) parse3_LDADD= @RDL_LIBS@ $(LDADDS) -reader3_SOURCES=reader3.c -reader3_LDFLAGS= -reader3_DEPENDENCIES= $(DEPS) -reader3_LDADD= @RDL_LIBS@ $(LDADDS) +io2_SOURCES=io2.c +io2_LDFLAGS= +io2_DEPENDENCIES= $(DEPS) +io2_LDADD= @RDL_LIBS@ $(LDADDS) tree2_SOURCES=tree2.c tree2_LDFLAGS= tree2_DEPENDENCIES= $(DEPS) tree2_LDADD= @RDL_LIBS@ $(LDADDS) -parse4_SOURCES=parse4.c -parse4_LDFLAGS= -parse4_DEPENDENCIES= $(DEPS) -parse4_LDADD= @RDL_LIBS@ $(LDADDS) - -io2_SOURCES=io2.c -io2_LDFLAGS= -io2_DEPENDENCIES= $(DEPS) -io2_LDADD= @RDL_LIBS@ $(LDADDS) +reader1_SOURCES=reader1.c +reader1_LDFLAGS= +reader1_DEPENDENCIES= $(DEPS) +reader1_LDADD= @RDL_LIBS@ $(LDADDS) testWriter_SOURCES=testWriter.c testWriter_LDFLAGS= testWriter_DEPENDENCIES= $(DEPS) testWriter_LDADD= @RDL_LIBS@ $(LDADDS) +parse4_SOURCES=parse4.c +parse4_LDFLAGS= +parse4_DEPENDENCIES= $(DEPS) +parse4_LDADD= @RDL_LIBS@ $(LDADDS) + +reader3_SOURCES=reader3.c +reader3_LDFLAGS= +reader3_DEPENDENCIES= $(DEPS) +reader3_LDADD= @RDL_LIBS@ $(LDADDS) + io1_SOURCES=io1.c io1_LDFLAGS= io1_DEPENDENCIES= $(DEPS) io1_LDADD= @RDL_LIBS@ $(LDADDS) -xpath1_SOURCES=xpath1.c -xpath1_LDFLAGS= -xpath1_DEPENDENCIES= $(DEPS) -xpath1_LDADD= @RDL_LIBS@ $(LDADDS) - parse1_SOURCES=parse1.c parse1_LDFLAGS= parse1_DEPENDENCIES= $(DEPS) @@ -94,41 +84,51 @@ tree1_LDFLAGS= tree1_DEPENDENCIES= $(DEPS) tree1_LDADD= @RDL_LIBS@ $(LDADDS) +reader4_SOURCES=reader4.c +reader4_LDFLAGS= +reader4_DEPENDENCIES= $(DEPS) +reader4_LDADD= @RDL_LIBS@ $(LDADDS) + +parse2_SOURCES=parse2.c +parse2_LDFLAGS= +parse2_DEPENDENCIES= $(DEPS) +parse2_LDADD= @RDL_LIBS@ $(LDADDS) + valgrind: $(MAKE) CHECKER='valgrind' tests tests: $(noinst_PROGRAMS) @(echo '## examples regression tests') @(echo > .memdump) - @($(CHECKER) ./xpath2 test3.xml '//discarded' discarded > xpath2.tmp ; diff xpath2.tmp xpath2.res ; rm xpath2.tmp) - @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./reader1 test2.xml > reader1.tmp ; diff reader1.tmp reader1.res ; rm reader1.tmp) - @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./reader4 test1.xml test2.xml test3.xml > reader4.tmp ; diff reader4.tmp reader4.res ; rm reader4.tmp) + @($(CHECKER) ./reader2 test2.xml > reader1.tmp ; diff reader1.tmp reader1.res ; rm reader1.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./parse2 test2.xml) + @($(CHECKER) ./xpath2 test3.xml '//discarded' discarded > xpath2.tmp ; diff xpath2.tmp xpath2.res ; rm xpath2.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./reader2 test2.xml > reader1.tmp ; diff reader1.tmp reader1.res ; rm reader1.tmp) + @($(CHECKER) ././xpath1 test3.xml '//child2' > xpath1.tmp ; diff xpath1.tmp xpath1.res ; rm xpath1.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) @($(CHECKER) ./parse3) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./reader3 > reader3.tmp ; diff reader3.tmp reader3.res ; rm reader3.tmp) + @($(CHECKER) ./io2 > io2.tmp ; diff io2.tmp io2.res ; rm -f io2.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) @($(CHECKER) ./tree2 > tree2.tmp ; diff tree2.tmp tree2.res ; rm tree2.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./parse4 test3.xml) - @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./io2 > io2.tmp ; diff io2.tmp io2.res ; rm -f io2.tmp) + @($(CHECKER) ./reader1 test2.xml > reader1.tmp ; diff reader1.tmp reader1.res ; rm reader1.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) @($(CHECKER) ./testWriter ; for i in 1 2 3 4 ; do diff writer.xml writer$$i.res ; done ; rm writer*.res) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./io1 > io1.tmp ; diff io1.tmp io1.res ; rm -f io1.tmp) + @($(CHECKER) ./parse4 test3.xml) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ././xpath1 test3.xml '//child2' > xpath1.tmp ; diff xpath1.tmp xpath1.res ; rm xpath1.tmp) + @($(CHECKER) ./reader3 > reader3.tmp ; diff reader3.tmp reader3.res ; rm reader3.tmp) + @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) + @($(CHECKER) ./io1 > io1.tmp ; diff io1.tmp io1.res ; rm -f io1.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) @($(CHECKER) ./parse1 test1.xml) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) @($(CHECKER) ./tree1 test2.xml > tree1.tmp ; diff tree1.tmp tree1.res ; rm tree1.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) + @($(CHECKER) ./reader4 test1.xml test2.xml test3.xml > reader4.tmp ; diff reader4.tmp reader4.res ; rm reader4.tmp) + @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) + @($(CHECKER) ./parse2 test2.xml) + @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) diff --git a/doc/examples/Makefile.in b/doc/examples/Makefile.in index 14681b4..025ef95 100644 --- a/doc/examples/Makefile.in +++ b/doc/examples/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -32,11 +32,11 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -noinst_PROGRAMS = xpath2$(EXEEXT) reader1$(EXEEXT) reader4$(EXEEXT) \ - parse2$(EXEEXT) reader2$(EXEEXT) parse3$(EXEEXT) \ - reader3$(EXEEXT) tree2$(EXEEXT) parse4$(EXEEXT) io2$(EXEEXT) \ - testWriter$(EXEEXT) io1$(EXEEXT) xpath1$(EXEEXT) \ - parse1$(EXEEXT) tree1$(EXEEXT) +noinst_PROGRAMS = reader2$(EXEEXT) xpath2$(EXEEXT) xpath1$(EXEEXT) \ + parse3$(EXEEXT) io2$(EXEEXT) tree2$(EXEEXT) reader1$(EXEEXT) \ + testWriter$(EXEEXT) parse4$(EXEEXT) reader3$(EXEEXT) \ + io1$(EXEEXT) parse1$(EXEEXT) tree1$(EXEEXT) reader4$(EXEEXT) \ + parse2$(EXEEXT) subdir = doc/examples DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -125,7 +125,7 @@ xpath2_OBJECTS = $(am_xpath2_OBJECTS) xpath2_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(xpath2_LDFLAGS) \ $(LDFLAGS) -o $@ -DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ @@ -370,59 +370,51 @@ top_srcdir = @top_srcdir@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I@srcdir@/include @THREAD_CFLAGS@ @Z_CFLAGS@ DEPS = $(top_builddir)/libxml2.la LDADDS = @STATIC_BINARIES@ $(top_builddir)/libxml2.la @THREAD_LIBS@ @Z_LIBS@ $(ICONV_LIBS) -lm @WIN32_EXTRA_LIBADD@ -EXTRA_DIST = examples.xsl index.py examples.xml writer.xml test3.xml tst.xml test1.xml test2.xml io2.res xpath2.res tree1.res reader4.res io1.res tree2.res reader3.res xpath1.res reader1.res -xpath2_SOURCES = xpath2.c -xpath2_LDFLAGS = -xpath2_DEPENDENCIES = $(DEPS) -xpath2_LDADD = @RDL_LIBS@ $(LDADDS) -reader1_SOURCES = reader1.c -reader1_LDFLAGS = -reader1_DEPENDENCIES = $(DEPS) -reader1_LDADD = @RDL_LIBS@ $(LDADDS) -reader4_SOURCES = reader4.c -reader4_LDFLAGS = -reader4_DEPENDENCIES = $(DEPS) -reader4_LDADD = @RDL_LIBS@ $(LDADDS) -parse2_SOURCES = parse2.c -parse2_LDFLAGS = -parse2_DEPENDENCIES = $(DEPS) -parse2_LDADD = @RDL_LIBS@ $(LDADDS) +EXTRA_DIST = examples.xsl index.py test1.xml examples.xml test2.xml tst.xml writer.xml test3.xml tree2.res xpath1.res reader1.res reader3.res reader4.res io1.res xpath2.res io2.res tree1.res reader2_SOURCES = reader2.c reader2_LDFLAGS = reader2_DEPENDENCIES = $(DEPS) reader2_LDADD = @RDL_LIBS@ $(LDADDS) +xpath2_SOURCES = xpath2.c +xpath2_LDFLAGS = +xpath2_DEPENDENCIES = $(DEPS) +xpath2_LDADD = @RDL_LIBS@ $(LDADDS) +xpath1_SOURCES = xpath1.c +xpath1_LDFLAGS = +xpath1_DEPENDENCIES = $(DEPS) +xpath1_LDADD = @RDL_LIBS@ $(LDADDS) parse3_SOURCES = parse3.c parse3_LDFLAGS = parse3_DEPENDENCIES = $(DEPS) parse3_LDADD = @RDL_LIBS@ $(LDADDS) -reader3_SOURCES = reader3.c -reader3_LDFLAGS = -reader3_DEPENDENCIES = $(DEPS) -reader3_LDADD = @RDL_LIBS@ $(LDADDS) -tree2_SOURCES = tree2.c -tree2_LDFLAGS = -tree2_DEPENDENCIES = $(DEPS) -tree2_LDADD = @RDL_LIBS@ $(LDADDS) -parse4_SOURCES = parse4.c -parse4_LDFLAGS = -parse4_DEPENDENCIES = $(DEPS) -parse4_LDADD = @RDL_LIBS@ $(LDADDS) io2_SOURCES = io2.c io2_LDFLAGS = io2_DEPENDENCIES = $(DEPS) io2_LDADD = @RDL_LIBS@ $(LDADDS) +tree2_SOURCES = tree2.c +tree2_LDFLAGS = +tree2_DEPENDENCIES = $(DEPS) +tree2_LDADD = @RDL_LIBS@ $(LDADDS) +reader1_SOURCES = reader1.c +reader1_LDFLAGS = +reader1_DEPENDENCIES = $(DEPS) +reader1_LDADD = @RDL_LIBS@ $(LDADDS) testWriter_SOURCES = testWriter.c testWriter_LDFLAGS = testWriter_DEPENDENCIES = $(DEPS) testWriter_LDADD = @RDL_LIBS@ $(LDADDS) +parse4_SOURCES = parse4.c +parse4_LDFLAGS = +parse4_DEPENDENCIES = $(DEPS) +parse4_LDADD = @RDL_LIBS@ $(LDADDS) +reader3_SOURCES = reader3.c +reader3_LDFLAGS = +reader3_DEPENDENCIES = $(DEPS) +reader3_LDADD = @RDL_LIBS@ $(LDADDS) io1_SOURCES = io1.c io1_LDFLAGS = io1_DEPENDENCIES = $(DEPS) io1_LDADD = @RDL_LIBS@ $(LDADDS) -xpath1_SOURCES = xpath1.c -xpath1_LDFLAGS = -xpath1_DEPENDENCIES = $(DEPS) -xpath1_LDADD = @RDL_LIBS@ $(LDADDS) parse1_SOURCES = parse1.c parse1_LDFLAGS = parse1_DEPENDENCIES = $(DEPS) @@ -431,6 +423,14 @@ tree1_SOURCES = tree1.c tree1_LDFLAGS = tree1_DEPENDENCIES = $(DEPS) tree1_LDADD = @RDL_LIBS@ $(LDADDS) +reader4_SOURCES = reader4.c +reader4_LDFLAGS = +reader4_DEPENDENCIES = $(DEPS) +reader4_LDADD = @RDL_LIBS@ $(LDADDS) +parse2_SOURCES = parse2.c +parse2_LDFLAGS = +parse2_DEPENDENCIES = $(DEPS) +parse2_LDADD = @RDL_LIBS@ $(LDADDS) all: all-am .SUFFIXES: @@ -571,8 +571,8 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS @@ -584,8 +584,8 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ @@ -595,13 +595,12 @@ ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ - here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique @@ -762,36 +761,36 @@ valgrind: tests: $(noinst_PROGRAMS) @(echo '## examples regression tests') @(echo > .memdump) - @($(CHECKER) ./xpath2 test3.xml '//discarded' discarded > xpath2.tmp ; diff xpath2.tmp xpath2.res ; rm xpath2.tmp) - @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./reader1 test2.xml > reader1.tmp ; diff reader1.tmp reader1.res ; rm reader1.tmp) - @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./reader4 test1.xml test2.xml test3.xml > reader4.tmp ; diff reader4.tmp reader4.res ; rm reader4.tmp) + @($(CHECKER) ./reader2 test2.xml > reader1.tmp ; diff reader1.tmp reader1.res ; rm reader1.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./parse2 test2.xml) + @($(CHECKER) ./xpath2 test3.xml '//discarded' discarded > xpath2.tmp ; diff xpath2.tmp xpath2.res ; rm xpath2.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./reader2 test2.xml > reader1.tmp ; diff reader1.tmp reader1.res ; rm reader1.tmp) + @($(CHECKER) ././xpath1 test3.xml '//child2' > xpath1.tmp ; diff xpath1.tmp xpath1.res ; rm xpath1.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) @($(CHECKER) ./parse3) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./reader3 > reader3.tmp ; diff reader3.tmp reader3.res ; rm reader3.tmp) + @($(CHECKER) ./io2 > io2.tmp ; diff io2.tmp io2.res ; rm -f io2.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) @($(CHECKER) ./tree2 > tree2.tmp ; diff tree2.tmp tree2.res ; rm tree2.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./parse4 test3.xml) - @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./io2 > io2.tmp ; diff io2.tmp io2.res ; rm -f io2.tmp) + @($(CHECKER) ./reader1 test2.xml > reader1.tmp ; diff reader1.tmp reader1.res ; rm reader1.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) @($(CHECKER) ./testWriter ; for i in 1 2 3 4 ; do diff writer.xml writer$$i.res ; done ; rm writer*.res) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./io1 > io1.tmp ; diff io1.tmp io1.res ; rm -f io1.tmp) + @($(CHECKER) ./parse4 test3.xml) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ././xpath1 test3.xml '//child2' > xpath1.tmp ; diff xpath1.tmp xpath1.res ; rm xpath1.tmp) + @($(CHECKER) ./reader3 > reader3.tmp ; diff reader3.tmp reader3.res ; rm reader3.tmp) + @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) + @($(CHECKER) ./io1 > io1.tmp ; diff io1.tmp io1.res ; rm -f io1.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) @($(CHECKER) ./parse1 test1.xml) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) @($(CHECKER) ./tree1 test2.xml > tree1.tmp ; diff tree1.tmp tree1.res ; rm tree1.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) + @($(CHECKER) ./reader4 test1.xml test2.xml test3.xml > reader4.tmp ; diff reader4.tmp reader4.res ; rm reader4.tmp) + @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) + @($(CHECKER) ./parse2 test2.xml) + @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/doc/examples/examples.xml b/doc/examples/examples.xml index 2a0827b..a237a0e 100644 --- a/doc/examples/examples.xml +++ b/doc/examples/examples.xml @@ -1,4 +1,36 @@ + + Parse and validate an XML file with an xmlReader + Demonstrate the use of xmlReaderForFile() to parse an XML file validating the content in the process and activating options like entities substitution, and DTD attributes defaulting. (Note that the XMLReader functions require libxml2 version later than 2.6.) + reader2 <valid_xml_filename> + reader2 test2.xml > reader1.tmp ; diff reader1.tmp reader1.res ; rm reader1.tmp + Daniel Veillard + see Copyright for the status of this software. +
        xmlReader
        + + <libxml/xmlreader.h> + + + + + + + + + + + + + + + + + + + + + +
        Load a document, locate subelements with XPath, modify said elements and save the resulting document. Shows how to make a full round-trip from a load/edit/save @@ -32,114 +64,42 @@ - - Parse an XML file with an xmlReader - Demonstrate the use of xmlReaderForFile() to parse an XML file and dump the informations about the nodes found in the process. (Note that the XMLReader functions require libxml2 version later than 2.6.) - reader1 <filename> - reader1 test2.xml > reader1.tmp ; diff reader1.tmp reader1.res ; rm reader1.tmp - Daniel Veillard - see Copyright for the status of this software. -
        xmlReader
        - - <libxml/xmlreader.h> - - - - - - - - - - - - - - - - - -
        - - Parse multiple XML files reusing an xmlReader - Demonstrate the use of xmlReaderForFile() and xmlReaderNewFile to parse XML files while reusing the reader object and parser context. (Note that the XMLReader functions require libxml2 version later than 2.6.) - reader4 <filename> [ filename ... ] - reader4 test1.xml test2.xml test3.xml > reader4.tmp ; diff reader4.tmp reader4.res ; rm reader4.tmp - Graham Bennett - see Copyright for the status of this software. -
        xmlReader
        - - <libxml/xmlreader.h> - - - - - - - - - - - - - - -
        - - Parse and validate an XML file to a tree and free the result - Create a parser context for an XML file, then parse and validate the file, creating a tree, check the validation result and xmlFreeDoc() to free the resulting tree. - parse2 test2.xml - parse2 test2.xml - Daniel Veillard + + Evaluate XPath expression and prints result node set. + Shows how to evaluate XPath expression and register known namespaces in XPath context. + xpath1 <xml-file> <xpath-expr> [<known-ns-list>] + ./xpath1 test3.xml '//child2' > xpath1.tmp ; diff xpath1.tmp xpath1.res ; rm xpath1.tmp + Aleksey Sanin see Copyright for the status of this software. -
        Parsing
        +
        XPath
        - <libxml/tree.h> <libxml/parser.h> + <libxml/xpath.h> + <libxml/xpathInternals.h> + <libxml/tree.h> - - - - - - - - - - - -
        - - Parse and validate an XML file with an xmlReader - Demonstrate the use of xmlReaderForFile() to parse an XML file validating the content in the process and activating options like entities substitution, and DTD attributes defaulting. (Note that the XMLReader functions require libxml2 version later than 2.6.) - reader2 <valid_xml_filename> - reader2 test2.xml > reader1.tmp ; diff reader1.tmp reader1.res ; rm reader1.tmp - Daniel Veillard - see Copyright for the status of this software. -
        xmlReader
        - - <libxml/xmlreader.h> - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + +
        @@ -163,27 +123,27 @@ - - Show how to extract subdocuments with xmlReader - Demonstrate the use of xmlTextReaderPreservePattern() to parse an XML file with the xmlReader while collecting only some subparts of the document. (Note that the XMLReader functions require libxml2 version later than 2.6.) - reader3 - reader3 > reader3.tmp ; diff reader3.tmp reader3.res ; rm reader3.tmp - Daniel Veillard + + Output to char buffer + Demonstrate the use of xmlDocDumpMemory to output document to a character buffer + io2 + io2 > io2.tmp ; diff io2.tmp io2.res ; rm -f io2.tmp + John Fleck see Copyright for the status of this software. -
        xmlReader
        +
        InputOutput
        - <libxml/xmlreader.h> + <libxml/parser.h> - - - - - - - - - + + + + + + + + +
        @@ -200,9 +160,12 @@ + + + @@ -211,45 +174,32 @@ - - Parse an XML document chunk by chunk to a tree and free it - Demonstrate the use of xmlCreatePushParserCtxt() and xmlParseChunk() to read an XML file progressively into a tree and and xmlFreeDoc() to free the resulting tree - parse4 test3.xml - parse4 test3.xml + + Parse an XML file with an xmlReader + Demonstrate the use of xmlReaderForFile() to parse an XML file and dump the informations about the nodes found in the process. (Note that the XMLReader functions require libxml2 version later than 2.6.) + reader1 <filename> + reader1 test2.xml > reader1.tmp ; diff reader1.tmp reader1.res ; rm reader1.tmp Daniel Veillard see Copyright for the status of this software. -
        Parsing
        - - <libxml/tree.h> - <libxml/parser.h> - - - - - - - - -
        - - Output to char buffer - Demonstrate the use of xmlDocDumpMemory to output document to a character buffer - io2 - io2 > io2.tmp ; diff io2.tmp io2.res ; rm -f io2.tmp - John Fleck - see Copyright for the status of this software. -
        InputOutput
        +
        xmlReader
        - <libxml/parser.h> + <libxml/xmlreader.h> - - - - - - - + + + + + + + + + + + + + +
        @@ -271,6 +221,7 @@ + @@ -282,6 +233,7 @@ + @@ -296,6 +248,47 @@ + + Parse an XML document chunk by chunk to a tree and free it + Demonstrate the use of xmlCreatePushParserCtxt() and xmlParseChunk() to read an XML file progressively into a tree and and xmlFreeDoc() to free the resulting tree + parse4 test3.xml + parse4 test3.xml + Daniel Veillard + see Copyright for the status of this software. +
        Parsing
        + + <libxml/tree.h> + <libxml/parser.h> + + + + + + + + +
        + + Show how to extract subdocuments with xmlReader + Demonstrate the use of xmlTextReaderPreservePattern() to parse an XML file with the xmlReader while collecting only some subparts of the document. (Note that the XMLReader functions require libxml2 version later than 2.6.) + reader3 + reader3 > reader3.tmp ; diff reader3.tmp reader3.res ; rm reader3.tmp + Daniel Veillard + see Copyright for the status of this software. +
        xmlReader
        + + <libxml/xmlreader.h> + + + + + + + + + + +
        Example of custom Input/Output Demonstrate the use of xmlRegisterInputCallbacks to build a custom I/O layer, this is used in an XInclude method context to show how dynamic document can be built in a clean way. @@ -317,39 +310,6 @@ - - Evaluate XPath expression and prints result node set. - Shows how to evaluate XPath expression and register known namespaces in XPath context. - xpath1 <xml-file> <xpath-expr> [<known-ns-list>] - ./xpath1 test3.xml '//child2' > xpath1.tmp ; diff xpath1.tmp xpath1.res ; rm xpath1.tmp - Aleksey Sanin - see Copyright for the status of this software. -
        XPath
        - - <libxml/parser.h> - <libxml/xpath.h> - <libxml/xpathInternals.h> - <libxml/tree.h> - - - - - - - - - - - - - - - - - - - -
        Parse an XML file to a tree and free it Demonstrate the use of xmlReadFile() to read an XML file into a tree and and xmlFreeDoc() to free the resulting tree @@ -384,14 +344,54 @@ + + Parse multiple XML files reusing an xmlReader + Demonstrate the use of xmlReaderForFile() and xmlReaderNewFile to parse XML files while reusing the reader object and parser context. (Note that the XMLReader functions require libxml2 version later than 2.6.) + reader4 <filename> [ filename ... ] + reader4 test1.xml test2.xml test3.xml > reader4.tmp ; diff reader4.tmp reader4.res ; rm reader4.tmp + Graham Bennett + see Copyright for the status of this software. +
        xmlReader
        + + <libxml/xmlreader.h> + + + + + + + + + +
        + + Parse and validate an XML file to a tree and free the result + Create a parser context for an XML file, then parse and validate the file, creating a tree, check the validation result and xmlFreeDoc() to free the resulting tree. + parse2 test2.xml + parse2 test2.xml + Daniel Veillard + see Copyright for the status of this software. +
        Parsing
        + + <libxml/tree.h> + <libxml/parser.h> + + + + + + + + +
        - - - - + + + + @@ -408,8 +408,8 @@ - + @@ -430,12 +430,12 @@ - - - - + + + + @@ -459,42 +459,42 @@ - - + - + + - + + - - - + - + + - + - - + + @@ -507,27 +507,27 @@ - - - - + + + + - + - + @@ -551,9 +551,9 @@ + - @@ -570,8 +570,8 @@ - + @@ -582,10 +582,10 @@ - - + + @@ -609,54 +609,54 @@ - + - + - + - + - + - + - + - + - - + + - - + + @@ -725,10 +725,10 @@
        - +
        @@ -739,10 +739,10 @@
        - - + +
        diff --git a/doc/examples/reader3.c b/doc/examples/reader3.c index acbff4f..51f9d3b 100644 --- a/doc/examples/reader3.c +++ b/doc/examples/reader3.c @@ -15,7 +15,8 @@ #include #include -#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED) +#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) + /** * streamFile: @@ -113,7 +114,7 @@ int main(int argc, char **argv) { #else int main(void) { - fprintf(stderr, "Reader or Pattern support not compiled in\n"); + fprintf(stderr, "Reader, Pattern or output support not compiled in\n"); exit(1); } #endif diff --git a/doc/html/libxml-c14n.html b/doc/html/libxml-c14n.html index f4b3ecd..dfcb9c5 100644 --- a/doc/html/libxml-c14n.html +++ b/doc/html/libxml-c14n.html @@ -28,5 +28,5 @@ int xmlC14NIsVisibleCallback (void * use

        Dumps the canonized image of given XML document into the provided buffer. For details see "Canonical XML" (http://www.w3.org/TR/xml-c14n) or "Exclusive XML Canonicalization" (http://www.w3.org/TR/xml-exc-c14n)

        doc:the XML document for canonization
        is_visible_callback:the function to use to determine is node visible or not
        user_data:the first parameter for @is_visible_callback function (in most cases, it is nodes set)
        exclusive:the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization)
        inclusive_ns_prefixes:the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise)
        with_comments:include comments in the result (!=0) or not (==0)
        buf:the output buffer to store canonical XML; this buffer MUST have encoder==NULL because C14N requires UTF-8 output
        Returns:non-negative value on success or a negative value on fail

        Function type: xmlC14NIsVisibleCallback

        Function type: xmlC14NIsVisibleCallback
         int	xmlC14NIsVisibleCallback	(void * user_data, 
        xmlNodePtr node,
        xmlNodePtr parent) -

        user_data:
        node:
        parent:
        Returns:

        +

        Signature for a C14N callback on visible nodes

        user_data:user data
        node:the curent node
        parent:the parent node
        Returns:1 if the node should be included

        Daniel Veillard

      14. diff --git a/doc/html/libxml-entities.html b/doc/html/libxml-entities.html index fe4ea86..406e64e 100644 --- a/doc/html/libxml-entities.html +++ b/doc/html/libxml-entities.html @@ -30,6 +30,7 @@ The content of this structure is not made public by the API.
        xmlEntityPtr	xmlGetParameterEntity	(xmlDocPtr doc, 
        const xmlChar * name)
        xmlEntityPtr	xmlGetPredefinedEntity	(const xmlChar * name)
        void	xmlInitializePredefinedEntities	(void)
        +
        xmlEntityPtr	xmlNewEntity		(xmlDocPtr doc, 
        const xmlChar * name,
        int type,
        const xmlChar * ExternalID,
        const xmlChar * SystemID,
        const xmlChar * content)

        Description

        Structure xmlEntitiesTable

        Structure xmlEntitiesTable
        struct _xmlHashTable { The content of this structure is not made public by the API. @@ -73,4 +74,6 @@ The content of this structure is not made public by the API.

        Check whether this name is an predefined entity.

        name:the entity name
        Returns:NULL if not, otherwise the entity

        Function: xmlInitializePredefinedEntities

        void	xmlInitializePredefinedEntities	(void)

        Set up the predefined entities. Deprecated call

        -

        Daniel Veillard

        +

        Function: xmlNewEntity

        xmlEntityPtr	xmlNewEntity		(xmlDocPtr doc, 
        const xmlChar * name,
        int type,
        const xmlChar * ExternalID,
        const xmlChar * SystemID,
        const xmlChar * content)
        +

        Create a new entity, this differs from xmlAddDocEntity() that if the document is NULL or has no internal subset defined, then an unlinked entity structure will be returned, it is then the responsability of the caller to link it to the document later or free it when not needed anymore.

        +
        doc:the document
        name:the entity name
        type:the entity type XML_xxx_yyy_ENTITY
        ExternalID:the entity external ID if available
        SystemID:the entity system ID if available
        content:the entity content
        Returns:a pointer to the entity or NULL in case of error

        Daniel Veillard

      diff --git a/doc/html/libxml-globals.html b/doc/html/libxml-globals.html index fd9a06c..148d6a1 100644 --- a/doc/html/libxml-globals.html +++ b/doc/html/libxml-globals.html @@ -90,7 +90,7 @@ void xmlRegisterNodeFunc (
      func:function pointer to the new DeregisterNodeFunc
      Returns:the previous value of the deregistration function

      Function type: xmlDeregisterNodeFunc

      Function type: xmlDeregisterNodeFunc
       void	xmlDeregisterNodeFunc		(xmlNodePtr node)
      -

      node:

      +

      Signature for the deregistration callback of a discarded node

      node:the current node

      Function: xmlInitGlobals

      void	xmlInitGlobals			(void)

      Additional initialisation for multi-threading

      Function: xmlInitializeGlobalState

      void	xmlInitializeGlobalState	(xmlGlobalStatePtr gs)
      @@ -99,17 +99,17 @@ void xmlDeregisterNodeFunc (xmlNodePtr

      Registers a callback for URI output file handling

      func:function pointer to the new OutputBufferCreateFilenameFunc
      Returns:the old value of the registration function

      Function type: xmlOutputBufferCreateFilenameFunc

      Function type: xmlOutputBufferCreateFilenameFunc
       xmlOutputBufferPtr	xmlOutputBufferCreateFilenameFunc	(const char * URI, 
      xmlCharEncodingHandlerPtr encoder,
      int compression) -

      URI:
      encoder:
      compression:
      Returns:

      +

      Signature for the function doing the lookup for a suitable output method corresponding to an URI.

      URI:the URI to write to
      encoder:
      compression:
      Returns:the new xmlOutputBufferPtr in case of success or NULL if no method was found.

      Function: xmlParserInputBufferCreateFilenameDefault

      xmlParserInputBufferCreateFilenameFunc	xmlParserInputBufferCreateFilenameDefault	(xmlParserInputBufferCreateFilenameFunc func)

      Registers a callback for URI input file handling

      func:function pointer to the new ParserInputBufferCreateFilenameFunc
      Returns:the old value of the registration function

      Function type: xmlParserInputBufferCreateFilenameFunc

      Function type: xmlParserInputBufferCreateFilenameFunc
       xmlParserInputBufferPtr	xmlParserInputBufferCreateFilenameFunc	(const char * URI, 
      xmlCharEncoding enc) -

      URI:
      enc:
      Returns:

      +

      Signature for the function doing the lookup for a suitable input method corresponding to an URI.

      URI:the URI to read from
      enc:the requested source encoding
      Returns:the new xmlParserInputBufferPtr in case of success or NULL if no method was found.

      Function: xmlRegisterNodeDefault

      xmlRegisterNodeFunc	xmlRegisterNodeDefault	(xmlRegisterNodeFunc func)

      Registers a callback for node creation

      func:function pointer to the new RegisterNodeFunc
      Returns:the old value of the registration function

      Function type: xmlRegisterNodeFunc

      Function type: xmlRegisterNodeFunc
       void	xmlRegisterNodeFunc		(xmlNodePtr node)
      -

      node:

      +

      Signature for the registration callback of a created node

      node:the current node

      Function: xmlThrDefBufferAllocScheme

      xmlBufferAllocationScheme	xmlThrDefBufferAllocScheme	(xmlBufferAllocationScheme v)

      v:
      Returns:

      Function: xmlThrDefDefaultBufferSize

      int	xmlThrDefDefaultBufferSize	(int v)
      diff --git a/doc/html/libxml-parser.html b/doc/html/libxml-parser.html index 82c6f8e..82dbf95 100644 --- a/doc/html/libxml-parser.html +++ b/doc/html/libxml-parser.html @@ -282,6 +282,9 @@ void xmlParserInputDeallocate (XML_PARSE_NOCDATA = 16384 : merge CDATA as text nodes XML_PARSE_NOXINCNODE = 32768 : do not generate XINCLUDE START/END nodes XML_PARSE_COMPACT = 65536 : compact small text nodes; no modification of the tree allowed afterwards (will possibly crash if you try to modify the tree) + XML_PARSE_OLD10 = 131072 : parse using XML-1.0 before update 5 + XML_PARSE_NOBASEFIX = 262144 : do not fixup XINCLUDE xml:base uris + XML_PARSE_HUGE = 524288 : relax any hardcoded limit from the parser }

      Structure xmlSAXHandlerV1

      Structure xmlSAXHandlerV1
      struct _xmlSAXHandlerV1 { internalSubsetSAXFunc internalSubset diff --git a/doc/html/libxml-parserInternals.html b/doc/html/libxml-parserInternals.html index 3c12a6a..ad1fb8e 100644 --- a/doc/html/libxml-parserInternals.html +++ b/doc/html/libxml-parserInternals.html @@ -92,7 +92,7 @@ void xmlEntityReferenceFunc (void xmlParserHandleReference (xmlParserCtxtPtr ctxt)
      void	xmlParserInputShrink		(xmlParserInputPtr in)
      xmlChar	xmlPopInput			(xmlParserCtxtPtr ctxt)
      -
      void	xmlPushInput			(xmlParserCtxtPtr ctxt, 
      xmlParserInputPtr input)
      +
      int	xmlPushInput			(xmlParserCtxtPtr ctxt, 
      xmlParserInputPtr input)
      xmlChar *	xmlScanName		(xmlParserCtxtPtr ctxt)
      void	xmlSetEntityReferenceFunc	(xmlEntityReferenceFunc func)
      int	xmlSkipBlankChars		(xmlParserCtxtPtr ctxt)
      @@ -140,7 +140,7 @@ void xmlEntityReferenceFunc (
      ctxt:an XML parser context
      Returns:the input just removed

      Function: inputPush

      int	inputPush			(xmlParserCtxtPtr ctxt, 
      xmlParserInputPtr value)

      Pushes a new parser input on top of the input stack

      -
      ctxt:an XML parser context
      value:the parser input
      Returns:0 in case of error, the index in the stack otherwise

      Function: namePop

      const xmlChar *	namePop			(xmlParserCtxtPtr ctxt)
      +
      ctxt:an XML parser context
      value:the parser input
      Returns:-1 in case of error, the index in the stack otherwise

      Function: namePop

      const xmlChar *	namePop			(xmlParserCtxtPtr ctxt)

      Pops the top element name from the name stack

      ctxt:an XML parser context
      Returns:the name just removed

      Function: namePush

      int	namePush			(xmlParserCtxtPtr ctxt, 
      const xmlChar * value)

      Pushes a new element name on top of the name stack

      @@ -148,7 +148,7 @@ void xmlEntityReferenceFunc (
      ctxt:an XML parser context
      Returns:the node just removed

      Function: nodePush

      int	nodePush			(xmlParserCtxtPtr ctxt, 
      xmlNodePtr value)

      Pushes a new element node on top of the node stack

      -
      ctxt:an XML parser context
      value:the element node
      Returns:0 in case of error, the index in the stack otherwise

      Function: xmlCheckLanguageID

      int	xmlCheckLanguageID		(const xmlChar * lang)
      +
      ctxt:an XML parser context
      value:the element node
      Returns:-1 in case of error, the index in the stack otherwise

      Function: xmlCheckLanguageID

      int	xmlCheckLanguageID		(const xmlChar * lang)

      Checks that the value conforms to the LanguageID production: NOTE: this is somewhat deprecated, those productions were removed from the XML Second edition. [33] LanguageID ::= Langcode ('-' Subcode)* [34] Langcode ::= ISO639Code | IanaCode | UserCode [35] ISO639Code ::= ([a-z] | [A-Z]) ([a-z] | [A-Z]) [36] IanaCode ::= ('i' | 'I') '-' ([a-z] | [A-Z])+ [37] UserCode ::= ('x' | 'X') '-' ([a-z] | [A-Z])+ [38] Subcode ::= ([a-z] | [A-Z])+

      lang:pointer to the string value
      Returns:1 if correct 0 otherwise

      Function: xmlCopyChar

      int	xmlCopyChar			(int len, 
      xmlChar * out,
      int val)

      append the char value in the array

      @@ -278,11 +278,11 @@ void xmlEntityReferenceFunc (xmlEntityP
      ctxt:an XML parser context
      Returns:the element name parsed

      Function: xmlParseSystemLiteral

      xmlChar *	xmlParseSystemLiteral	(xmlParserCtxtPtr ctxt)

      parse an XML Literal [11] SystemLiteral ::= ('"' [^"]* '"') | ("'" [^']* "'")

      ctxt:an XML parser context
      Returns:the SystemLiteral parsed or NULL

      Function: xmlParseTextDecl

      void	xmlParseTextDecl		(xmlParserCtxtPtr ctxt)
      -

      parse an XML declaration header for external entities [77] TextDecl ::= '<?xml' VersionInfo? EncodingDecl S? '?>' Question: Seems that EncodingDecl is mandatory ? Is that a typo ?

      +

      parse an XML declaration header for external entities [77] TextDecl ::= '<?xml' VersionInfo? EncodingDecl S? '?>'

      ctxt:an XML parser context

      Function: xmlParseVersionInfo

      xmlChar *	xmlParseVersionInfo	(xmlParserCtxtPtr ctxt)

      parse the XML version. [24] VersionInfo ::= S 'version' Eq (' VersionNum ' | " VersionNum ") [25] Eq ::= S? '=' S?

      ctxt:an XML parser context
      Returns:the version string, e.g. "1.0"

      Function: xmlParseVersionNum

      xmlChar *	xmlParseVersionNum	(xmlParserCtxtPtr ctxt)
      -

      parse the XML version value. [26] VersionNum ::= ([a-zA-Z0-9_.:] | '-')+

      +

      parse the XML version value. [26] VersionNum ::= '1.' [0-9]+ In practice allow [0-9].[0-9]+ at that level

      ctxt:an XML parser context
      Returns:the string giving the XML version number, or NULL

      Function: xmlParseXMLDecl

      void	xmlParseXMLDecl			(xmlParserCtxtPtr ctxt)

      parse an XML declaration header [23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'

      ctxt:an XML parser context

      Function: xmlParserHandlePEReference

      void	xmlParserHandlePEReference	(xmlParserCtxtPtr ctxt)
      @@ -293,9 +293,9 @@ void xmlEntityReferenceFunc (xmlEntityP

      This function removes used input for the parser.

      in:an XML parser input

      Function: xmlPopInput

      xmlChar	xmlPopInput			(xmlParserCtxtPtr ctxt)

      xmlPopInput: the current input pointed by ctxt->input came to an end pop it and return the next char.

      -
      ctxt:an XML parser context
      Returns:the current xmlChar in the parser context

      Function: xmlPushInput

      void	xmlPushInput			(xmlParserCtxtPtr ctxt, 
      xmlParserInputPtr input)
      +
      ctxt:an XML parser context
      Returns:the current xmlChar in the parser context

      Function: xmlPushInput

      int	xmlPushInput			(xmlParserCtxtPtr ctxt, 
      xmlParserInputPtr input)

      xmlPushInput: switch to a new input stream which is stacked on top of the previous one(s).

      -
      ctxt:an XML parser context
      input:an XML parser input fragment (entity, XML fragment ...).

      Function: xmlScanName

      xmlChar *	xmlScanName		(xmlParserCtxtPtr ctxt)
      +
      ctxt:an XML parser context
      input:an XML parser input fragment (entity, XML fragment ...).
      Returns:-1 in case of error or the index in the input stack

      Function: xmlScanName

      xmlChar *	xmlScanName		(xmlParserCtxtPtr ctxt)

      Trickery: parse an XML name but without consuming the input flow Needed for rollback cases. Used only when parsing entities references. TODO: seems deprecated now, only used in the default part of xmlParserHandleReference [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender [5] Name ::= (Letter | '_' | ':') (NameChar)* [6] Names ::= Name (S Name)*

      ctxt:an XML parser context
      Returns:the Name parsed or NULL

      Function: xmlSetEntityReferenceFunc

      void	xmlSetEntityReferenceFunc	(xmlEntityReferenceFunc func)

      Set the function to call call back when a xml reference has been made

      diff --git a/doc/html/libxml-relaxng.html b/doc/html/libxml-relaxng.html index 650d058..b631a1a 100644 --- a/doc/html/libxml-relaxng.html +++ b/doc/html/libxml-relaxng.html @@ -153,10 +153,10 @@ The content of this structure is not made public by the API.

      Push a new element start on the RelaxNG validation stack.

      ctxt:the validation context
      doc:a document instance
      elem:an element instance
      Returns:1 if no validation problem was found or 0 if validating the element requires a full node, and -1 in case of error.

      Function type: xmlRelaxNGValidityErrorFunc

      Function type: xmlRelaxNGValidityErrorFunc
       void	xmlRelaxNGValidityErrorFunc	(void * ctx, 
      const char * msg,
      ... ...) -

      ctx:
      msg:
      ...:

      +

      Signature of an error callback from a Relax-NG validation

      ctx:the validation context
      msg:the message
      ...:extra arguments

      Function type: xmlRelaxNGValidityWarningFunc

      Function type: xmlRelaxNGValidityWarningFunc
       void	xmlRelaxNGValidityWarningFunc	(void * ctx, 
      const char * msg,
      ... ...) -

      ctx:
      msg:
      ...:

      +

      Signature of a warning callback from a Relax-NG validation

      ctx:the validation context
      msg:the message
      ...:extra arguments

      Function: xmlRelaxParserSetFlag

      int	xmlRelaxParserSetFlag		(xmlRelaxNGParserCtxtPtr ctxt, 
      int flags)

      Semi private function used to pass informations to a parser context which are a combination of xmlRelaxNGParserFlag .

      ctxt:a RelaxNG parser context
      flags:a set of flags values
      Returns:0 if success and -1 in case of error

      Daniel Veillard

    diff --git a/doc/html/libxml-schematron.html b/doc/html/libxml-schematron.html index 5ec67e5..1dcd73a 100644 --- a/doc/html/libxml-schematron.html +++ b/doc/html/libxml-schematron.html @@ -74,8 +74,8 @@ The content of this structure is not made public by the API.

    Validate a tree instance against the schematron

    ctxt:the schema validation context
    instance:the document instace tree
    Returns:0 in case of success, -1 in case of internal error and an error count otherwise.

    Function type: xmlSchematronValidityErrorFunc

    Function type: xmlSchematronValidityErrorFunc
     void	xmlSchematronValidityErrorFunc	(void * ctx, 
    const char * msg,
    ... ...) -

    ctx:
    msg:
    ...:

    +

    Signature of an error callback from a Schematron validation

    ctx:the validation context
    msg:the message
    ...:extra arguments

    Function type: xmlSchematronValidityWarningFunc

    Function type: xmlSchematronValidityWarningFunc
     void	xmlSchematronValidityWarningFunc	(void * ctx, 
    const char * msg,
    ... ...) -

    ctx:
    msg:
    ...:

    +

    Signature of a warning callback from a Schematron validation

    ctx:the validation context
    msg:the message
    ...:extra arguments

    Daniel Veillard

    diff --git a/doc/html/libxml-tree.html b/doc/html/libxml-tree.html index 34914cb..ab57566 100644 --- a/doc/html/libxml-tree.html +++ b/doc/html/libxml-tree.html @@ -22,6 +22,7 @@ A:link, A:visited, A:active { text-decoration: underline }
    Structure xmlDOMWrapCtxt
    struct _xmlDOMWrapCtxt
    Typedef xmlDOMWrapCtxt * xmlDOMWrapCtxtPtr
     
    Structure xmlDoc
    struct _xmlDoc +
    Enum xmlDocProperties
     
    Typedef xmlDoc * xmlDocPtr
     
    Structure xmlDtd
    struct _xmlDtd
    Typedef xmlDtd * xmlDtdPtr
    @@ -277,10 +278,12 @@ A:link, A:visited, A:active { text-decoration: underline }
         unsigned int	use	: The buffer size used
         unsigned int	size	: The buffer size
         xmlBufferAllocationScheme	alloc	: The realloc method
    +    xmlChar *	contentIO	: in IO mode we may have a different base
     }

    Enum xmlBufferAllocationScheme

    Enum xmlBufferAllocationScheme {
    -    XML_BUFFER_ALLOC_DOUBLEIT = 1
    -    XML_BUFFER_ALLOC_EXACT = 2
    -    XML_BUFFER_ALLOC_IMMUTABLE = 3
    +    XML_BUFFER_ALLOC_DOUBLEIT = 1 : double each time one need to grow
    +    XML_BUFFER_ALLOC_EXACT = 2 : grow only to the minimal size
    +    XML_BUFFER_ALLOC_IMMUTABLE = 3 : immutable buffer
    +    XML_BUFFER_ALLOC_IO = 4 : special allocation scheme used for I/O
     }
     

    Structure xmlDOMWrapCtxt

    Structure xmlDOMWrapCtxt
    struct _xmlDOMWrapCtxt { void * _private : * The type of this context, just in case @@ -310,7 +313,19 @@ A:link, A:visited, A:active { text-decoration: underline } int charset : encoding of the in-memory content actua struct _xmlDict * dict : dict used to allocate names or NULL void * psvi : for type/PSVI informations -}

    Structure xmlDtd

    Structure xmlDtd
    struct _xmlDtd { + int parseFlags : set of xmlParserOption used to parse th + int properties : set of xmlDocProperties for this docume +}

    Enum xmlDocProperties

    Enum xmlDocProperties {
    +    XML_DOC_WELLFORMED = 1 : document is XML well formed
    +    XML_DOC_NSVALID = 2 : document is Namespace valid
    +    XML_DOC_OLD10 = 4 : parsed with old XML-1.0 parser
    +    XML_DOC_DTDVALID = 8 : DTD validation was successful
    +    XML_DOC_XINCLUDE = 16 : XInclude substitution was done
    +    XML_DOC_USERBUILT = 32 : Document was built using the API and not by parsing an instance
    +    XML_DOC_INTERNAL = 64 : built for internal processing
    +    XML_DOC_HTML = 128 : parsed or built HTML document
    +}
    +

    Structure xmlDtd

    Structure xmlDtd
    struct _xmlDtd { void * _private : application data xmlElementType type : XML_DTD_NODE, must be second ! const xmlChar * name : Name of the DTD @@ -412,7 +427,7 @@ A:link, A:visited, A:active { text-decoration: underline } struct _xmlEntity * nexte : unused const xmlChar * URI : the full URI as computed int owner : does the entity own the childrens - int checked : was the entity content checked + int checked : was the entity content checked this is }

    Structure xmlEnumeration

    Structure xmlEnumeration
    struct _xmlEnumeration { struct _xmlEnumeration * next : next one const xmlChar * name : Enumeration name @@ -542,6 +557,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlAttrPtr freeAttrs : * the complete error informations for th xmlError lastError xmlParserMode parseMode : the parser mode + unsigned long nbentities : number of entities references + unsigned long sizeentities : size of parsed entities }

    Structure xmlParserInput

    Structure xmlParserInput
    struct _xmlParserInput { xmlParserInputBufferPtr buf : UTF-8 encoded buffer const char * filename : The file analyzed, if any diff --git a/doc/html/libxml-uri.html b/doc/html/libxml-uri.html index 9b8cdb6..61d4dba 100644 --- a/doc/html/libxml-uri.html +++ b/doc/html/libxml-uri.html @@ -53,11 +53,11 @@ A:link, A:visited, A:active { text-decoration: underline }
    uri:pointer to an xmlURI

    Function: xmlNormalizeURIPath

    int	xmlNormalizeURIPath		(char * path)

    Applies the 5 normalization steps to a path string--that is, RFC 2396 Section 5.2, steps 6.c through 6.g. Normalization occurs directly on the string, no new allocation is done

    path:pointer to the path string
    Returns:0 or an error code

    Function: xmlParseURI

    xmlURIPtr	xmlParseURI		(const char * str)
    -

    Parse an URI URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]

    +

    Parse an URI based on RFC 3986 URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]

    str:the URI string to analyze
    Returns:a newly built xmlURIPtr or NULL in case of error

    Function: xmlParseURIRaw

    xmlURIPtr	xmlParseURIRaw		(const char * str, 
    int raw)
    -

    Parse an URI but allows to keep intact the original fragments. URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]

    +

    Parse an URI but allows to keep intact the original fragments. URI-reference = URI / relative-ref

    str:the URI string to analyze
    raw:if 1 unescaping of URI pieces are disabled
    Returns:a newly built xmlURIPtr or NULL in case of error

    Function: xmlParseURIReference

    int	xmlParseURIReference		(xmlURIPtr uri, 
    const char * str)
    -

    Parse an URI reference string and fills in the appropriate fields of the @uri structure URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]

    +

    Parse an URI reference string based on RFC 3986 and fills in the appropriate fields of the @uri structure URI-reference = URI / relative-ref

    uri:pointer to an URI structure
    str:the string to analyze
    Returns:0 or the error code

    Function: xmlPathToURI

    xmlChar *	xmlPathToURI		(const xmlChar * path)

    Constructs an URI expressing the existing path

    path:the resource locator in a filesystem notation
    Returns:a new URI, or a duplicate of the path parameter if the construction fails. The caller is responsible for freeing the memory occupied by the returned string. If there is insufficient memory available, or the argument is NULL, the function returns NULL.

    Function: xmlPrintURI

    void	xmlPrintURI			(FILE * stream, 
    xmlURIPtr uri)
    diff --git a/doc/html/libxml-valid.html b/doc/html/libxml-valid.html index 30ef3cd..eb9f667 100644 --- a/doc/html/libxml-valid.html +++ b/doc/html/libxml-valid.html @@ -241,8 +241,8 @@ The content of this structure is not made public by the API.
    doc:the document
    elem:the parent
    name:the attribute name
    value:the attribute value
    Returns:a new normalized string if normalization is needed, NULL otherwise the caller must free the returned value.

    Function: xmlValidateAttributeDecl

    int	xmlValidateAttributeDecl	(xmlValidCtxtPtr ctxt, 
    xmlDocPtr doc,
    xmlAttributePtr attr)

    Try to validate a single attribute definition basically it does the following checks as described by the XML-1.0 recommendation: - [ VC: Attribute Default Legal ] - [ VC: Enumeration ] - [ VC: ID Attribute Default ] The ID/IDREF uniqueness and matching are done separately

    ctxt:the validation context
    doc:a document instance
    attr:an attribute definition
    Returns:1 if valid or 0 otherwise

    Function: xmlValidateAttributeValue

    int	xmlValidateAttributeValue	(xmlAttributeType type, 
    const xmlChar * value)
    -

    Validate that the given attribute value match the proper production [ VC: ID ] Values of type ID must match the Name production.... [ VC: IDREF ] Values of type IDREF must match the Name production, and values of type IDREFS must match Names ... [ VC: Entity Name ] Values of type ENTITY must match the Name production, values of type ENTITIES must match Names ... [ VC: Name Token ] Values of type NMTOKEN must match the Nmtoken production; values of type NMTOKENS must match Nmtokens.

    -
    type:an attribute type
    value:an attribute value
    Returns:1 if valid or 0 otherwise

    Function: xmlValidateDocument

    int	xmlValidateDocument		(xmlValidCtxtPtr ctxt, 
    xmlDocPtr doc)
    +

    +
    type:
    value:
    Returns:

    Function: xmlValidateDocument

    int	xmlValidateDocument		(xmlValidCtxtPtr ctxt, 
    xmlDocPtr doc)

    Try to validate the document instance basically it does the all the checks described by the XML Rec i.e. validates the internal and external subset (if present) and validate the document tree.

    ctxt:the validation context
    doc:a document instance
    Returns:1 if valid or 0 otherwise

    Function: xmlValidateDocumentFinal

    int	xmlValidateDocumentFinal	(xmlValidCtxtPtr ctxt, 
    xmlDocPtr doc)

    Does the final step for the document validation once all the incremental validation steps have been completed basically it does the following checks described by the XML Rec Check all the IDREF/IDREFS attributes definition for validity

    diff --git a/doc/html/libxml-xmlerror.html b/doc/html/libxml-xmlerror.html index 9803b4a..74af5ed 100644 --- a/doc/html/libxml-xmlerror.html +++ b/doc/html/libxml-xmlerror.html @@ -197,11 +197,14 @@ void xmlStructuredErrorFunc (void * userD XML_ERR_NOTATION_PROCESSING = 105 : 105 XML_WAR_NS_COLUMN = 106 : 106 XML_WAR_ENTITY_REDEFINED = 107 : 107 + XML_ERR_UNKNOWN_VERSION = 108 : 108 + XML_ERR_VERSION_MISMATCH = 109 : 109 XML_NS_ERR_XML_NAMESPACE = 200 XML_NS_ERR_UNDEFINED_NAMESPACE = 201 : 201 XML_NS_ERR_QNAME = 202 : 202 XML_NS_ERR_ATTRIBUTE_REDEFINED = 203 : 203 XML_NS_ERR_EMPTY = 204 : 204 + XML_NS_ERR_COLON = 205 : 205 XML_DTD_ATTRIBUTE_DEFAULT = 500 XML_DTD_ATTRIBUTE_REDEFINED = 501 : 501 XML_DTD_ATTRIBUTE_VALUE = 502 : 502 @@ -243,6 +246,7 @@ void xmlStructuredErrorFunc (void * userD XML_DTD_STANDALONE_DEFAULTED = 538 : 538 XML_DTD_XMLID_VALUE = 539 : 539 XML_DTD_XMLID_TYPE = 540 : 540 + XML_DTD_DUP_TOKEN = 541 : 541 XML_HTML_STRUCURE_ERROR = 800 XML_HTML_UNKNOWN_TAG = 801 : 801 XML_RNGP_ANYNAME_ATTR_ANCESTOR = 1000 diff --git a/doc/html/libxml-xmlmemory.html b/doc/html/libxml-xmlmemory.html index ea62ae7..8dd16ec 100644 --- a/doc/html/libxml-xmlmemory.html +++ b/doc/html/libxml-xmlmemory.html @@ -32,6 +32,7 @@ void * xmlMallocFunc (size_t size)
    void *	xmlMallocLoc			(size_t size, 
    const char * file,
    int line)
    int	xmlMemBlocks			(void)
    void	xmlMemDisplay			(FILE * fp)
    +
    void	xmlMemDisplayLast		(FILE * fp, 
    long nbBytes)
    void	xmlMemFree			(void * ptr)
    int	xmlMemGet			(xmlFreeFunc * freeFunc, 
    xmlMallocFunc * mallocFunc,
    xmlReallocFunc * reallocFunc,
    xmlStrdupFunc * strdupFunc)
    void *	xmlMemMalloc			(size_t size)
    @@ -73,7 +74,9 @@ void * xmlMallocFunc (size_t size)

    Provides the number of memory areas currently allocated

    Returns:an int representing the number of blocks

    Function: xmlMemDisplay

    void	xmlMemDisplay			(FILE * fp)

    show in-extenso the memory blocks allocated

    -
    fp:a FILE descriptor used as the output file, if NULL, the result is written to the file .memorylist

    Function: xmlMemFree

    void	xmlMemFree			(void * ptr)
    +
    fp:a FILE descriptor used as the output file, if NULL, the result is written to the file .memorylist

    Function: xmlMemDisplayLast

    void	xmlMemDisplayLast		(FILE * fp, 
    long nbBytes)
    +

    the last nbBytes of memory allocated and not freed, useful for dumping the memory left allocated between two places at runtime.

    +
    fp:a FILE descriptor used as the output file, if NULL, the result is written to the file .memorylist
    nbBytes:the amount of memory to dump

    Function: xmlMemFree

    void	xmlMemFree			(void * ptr)

    a free() equivalent, with error checking.

    ptr:the memory block pointer

    Function: xmlMemGet

    int	xmlMemGet			(xmlFreeFunc * freeFunc, 
    xmlMallocFunc * mallocFunc,
    xmlReallocFunc * reallocFunc,
    xmlStrdupFunc * strdupFunc)

    Provides the memory access functions set currently in use

    diff --git a/doc/html/libxml-xmlreader.html b/doc/html/libxml-xmlreader.html index b4c1cbc..f02707a 100644 --- a/doc/html/libxml-xmlreader.html +++ b/doc/html/libxml-xmlreader.html @@ -217,7 +217,7 @@ The content of this structure is not made public by the API.

    The depth of the node in the tree.

    reader:the xmlTextReaderPtr used
    Returns:the depth or -1 in case of error

    Function type: xmlTextReaderErrorFunc

    Function type: xmlTextReaderErrorFunc
     void	xmlTextReaderErrorFunc		(void * arg, 
    const char * msg,
    xmlParserSeverities severity,
    xmlTextReaderLocatorPtr locator) -

    arg:
    msg:
    severity:
    locator:

    +

    Signature of an error callback from a reader parser

    arg:the user argument
    msg:the message
    severity:the severity of the error
    locator:a locator indicating where the error occured

    Function: xmlTextReaderExpand

    xmlNodePtr	xmlTextReaderExpand	(xmlTextReaderPtr reader)

    Reads the contents of the current node and the full subtree. It then makes the subtree available until the next xmlTextReaderRead() call

    reader:the xmlTextReaderPtr used
    Returns:a node pointer valid until the next xmlTextReaderRead() call or NULL in case of error.

    Function: xmlTextReaderGetAttribute

    xmlChar *	xmlTextReaderGetAttribute	(xmlTextReaderPtr reader, 
    const xmlChar * name)
    diff --git a/doc/html/libxml-xmlregexp.html b/doc/html/libxml-xmlregexp.html index 642e930..15de2f4 100644 --- a/doc/html/libxml-xmlregexp.html +++ b/doc/html/libxml-xmlregexp.html @@ -117,7 +117,7 @@ The content of this structure is not made public by the API.

    Check whether @exp accepts all the languages accexpted by @sub the input being a subexpression.

    ctxt:the expressions context
    exp:the englobing expression
    sub:the subexpression
    Returns:1 if true 0 if false and -1 in case of failure.

    Function type: xmlRegExecCallbacks

    Function type: xmlRegExecCallbacks
     void	xmlRegExecCallbacks		(xmlRegExecCtxtPtr exec, 
    const xmlChar * token,
    void * transdata,
    void * inputdata) -

    exec:
    token:
    transdata:
    inputdata:

    +

    Callback function when doing a transition in the automata

    exec:the regular expression context
    token:the current token string
    transdata:transition data
    inputdata:input data

    Function: xmlRegExecErrInfo

    int	xmlRegExecErrInfo		(xmlRegExecCtxtPtr exec, 
    const xmlChar ** string,
    int * nbval,
    int * nbneg,
    xmlChar ** values,
    int * terminal)

    Extract error informations from the regexp execution, the parameter @string will be updated with the value pushed and not accepted, the parameter @values must point to an array of @nbval string pointers on return nbval will contain the number of possible strings in that state and the @values array will be updated with them. The string values

    exec:a regexp execution context generating an error
    string:return value for the error string
    nbval:pointer to the number of accepted values IN/OUT
    nbneg:return number of negative transitions
    values:pointer to the array of acceptable values
    terminal:return value if this was a terminal state
    Returns:will be freed with the @exec context and don't need to be deallocated. Returns: 0 in case of success or -1 in case of error.

    Function: xmlRegExecNextValues

    int	xmlRegExecNextValues		(xmlRegExecCtxtPtr exec, 
    int * nbval,
    int * nbneg,
    xmlChar ** values,
    int * terminal)
    diff --git a/doc/html/libxml-xmlschemas.html b/doc/html/libxml-xmlschemas.html index 261f221..aa4b76f 100644 --- a/doc/html/libxml-xmlschemas.html +++ b/doc/html/libxml-xmlschemas.html @@ -43,7 +43,8 @@ The content of this structure is not made public by the API.
    int	xmlSchemaSetValidOptions	(xmlSchemaValidCtxtPtr ctxt, 
    int options)
    void	xmlSchemaSetValidStructuredErrors	(xmlSchemaValidCtxtPtr ctxt, 
    xmlStructuredErrorFunc serror,
    void * ctx)
    int	xmlSchemaValidCtxtGetOptions	(xmlSchemaValidCtxtPtr ctxt)
    -
    int	xmlSchemaValidateDoc		(xmlSchemaValidCtxtPtr ctxt, 
    xmlDocPtr instance)
    +
    xmlParserCtxtPtr	xmlSchemaValidCtxtGetParserCtxt	(xmlSchemaValidCtxtPtr ctxt)
    +
    int	xmlSchemaValidateDoc		(xmlSchemaValidCtxtPtr ctxt, 
    xmlDocPtr doc)
    int	xmlSchemaValidateFile		(xmlSchemaValidCtxtPtr ctxt, 
    const char * filename,
    int options)
    int	xmlSchemaValidateOneElement	(xmlSchemaValidCtxtPtr ctxt, 
    xmlNodePtr elem)
    int	xmlSchemaValidateStream		(xmlSchemaValidCtxtPtr ctxt, 
    xmlParserInputBufferPtr input,
    xmlCharEncoding enc,
    xmlSAXHandlerPtr sax,
    void * user_data)
    @@ -120,51 +121,53 @@ The content of this structure is not made public by the API.
    schema:a schema structure

    Function: xmlSchemaFreeParserCtxt

    void	xmlSchemaFreeParserCtxt		(xmlSchemaParserCtxtPtr ctxt)

    Free the resources associated to the schema parser context

    ctxt:the schema parser context

    Function: xmlSchemaFreeValidCtxt

    void	xmlSchemaFreeValidCtxt		(xmlSchemaValidCtxtPtr ctxt)
    -

    -
    ctxt:

    Function: xmlSchemaGetParserErrors

    int	xmlSchemaGetParserErrors	(xmlSchemaParserCtxtPtr ctxt, 
    xmlSchemaValidityErrorFunc * err,
    xmlSchemaValidityWarningFunc * warn,
    void ** ctx)
    +

    Free the resources associated to the schema validation context

    +
    ctxt:the schema validation context

    Function: xmlSchemaGetParserErrors

    int	xmlSchemaGetParserErrors	(xmlSchemaParserCtxtPtr ctxt, 
    xmlSchemaValidityErrorFunc * err,
    xmlSchemaValidityWarningFunc * warn,
    void ** ctx)

    Get the callback information used to handle errors for a parser context

    ctxt:a XMl-Schema parser context
    err:the error callback result
    warn:the warning callback result
    ctx:contextual data for the callbacks result
    Returns:-1 in case of failure, 0 otherwise

    Function: xmlSchemaGetValidErrors

    int	xmlSchemaGetValidErrors		(xmlSchemaValidCtxtPtr ctxt, 
    xmlSchemaValidityErrorFunc * err,
    xmlSchemaValidityWarningFunc * warn,
    void ** ctx)
    -

    -
    ctxt:
    err:
    warn:
    ctx:
    Returns:

    Function: xmlSchemaIsValid

    int	xmlSchemaIsValid		(xmlSchemaValidCtxtPtr ctxt)
    -

    -
    ctxt:
    Returns:

    Function: xmlSchemaNewDocParserCtxt

    xmlSchemaParserCtxtPtr	xmlSchemaNewDocParserCtxt	(xmlDocPtr doc)
    +

    Get the error and warning callback informations

    +
    ctxt:a XML-Schema validation context
    err:the error function result
    warn:the warning function result
    ctx:the functions context result
    Returns:-1 in case of error and 0 otherwise

    Function: xmlSchemaIsValid

    int	xmlSchemaIsValid		(xmlSchemaValidCtxtPtr ctxt)
    +

    Check if any error was detected during validation.

    +
    ctxt:the schema validation context
    Returns:1 if valid so far, 0 if errors were detected, and -1 in case of internal error.

    Function: xmlSchemaNewDocParserCtxt

    xmlSchemaParserCtxtPtr	xmlSchemaNewDocParserCtxt	(xmlDocPtr doc)

    Create an XML Schemas parse context for that document. NB. The document may be modified during the parsing process.

    doc:a preparsed document tree
    Returns:the parser context or NULL in case of error

    Function: xmlSchemaNewMemParserCtxt

    xmlSchemaParserCtxtPtr	xmlSchemaNewMemParserCtxt	(const char * buffer, 
    int size)

    Create an XML Schemas parse context for that memory buffer expected to contain an XML Schemas file.

    buffer:a pointer to a char array containing the schemas
    size:the size of the array
    Returns:the parser context or NULL in case of error

    Function: xmlSchemaNewParserCtxt

    xmlSchemaParserCtxtPtr	xmlSchemaNewParserCtxt	(const char * URL)

    Create an XML Schemas parse context for that file/resource expected to contain an XML Schemas file.

    URL:the location of the schema
    Returns:the parser context or NULL in case of error

    Function: xmlSchemaNewValidCtxt

    xmlSchemaValidCtxtPtr	xmlSchemaNewValidCtxt	(xmlSchemaPtr schema)
    -

    -
    schema:
    Returns:

    Function: xmlSchemaParse

    xmlSchemaPtr	xmlSchemaParse		(xmlSchemaParserCtxtPtr ctxt)
    +

    Create an XML Schemas validation context based on the given schema.

    +
    schema:a precompiled XML Schemas
    Returns:the validation context or NULL in case of error

    Function: xmlSchemaParse

    xmlSchemaPtr	xmlSchemaParse		(xmlSchemaParserCtxtPtr ctxt)

    parse a schema definition resource and build an internal XML Shema struture which can be used to validate instances.

    ctxt:a schema validation context
    Returns:the internal XML Schema structure built from the resource or NULL in case of error

    Function: xmlSchemaSAXPlug

    xmlSchemaSAXPlugPtr	xmlSchemaSAXPlug	(xmlSchemaValidCtxtPtr ctxt, 
    xmlSAXHandlerPtr * sax,
    void ** user_data)
    -

    -
    ctxt:
    sax:
    user_data:
    Returns:

    Function: xmlSchemaSAXUnplug

    int	xmlSchemaSAXUnplug		(xmlSchemaSAXPlugPtr plug)
    -

    -
    plug:
    Returns:

    Function: xmlSchemaSetParserErrors

    void	xmlSchemaSetParserErrors	(xmlSchemaParserCtxtPtr ctxt, 
    xmlSchemaValidityErrorFunc err,
    xmlSchemaValidityWarningFunc warn,
    void * ctx)
    +

    Plug a SAX based validation layer in a SAX parsing event flow. The original @saxptr and @dataptr data are replaced by new pointers but the calls to the original will be maintained.

    +
    ctxt:a schema validation context
    sax:a pointer to the original xmlSAXHandlerPtr
    user_data:a pointer to the original SAX user data pointer
    Returns:a pointer to a data structure needed to unplug the validation layer or NULL in case of errors.

    Function: xmlSchemaSAXUnplug

    int	xmlSchemaSAXUnplug		(xmlSchemaSAXPlugPtr plug)
    +

    Unplug a SAX based validation layer in a SAX parsing event flow. The original pointers used in the call are restored.

    +
    plug:a data structure returned by xmlSchemaSAXPlug
    Returns:0 in case of success and -1 in case of failure.

    Function: xmlSchemaSetParserErrors

    void	xmlSchemaSetParserErrors	(xmlSchemaParserCtxtPtr ctxt, 
    xmlSchemaValidityErrorFunc err,
    xmlSchemaValidityWarningFunc warn,
    void * ctx)

    Set the callback functions used to handle errors for a validation context

    ctxt:a schema validation context
    err:the error callback
    warn:the warning callback
    ctx:contextual data for the callbacks

    Function: xmlSchemaSetParserStructuredErrors

    void	xmlSchemaSetParserStructuredErrors	(xmlSchemaParserCtxtPtr ctxt, 
    xmlStructuredErrorFunc serror,
    void * ctx)

    Set the structured error callback

    ctxt:a schema parser context
    serror:the structured error function
    ctx:the functions context

    Function: xmlSchemaSetValidErrors

    void	xmlSchemaSetValidErrors		(xmlSchemaValidCtxtPtr ctxt, 
    xmlSchemaValidityErrorFunc err,
    xmlSchemaValidityWarningFunc warn,
    void * ctx)
    -

    -
    ctxt:
    err:
    warn:
    ctx:

    Function: xmlSchemaSetValidOptions

    int	xmlSchemaSetValidOptions	(xmlSchemaValidCtxtPtr ctxt, 
    int options)
    -

    -
    ctxt:
    options:
    Returns:

    Function: xmlSchemaSetValidStructuredErrors

    void	xmlSchemaSetValidStructuredErrors	(xmlSchemaValidCtxtPtr ctxt, 
    xmlStructuredErrorFunc serror,
    void * ctx)
    -

    -
    ctxt:
    serror:
    ctx:

    Function: xmlSchemaValidCtxtGetOptions

    int	xmlSchemaValidCtxtGetOptions	(xmlSchemaValidCtxtPtr ctxt)
    -

    -
    ctxt:
    Returns:

    Function: xmlSchemaValidateDoc

    int	xmlSchemaValidateDoc		(xmlSchemaValidCtxtPtr ctxt, 
    xmlDocPtr instance)
    -

    -
    ctxt:
    instance:
    Returns:

    Function: xmlSchemaValidateFile

    int	xmlSchemaValidateFile		(xmlSchemaValidCtxtPtr ctxt, 
    const char * filename,
    int options)
    -

    -
    ctxt:
    filename:
    options:
    Returns:

    Function: xmlSchemaValidateOneElement

    int	xmlSchemaValidateOneElement	(xmlSchemaValidCtxtPtr ctxt, 
    xmlNodePtr elem)
    -

    -
    ctxt:
    elem:
    Returns:

    Function: xmlSchemaValidateStream

    int	xmlSchemaValidateStream		(xmlSchemaValidCtxtPtr ctxt, 
    xmlParserInputBufferPtr input,
    xmlCharEncoding enc,
    xmlSAXHandlerPtr sax,
    void * user_data)
    -

    -
    ctxt:
    input:
    enc:
    sax:
    user_data:
    Returns:

    Function type: xmlSchemaValidityErrorFunc

    Function type: xmlSchemaValidityErrorFunc
    +

    Set the error and warning callback informations

    +
    ctxt:a schema validation context
    err:the error function
    warn:the warning function
    ctx:the functions context

    Function: xmlSchemaSetValidOptions

    int	xmlSchemaSetValidOptions	(xmlSchemaValidCtxtPtr ctxt, 
    int options)
    +

    Sets the options to be used during the validation.

    +
    ctxt:a schema validation context
    options:a combination of xmlSchemaValidOption
    Returns:0 in case of success, -1 in case of an API error.

    Function: xmlSchemaSetValidStructuredErrors

    void	xmlSchemaSetValidStructuredErrors	(xmlSchemaValidCtxtPtr ctxt, 
    xmlStructuredErrorFunc serror,
    void * ctx)
    +

    Set the structured error callback

    +
    ctxt:a schema validation context
    serror:the structured error function
    ctx:the functions context

    Function: xmlSchemaValidCtxtGetOptions

    int	xmlSchemaValidCtxtGetOptions	(xmlSchemaValidCtxtPtr ctxt)
    +

    Get the validation context options.

    +
    ctxt:a schema validation context
    Returns:the option combination or -1 on error.

    Function: xmlSchemaValidCtxtGetParserCtxt

    xmlParserCtxtPtr	xmlSchemaValidCtxtGetParserCtxt	(xmlSchemaValidCtxtPtr ctxt)
    +

    allow access to the parser context of the schema validation context

    +
    ctxt:a schema validation context
    Returns:the parser context of the schema validation context or NULL in case of error.

    Function: xmlSchemaValidateDoc

    int	xmlSchemaValidateDoc		(xmlSchemaValidCtxtPtr ctxt, 
    xmlDocPtr doc)
    +

    Validate a document tree in memory.

    +
    ctxt:a schema validation context
    doc:a parsed document tree
    Returns:0 if the document is schemas valid, a positive error code number otherwise and -1 in case of internal or API error.

    Function: xmlSchemaValidateFile

    int	xmlSchemaValidateFile		(xmlSchemaValidCtxtPtr ctxt, 
    const char * filename,
    int options)
    +

    Do a schemas validation of the given resource, it will use the SAX streamable validation internally.

    +
    ctxt:a schema validation context
    filename:the URI of the instance
    options:a future set of options, currently unused
    Returns:0 if the document is valid, a positive error code number otherwise and -1 in case of an internal or API error.

    Function: xmlSchemaValidateOneElement

    int	xmlSchemaValidateOneElement	(xmlSchemaValidCtxtPtr ctxt, 
    xmlNodePtr elem)
    +

    Validate a branch of a tree, starting with the given @elem.

    +
    ctxt:a schema validation context
    elem:an element node
    Returns:0 if the element and its subtree is valid, a positive error code number otherwise and -1 in case of an internal or API error.

    Function: xmlSchemaValidateStream

    int	xmlSchemaValidateStream		(xmlSchemaValidCtxtPtr ctxt, 
    xmlParserInputBufferPtr input,
    xmlCharEncoding enc,
    xmlSAXHandlerPtr sax,
    void * user_data)
    +

    Validate an input based on a flow of SAX event from the parser and forward the events to the @sax handler with the provided @user_data the user provided @sax handler must be a SAX2 one.

    +
    ctxt:a schema validation context
    input:the input to use for reading the data
    enc:an optional encoding information
    sax:a SAX handler for the resulting events
    user_data:the context to provide to the SAX handler.
    Returns:0 if the document is schemas valid, a positive error code number otherwise and -1 in case of internal or API error.

    Function type: xmlSchemaValidityErrorFunc

    Function type: xmlSchemaValidityErrorFunc
     void	xmlSchemaValidityErrorFunc	(void * ctx, 
    const char * msg,
    ... ...) -

    ctx:
    msg:
    ...:

    +

    Signature of an error callback from an XSD validation

    ctx:the validation context
    msg:the message
    ...:extra arguments

    Function type: xmlSchemaValidityWarningFunc

    Function type: xmlSchemaValidityWarningFunc
     void	xmlSchemaValidityWarningFunc	(void * ctx, 
    const char * msg,
    ... ...) -

    ctx:
    msg:
    ...:

    +

    Signature of a warning callback from an XSD validation

    ctx:the validation context
    msg:the message
    ...:extra arguments

    Daniel Veillard

    diff --git a/doc/libxml2-api.xml b/doc/libxml2-api.xml index 867ac92..98dc568 100644 --- a/doc/libxml2-api.xml +++ b/doc/libxml2-api.xml @@ -445,6 +445,7 @@ + @@ -665,6 +666,7 @@ + @@ -674,9 +676,10 @@ - + + @@ -699,7 +702,7 @@ - + @@ -711,7 +714,7 @@ - + @@ -729,7 +732,7 @@ - + @@ -738,6 +741,7 @@ + @@ -1393,36 +1397,44 @@ + + + - + + + + + - + - + + @@ -1433,9 +1445,10 @@ - + + @@ -1487,6 +1500,7 @@ + @@ -2010,7 +2024,6 @@ - @@ -2023,7 +2036,7 @@ - + @@ -2062,7 +2075,7 @@ - + @@ -2193,6 +2206,7 @@ + @@ -2266,7 +2280,7 @@ - + @@ -2360,6 +2374,7 @@ + @@ -2470,7 +2485,7 @@ - + @@ -2505,6 +2520,7 @@ + @@ -2521,6 +2537,7 @@ + @@ -2557,7 +2574,7 @@ - + @@ -2666,6 +2683,7 @@ + @@ -2742,6 +2760,7 @@ + @@ -3046,6 +3065,7 @@ + @@ -4579,9 +4599,10 @@ - - - + + + + @@ -4670,6 +4691,15 @@ + + + + + + + + @@ -4677,6 +4707,7 @@ + @@ -4824,11 +4855,13 @@ + + @@ -4953,6 +4986,7 @@ + @@ -4983,13 +5017,15 @@ - + + @@ -4999,6 +5035,7 @@ crash if you try to modify the tree)'/> + @@ -5861,6 +5898,7 @@ if necessary or NULL'/> + @@ -5940,7 +5978,12 @@ standalone attribute was specified'/> actually an xmlCharEncoding'/> + + + @@ -6016,7 +6059,8 @@ actually an xmlCharEncoding'/> - + @@ -6255,6 +6299,8 @@ actually an xmlCharEncoding'/> *'/> + + @@ -7727,7 +7773,7 @@ Could we use @subtypes for this?'/> Pushes a new parser input on top of the input stack - + @@ -7793,7 +7839,7 @@ Could we use @subtypes for this?'/> Pushes a new element node on top of the node stack - + @@ -8552,11 +8598,11 @@ Could we use @subtypes for this?'/> defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) - - - - - + Signature for a C14N callback on visible nodes + + + + Constructs a canonic path from the specified path. @@ -9247,9 +9293,9 @@ Could we use @subtypes for this?'/> - + Signature for the deregistration callback of a discarded node - + Guess the encoding of the entity using the first bytes of the entity content according to the non-normative appendix F of the XML-1.0 recommendation. @@ -10742,6 +10788,12 @@ Could we use @subtypes for this?'/> + + the last nbBytes of memory allocated and not freed, useful for dumping the memory left allocated between two places at runtime. + + + + a free() equivalent, with error checking. @@ -11257,6 +11309,16 @@ Could we use @subtypes for this?'/> + + Create a new entity, this differs from xmlAddDocEntity() that if the document is NULL or has no internal subset defined, then an unlinked entity structure will be returned, it is then the responsability of the caller to link it to the document later or free it when not needed anymore. + + + + + + + + Create a new input stream based on an xmlEntityPtr @@ -11628,9 +11690,9 @@ Could we use @subtypes for this?'/> - - - + Signature for the function doing the lookup for a suitable output method corresponding to an URI. + + @@ -12042,23 +12104,23 @@ Could we use @subtypes for this?'/> - parse an XML declaration header for external entities [77] TextDecl ::= '<?xml' VersionInfo? EncodingDecl S? '?>' Question: Seems that EncodingDecl is mandatory ? Is that a typo ? + parse an XML declaration header for external entities [77] TextDecl ::= '<?xml' VersionInfo? EncodingDecl S? '?>' - Parse an URI URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ] + Parse an URI based on RFC 3986 URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ] - Parse an URI but allows to keep intact the original fragments. URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ] + Parse an URI but allows to keep intact the original fragments. URI-reference = URI / relative-ref - Parse an URI reference string and fills in the appropriate fields of the @uri structure URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ] + Parse an URI reference string based on RFC 3986 and fills in the appropriate fields of the @uri structure URI-reference = URI / relative-ref @@ -12069,7 +12131,7 @@ Could we use @subtypes for this?'/> - parse the XML version value. [26] VersionNum ::= ([a-zA-Z0-9_.:] | '-')+ + parse the XML version value. [26] VersionNum ::= '1.' [0-9]+ In practice allow [0-9].[0-9]+ at that level @@ -12143,10 +12205,10 @@ Could we use @subtypes for this?'/> - - - - + Signature for the function doing the lookup for a suitable input method corresponding to an URI. + + + Create a buffered parser input for the progressive parsing for the input from an I/O handler @@ -12315,7 +12377,7 @@ Could we use @subtypes for this?'/> xmlPushInput: switch to a new input stream which is stacked on top of the previous one(s). - + @@ -12525,12 +12587,12 @@ Could we use @subtypes for this?'/> defined(LIBXML_REGEXP_ENABLED) - + Callback function when doing a transition in the automata - - - - + + + + defined(LIBXML_REGEXP_ENABLED) @@ -12649,9 +12711,9 @@ Could we use @subtypes for this?'/> - + Signature for the registration callback of a created node - + defined(LIBXML_OUTPUT_ENABLED) @@ -12828,19 +12890,19 @@ Could we use @subtypes for this?'/> defined(LIBXML_SCHEMAS_ENABLED) - + Signature of an error callback from a Relax-NG validation - - - + + + defined(LIBXML_SCHEMAS_ENABLED) - + Signature of a warning callback from a Relax-NG validation - - - + + + defined(LIBXML_SCHEMAS_ENABLED) @@ -13405,9 +13467,9 @@ Could we use @subtypes for this?'/> defined(LIBXML_SCHEMAS_ENABLED) - + Free the resources associated to the schema validation context - + defined(LIBXML_SCHEMAS_ENABLED) @@ -13478,12 +13540,12 @@ Could we use @subtypes for this?'/> defined(LIBXML_SCHEMAS_ENABLED) - - - - - - + Get the error and warning callback informations + + + + + defined(LIBXML_SCHEMAS_ENABLED) @@ -13499,9 +13561,9 @@ Could we use @subtypes for this?'/> defined(LIBXML_SCHEMAS_ENABLED) - - - + Check if any error was detected during validation. + + defined(LIBXML_SCHEMAS_ENABLED) @@ -13550,9 +13612,9 @@ Could we use @subtypes for this?'/> defined(LIBXML_SCHEMAS_ENABLED) - - - + Create an XML Schemas validation context based on the given schema. + + defined(LIBXML_SCHEMAS_ENABLED) @@ -13562,17 +13624,17 @@ Could we use @subtypes for this?'/> defined(LIBXML_SCHEMAS_ENABLED) - - - - - + Plug a SAX based validation layer in a SAX parsing event flow. The original @saxptr and @dataptr data are replaced by new pointers but the calls to the original will be maintained. + + + + defined(LIBXML_SCHEMAS_ENABLED) - - - + Unplug a SAX based validation layer in a SAX parsing event flow. The original pointers used in the call are restored. + + defined(LIBXML_SCHEMAS_ENABLED) @@ -13593,27 +13655,27 @@ Could we use @subtypes for this?'/> defined(LIBXML_SCHEMAS_ENABLED) - + Set the error and warning callback informations - - - - + + + + defined(LIBXML_SCHEMAS_ENABLED) - - - - + Sets the options to be used during the validation. + + + defined(LIBXML_SCHEMAS_ENABLED) - + Set the structured error callback - - - + + + defined(LIBXML_SCHEMAS_ENABLED) @@ -13635,16 +13697,22 @@ Could we use @subtypes for this?'/> defined(LIBXML_SCHEMAS_ENABLED) - - - + Get the validation context options. + + + + + defined(LIBXML_SCHEMAS_ENABLED) + allow access to the parser context of the schema validation context + + defined(LIBXML_SCHEMAS_ENABLED) - - - - + Validate a document tree in memory. + + + defined(LIBXML_SCHEMAS_ENABLED) @@ -13668,11 +13736,11 @@ Could we use @subtypes for this?'/> defined(LIBXML_SCHEMAS_ENABLED) - - - - - + Do a schemas validation of the given resource, it will use the SAX streamable validation internally. + + + + defined(LIBXML_SCHEMAS_ENABLED) @@ -13706,10 +13774,10 @@ Could we use @subtypes for this?'/> defined(LIBXML_SCHEMAS_ENABLED) - - - - + Validate a branch of a tree, starting with the given @elem. + + + defined(LIBXML_SCHEMAS_ENABLED) @@ -13721,29 +13789,29 @@ Could we use @subtypes for this?'/> defined(LIBXML_SCHEMAS_ENABLED) - - - - - - - + Validate an input based on a flow of SAX event from the parser and forward the events to the @sax handler with the provided @user_data the user provided @sax handler must be a SAX2 one. + + + + + + defined(LIBXML_SCHEMAS_ENABLED) - + Signature of an error callback from an XSD validation - - - + + + defined(LIBXML_SCHEMAS_ENABLED) - + Signature of a warning callback from an XSD validation - - - + + + defined(LIBXML_SCHEMAS_ENABLED) @@ -13843,19 +13911,19 @@ Could we use @subtypes for this?'/> defined(LIBXML_SCHEMATRON_ENABLED) - + Signature of an error callback from a Schematron validation - - - + + + defined(LIBXML_SCHEMATRON_ENABLED) - + Signature of a warning callback from a Schematron validation - - - + + + Search a Ns registered under a given name space for a document. recurse on the parents until it finds the defined namespace or return NULL otherwise. @nameSpace can be NULL, this is a search for the default namespace. We don't allow to cross entities boundaries. If you don't declare the namespace within those you will be in troubles !!! A warning is generated to cover this case. @@ -14486,12 +14554,12 @@ Could we use @subtypes for this?'/> defined(LIBXML_READER_ENABLED) - + Signature of an error callback from a reader parser - - - - + + + + defined(LIBXML_READER_ENABLED) @@ -16670,10 +16738,10 @@ Could we use @subtypes for this?'/> defined(LIBXML_VALID_ENABLED) - Validate that the given attribute value match the proper production [ VC: ID ] Values of type ID must match the Name production.... [ VC: IDREF ] Values of type IDREF must match the Name production, and values of type IDREFS must match Names ... [ VC: Entity Name ] Values of type ENTITY must match the Name production, values of type ENTITIES must match Names ... [ VC: Name Token ] Values of type NMTOKEN must match the Nmtoken production; values of type NMTOKENS must match Nmtokens. - - - + + + + defined(LIBXML_VALID_ENABLED) diff --git a/doc/libxml2.xsa b/doc/libxml2.xsa index 9133b40..f93c298 100644 --- a/doc/libxml2.xsa +++ b/doc/libxml2.xsa @@ -8,26 +8,42 @@ libxml2 - 2.6.31 - Jan 11 2008 + 2.6.32 + Apr 8 2008 http://xmlsoft.org/ - - Security fix: missing of checks in UTF-8 parsing - - Bug fixes: regexp bug, dump attribute from XHTML document, fix - xmlFree(NULL) to not crash in debug mode, Schematron parsing crash - (Rob Richards), global lock free on Windows (Marc-Antoine Ruel), - XSD crash due to double free (Rob Richards), indentation fix in - xmlTextWriterFullEndElement (Felipe Pena), error in attribute type - parsing if attribute redeclared, avoid crash in hash list scanner if - deleting elements, column counter bug fix (Christian Schmidt), - HTML embed element saving fix (Stefan Behnel), avoid -L/usr/lib - output from xml2-config (Fred Crozat), avoid an xmllint crash - (Stefan Kost), don't stop HTML parsing on out of range chars. - - - Code cleanup: fix open() call third argument, regexp cut'n paste - copy error, unused variable in __xmlGlobalInitMutexLock (Hannes Eder), - some make distcheck realted fixes (John Carr) - - Improvements: HTTP Header: includes port number (William Brack), - testURI --debug option, + - Documentation: returning heap memory to kernel (Wolfram Sang), + trying to clarify xmlCleanupParser() use, xmlXPathContext improvement + (Jack Jansen), improve the *Recover* functions documentation, + XmlNodeType doc link fix (Martijn Arts) + - Bug fixes: internal subset memory leak (Ashwin), avoid problem with + paths starting with // (Petr Sumbera), streaming XSD validation callback + patches (Ashwin), fix redirection on port other than 80 (William Brack), + SAX2 leak (Ashwin), XInclude fragment of own document (Chris Ryan), + regexp bug with '.' (Andrew Tosh), flush the writer at the end of the + document (Alfred Mickautsch), output I/O bug fix (William Brack), + writer CDATA output after a text node (Alex Khesin), UTF-16 encoding + detection (William Brack), fix handling of empty CDATA nodes for Safari + team, python binding problem with namespace nodes, improve HTML parsing + (Arnold Hendriks), regexp automata build bug, memory leak fix (Vasily + Chekalkin), XSD test crash, weird system parameter entity parsing problem, + allow save to file:///X:/ windows paths, various attribute normalisation + problems, externalSubsetSplit fix (Ashwin), attribute redefinition in + the DTD (Ashwin), fix in char ref parsing check (Alex Khesin), many + out of memory handling fixes (Ashwin), XPath out of memory handling fixes + (Alvaro Herrera), various realloc problems (Ashwin), UCS4 encoding + conversion buffer size (Christian Fruth), problems with EatName + functions on memory errors, BOM handling in external parsed entities + (Mark Rowe) + - Code cleanup: fix build under VS 2008 (David Wimsey), remove useless + mutex in xmlDict (Florent Guilian), Mingw32 compilation fix (Carlo + Bramini), Win and MacOS EOL cleanups (Florent Guiliani), iconv need + a const detection (Roumen Petrov), simplify xmlSetProp (Julien Charbon), + cross compilation fixes for Mingw (Roumen Petrov), SCO Openserver build + fix (Florent Guiliani), iconv uses const on Win32 (Rob Richards), + duplicate code removal (Ashwin), missing malloc test and error reports + (Ashwin), VMS makefile fix (Tycho Hilhorst) + - improvements: better plug of schematron in the normal error handling + (Tobias Minich) diff --git a/doc/news.html b/doc/news.html index 4c89278..a4126c0 100644 --- a/doc/news.html +++ b/doc/news.html @@ -12,7 +12,31 @@ to help those

    The change log describes the recents commits -to the SVN code base.

    Here is the list of public releases:

    2.6.32: Apr 8 2008

    • Documentation: returning heap memory to kernel (Wolfram Sang), +to the SVN code base.

      Here is the list of public releases:

      2.7.0: Aug 30 2008

      • Documentation: switch ChangeLog to UTF-8, improve mutithreads and + xmlParserCleanup docs
      • +
      • Portability fixes: Older Win32 platforms (Rob Richards), MSVC + porting fix (Rob Richards), Mac OS X regression tests (Sven Herzberg), + non GNUCC builds (Rob Richards), compilation on Haiku (Andreas Färber) +
      • +
      • Bug fixes: various realloc problems (Ashwin), potential double-free + (Ashwin), regexp crash, icrash with invalid whitespace facets (Rob + Richards), pattern fix when streaming (William Brack), various XML + parsing and validation fixes based on the W3C regression tests, reader + tree skipping function fix (Ashwin), Schemas regexps escaping fix + (Volker Grabsch), handling of entity push errors (Ashwin), fix a slowdown + when encoder cant serialize characters on output
      • +
      • Code cleanup: compilation fix without the reader, without the output + (Robert Schwebel), python whitespace (Martin), many space/tabs cleanups, + serious cleanup of the entity handling code
      • +
      • Improvement: switch parser to XML-1.0 5th edition, add parsing flags + for old versions, switch URI parsing to RFC 3986, + add xmlSchemaValidCtxtGetParserCtxt (Holger Kaelberer), + new hashing functions for dictionnaries (based on Stefan Behnel work), + improve handling of misplaced html/head/body in HTML parser, better + regression test tools and code coverage display, better algorithms + to detect various versions of the billion laughts attacks, make + arbitrary parser limits avoidable as a parser option
      • +

      2.6.32: Apr 8 2008

      • Documentation: returning heap memory to kernel (Wolfram Sang), trying to clarify xmlCleanupParser() use, xmlXPathContext improvement (Jack Jansen), improve the *Recover* functions documentation, XmlNodeType doc link fix (Martijn Arts)
      • diff --git a/doc/news.xsl b/doc/news.xsl index 2312e0d..50089eb 100644 --- a/doc/news.xsl +++ b/doc/news.xsl @@ -2,7 +2,7 @@ - + diff --git a/doc/xml.html b/doc/xml.html index 8e42443..30398d2 100644 --- a/doc/xml.html +++ b/doc/xml.html @@ -421,9 +421,11 @@ pnode=pxmlDoc->children->children; and libxml2, but you need to install a more recent version: libxml(-devel) >= 1.8.8 or libxml2(-devel) >= 2.1.0

        -
      • XPath implementation looks seriously broken -

        XPath implementation prior to 2.3.0 was really incomplete. Upgrade to - a recent version, there are no known bugs in the current version.

        +
      • Random crashes in threaded applications +

        Read and follow all advices on the thread + safety page, and make 100% sure you never call xmlCleanupParser() + while the library or an XML document might still be in use by another + thread.

      • The example provided in the web page does not compile.

        It's hard to maintain the documentation in sync with the code @@ -440,16 +442,8 @@ pnode=pxmlDoc->children->children; generated doc

      • have a look at the set of examples.
      • -
      • look for examples of use for libxml2 function using the Gnome code. - -
      • +
      • look for examples of use for libxml2 function using the Gnome code + or by asking on Google.
      • Browse the libxml2 source , I try to write code as clean and documented @@ -471,12 +465,6 @@ pnode=pxmlDoc->children->children;

        Download: http://sourceforge.net/project/showfiles.php?group_id=12999

      • -
    • How to validate a document a posteriori ? @@ -739,6 +727,33 @@ to the SVN code base.<

      Here is the list of public releases:

      +

      2.7.0: Aug 30 2008

      +
        +
      • Documentation: switch ChangeLog to UTF-8, improve mutithreads and + xmlParserCleanup docs
      • +
      • Portability fixes: Older Win32 platforms (Rob Richards), MSVC + porting fix (Rob Richards), Mac OS X regression tests (Sven Herzberg), + non GNUCC builds (Rob Richards), compilation on Haiku (Andreas Färber) +
      • +
      • Bug fixes: various realloc problems (Ashwin), potential double-free + (Ashwin), regexp crash, icrash with invalid whitespace facets (Rob + Richards), pattern fix when streaming (William Brack), various XML + parsing and validation fixes based on the W3C regression tests, reader + tree skipping function fix (Ashwin), Schemas regexps escaping fix + (Volker Grabsch), handling of entity push errors (Ashwin), fix a slowdown + when encoder cant serialize characters on output
      • +
      • Code cleanup: compilation fix without the reader, without the output + (Robert Schwebel), python whitespace (Martin), many space/tabs cleanups, + serious cleanup of the entity handling code
      • +
      • Improvement: switch parser to XML-1.0 5th edition, add parsing flags + for old versions, switch URI parsing to RFC 3986, + add xmlSchemaValidCtxtGetParserCtxt (Holger Kaelberer), + new hashing functions for dictionnaries (based on Stefan Behnel work), + improve handling of misplaced html/head/body in HTML parser, better + regression test tools and code coverage display, better algorithms + to detect various versions of the billion laughts attacks, make + arbitrary parser limits avoidable as a parser option
      • +

      2.6.32: Apr 8 2008

      • Documentation: returning heap memory to kernel (Wolfram Sang), diff --git a/elfgcchack.h b/elfgcchack.h index e1d21bb..a747fca 100644 --- a/elfgcchack.h +++ b/elfgcchack.h @@ -9841,6 +9841,18 @@ extern __typeof (xmlSchemaValidCtxtGetOptions) xmlSchemaValidCtxtGetOptions__int #endif #endif +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaValidCtxtGetParserCtxt +extern __typeof (xmlSchemaValidCtxtGetParserCtxt) xmlSchemaValidCtxtGetParserCtxt __attribute((alias("xmlSchemaValidCtxtGetParserCtxt__internal_alias"))); +#else +#ifndef xmlSchemaValidCtxtGetParserCtxt +extern __typeof (xmlSchemaValidCtxtGetParserCtxt) xmlSchemaValidCtxtGetParserCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaValidCtxtGetParserCtxt xmlSchemaValidCtxtGetParserCtxt__internal_alias +#endif +#endif +#endif + #if defined(LIBXML_SCHEMAS_ENABLED) #ifdef bottom_xmlschemas #undef xmlSchemaValidateDoc diff --git a/encoding.c b/encoding.c index 6c49fff..e2df797 100644 --- a/encoding.c +++ b/encoding.c @@ -1999,9 +1999,11 @@ retry: if (handler->output != NULL) { ret = handler->output(&out->content[out->use], &written, in->content, &toconv); - xmlBufferShrink(in, toconv); - out->use += written; - writtentot += written; + if (written > 0) { + xmlBufferShrink(in, toconv); + out->use += written; + writtentot += written; + } out->content[out->use] = 0; } #ifdef LIBXML_ICONV_ENABLED diff --git a/entities.c b/entities.c index 91a3978..c171e97 100644 --- a/entities.c +++ b/entities.c @@ -139,45 +139,19 @@ xmlFreeEntity(xmlEntityPtr entity) } /* - * xmlAddEntity : register a new entity for an entities table. + * xmlCreateEntity: + * + * internal routine doing the entity node strutures allocations */ static xmlEntityPtr -xmlAddEntity(xmlDtdPtr dtd, const xmlChar *name, int type, - const xmlChar *ExternalID, const xmlChar *SystemID, - const xmlChar *content) { - xmlDictPtr dict = NULL; - xmlEntitiesTablePtr table = NULL; +xmlCreateEntity(xmlDictPtr dict, const xmlChar *name, int type, + const xmlChar *ExternalID, const xmlChar *SystemID, + const xmlChar *content) { xmlEntityPtr ret; - if (name == NULL) - return(NULL); - if (dtd == NULL) - return(NULL); - if (dtd->doc != NULL) - dict = dtd->doc->dict; - - switch (type) { - case XML_INTERNAL_GENERAL_ENTITY: - case XML_EXTERNAL_GENERAL_PARSED_ENTITY: - case XML_EXTERNAL_GENERAL_UNPARSED_ENTITY: - if (dtd->entities == NULL) - dtd->entities = xmlHashCreateDict(0, dict); - table = dtd->entities; - break; - case XML_INTERNAL_PARAMETER_ENTITY: - case XML_EXTERNAL_PARAMETER_ENTITY: - if (dtd->pentities == NULL) - dtd->pentities = xmlHashCreateDict(0, dict); - table = dtd->pentities; - break; - case XML_INTERNAL_PREDEFINED_ENTITY: - return(NULL); - } - if (table == NULL) - return(NULL); ret = (xmlEntityPtr) xmlMalloc(sizeof(xmlEntity)); if (ret == NULL) { - xmlEntitiesErrMemory("xmlAddEntity:: malloc failed"); + xmlEntitiesErrMemory("xmlCreateEntity: malloc failed"); return(NULL); } memset(ret, 0, sizeof(xmlEntity)); @@ -216,6 +190,50 @@ xmlAddEntity(xmlDtdPtr dtd, const xmlChar *name, int type, the defining entity */ ret->orig = NULL; ret->owner = 0; + + return(ret); +} + +/* + * xmlAddEntity : register a new entity for an entities table. + */ +static xmlEntityPtr +xmlAddEntity(xmlDtdPtr dtd, const xmlChar *name, int type, + const xmlChar *ExternalID, const xmlChar *SystemID, + const xmlChar *content) { + xmlDictPtr dict = NULL; + xmlEntitiesTablePtr table = NULL; + xmlEntityPtr ret; + + if (name == NULL) + return(NULL); + if (dtd == NULL) + return(NULL); + if (dtd->doc != NULL) + dict = dtd->doc->dict; + + switch (type) { + case XML_INTERNAL_GENERAL_ENTITY: + case XML_EXTERNAL_GENERAL_PARSED_ENTITY: + case XML_EXTERNAL_GENERAL_UNPARSED_ENTITY: + if (dtd->entities == NULL) + dtd->entities = xmlHashCreateDict(0, dict); + table = dtd->entities; + break; + case XML_INTERNAL_PARAMETER_ENTITY: + case XML_EXTERNAL_PARAMETER_ENTITY: + if (dtd->pentities == NULL) + dtd->pentities = xmlHashCreateDict(0, dict); + table = dtd->pentities; + break; + case XML_INTERNAL_PREDEFINED_ENTITY: + return(NULL); + } + if (table == NULL) + return(NULL); + ret = xmlCreateEntity(dict, name, type, ExternalID, SystemID, content); + if (ret == NULL) + return(NULL); ret->doc = dtd->doc; if (xmlHashAddEntry(table, name, ret)) { @@ -362,6 +380,44 @@ xmlAddDocEntity(xmlDocPtr doc, const xmlChar *name, int type, return(ret); } +/** + * xmlNewEntity: + * @doc: the document + * @name: the entity name + * @type: the entity type XML_xxx_yyy_ENTITY + * @ExternalID: the entity external ID if available + * @SystemID: the entity system ID if available + * @content: the entity content + * + * Create a new entity, this differs from xmlAddDocEntity() that if + * the document is NULL or has no internal subset defined, then an + * unlinked entity structure will be returned, it is then the responsability + * of the caller to link it to the document later or free it when not needed + * anymore. + * + * Returns a pointer to the entity or NULL in case of error + */ +xmlEntityPtr +xmlNewEntity(xmlDocPtr doc, const xmlChar *name, int type, + const xmlChar *ExternalID, const xmlChar *SystemID, + const xmlChar *content) { + xmlEntityPtr ret; + xmlDictPtr dict; + + if ((doc != NULL) && (doc->intSubset != NULL)) { + return(xmlAddDocEntity(doc, name, type, ExternalID, SystemID, content)); + } + if (doc != NULL) + dict = doc->dict; + else + dict = NULL; + ret = xmlCreateEntity(dict, name, type, ExternalID, SystemID, content); + if (ret == NULL) + return(NULL); + ret->doc = doc; + return(ret); +} + /** * xmlGetEntityFromTable: * @table: an entity table diff --git a/example/Makefile.in b/example/Makefile.in index 2ecca3f..cc610a1 100644 --- a/example/Makefile.in +++ b/example/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -51,7 +51,7 @@ am__DEPENDENCIES_2 = $(top_builddir)/libxml2.la $(am__DEPENDENCIES_1) gjobread_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(gjobread_LDFLAGS) \ $(LDFLAGS) -o $@ -DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ @@ -374,8 +374,8 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS @@ -387,8 +387,8 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ @@ -398,13 +398,12 @@ ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ - here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique diff --git a/gentest.py b/gentest.py index 4538eb8..17c9f59 100755 --- a/gentest.py +++ b/gentest.py @@ -174,7 +174,8 @@ skipped_memcheck = [ "xmlLoadCatalog", "xmlAddEncodingAlias", "xmlInitCharEncodingHandlers", "xmlCatalogCleanup", "xmlSchemaGetBuiltInType", "htmlParseFile", "htmlCtxtReadFile", # loads the catalogs - "xmlTextReaderSchemaValidate", "xmlSchemaCleanupTypes" # initialize the schemas type system + "xmlTextReaderSchemaValidate", "xmlSchemaCleanupTypes", # initialize the schemas type system + "xmlCatalogResolve", "xmlIOParseDTD" # loads the catalogs ] # @@ -207,6 +208,8 @@ extra_pre_call = { extra_post_call = { "xmlAddChild": "if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; }", + "xmlAddEntity": + "if (ret_val != NULL) { xmlFreeNode(ret_val) ; ret_val = NULL; }", "xmlAddChildList": "if (ret_val == NULL) { xmlFreeNodeList(cur) ; cur = NULL ; }", "xmlAddSibling": diff --git a/include/Makefile.in b/include/Makefile.in index f2292f4..00844d1 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -387,8 +387,8 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS @@ -413,8 +413,8 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ @@ -424,13 +424,12 @@ ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ - here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique diff --git a/include/libxml/Makefile.in b/include/libxml/Makefile.in index 1d495a9..f6650ef 100644 --- a/include/libxml/Makefile.in +++ b/include/libxml/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -386,8 +386,8 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS @@ -399,8 +399,8 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ @@ -410,13 +410,12 @@ ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ - here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique diff --git a/include/libxml/c14n.h b/include/libxml/c14n.h index 9f4c6c0..a8aa737 100644 --- a/include/libxml/c14n.h +++ b/include/libxml/c14n.h @@ -2,30 +2,30 @@ * Summary: Provide Canonical XML and Exclusive XML Canonicalization * Description: the c14n modules provides a * - * "Canonical XML" implementation + * "Canonical XML" implementation * http://www.w3.org/TR/xml-c14n - * + * * and an * * "Exclusive XML Canonicalization" implementation * http://www.w3.org/TR/xml-exc-c14n - + * Copy: See Copyright for the status of this software. - * + * * Author: Aleksey Sanin */ #ifndef __XML_C14N_H__ -#define __XML_C14N_H__ +#define __XML_C14N_H__ #ifdef LIBXML_C14N_ENABLED #ifdef LIBXML_OUTPUT_ENABLED #ifdef __cplusplus extern "C" { -#endif /* __cplusplus */ +#endif /* __cplusplus */ #include #include -#include +#include /* * XML Canonicazation @@ -37,28 +37,28 @@ extern "C" { * Canonical form of an XML document could be created if and only if * a) default attributes (if any) are added to all nodes * b) all character and parsed entity references are resolved - * In order to achive this in libxml2 the document MUST be loaded with + * In order to achive this in libxml2 the document MUST be loaded with * following global setings: - * + * * xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; * xmlSubstituteEntitiesDefault(1); * * or corresponding parser context setting: * xmlParserCtxtPtr ctxt; - * - * ... + * + * ... * ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS; * ctxt->replaceEntities = 1; * ... */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlC14NDocSaveTo (xmlDocPtr doc, xmlNodeSetPtr nodes, int exclusive, xmlChar **inclusive_ns_prefixes, - int with_comments, + int with_comments, xmlOutputBufferPtr buf); XMLPUBFUN int XMLCALL @@ -66,7 +66,7 @@ XMLPUBFUN int XMLCALL xmlNodeSetPtr nodes, int exclusive, xmlChar **inclusive_ns_prefixes, - int with_comments, + int with_comments, xmlChar **doc_txt_ptr); XMLPUBFUN int XMLCALL @@ -74,7 +74,7 @@ XMLPUBFUN int XMLCALL xmlNodeSetPtr nodes, int exclusive, xmlChar **inclusive_ns_prefixes, - int with_comments, + int with_comments, const char* filename, int compression); @@ -82,17 +82,27 @@ XMLPUBFUN int XMLCALL /** * This is the core C14N function */ -typedef int (*xmlC14NIsVisibleCallback) (void* user_data, +/** + * xmlC14NIsVisibleCallback: + * @user_data: user data + * @node: the curent node + * @parent: the parent node + * + * Signature for a C14N callback on visible nodes + * + * Returns 1 if the node should be included + */ +typedef int (*xmlC14NIsVisibleCallback) (void* user_data, xmlNodePtr node, xmlNodePtr parent); XMLPUBFUN int XMLCALL xmlC14NExecute (xmlDocPtr doc, xmlC14NIsVisibleCallback is_visible_callback, - void* user_data, + void* user_data, int exclusive, xmlChar **inclusive_ns_prefixes, - int with_comments, + int with_comments, xmlOutputBufferPtr buf); #ifdef __cplusplus diff --git a/include/libxml/entities.h b/include/libxml/entities.h index fdd7222..cefb97f 100644 --- a/include/libxml/entities.h +++ b/include/libxml/entities.h @@ -57,6 +57,8 @@ struct _xmlEntity { const xmlChar *URI; /* the full URI as computed */ int owner; /* does the entity own the childrens */ int checked; /* was the entity content checked */ + /* this is also used to count entites + * references done from that entity */ }; /* @@ -72,9 +74,17 @@ typedef xmlEntitiesTable *xmlEntitiesTablePtr; */ #ifdef LIBXML_LEGACY_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlInitializePredefinedEntities (void); #endif /* LIBXML_LEGACY_ENABLED */ + +XMLPUBFUN xmlEntityPtr XMLCALL + xmlNewEntity (xmlDocPtr doc, + const xmlChar *name, + int type, + const xmlChar *ExternalID, + const xmlChar *SystemID, + const xmlChar *content); XMLPUBFUN xmlEntityPtr XMLCALL xmlAddDocEntity (xmlDocPtr doc, const xmlChar *name, @@ -82,53 +92,53 @@ XMLPUBFUN xmlEntityPtr XMLCALL const xmlChar *ExternalID, const xmlChar *SystemID, const xmlChar *content); -XMLPUBFUN xmlEntityPtr XMLCALL +XMLPUBFUN xmlEntityPtr XMLCALL xmlAddDtdEntity (xmlDocPtr doc, const xmlChar *name, int type, const xmlChar *ExternalID, const xmlChar *SystemID, const xmlChar *content); -XMLPUBFUN xmlEntityPtr XMLCALL +XMLPUBFUN xmlEntityPtr XMLCALL xmlGetPredefinedEntity (const xmlChar *name); -XMLPUBFUN xmlEntityPtr XMLCALL +XMLPUBFUN xmlEntityPtr XMLCALL xmlGetDocEntity (xmlDocPtr doc, const xmlChar *name); -XMLPUBFUN xmlEntityPtr XMLCALL +XMLPUBFUN xmlEntityPtr XMLCALL xmlGetDtdEntity (xmlDocPtr doc, const xmlChar *name); -XMLPUBFUN xmlEntityPtr XMLCALL +XMLPUBFUN xmlEntityPtr XMLCALL xmlGetParameterEntity (xmlDocPtr doc, const xmlChar *name); #ifdef LIBXML_LEGACY_ENABLED -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlEncodeEntities (xmlDocPtr doc, const xmlChar *input); #endif /* LIBXML_LEGACY_ENABLED */ -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlEncodeSpecialChars (xmlDocPtr doc, const xmlChar *input); -XMLPUBFUN xmlEntitiesTablePtr XMLCALL +XMLPUBFUN xmlEntitiesTablePtr XMLCALL xmlCreateEntitiesTable (void); #ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlEntitiesTablePtr XMLCALL +XMLPUBFUN xmlEntitiesTablePtr XMLCALL xmlCopyEntitiesTable (xmlEntitiesTablePtr table); #endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeEntitiesTable (xmlEntitiesTablePtr table); #ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDumpEntitiesTable (xmlBufferPtr buf, xmlEntitiesTablePtr table); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDumpEntityDecl (xmlBufferPtr buf, xmlEntityPtr ent); #endif /* LIBXML_OUTPUT_ENABLED */ #ifdef LIBXML_LEGACY_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlCleanupPredefinedEntities(void); #endif /* LIBXML_LEGACY_ENABLED */ diff --git a/include/libxml/globals.h b/include/libxml/globals.h index 1173a8f..57e25fa 100644 --- a/include/libxml/globals.h +++ b/include/libxml/globals.h @@ -28,8 +28,32 @@ extern "C" { XMLPUBFUN void XMLCALL xmlInitGlobals(void); XMLPUBFUN void XMLCALL xmlCleanupGlobals(void); +/** + * xmlParserInputBufferCreateFilenameFunc: + * @URI: the URI to read from + * @enc: the requested source encoding + * + * Signature for the function doing the lookup for a suitable input method + * corresponding to an URI. + * + * Returns the new xmlParserInputBufferPtr in case of success or NULL if no + * method was found. + */ typedef xmlParserInputBufferPtr (*xmlParserInputBufferCreateFilenameFunc) (const char *URI, xmlCharEncoding enc); + +/** + * xmlOutputBufferCreateFilenameFunc: + * @URI: the URI to write to + * @enc: the requested target encoding + * + * Signature for the function doing the lookup for a suitable output method + * corresponding to an URI. + * + * Returns the new xmlOutputBufferPtr in case of success or NULL if no + * method was found. + */ typedef xmlOutputBufferPtr (*xmlOutputBufferCreateFilenameFunc) (const char *URI, xmlCharEncodingHandlerPtr encoder, int compression); + XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL xmlParserInputBufferCreateFilenameDefault (xmlParserInputBufferCreateFilenameFunc func); XMLPUBFUN xmlOutputBufferCreateFilenameFunc @@ -73,12 +97,24 @@ XMLCALL xmlOutputBufferCreateFilenameDefault (xmlOutputBufferCreateFilenameFunc #undef xmlParserInputBufferCreateFilenameValue #undef xmlOutputBufferCreateFilenameValue +/** + * xmlRegisterNodeFunc: + * @node: the current node + * + * Signature for the registration callback of a created node + */ typedef void (*xmlRegisterNodeFunc) (xmlNodePtr node); +/** + * xmlDeregisterNodeFunc: + * @node: the current node + * + * Signature for the deregistration callback of a discarded node + */ typedef void (*xmlDeregisterNodeFunc) (xmlNodePtr node); typedef struct _xmlGlobalState xmlGlobalState; typedef xmlGlobalState *xmlGlobalStatePtr; -struct _xmlGlobalState +struct _xmlGlobalState { const char *xmlParserVersion; @@ -114,8 +150,8 @@ struct _xmlGlobalState int xmlIndentTreeOutput; const char *xmlTreeIndentString; - xmlRegisterNodeFunc xmlRegisterNodeDefaultValue; - xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue; + xmlRegisterNodeFunc xmlRegisterNodeDefaultValue; + xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue; xmlMallocFunc xmlMallocAtomic; xmlError xmlLastError; @@ -143,9 +179,9 @@ XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlThrDefRegisterNodeDefault(xmlRegisterNo XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func); XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func); -XMLPUBFUN xmlOutputBufferCreateFilenameFunc XMLCALL +XMLPUBFUN xmlOutputBufferCreateFilenameFunc XMLCALL xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func); -XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL +XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func); /** DOC_DISABLE */ diff --git a/include/libxml/parser.h b/include/libxml/parser.h index fe63bda..24d5cf9 100644 --- a/include/libxml/parser.h +++ b/include/libxml/parser.h @@ -297,6 +297,8 @@ struct _xmlParserCtxt { */ xmlError lastError; xmlParserMode parseMode; /* the parser mode */ + unsigned long nbentities; /* number of entities references */ + unsigned long sizeentities; /* size of parsed entities */ }; /** @@ -1089,9 +1091,12 @@ typedef enum { XML_PARSE_NSCLEAN = 1<<13,/* remove redundant namespaces declarations */ XML_PARSE_NOCDATA = 1<<14,/* merge CDATA as text nodes */ XML_PARSE_NOXINCNODE= 1<<15,/* do not generate XINCLUDE START/END nodes */ - XML_PARSE_COMPACT = 1<<16 /* compact small text nodes; no modification of + XML_PARSE_COMPACT = 1<<16,/* compact small text nodes; no modification of the tree allowed afterwards (will possibly crash if you try to modify the tree) */ + XML_PARSE_OLD10 = 1<<17,/* parse using XML-1.0 before update 5 */ + XML_PARSE_NOBASEFIX = 1<<18,/* do not fixup XINCLUDE xml:base uris */ + XML_PARSE_HUGE = 1<<19 /* relax any hardcoded limit from the parser */ } xmlParserOption; XMLPUBFUN void XMLCALL diff --git a/include/libxml/parserInternals.h b/include/libxml/parserInternals.h index 7ac0ce6..fddcd27 100644 --- a/include/libxml/parserInternals.h +++ b/include/libxml/parserInternals.h @@ -321,7 +321,7 @@ XMLPUBFUN xmlParserInputPtr XMLCALL XMLPUBFUN xmlParserInputPtr XMLCALL xmlNewEntityInputStream (xmlParserCtxtPtr ctxt, xmlEntityPtr entity); -XMLPUBFUN void XMLCALL +XMLPUBFUN int XMLCALL xmlPushInput (xmlParserCtxtPtr ctxt, xmlParserInputPtr input); XMLPUBFUN xmlChar XMLCALL diff --git a/include/libxml/relaxng.h b/include/libxml/relaxng.h index 6acd467..29c91c7 100644 --- a/include/libxml/relaxng.h +++ b/include/libxml/relaxng.h @@ -25,11 +25,28 @@ typedef xmlRelaxNG *xmlRelaxNGPtr; /** - * A schemas validation context + * xmlRelaxNGValidityErrorFunc: + * @ctx: the validation context + * @msg: the message + * @...: extra arguments + * + * Signature of an error callback from a Relax-NG validation */ typedef void (XMLCDECL *xmlRelaxNGValidityErrorFunc) (void *ctx, const char *msg, ...); + +/** + * xmlRelaxNGValidityWarningFunc: + * @ctx: the validation context + * @msg: the message + * @...: extra arguments + * + * Signature of a warning callback from a Relax-NG validation + */ typedef void (XMLCDECL *xmlRelaxNGValidityWarningFunc) (void *ctx, const char *msg, ...); +/** + * A schemas validation context + */ typedef struct _xmlRelaxNGParserCtxt xmlRelaxNGParserCtxt; typedef xmlRelaxNGParserCtxt *xmlRelaxNGParserCtxtPtr; diff --git a/include/libxml/schematron.h b/include/libxml/schematron.h index 9e36c0e..f442826 100644 --- a/include/libxml/schematron.h +++ b/include/libxml/schematron.h @@ -38,11 +38,28 @@ typedef struct _xmlSchematron xmlSchematron; typedef xmlSchematron *xmlSchematronPtr; /** - * A schemas validation context + * xmlSchematronValidityErrorFunc: + * @ctx: the validation context + * @msg: the message + * @...: extra arguments + * + * Signature of an error callback from a Schematron validation */ typedef void (*xmlSchematronValidityErrorFunc) (void *ctx, const char *msg, ...); + +/** + * xmlSchematronValidityWarningFunc: + * @ctx: the validation context + * @msg: the message + * @...: extra arguments + * + * Signature of a warning callback from a Schematron validation + */ typedef void (*xmlSchematronValidityWarningFunc) (void *ctx, const char *msg, ...); +/** + * A schemas validation context + */ typedef struct _xmlSchematronParserCtxt xmlSchematronParserCtxt; typedef xmlSchematronParserCtxt *xmlSchematronParserCtxtPtr; diff --git a/include/libxml/tree.h b/include/libxml/tree.h index 0e1d47c..6a6a09d 100644 --- a/include/libxml/tree.h +++ b/include/libxml/tree.h @@ -71,9 +71,10 @@ typedef xmlEntity *xmlEntityPtr; */ typedef enum { - XML_BUFFER_ALLOC_DOUBLEIT, - XML_BUFFER_ALLOC_EXACT, - XML_BUFFER_ALLOC_IMMUTABLE + XML_BUFFER_ALLOC_DOUBLEIT, /* double each time one need to grow */ + XML_BUFFER_ALLOC_EXACT, /* grow only to the minimal size */ + XML_BUFFER_ALLOC_IMMUTABLE, /* immutable buffer */ + XML_BUFFER_ALLOC_IO /* special allocation scheme used for I/O */ } xmlBufferAllocationScheme; /** @@ -88,6 +89,7 @@ struct _xmlBuffer { unsigned int use; /* The buffer size used */ unsigned int size; /* The buffer size */ xmlBufferAllocationScheme alloc; /* The realloc method */ + xmlChar *contentIO; /* in IO mode we may have a different base */ }; /** @@ -482,6 +484,23 @@ struct _xmlNode { #define XML_GET_LINE(n) \ (xmlGetLineNo(n)) +/** + * xmlDocProperty + * + * Set of properties of the document as found by the parser + * Some of them are linked to similary named xmlParserOption + */ +typedef enum { + XML_DOC_WELLFORMED = 1<<0, /* document is XML well formed */ + XML_DOC_NSVALID = 1<<1, /* document is Namespace valid */ + XML_DOC_OLD10 = 1<<2, /* parsed with old XML-1.0 parser */ + XML_DOC_DTDVALID = 1<<3, /* DTD validation was successful */ + XML_DOC_XINCLUDE = 1<<4, /* XInclude substitution was done */ + XML_DOC_USERBUILT = 1<<5, /* Document was built using the API + and not by parsing an instance */ + XML_DOC_INTERNAL = 1<<6, /* built for internal processing */ + XML_DOC_HTML = 1<<7 /* parsed or built HTML document */ +} xmlDocProperties; /** * xmlDoc: @@ -521,6 +540,10 @@ struct _xmlDoc { actually an xmlCharEncoding */ struct _xmlDict *dict; /* dict used to allocate names or NULL */ void *psvi; /* for type/PSVI informations */ + int parseFlags; /* set of xmlParserOption used to parse the + document */ + int properties; /* set of xmlDocProperties for this document + set at the end of parsing */ }; diff --git a/include/libxml/uri.h b/include/libxml/uri.h index 49ed105..db48262 100644 --- a/include/libxml/uri.h +++ b/include/libxml/uri.h @@ -49,43 +49,43 @@ struct _xmlURI { * xmlChar * xmlNodeGetBase (xmlDocPtr doc, * xmlNodePtr cur); */ -XMLPUBFUN xmlURIPtr XMLCALL +XMLPUBFUN xmlURIPtr XMLCALL xmlCreateURI (void); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlBuildURI (const xmlChar *URI, - const xmlChar *base); -XMLPUBFUN xmlChar * XMLCALL + const xmlChar *base); +XMLPUBFUN xmlChar * XMLCALL xmlBuildRelativeURI (const xmlChar *URI, - const xmlChar *base); -XMLPUBFUN xmlURIPtr XMLCALL + const xmlChar *base); +XMLPUBFUN xmlURIPtr XMLCALL xmlParseURI (const char *str); -XMLPUBFUN xmlURIPtr XMLCALL +XMLPUBFUN xmlURIPtr XMLCALL xmlParseURIRaw (const char *str, int raw); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlParseURIReference (xmlURIPtr uri, const char *str); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlSaveUri (xmlURIPtr uri); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlPrintURI (FILE *stream, xmlURIPtr uri); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlURIEscapeStr (const xmlChar *str, - const xmlChar *list); -XMLPUBFUN char * XMLCALL + const xmlChar *list); +XMLPUBFUN char * XMLCALL xmlURIUnescapeString (const char *str, int len, char *target); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlNormalizeURIPath (char *path); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlURIEscape (const xmlChar *str); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeURI (xmlURIPtr uri); -XMLPUBFUN xmlChar* XMLCALL +XMLPUBFUN xmlChar* XMLCALL xmlCanonicPath (const xmlChar *path); -XMLPUBFUN xmlChar* XMLCALL +XMLPUBFUN xmlChar* XMLCALL xmlPathToURI (const xmlChar *path); #ifdef __cplusplus diff --git a/include/libxml/xmlerror.h b/include/libxml/xmlerror.h index 8cbab5e..c9336b9 100644 --- a/include/libxml/xmlerror.h +++ b/include/libxml/xmlerror.h @@ -203,11 +203,14 @@ typedef enum { XML_ERR_NOTATION_PROCESSING, /* 105 */ XML_WAR_NS_COLUMN, /* 106 */ XML_WAR_ENTITY_REDEFINED, /* 107 */ + XML_ERR_UNKNOWN_VERSION, /* 108 */ + XML_ERR_VERSION_MISMATCH, /* 109 */ XML_NS_ERR_XML_NAMESPACE = 200, XML_NS_ERR_UNDEFINED_NAMESPACE, /* 201 */ XML_NS_ERR_QNAME, /* 202 */ XML_NS_ERR_ATTRIBUTE_REDEFINED, /* 203 */ XML_NS_ERR_EMPTY, /* 204 */ + XML_NS_ERR_COLON, /* 205 */ XML_DTD_ATTRIBUTE_DEFAULT = 500, XML_DTD_ATTRIBUTE_REDEFINED, /* 501 */ XML_DTD_ATTRIBUTE_VALUE, /* 502 */ @@ -249,6 +252,7 @@ typedef enum { XML_DTD_STANDALONE_DEFAULTED, /* 538 */ XML_DTD_XMLID_VALUE, /* 539 */ XML_DTD_XMLID_TYPE, /* 540 */ + XML_DTD_DUP_TOKEN, /* 541 */ XML_HTML_STRUCURE_ERROR = 800, XML_HTML_UNKNOWN_TAG, /* 801 */ XML_RNGP_ANYNAME_ATTR_ANCESTOR = 1000, diff --git a/include/libxml/xmlmemory.h b/include/libxml/xmlmemory.h index 235721c..ee8328a 100644 --- a/include/libxml/xmlmemory.h +++ b/include/libxml/xmlmemory.h @@ -20,7 +20,7 @@ * * DEBUG_MEMORY replaces the allocator with a collect and debug * shell to the libc allocator. - * DEBUG_MEMORY should only be activated when debugging + * DEBUG_MEMORY should only be activated when debugging * libxml i.e. if libxml has been configured with --with-debug-mem too. */ /* #define DEBUG_MEMORY_FREED */ @@ -35,7 +35,7 @@ /** * DEBUG_MEMORY_LOCATION: * - * DEBUG_MEMORY_LOCATION should be activated only when debugging + * DEBUG_MEMORY_LOCATION should be activated only when debugging * libxml i.e. if libxml has been configured with --with-debug-mem too. */ #ifdef DEBUG_MEMORY_LOCATION @@ -105,18 +105,18 @@ XMLPUBFUN int XMLCALL xmlMallocFunc mallocFunc, xmlReallocFunc reallocFunc, xmlStrdupFunc strdupFunc); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlMemGet (xmlFreeFunc *freeFunc, xmlMallocFunc *mallocFunc, xmlReallocFunc *reallocFunc, xmlStrdupFunc *strdupFunc); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlGcMemSetup (xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc, xmlMallocFunc mallocAtomicFunc, xmlReallocFunc reallocFunc, xmlStrdupFunc strdupFunc); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlGcMemGet (xmlFreeFunc *freeFunc, xmlMallocFunc *mallocFunc, xmlMallocFunc *mallocAtomicFunc, @@ -126,42 +126,44 @@ XMLPUBFUN int XMLCALL /* * Initialization of the memory layer. */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlInitMemory (void); -/* +/* * Cleanup of the memory layer. */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlCleanupMemory (void); /* * These are specific to the XML debug memory wrapper. */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlMemUsed (void); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlMemBlocks (void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlMemDisplay (FILE *fp); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL + xmlMemDisplayLast(FILE *fp, long nbBytes); +XMLPUBFUN void XMLCALL xmlMemShow (FILE *fp, int nr); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlMemoryDump (void); -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlMemMalloc (size_t size); -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlMemRealloc (void *ptr,size_t size); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlMemFree (void *ptr); -XMLPUBFUN char * XMLCALL +XMLPUBFUN char * XMLCALL xmlMemoryStrdup (const char *str); -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlMallocLoc (size_t size, const char *file, int line); -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlReallocLoc (void *ptr, size_t size, const char *file, int line); -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlMallocAtomicLoc (size_t size, const char *file, int line); -XMLPUBFUN char * XMLCALL +XMLPUBFUN char * XMLCALL xmlMemStrdupLoc (const char *str, const char *file, int line); diff --git a/include/libxml/xmlreader.h b/include/libxml/xmlreader.h index dfe51a3..6964482 100644 --- a/include/libxml/xmlreader.h +++ b/include/libxml/xmlreader.h @@ -18,12 +18,25 @@ #include #endif -#ifdef LIBXML_READER_ENABLED - #ifdef __cplusplus extern "C" { #endif +/** + * xmlParserSeverities: + * + * How severe an error callback is when the per-reader error callback API + * is used. + */ +typedef enum { + XML_PARSER_SEVERITY_VALIDITY_WARNING = 1, + XML_PARSER_SEVERITY_VALIDITY_ERROR = 2, + XML_PARSER_SEVERITY_WARNING = 3, + XML_PARSER_SEVERITY_ERROR = 4 +} xmlParserSeverities; + +#ifdef LIBXML_READER_ENABLED + /** * xmlTextReaderMode: * @@ -42,7 +55,7 @@ typedef enum { * xmlParserProperties: * * Some common options to use with xmlTextReaderSetParserProp, but it - * is better to use xmlParserOption and the xmlReaderNewxxx and + * is better to use xmlParserOption and the xmlReaderNewxxx and * xmlReaderForxxx APIs now. */ typedef enum { @@ -52,19 +65,6 @@ typedef enum { XML_PARSER_SUBST_ENTITIES = 4 } xmlParserProperties; -/** - * xmlParserSeverities: - * - * How severe an error callback is when the per-reader error callback API - * is used. - */ -typedef enum { - XML_PARSER_SEVERITY_VALIDITY_WARNING = 1, - XML_PARSER_SEVERITY_VALIDITY_ERROR = 2, - XML_PARSER_SEVERITY_WARNING = 3, - XML_PARSER_SEVERITY_ERROR = 4 -} xmlParserSeverities; - /** * xmlReaderTypes: * @@ -111,13 +111,13 @@ typedef xmlTextReader *xmlTextReaderPtr; XMLPUBFUN xmlTextReaderPtr XMLCALL xmlNewTextReader (xmlParserInputBufferPtr input, const char *URI); -XMLPUBFUN xmlTextReaderPtr XMLCALL +XMLPUBFUN xmlTextReaderPtr XMLCALL xmlNewTextReaderFilename(const char *URI); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeTextReader (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderSetup(xmlTextReaderPtr reader, xmlParserInputBufferPtr input, const char *URL, const char *encoding, int options); @@ -125,120 +125,120 @@ XMLPUBFUN int XMLCALL /* * Iterators */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderRead (xmlTextReaderPtr reader); #ifdef LIBXML_WRITER_ENABLED -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlTextReaderReadInnerXml (xmlTextReaderPtr reader); - -XMLPUBFUN xmlChar * XMLCALL + +XMLPUBFUN xmlChar * XMLCALL xmlTextReaderReadOuterXml (xmlTextReaderPtr reader); #endif -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlTextReaderReadString (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderReadAttributeValue (xmlTextReaderPtr reader); /* * Attributes of the node */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderAttributeCount(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderDepth (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderHasAttributes(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderHasValue(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderIsDefault (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderIsEmptyElement(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderNodeType (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderQuoteChar (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderReadState (xmlTextReaderPtr reader); XMLPUBFUN int XMLCALL xmlTextReaderIsNamespaceDecl(xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstBaseUri (xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstLocalName (xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstName (xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstNamespaceUri(xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstPrefix (xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstXmlLang (xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstString (xmlTextReaderPtr reader, - const xmlChar *str); -XMLPUBFUN const xmlChar * XMLCALL + const xmlChar *str); +XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstValue (xmlTextReaderPtr reader); /* * use the Const version of the routine for * better performance and simpler code */ -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlTextReaderBaseUri (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlTextReaderLocalName (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlTextReaderName (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlTextReaderNamespaceUri(xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlTextReaderPrefix (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlTextReaderXmlLang (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlTextReaderValue (xmlTextReaderPtr reader); /* * Methods of the XmlTextReader */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderClose (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlTextReaderGetAttributeNo (xmlTextReaderPtr reader, int no); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlTextReaderGetAttribute (xmlTextReaderPtr reader, const xmlChar *name); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlTextReaderGetAttributeNs (xmlTextReaderPtr reader, const xmlChar *localName, const xmlChar *namespaceURI); -XMLPUBFUN xmlParserInputBufferPtr XMLCALL +XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlTextReaderGetRemainder (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlTextReaderLookupNamespace(xmlTextReaderPtr reader, const xmlChar *prefix); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderMoveToAttributeNo(xmlTextReaderPtr reader, int no); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderMoveToAttribute(xmlTextReaderPtr reader, const xmlChar *name); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderMoveToAttributeNs(xmlTextReaderPtr reader, const xmlChar *localName, const xmlChar *namespaceURI); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderMoveToFirstAttribute(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderMoveToNextAttribute(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderMoveToElement (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderNormalization (xmlTextReaderPtr reader); XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstEncoding (xmlTextReaderPtr reader); @@ -246,14 +246,14 @@ XMLPUBFUN const xmlChar * XMLCALL /* * Extensions */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderSetParserProp (xmlTextReaderPtr reader, int prop, int value); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderGetParserProp (xmlTextReaderPtr reader, int prop); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlTextReaderCurrentNode (xmlTextReaderPtr reader); XMLPUBFUN int XMLCALL @@ -262,41 +262,41 @@ XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL xmlTextReaderGetParserColumnNumber(xmlTextReaderPtr reader); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlTextReaderPreserve (xmlTextReaderPtr reader); #ifdef LIBXML_PATTERN_ENABLED -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderPreservePattern(xmlTextReaderPtr reader, - const xmlChar *pattern, + const xmlChar *pattern, const xmlChar **namespaces); #endif /* LIBXML_PATTERN_ENABLED */ -XMLPUBFUN xmlDocPtr XMLCALL +XMLPUBFUN xmlDocPtr XMLCALL xmlTextReaderCurrentDoc (xmlTextReaderPtr reader); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlTextReaderExpand (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderNext (xmlTextReaderPtr reader); XMLPUBFUN int XMLCALL xmlTextReaderNextSibling (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderIsValid (xmlTextReaderPtr reader); #ifdef LIBXML_SCHEMAS_ENABLED -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderRelaxNGValidate(xmlTextReaderPtr reader, const char *rng); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader, xmlRelaxNGPtr schema); XMLPUBFUN int XMLCALL xmlTextReaderSchemaValidate (xmlTextReaderPtr reader, - const char *xsd); + const char *xsd); XMLPUBFUN int XMLCALL xmlTextReaderSchemaValidateCtxt(xmlTextReaderPtr reader, xmlSchemaValidCtxtPtr ctxt, int options); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderSetSchema (xmlTextReaderPtr reader, - xmlSchemaPtr schema); + xmlSchemaPtr schema); #endif XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstXmlVersion(xmlTextReaderPtr reader); @@ -382,33 +382,43 @@ XMLPUBFUN int XMLCALL * Error handling extensions */ typedef void * xmlTextReaderLocatorPtr; -typedef void (XMLCALL *xmlTextReaderErrorFunc) (void *arg, + +/** + * xmlTextReaderErrorFunc: + * @arg: the user argument + * @msg: the message + * @severity: the severity of the error + * @locator: a locator indicating where the error occured + * + * Signature of an error callback from a reader parser + */ +typedef void (XMLCALL *xmlTextReaderErrorFunc)(void *arg, const char *msg, xmlParserSeverities severity, xmlTextReaderLocatorPtr locator); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr locator); /*int xmlTextReaderLocatorLinePosition(xmlTextReaderLocatorPtr locator);*/ -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlTextReaderLocatorBaseURI (xmlTextReaderLocatorPtr locator); -XMLPUBFUN void XMLCALL - xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader, - xmlTextReaderErrorFunc f, +XMLPUBFUN void XMLCALL + xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader, + xmlTextReaderErrorFunc f, void *arg); XMLPUBFUN void XMLCALL xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader, xmlStructuredErrorFunc f, void *arg); -XMLPUBFUN void XMLCALL - xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader, - xmlTextReaderErrorFunc *f, +XMLPUBFUN void XMLCALL + xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader, + xmlTextReaderErrorFunc *f, void **arg); +#endif /* LIBXML_READER_ENABLED */ + #ifdef __cplusplus } #endif -#endif /* LIBXML_READER_ENABLED */ - #endif /* __XML_XMLREADER_H__ */ diff --git a/include/libxml/xmlregexp.h b/include/libxml/xmlregexp.h index 022cd6a..7009645 100644 --- a/include/libxml/xmlregexp.h +++ b/include/libxml/xmlregexp.h @@ -38,7 +38,7 @@ typedef xmlRegExecCtxt *xmlRegExecCtxtPtr; #ifdef __cplusplus } -#endif +#endif #include #include #ifdef __cplusplus @@ -51,16 +51,22 @@ extern "C" { XMLPUBFUN xmlRegexpPtr XMLCALL xmlRegexpCompile (const xmlChar *regexp); XMLPUBFUN void XMLCALL xmlRegFreeRegexp(xmlRegexpPtr regexp); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlRegexpExec (xmlRegexpPtr comp, const xmlChar *value); -XMLPUBFUN void XMLCALL - xmlRegexpPrint (FILE *output, +XMLPUBFUN void XMLCALL + xmlRegexpPrint (FILE *output, xmlRegexpPtr regexp); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlRegexpIsDeterminist(xmlRegexpPtr comp); -/* +/** + * xmlRegExecCallbacks: + * @exec: the regular expression context + * @token: the current token string + * @transdata: transition data + * @inputdata: input data + * * Callback function when doing a transition in the automata */ typedef void (*xmlRegExecCallbacks) (xmlRegExecCtxtPtr exec, @@ -71,17 +77,17 @@ typedef void (*xmlRegExecCallbacks) (xmlRegExecCtxtPtr exec, /* * The progressive API */ -XMLPUBFUN xmlRegExecCtxtPtr XMLCALL - xmlRegNewExecCtxt (xmlRegexpPtr comp, +XMLPUBFUN xmlRegExecCtxtPtr XMLCALL + xmlRegNewExecCtxt (xmlRegexpPtr comp, xmlRegExecCallbacks callback, void *data); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlRegFreeExecCtxt (xmlRegExecCtxtPtr exec); -XMLPUBFUN int XMLCALL - xmlRegExecPushString(xmlRegExecCtxtPtr exec, +XMLPUBFUN int XMLCALL + xmlRegExecPushString(xmlRegExecCtxtPtr exec, const xmlChar *value, void *data); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlRegExecPushString2(xmlRegExecCtxtPtr exec, const xmlChar *value, const xmlChar *value2, @@ -89,15 +95,15 @@ XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL xmlRegExecNextValues(xmlRegExecCtxtPtr exec, - int *nbval, - int *nbneg, + int *nbval, + int *nbneg, xmlChar **values, int *terminal); XMLPUBFUN int XMLCALL xmlRegExecErrInfo (xmlRegExecCtxtPtr exec, - const xmlChar **string, + const xmlChar **string, int *nbval, - int *nbneg, + int *nbneg, xmlChar **values, int *terminal); #ifdef LIBXML_EXPR_ENABLED @@ -135,7 +141,7 @@ typedef enum { } xmlExpNodeType; /* - * 2 core expressions shared by all for the empty language set + * 2 core expressions shared by all for the empty language set * and for the set with just the empty token */ XMLPUBVAR xmlExpNodePtr forbiddenExp; @@ -209,7 +215,7 @@ XMLPUBFUN void XMLCALL #endif /* LIBXML_EXPR_ENABLED */ #ifdef __cplusplus } -#endif +#endif #endif /* LIBXML_REGEXP_ENABLED */ diff --git a/include/libxml/xmlschemas.h b/include/libxml/xmlschemas.h index 15faef5..556ef89 100644 --- a/include/libxml/xmlschemas.h +++ b/include/libxml/xmlschemas.h @@ -56,7 +56,7 @@ typedef enum { /* * ATTENTION: Change xmlSchemaSetValidOptions's check -* for invalid values, if adding to the validation +* for invalid values, if adding to the validation * options below. */ /** @@ -85,11 +85,28 @@ typedef struct _xmlSchema xmlSchema; typedef xmlSchema *xmlSchemaPtr; /** - * A schemas validation context + * xmlSchemaValidityErrorFunc: + * @ctx: the validation context + * @msg: the message + * @...: extra arguments + * + * Signature of an error callback from an XSD validation */ typedef void (XMLCDECL *xmlSchemaValidityErrorFunc) (void *ctx, const char *msg, ...); + +/** + * xmlSchemaValidityWarningFunc: + * @ctx: the validation context + * @msg: the message + * @...: extra arguments + * + * Signature of a warning callback from an XSD validation + */ typedef void (XMLCDECL *xmlSchemaValidityWarningFunc) (void *ctx, const char *msg, ...); +/** + * A schemas validation context + */ typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt; typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr; @@ -99,16 +116,16 @@ typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr; /* * Interfaces for parsing. */ -XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL +XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL xmlSchemaNewParserCtxt (const char *URL); -XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL +XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL xmlSchemaNewMemParserCtxt (const char *buffer, int size); XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL xmlSchemaNewDocParserCtxt (xmlDocPtr doc); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSchemaFreeParserCtxt (xmlSchemaParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSchemaSetParserErrors (xmlSchemaParserCtxtPtr ctxt, xmlSchemaValidityErrorFunc err, xmlSchemaValidityWarningFunc warn, @@ -125,19 +142,19 @@ XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL xmlSchemaIsValid (xmlSchemaValidCtxtPtr ctxt); -XMLPUBFUN xmlSchemaPtr XMLCALL +XMLPUBFUN xmlSchemaPtr XMLCALL xmlSchemaParse (xmlSchemaParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSchemaFree (xmlSchemaPtr schema); #ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSchemaDump (FILE *output, xmlSchemaPtr schema); #endif /* LIBXML_OUTPUT_ENABLED */ /* * Interfaces for validating */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt, xmlSchemaValidityErrorFunc err, xmlSchemaValidityWarningFunc warn, @@ -157,11 +174,11 @@ XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL xmlSchemaValidCtxtGetOptions(xmlSchemaValidCtxtPtr ctxt); -XMLPUBFUN xmlSchemaValidCtxtPtr XMLCALL +XMLPUBFUN xmlSchemaValidCtxtPtr XMLCALL xmlSchemaNewValidCtxt (xmlSchemaPtr schema); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt, xmlDocPtr instance); XMLPUBFUN int XMLCALL @@ -178,8 +195,11 @@ XMLPUBFUN int XMLCALL const char * filename, int options); +XMLPUBFUN xmlParserCtxtPtr XMLCALL + xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxtPtr ctxt); + /* - * Interface to insert Schemas SAX velidation in a SAX stream + * Interface to insert Schemas SAX validation in a SAX stream */ typedef struct _xmlSchemaSAXPlug xmlSchemaSAXPlugStruct; typedef xmlSchemaSAXPlugStruct *xmlSchemaSAXPlugPtr; diff --git a/include/libxml/xmlversion.h b/include/libxml/xmlversion.h index 9fc51a2..e00a6e9 100644 --- a/include/libxml/xmlversion.h +++ b/include/libxml/xmlversion.h @@ -29,21 +29,21 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * * the version string like "1.2.3" */ -#define LIBXML_DOTTED_VERSION "2.6.32" +#define LIBXML_DOTTED_VERSION "2.7.0" /** * LIBXML_VERSION: * * the version number: 1.2.3 value is 10203 */ -#define LIBXML_VERSION 20632 +#define LIBXML_VERSION 20700 /** * LIBXML_VERSION_STRING: * * the version number string, 1.2.3 value is "10203" */ -#define LIBXML_VERSION_STRING "20632" +#define LIBXML_VERSION_STRING "20700" /** * LIBXML_VERSION_EXTRA: @@ -58,7 +58,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * Macro to check that the libxml version in use is compatible with * the version the software has been compiled against */ -#define LIBXML_TEST_VERSION xmlCheckVersion(20632); +#define LIBXML_TEST_VERSION xmlCheckVersion(20700); #ifndef VMS #if 0 diff --git a/include/wsockcompat.h b/include/wsockcompat.h index 333b561..18fab37 100644 --- a/include/wsockcompat.h +++ b/include/wsockcompat.h @@ -21,6 +21,7 @@ /* Check if ws2tcpip.h is a recent version which provides getaddrinfo() */ #if defined(GetAddrInfo) +#include #define HAVE_GETADDRINFO #endif #endif diff --git a/libxml.spec.in b/libxml.spec.in index fd13511..324b12c 100644 --- a/libxml.spec.in +++ b/libxml.spec.in @@ -5,7 +5,7 @@ Release: 1 License: MIT Group: Development/Libraries Source: ftp://xmlsoft.org/libxml2-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-root +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: python python-devel zlib-devel URL: http://xmlsoft.org/ Prefix: %{_prefix} diff --git a/libxml2.spec b/libxml2.spec index 887e8a1..37ee12c 100644 --- a/libxml2.spec +++ b/libxml2.spec @@ -1,11 +1,11 @@ Summary: Library providing XML and HTML support Name: libxml2 -Version: 2.6.32 +Version: 2.7.0 Release: 1 License: MIT Group: Development/Libraries Source: ftp://xmlsoft.org/libxml2-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-root +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: python python-devel zlib-devel URL: http://xmlsoft.org/ Prefix: %{_prefix} @@ -128,6 +128,6 @@ rm -fr %{buildroot} %doc doc/python.html %changelog -* Tue Apr 8 2008 Daniel Veillard -- upstream release 2.6.32 see http://xmlsoft.org/news.html +* Sat Aug 30 2008 Daniel Veillard +- upstream release 2.7.0 see http://xmlsoft.org/news.html diff --git a/macos/src/XMLTestPrefix.h.orig b/macos/src/XMLTestPrefix.h.orig deleted file mode 100644 index 3e84255..0000000 --- a/macos/src/XMLTestPrefix.h.orig +++ /dev/null @@ -1 +0,0 @@ -int test_main(int argc, char **argv); #define main(X,Y) test_main(X,Y) \ No newline at end of file diff --git a/nanoftp.c b/nanoftp.c index 8c4ea88..a54b85b 100644 --- a/nanoftp.c +++ b/nanoftp.c @@ -89,7 +89,7 @@ * A couple portability macros */ #ifndef _WINSOCKAPI_ -#ifndef __BEOS__ +#if !defined(__BEOS__) || defined(__HAIKU__) #define closesocket(s) close(s) #endif #define SOCKET int diff --git a/nanohttp.c b/nanohttp.c index 07829c7..9001ae5 100644 --- a/nanohttp.c +++ b/nanohttp.c @@ -95,7 +95,7 @@ * A couple portability macros */ #ifndef _WINSOCKAPI_ -#ifndef __BEOS__ +#if !defined(__BEOS__) || defined(__HAIKU__) #define closesocket(s) close(s) #endif #define SOCKET int @@ -844,7 +844,7 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr) status = ioctl(s, FIONBIO, &enable); } #else /* VMS */ -#if defined(__BEOS__) +#if defined(__BEOS__) && !defined(__HAIKU__) { bool noblock = true; status = setsockopt(s, SOL_SOCKET, SO_NONBLOCK, &noblock, sizeof(noblock)); diff --git a/parser.c b/parser.c index f20fd05..42b2852 100644 --- a/parser.c +++ b/parser.c @@ -80,20 +80,111 @@ #include #endif +static void +xmlFatalErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *info); + +/************************************************************************ + * * + * Arbitrary limits set in the parser. See XML_PARSE_HUGE * + * * + ************************************************************************/ + +#define XML_PARSER_BIG_ENTITY 1000 +#define XML_PARSER_LOT_ENTITY 5000 + +/* + * XML_PARSER_NON_LINEAR is the threshold where the ratio of parsed entity + * replacement over the size in byte of the input indicates that you have + * and eponential behaviour. A value of 10 correspond to at least 3 entity + * replacement per byte of input. + */ +#define XML_PARSER_NON_LINEAR 10 + +/* + * xmlParserEntityCheck + * + * Function to check non-linear entity expansion behaviour + * This is here to detect and stop exponential linear entity expansion + * This is not a limitation of the parser but a safety + * boundary feature. It can be disabled with the XML_PARSE_HUGE + * parser option. + */ +static int +xmlParserEntityCheck(xmlParserCtxtPtr ctxt, unsigned long size, + xmlEntityPtr ent) +{ + unsigned long consumed = 0; + + if ((ctxt == NULL) || (ctxt->options & XML_PARSE_HUGE)) + return (0); + if (ctxt->lastError.code == XML_ERR_ENTITY_LOOP) + return (1); + if (size != 0) { + /* + * Do the check based on the replacement size of the entity + */ + if (size < XML_PARSER_BIG_ENTITY) + return(0); + + /* + * A limit on the amount of text data reasonably used + */ + if (ctxt->input != NULL) { + consumed = ctxt->input->consumed + + (ctxt->input->cur - ctxt->input->base); + } + consumed += ctxt->sizeentities; + + if ((size < XML_PARSER_NON_LINEAR * consumed) && + (ctxt->nbentities * 3 < XML_PARSER_NON_LINEAR * consumed)) + return (0); + } else if (ent != NULL) { + /* + * use the number of parsed entities in the replacement + */ + size = ent->checked; + + /* + * The amount of data parsed counting entities size only once + */ + if (ctxt->input != NULL) { + consumed = ctxt->input->consumed + + (ctxt->input->cur - ctxt->input->base); + } + consumed += ctxt->sizeentities; + + /* + * Check the density of entities for the amount of data + * knowing an entity reference will take at least 3 bytes + */ + if (size * 3 < consumed * XML_PARSER_NON_LINEAR) + return (0); + } else { + /* + * strange we got no data for checking just return + */ + return (0); + } + + xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL); + return (1); +} + /** * xmlParserMaxDepth: * - * arbitrary depth limit for the XML documents that we allow to - * process. This is not a limitation of the parser but a safety - * boundary feature. + * arbitrary depth limit for the XML documents that we allow to + * process. This is not a limitation of the parser but a safety + * boundary feature. It can be disabled with the XML_PARSE_HUGE + * parser option. */ -unsigned int xmlParserMaxDepth = 1024; +unsigned int xmlParserMaxDepth = 256; + -#define SAX2 1 +#define SAX2 1 #define XML_PARSER_BIG_BUFFER_SIZE 300 #define XML_PARSER_BUFFER_SIZE 100 - #define SAX_COMPAT_MODE BAD_CAST "SAX compatibility mode document" /* @@ -116,6 +207,9 @@ xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt, void *user_data, int depth, const xmlChar *URL, const xmlChar *ID, xmlNodePtr *list); +static int +xmlCtxtUseOptionsInternal(xmlParserCtxtPtr ctxt, int options, + const char *encoding); #ifdef LIBXML_LEGACY_ENABLED static void xmlAddEntityReference(xmlEntityPtr ent, xmlNodePtr firstNode, @@ -418,7 +512,7 @@ xmlWarningMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *msg, const xmlChar *str1, const xmlChar *str2) { xmlStructuredErrorFunc schannel = NULL; - + if ((ctxt != NULL) && (ctxt->disableSAX != 0) && (ctxt->instate == XML_PARSER_EOF)) return; @@ -445,7 +539,7 @@ xmlWarningMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, */ static void xmlValidityError(xmlParserCtxtPtr ctxt, xmlParserErrors error, - const char *msg, const xmlChar *str1) + const char *msg, const xmlChar *str1, const xmlChar *str2) { xmlStructuredErrorFunc schannel = NULL; @@ -461,8 +555,8 @@ xmlValidityError(xmlParserCtxtPtr ctxt, xmlParserErrors error, ctxt->vctxt.error, ctxt->vctxt.userData, ctxt, NULL, XML_FROM_DTD, error, XML_ERR_ERROR, NULL, 0, (const char *) str1, - NULL, NULL, 0, 0, - msg, (const char *) str1); + (const char *) str2, NULL, 0, 0, + msg, (const char *) str1, (const char *) str2); if (ctxt != NULL) { ctxt->valid = 0; } @@ -610,6 +704,33 @@ xmlNsErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, ctxt->nsWellFormed = 0; } +/** + * xmlNsWarn + * @ctxt: an XML parser context + * @error: the error number + * @msg: the message + * @info1: extra information string + * @info2: extra information string + * + * Handle a fatal parser error, i.e. violating Well-Formedness constraints + */ +static void +xmlNsWarn(xmlParserCtxtPtr ctxt, xmlParserErrors error, + const char *msg, + const xmlChar * info1, const xmlChar * info2, + const xmlChar * info3) +{ + if ((ctxt != NULL) && (ctxt->disableSAX != 0) && + (ctxt->instate == XML_PARSER_EOF)) + return; + if (ctxt != NULL) + ctxt->errNo = error; + __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_NAMESPACE, error, + XML_ERR_WARNING, NULL, 0, (const char *) info1, + (const char *) info2, (const char *) info3, 0, 0, msg, + info1, info2, info3); +} + /************************************************************************ * * * Library wide options * @@ -809,7 +930,7 @@ xmlHasFeature(xmlFeature feature) return(1); #else return(0); -#endif +#endif case XML_WITH_ZLIB: #ifdef LIBXML_ZLIB_ENABLED return(1); @@ -859,7 +980,7 @@ typedef xmlDefAttrs *xmlDefAttrsPtr; struct _xmlDefAttrs { int nbAttrs; /* number of defaulted attributes on that element */ int maxAttrs; /* the size of the array */ - const xmlChar *values[4]; /* array of localname/prefix/values */ + const xmlChar *values[5]; /* array of localname/prefix/values/external */ }; /** @@ -913,7 +1034,7 @@ xmlAttrNormalizeSpace(const xmlChar *src, xmlChar *dst) * is needed. */ static const xmlChar * -xmlAttrNormalizeSpace2(xmlParserCtxtPtr ctxt, const xmlChar *src, int *len) +xmlAttrNormalizeSpace2(xmlParserCtxtPtr ctxt, xmlChar *src, int *len) { int i; int remove_head = 0; @@ -954,7 +1075,8 @@ xmlAttrNormalizeSpace2(xmlParserCtxtPtr ctxt, const xmlChar *src, int *len) return(ret); } else if (remove_head) { *len -= remove_head; - return(src + remove_head); + memmove(src, src + remove_head, 1 + *len); + return(src); } return(NULL); } @@ -1011,7 +1133,7 @@ xmlAddDefAttrs(xmlParserCtxtPtr ctxt, defaults = xmlHashLookup2(ctxt->attsDefault, name, prefix); if (defaults == NULL) { defaults = (xmlDefAttrsPtr) xmlMalloc(sizeof(xmlDefAttrs) + - (4 * 4) * sizeof(const xmlChar *)); + (4 * 5) * sizeof(const xmlChar *)); if (defaults == NULL) goto mem_error; defaults->nbAttrs = 0; @@ -1025,7 +1147,7 @@ xmlAddDefAttrs(xmlParserCtxtPtr ctxt, xmlDefAttrsPtr temp; temp = (xmlDefAttrsPtr) xmlRealloc(defaults, sizeof(xmlDefAttrs) + - (2 * defaults->maxAttrs * 4) * sizeof(const xmlChar *)); + (2 * defaults->maxAttrs * 5) * sizeof(const xmlChar *)); if (temp == NULL) goto mem_error; defaults = temp; @@ -1050,13 +1172,17 @@ xmlAddDefAttrs(xmlParserCtxtPtr ctxt, prefix = xmlDictLookup(ctxt->dict, fullattr, len); } - defaults->values[4 * defaults->nbAttrs] = name; - defaults->values[4 * defaults->nbAttrs + 1] = prefix; + defaults->values[5 * defaults->nbAttrs] = name; + defaults->values[5 * defaults->nbAttrs + 1] = prefix; /* intern the string and precompute the end */ len = xmlStrlen(value); value = xmlDictLookup(ctxt->dict, value, len); - defaults->values[4 * defaults->nbAttrs + 2] = value; - defaults->values[4 * defaults->nbAttrs + 3] = value + len; + defaults->values[5 * defaults->nbAttrs + 2] = value; + defaults->values[5 * defaults->nbAttrs + 3] = value + len; + if (ctxt->external) + defaults->values[5 * defaults->nbAttrs + 4] = BAD_CAST "external"; + else + defaults->values[5 * defaults->nbAttrs + 4] = NULL; defaults->nbAttrs++; return; @@ -1212,7 +1338,7 @@ xmlCheckLanguageID(const xmlChar * lang) /************************************************************************ * * - * Parser stacks related functions and macros * + * Parser stacks related functions and macros * * * ************************************************************************/ @@ -1293,7 +1419,7 @@ nsPop(xmlParserCtxtPtr ctxt, int nr) } if (ctxt->nsNr <= 0) return (0); - + for (i = 0;i < nr;i++) { ctxt->nsNr--; ctxt->nsTab[ctxt->nsNr] = NULL; @@ -1343,13 +1469,13 @@ mem_error: * * Pushes a new parser input on top of the input stack * - * Returns 0 in case of error, the index in the stack otherwise + * Returns -1 in case of error, the index in the stack otherwise */ int inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value) { if ((ctxt == NULL) || (value == NULL)) - return(0); + return(-1); if (ctxt->inputNr >= ctxt->inputMax) { ctxt->inputMax *= 2; ctxt->inputTab = @@ -1358,7 +1484,10 @@ inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value) sizeof(ctxt->inputTab[0])); if (ctxt->inputTab == NULL) { xmlErrMemory(ctxt, NULL); - return (0); + xmlFreeInputStream(value); + ctxt->inputMax /= 2; + value = NULL; + return (-1); } } ctxt->inputTab[ctxt->inputNr] = value; @@ -1398,7 +1527,7 @@ inputPop(xmlParserCtxtPtr ctxt) * * Pushes a new element node on top of the node stack * - * Returns 0 in case of error, the index in the stack otherwise + * Returns -1 in case of error, the index in the stack otherwise */ int nodePush(xmlParserCtxtPtr ctxt, xmlNodePtr value) @@ -1412,22 +1541,24 @@ nodePush(xmlParserCtxtPtr ctxt, xmlNodePtr value) sizeof(ctxt->nodeTab[0])); if (tmp == NULL) { xmlErrMemory(ctxt, NULL); - return (0); + return (-1); } ctxt->nodeTab = tmp; ctxt->nodeMax *= 2; } - if (((unsigned int) ctxt->nodeNr) > xmlParserMaxDepth) { + if ((((unsigned int) ctxt->nodeNr) > xmlParserMaxDepth) && + ((ctxt->options & XML_PARSE_HUGE) == 0)) { xmlFatalErrMsgInt(ctxt, XML_ERR_INTERNAL_ERROR, - "Excessive depth in document: change xmlParserMaxDepth = %d\n", + "Excessive depth in document: %d use XML_PARSE_HUGE option\n", xmlParserMaxDepth); ctxt->instate = XML_PARSER_EOF; - return(0); + return(-1); } ctxt->nodeTab[ctxt->nodeNr] = value; ctxt->node = value; return (ctxt->nodeNr++); } + /** * nodePop: * @ctxt: an XML parser context @@ -1594,7 +1725,8 @@ static int spacePush(xmlParserCtxtPtr ctxt, int val) { ctxt->spaceMax * sizeof(ctxt->spaceTab[0])); if (tmp == NULL) { xmlErrMemory(ctxt, NULL); - return(0); + ctxt->spaceMax /=2; + return(-1); } ctxt->spaceTab = tmp; } @@ -1842,10 +1974,12 @@ xmlPopInput(xmlParserCtxtPtr ctxt) { * * xmlPushInput: switch to a new input stream which is stacked on top * of the previous one(s). + * Returns -1 in case of error or the index in the input stack */ -void +int xmlPushInput(xmlParserCtxtPtr ctxt, xmlParserInputPtr input) { - if (input == NULL) return; + int ret; + if (input == NULL) return(-1); if (xmlParserDebugEntities) { if ((ctxt->input != NULL) && (ctxt->input->filename)) @@ -1855,8 +1989,9 @@ xmlPushInput(xmlParserCtxtPtr ctxt, xmlParserInputPtr input) { xmlGenericError(xmlGenericErrorContext, "Pushing input %d : %.30s\n", ctxt->inputNr+1, input->cur); } - inputPush(ctxt, input); + ret = inputPush(ctxt, input); GROW; + return(ret); } /** @@ -2234,7 +2369,7 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) { if ((ctxt->validate) && (ctxt->vctxt.error != NULL)) { xmlValidityError(ctxt, XML_WAR_UNDECLARED_ENTITY, "PEReference: %%%s; not found\n", - name); + name, NULL); } else xmlWarningMsg(ctxt, XML_WAR_UNDECLARED_ENTITY, "PEReference: %%%s; not found\n", @@ -2243,7 +2378,8 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) { } } else if (ctxt->input->free != deallocblankswrapper) { input = xmlNewBlanksWrapperInputStream(ctxt, entity); - xmlPushInput(ctxt, input); + if (xmlPushInput(ctxt, input) < 0) + return; } else { if ((entity->etype == XML_INTERNAL_PARAMETER_ENTITY) || (entity->etype == XML_EXTERNAL_PARAMETER_ENTITY)) { @@ -2256,7 +2392,8 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) { * this is done independently. */ input = xmlNewEntityInputStream(ctxt, entity); - xmlPushInput(ctxt, input); + if (xmlPushInput(ctxt, input) < 0) + return; /* * Get the 4 first bytes and decode the charset @@ -2299,9 +2436,10 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) { /* * Macro used to grow the current buffer. */ -#define growBuffer(buffer) { \ +#define growBuffer(buffer, n) { \ xmlChar *tmp; \ buffer##_size *= 2; \ + buffer##_size += n; \ tmp = (xmlChar *) \ xmlRealloc(buffer, buffer##_size * sizeof(xmlChar)); \ if (tmp == NULL) goto mem_error; \ @@ -2344,7 +2482,9 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, return(NULL); last = str + len; - if (ctxt->depth > 40) { + if (((ctxt->depth > 40) && + ((ctxt->options & XML_PARSE_HUGE) == 0)) || + (ctxt->depth > 1024)) { xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL); return(NULL); } @@ -2374,7 +2514,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, COPY_BUF(0,buffer,nbchars,val); } if (nbchars > buffer_size - XML_PARSER_BUFFER_SIZE) { - growBuffer(buffer); + growBuffer(buffer, XML_PARSER_BUFFER_SIZE); } } else if ((c == '&') && (what & XML_SUBSTITUTE_REF)) { if (xmlParserDebugEntities) @@ -2382,12 +2522,17 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, "String decoding Entity Reference: %.30s\n", str); ent = xmlParseStringEntityRef(ctxt, &str); + if ((ctxt->lastError.code == XML_ERR_ENTITY_LOOP) || + (ctxt->lastError.code == XML_ERR_INTERNAL_ERROR)) + goto int_error; + if (ent != NULL) + ctxt->nbentities += ent->checked; if ((ent != NULL) && (ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) { if (ent->content != NULL) { COPY_BUF(0,buffer,nbchars,ent->content[0]); if (nbchars > buffer_size - XML_PARSER_BUFFER_SIZE) { - growBuffer(buffer); + growBuffer(buffer, XML_PARSER_BUFFER_SIZE); } } else { xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR, @@ -2398,13 +2543,16 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, rep = xmlStringDecodeEntities(ctxt, ent->content, what, 0, 0, 0); ctxt->depth--; + if (rep != NULL) { current = rep; while (*current != 0) { /* non input consuming loop */ buffer[nbchars++] = *current++; if (nbchars > buffer_size - XML_PARSER_BUFFER_SIZE) { - growBuffer(buffer); + if (xmlParserEntityCheck(ctxt, nbchars, ent)) + goto int_error; + growBuffer(buffer, XML_PARSER_BUFFER_SIZE); } } xmlFree(rep); @@ -2416,7 +2564,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, buffer[nbchars++] = '&'; if (nbchars > buffer_size - i - XML_PARSER_BUFFER_SIZE) { - growBuffer(buffer); + growBuffer(buffer, XML_PARSER_BUFFER_SIZE); } for (;i > 0;i--) buffer[nbchars++] = *cur++; @@ -2427,10 +2575,13 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, xmlGenericError(xmlGenericErrorContext, "String decoding PE Reference: %.30s\n", str); ent = xmlParseStringPEReference(ctxt, &str); + if (ctxt->lastError.code == XML_ERR_ENTITY_LOOP) + goto int_error; + if (ent != NULL) + ctxt->nbentities += ent->checked; if (ent != NULL) { if (ent->content == NULL) { - if (xmlLoadEntityContent(ctxt, ent) < 0) { - } + xmlLoadEntityContent(ctxt, ent); } ctxt->depth++; rep = xmlStringDecodeEntities(ctxt, ent->content, what, @@ -2442,7 +2593,9 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, buffer[nbchars++] = *current++; if (nbchars > buffer_size - XML_PARSER_BUFFER_SIZE) { - growBuffer(buffer); + if (xmlParserEntityCheck(ctxt, nbchars, ent)) + goto int_error; + growBuffer(buffer, XML_PARSER_BUFFER_SIZE); } } xmlFree(rep); @@ -2453,7 +2606,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, COPY_BUF(l,buffer,nbchars,c); str += l; if (nbchars > buffer_size - XML_PARSER_BUFFER_SIZE) { - growBuffer(buffer); + growBuffer(buffer, XML_PARSER_BUFFER_SIZE); } } if (str < last) @@ -2466,6 +2619,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, mem_error: xmlErrMemory(ctxt, NULL); +int_error: if (rep != NULL) xmlFree(rep); if (buffer != NULL) @@ -2758,10 +2912,198 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) { * * ************************************************************************/ -static const xmlChar * xmlParseNameComplex(xmlParserCtxtPtr ctxt); +/************************************************************************ + * * + * Routines to parse Name, NCName and NmToken * + * * + ************************************************************************/ +unsigned long nbParseName = 0; +unsigned long nbParseNmToken = 0; +unsigned long nbParseNCName = 0; +unsigned long nbParseNCNameComplex = 0; +unsigned long nbParseNameComplex = 0; +unsigned long nbParseStringName = 0; +/* + * The two following functions are related to the change of accepted + * characters for Name and NmToken in the Revision 5 of XML-1.0 + * They correspond to the modified production [4] and the new production [4a] + * changes in that revision. Also note that the macros used for the + * productions Letter, Digit, CombiningChar and Extender are not needed + * anymore. + * We still keep compatibility to pre-revision5 parsing semantic if the + * new XML_PARSE_OLD10 option is given to the parser. + */ +static int +xmlIsNameStartChar(xmlParserCtxtPtr ctxt, int c) { + if ((ctxt->options & XML_PARSE_OLD10) == 0) { + /* + * Use the new checks of production [4] [4a] amd [5] of the + * Update 5 of XML-1.0 + */ + if ((c != ' ') && (c != '>') && (c != '/') && /* accelerators */ + (((c >= 'a') && (c <= 'z')) || + ((c >= 'A') && (c <= 'Z')) || + (c == '_') || (c == ':') || + ((c >= 0xC0) && (c <= 0xD6)) || + ((c >= 0xD8) && (c <= 0xF6)) || + ((c >= 0xF8) && (c <= 0x2FF)) || + ((c >= 0x370) && (c <= 0x37D)) || + ((c >= 0x37F) && (c <= 0x1FFF)) || + ((c >= 0x200C) && (c <= 0x200D)) || + ((c >= 0x2070) && (c <= 0x218F)) || + ((c >= 0x2C00) && (c <= 0x2FEF)) || + ((c >= 0x3001) && (c <= 0xD7FF)) || + ((c >= 0xF900) && (c <= 0xFDCF)) || + ((c >= 0xFDF0) && (c <= 0xFFFD)) || + ((c >= 0x10000) && (c <= 0xEFFFF)))) + return(1); + } else { + if (IS_LETTER(c) || (c == '_') || (c == ':')) + return(1); + } + return(0); +} + +static int +xmlIsNameChar(xmlParserCtxtPtr ctxt, int c) { + if ((ctxt->options & XML_PARSE_OLD10) == 0) { + /* + * Use the new checks of production [4] [4a] amd [5] of the + * Update 5 of XML-1.0 + */ + if ((c != ' ') && (c != '>') && (c != '/') && /* accelerators */ + (((c >= 'a') && (c <= 'z')) || + ((c >= 'A') && (c <= 'Z')) || + ((c >= '0') && (c <= '9')) || /* !start */ + (c == '_') || (c == ':') || + (c == '-') || (c == '.') || (c == 0xB7) || /* !start */ + ((c >= 0xC0) && (c <= 0xD6)) || + ((c >= 0xD8) && (c <= 0xF6)) || + ((c >= 0xF8) && (c <= 0x2FF)) || + ((c >= 0x300) && (c <= 0x36F)) || /* !start */ + ((c >= 0x370) && (c <= 0x37D)) || + ((c >= 0x37F) && (c <= 0x1FFF)) || + ((c >= 0x200C) && (c <= 0x200D)) || + ((c >= 0x203F) && (c <= 0x2040)) || /* !start */ + ((c >= 0x2070) && (c <= 0x218F)) || + ((c >= 0x2C00) && (c <= 0x2FEF)) || + ((c >= 0x3001) && (c <= 0xD7FF)) || + ((c >= 0xF900) && (c <= 0xFDCF)) || + ((c >= 0xFDF0) && (c <= 0xFFFD)) || + ((c >= 0x10000) && (c <= 0xEFFFF)))) + return(1); + } else { + if ((IS_LETTER(c)) || (IS_DIGIT(c)) || + (c == '.') || (c == '-') || + (c == '_') || (c == ':') || + (IS_COMBINING(c)) || + (IS_EXTENDER(c))) + return(1); + } + return(0); +} + static xmlChar * xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc, int normalize); +static const xmlChar * +xmlParseNameComplex(xmlParserCtxtPtr ctxt) { + int len = 0, l; + int c; + int count = 0; + + nbParseNameComplex++; + + /* + * Handler for more complex cases + */ + GROW; + c = CUR_CHAR(l); + if ((ctxt->options & XML_PARSE_OLD10) == 0) { + /* + * Use the new checks of production [4] [4a] amd [5] of the + * Update 5 of XML-1.0 + */ + if ((c == ' ') || (c == '>') || (c == '/') || /* accelerators */ + (!(((c >= 'a') && (c <= 'z')) || + ((c >= 'A') && (c <= 'Z')) || + (c == '_') || (c == ':') || + ((c >= 0xC0) && (c <= 0xD6)) || + ((c >= 0xD8) && (c <= 0xF6)) || + ((c >= 0xF8) && (c <= 0x2FF)) || + ((c >= 0x370) && (c <= 0x37D)) || + ((c >= 0x37F) && (c <= 0x1FFF)) || + ((c >= 0x200C) && (c <= 0x200D)) || + ((c >= 0x2070) && (c <= 0x218F)) || + ((c >= 0x2C00) && (c <= 0x2FEF)) || + ((c >= 0x3001) && (c <= 0xD7FF)) || + ((c >= 0xF900) && (c <= 0xFDCF)) || + ((c >= 0xFDF0) && (c <= 0xFFFD)) || + ((c >= 0x10000) && (c <= 0xEFFFF))))) { + return(NULL); + } + len += l; + NEXTL(l); + c = CUR_CHAR(l); + while ((c != ' ') && (c != '>') && (c != '/') && /* accelerators */ + (((c >= 'a') && (c <= 'z')) || + ((c >= 'A') && (c <= 'Z')) || + ((c >= '0') && (c <= '9')) || /* !start */ + (c == '_') || (c == ':') || + (c == '-') || (c == '.') || (c == 0xB7) || /* !start */ + ((c >= 0xC0) && (c <= 0xD6)) || + ((c >= 0xD8) && (c <= 0xF6)) || + ((c >= 0xF8) && (c <= 0x2FF)) || + ((c >= 0x300) && (c <= 0x36F)) || /* !start */ + ((c >= 0x370) && (c <= 0x37D)) || + ((c >= 0x37F) && (c <= 0x1FFF)) || + ((c >= 0x200C) && (c <= 0x200D)) || + ((c >= 0x203F) && (c <= 0x2040)) || /* !start */ + ((c >= 0x2070) && (c <= 0x218F)) || + ((c >= 0x2C00) && (c <= 0x2FEF)) || + ((c >= 0x3001) && (c <= 0xD7FF)) || + ((c >= 0xF900) && (c <= 0xFDCF)) || + ((c >= 0xFDF0) && (c <= 0xFFFD)) || + ((c >= 0x10000) && (c <= 0xEFFFF)) + )) { + if (count++ > 100) { + count = 0; + GROW; + } + len += l; + NEXTL(l); + c = CUR_CHAR(l); + } + } else { + if ((c == ' ') || (c == '>') || (c == '/') || /* accelerators */ + (!IS_LETTER(c) && (c != '_') && + (c != ':'))) { + return(NULL); + } + len += l; + NEXTL(l); + c = CUR_CHAR(l); + + while ((c != ' ') && (c != '>') && (c != '/') && /* test bigname.xml */ + ((IS_LETTER(c)) || (IS_DIGIT(c)) || + (c == '.') || (c == '-') || + (c == '_') || (c == ':') || + (IS_COMBINING(c)) || + (IS_EXTENDER(c)))) { + if (count++ > 100) { + count = 0; + GROW; + } + len += l; + NEXTL(l); + c = CUR_CHAR(l); + } + } + if ((*ctxt->input->cur == '\n') && (ctxt->input->cur[-1] == '\r')) + return(xmlDictLookup(ctxt->dict, ctxt->input->cur - (len + 1), len)); + return(xmlDictLookup(ctxt->dict, ctxt->input->cur - len, len)); +} + /** * xmlParseName: * @ctxt: an XML parser context @@ -2786,6 +3128,8 @@ xmlParseName(xmlParserCtxtPtr ctxt) { GROW; + nbParseName++; + /* * Accelerator for simple ASCII names */ @@ -2811,71 +3155,30 @@ xmlParseName(xmlParserCtxtPtr ctxt) { return(ret); } } + /* accelerator for special cases */ return(xmlParseNameComplex(ctxt)); } -/** - * xmlParseNameAndCompare: - * @ctxt: an XML parser context - * - * parse an XML name and compares for match - * (specialized for endtag parsing) - * - * Returns NULL for an illegal name, (xmlChar*) 1 for success - * and the name for mismatch - */ - -static const xmlChar * -xmlParseNameAndCompare(xmlParserCtxtPtr ctxt, xmlChar const *other) { - register const xmlChar *cmp = other; - register const xmlChar *in; - const xmlChar *ret; - - GROW; - - in = ctxt->input->cur; - while (*in != 0 && *in == *cmp) { - ++in; - ++cmp; - ctxt->input->col++; - } - if (*cmp == 0 && (*in == '>' || IS_BLANK_CH (*in))) { - /* success */ - ctxt->input->cur = in; - return (const xmlChar*) 1; - } - /* failure (or end of input buffer), check with full function */ - ret = xmlParseName (ctxt); - /* strings coming from the dictionnary direct compare possible */ - if (ret == other) { - return (const xmlChar*) 1; - } - return ret; -} - static const xmlChar * -xmlParseNameComplex(xmlParserCtxtPtr ctxt) { +xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) { int len = 0, l; int c; int count = 0; + nbParseNCNameComplex++; + /* * Handler for more complex cases */ GROW; c = CUR_CHAR(l); if ((c == ' ') || (c == '>') || (c == '/') || /* accelerators */ - (!IS_LETTER(c) && (c != '_') && - (c != ':'))) { + (!xmlIsNameStartChar(ctxt, c) || (c == ':'))) { return(NULL); } while ((c != ' ') && (c != '>') && (c != '/') && /* test bigname.xml */ - ((IS_LETTER(c)) || (IS_DIGIT(c)) || - (c == '.') || (c == '-') || - (c == '_') || (c == ':') || - (IS_COMBINING(c)) || - (IS_EXTENDER(c)))) { + (xmlIsNameChar(ctxt, c) && (c != ':'))) { if (count++ > 100) { count = 0; GROW; @@ -2884,70 +3187,154 @@ xmlParseNameComplex(xmlParserCtxtPtr ctxt) { NEXTL(l); c = CUR_CHAR(l); } - if ((*ctxt->input->cur == '\n') && (ctxt->input->cur[-1] == '\r')) - return(xmlDictLookup(ctxt->dict, ctxt->input->cur - (len + 1), len)); return(xmlDictLookup(ctxt->dict, ctxt->input->cur - len, len)); } /** - * xmlParseStringName: + * xmlParseNCName: * @ctxt: an XML parser context - * @str: a pointer to the string pointer (IN/OUT) + * @len: lenght of the string parsed * * parse an XML name. * - * [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | - * CombiningChar | Extender - * - * [5] Name ::= (Letter | '_' | ':') (NameChar)* + * [4NS] NCNameChar ::= Letter | Digit | '.' | '-' | '_' | + * CombiningChar | Extender * - * [6] Names ::= Name (#x20 Name)* + * [5NS] NCName ::= (Letter | '_') (NCNameChar)* * - * Returns the Name parsed or NULL. The @str pointer - * is updated to the current location in the string. + * Returns the Name parsed or NULL */ -static xmlChar * -xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar** str) { - xmlChar buf[XML_MAX_NAMELEN + 5]; - const xmlChar *cur = *str; - int len = 0, l; - int c; +static const xmlChar * +xmlParseNCName(xmlParserCtxtPtr ctxt) { + const xmlChar *in; + const xmlChar *ret; + int count = 0; - c = CUR_SCHAR(cur, l); - if (!IS_LETTER(c) && (c != '_') && - (c != ':')) { - return(NULL); - } + nbParseNCName++; - while ((IS_LETTER(c)) || (IS_DIGIT(c)) || /* test bigentname.xml */ - (c == '.') || (c == '-') || - (c == '_') || (c == ':') || - (IS_COMBINING(c)) || - (IS_EXTENDER(c))) { - COPY_BUF(l,buf,len,c); - cur += l; - c = CUR_SCHAR(cur, l); - if (len >= XML_MAX_NAMELEN) { /* test bigentname.xml */ - /* + /* + * Accelerator for simple ASCII names + */ + in = ctxt->input->cur; + if (((*in >= 0x61) && (*in <= 0x7A)) || + ((*in >= 0x41) && (*in <= 0x5A)) || + (*in == '_')) { + in++; + while (((*in >= 0x61) && (*in <= 0x7A)) || + ((*in >= 0x41) && (*in <= 0x5A)) || + ((*in >= 0x30) && (*in <= 0x39)) || + (*in == '_') || (*in == '-') || + (*in == '.')) + in++; + if ((*in > 0) && (*in < 0x80)) { + count = in - ctxt->input->cur; + ret = xmlDictLookup(ctxt->dict, ctxt->input->cur, count); + ctxt->input->cur = in; + ctxt->nbChars += count; + ctxt->input->col += count; + if (ret == NULL) { + xmlErrMemory(ctxt, NULL); + } + return(ret); + } + } + return(xmlParseNCNameComplex(ctxt)); +} + +/** + * xmlParseNameAndCompare: + * @ctxt: an XML parser context + * + * parse an XML name and compares for match + * (specialized for endtag parsing) + * + * Returns NULL for an illegal name, (xmlChar*) 1 for success + * and the name for mismatch + */ + +static const xmlChar * +xmlParseNameAndCompare(xmlParserCtxtPtr ctxt, xmlChar const *other) { + register const xmlChar *cmp = other; + register const xmlChar *in; + const xmlChar *ret; + + GROW; + + in = ctxt->input->cur; + while (*in != 0 && *in == *cmp) { + ++in; + ++cmp; + ctxt->input->col++; + } + if (*cmp == 0 && (*in == '>' || IS_BLANK_CH (*in))) { + /* success */ + ctxt->input->cur = in; + return (const xmlChar*) 1; + } + /* failure (or end of input buffer), check with full function */ + ret = xmlParseName (ctxt); + /* strings coming from the dictionnary direct compare possible */ + if (ret == other) { + return (const xmlChar*) 1; + } + return ret; +} + +/** + * xmlParseStringName: + * @ctxt: an XML parser context + * @str: a pointer to the string pointer (IN/OUT) + * + * parse an XML name. + * + * [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | + * CombiningChar | Extender + * + * [5] Name ::= (Letter | '_' | ':') (NameChar)* + * + * [6] Names ::= Name (#x20 Name)* + * + * Returns the Name parsed or NULL. The @str pointer + * is updated to the current location in the string. + */ + +static xmlChar * +xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar** str) { + xmlChar buf[XML_MAX_NAMELEN + 5]; + const xmlChar *cur = *str; + int len = 0, l; + int c; + + nbParseStringName++; + + c = CUR_SCHAR(cur, l); + if (!xmlIsNameStartChar(ctxt, c)) { + return(NULL); + } + + COPY_BUF(l,buf,len,c); + cur += l; + c = CUR_SCHAR(cur, l); + while (xmlIsNameChar(ctxt, c)) { + COPY_BUF(l,buf,len,c); + cur += l; + c = CUR_SCHAR(cur, l); + if (len >= XML_MAX_NAMELEN) { /* test bigentname.xml */ + /* * Okay someone managed to make a huge name, so he's ready to pay * for the processing speed. */ xmlChar *buffer; int max = len * 2; - + buffer = (xmlChar *) xmlMallocAtomic(max * sizeof(xmlChar)); if (buffer == NULL) { xmlErrMemory(ctxt, NULL); return(NULL); } memcpy(buffer, buf, len); - while ((IS_LETTER(c)) || (IS_DIGIT(c)) || - /* test bigentname.xml */ - (c == '.') || (c == '-') || - (c == '_') || (c == ':') || - (IS_COMBINING(c)) || - (IS_EXTENDER(c))) { + while (xmlIsNameChar(ctxt, c)) { if (len + 10 > max) { xmlChar *tmp; max *= 2; @@ -2976,7 +3363,7 @@ xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar** str) { /** * xmlParseNmtoken: * @ctxt: an XML parser context - * + * * parse an XML Nmtoken. * * [7] Nmtoken ::= (NameChar)+ @@ -2993,14 +3380,12 @@ xmlParseNmtoken(xmlParserCtxtPtr ctxt) { int c; int count = 0; + nbParseNmToken++; + GROW; c = CUR_CHAR(l); - while ((IS_LETTER(c)) || (IS_DIGIT(c)) || /* test bigtoken.xml */ - (c == '.') || (c == '-') || - (c == '_') || (c == ':') || - (IS_COMBINING(c)) || - (IS_EXTENDER(c))) { + while (xmlIsNameChar(ctxt, c)) { if (count++ > 100) { count = 0; GROW; @@ -3015,18 +3400,14 @@ xmlParseNmtoken(xmlParserCtxtPtr ctxt) { */ xmlChar *buffer; int max = len * 2; - + buffer = (xmlChar *) xmlMallocAtomic(max * sizeof(xmlChar)); if (buffer == NULL) { xmlErrMemory(ctxt, NULL); return(NULL); } memcpy(buffer, buf, len); - while ((IS_LETTER(c)) || (IS_DIGIT(c)) || /* test bigtoken.xml */ - (c == '.') || (c == '-') || - (c == '_') || (c == ':') || - (IS_COMBINING(c)) || - (IS_EXTENDER(c))) { + while (xmlIsNameChar(ctxt, c)) { if (count++ > 100) { count = 0; GROW; @@ -3255,7 +3636,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { if (val == '&') { if (ctxt->replaceEntities) { if (len > buf_size - 10) { - growBuffer(buf); + growBuffer(buf, 10); } buf[len++] = '&'; } else { @@ -3264,7 +3645,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { * called by the attribute() function in SAX.c */ if (len > buf_size - 10) { - growBuffer(buf); + growBuffer(buf, 10); } buf[len++] = '&'; buf[len++] = '#'; @@ -3274,16 +3655,19 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { } } else if (val != 0) { if (len > buf_size - 10) { - growBuffer(buf); + growBuffer(buf, 10); } len += xmlCopyChar(0, &buf[len], val); } } else { ent = xmlParseEntityRef(ctxt); + ctxt->nbentities++; + if (ent != NULL) + ctxt->nbentities += ent->owner; if ((ent != NULL) && (ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) { if (len > buf_size - 10) { - growBuffer(buf); + growBuffer(buf, 10); } if ((ctxt->replaceEntities == 0) && (ent->content[0] == '&')) { @@ -3306,7 +3690,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { while (*current != 0) { /* non input consuming */ buf[len++] = *current++; if (len > buf_size - 10) { - growBuffer(buf); + growBuffer(buf, 10); } } xmlFree(rep); @@ -3314,7 +3698,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { } } else { if (len > buf_size - 10) { - growBuffer(buf); + growBuffer(buf, 10); } if (ent->content != NULL) buf[len++] = ent->content[0]; @@ -3341,8 +3725,8 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { * Just output the reference */ buf[len++] = '&'; - if (len > buf_size - i - 10) { - growBuffer(buf); + while (len > buf_size - i - 10) { + growBuffer(buf, i + 10); } for (;i > 0;i--) buf[len++] = *cur++; @@ -3354,8 +3738,8 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { if ((len != 0) || (!normalize)) { if ((!normalize) || (!in_space)) { COPY_BUF(l,buf,len,0x20); - if (len > buf_size - 10) { - growBuffer(buf); + while (len > buf_size - 10) { + growBuffer(buf, 10); } } in_space = 1; @@ -3364,7 +3748,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { in_space = 0; COPY_BUF(l,buf,len,c); if (len > buf_size - 10) { - growBuffer(buf); + growBuffer(buf, 10); } } NEXTL(l); @@ -3976,8 +4360,10 @@ xmlParseCommentComplex(xmlParserCtxtPtr ctxt, xmlChar *buf, int len, int size) { int q, ql; int r, rl; int cur, l; - xmlParserInputPtr input = ctxt->input; int count = 0; + int inputid; + + inputid = ctxt->input->id; if (buf == NULL) { len = 0; @@ -4059,7 +4445,7 @@ xmlParseCommentComplex(xmlParserCtxtPtr ctxt, xmlChar *buf, int len, int size) { "xmlParseComment: invalid xmlChar value %d\n", cur); } else { - if (input != ctxt->input) { + if (inputid != ctxt->input->id) { xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY, "Comment doesn't start and stop in the same entity\n"); } @@ -4095,15 +4481,16 @@ xmlParseComment(xmlParserCtxtPtr ctxt) { xmlParserInputState state; const xmlChar *in; int nbchar = 0, ccol; + int inputid; /* * Check that there is a comment right here. */ if ((RAW != '<') || (NXT(1) != '!') || (NXT(2) != '-') || (NXT(3) != '-')) return; - state = ctxt->instate; ctxt->instate = XML_PARSER_COMMENT; + inputid = ctxt->input->id; SKIP(4); SHRINK; GROW; @@ -4194,6 +4581,10 @@ get_more: if (*in == '-') { if (in[1] == '-') { if (in[2] == '>') { + if (ctxt->input->id != inputid) { + xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY, + "comment doesn't start and stop in the same entity\n"); + } SKIP(3); if ((ctxt->sax != NULL) && (ctxt->sax->comment != NULL) && (!ctxt->disableSAX)) { @@ -4267,6 +4658,10 @@ xmlParsePITarget(xmlParserCtxtPtr ctxt) { "xmlParsePITarget: invalid name prefix 'xml'\n", NULL, NULL); } + if ((name != NULL) && (xmlStrchr(name, ':') != NULL)) { + xmlNsErr(ctxt, XML_NS_ERR_COLON, + "colon are forbidden from PI names '%s'\n", name, NULL, NULL); + } return(name); } @@ -4510,6 +4905,11 @@ xmlParseNotationDecl(xmlParserCtxtPtr ctxt) { "Space required after the NOTATION name'\n"); return; } + if (xmlStrchr(name, ':') != NULL) { + xmlNsErr(ctxt, XML_NS_ERR_COLON, + "colon are forbidden from notation names '%s'\n", + name, NULL, NULL); + } SKIP_BLANKS; /* @@ -4594,6 +4994,11 @@ xmlParseEntityDecl(xmlParserCtxtPtr ctxt) { "xmlParseEntityDecl: no name\n"); return; } + if (xmlStrchr(name, ':') != NULL) { + xmlNsErr(ctxt, XML_NS_ERR_COLON, + "colon are forbidden from entities names '%s'\n", + name, NULL, NULL); + } skipped = SKIP_BLANKS; if (skipped == 0) { xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, @@ -4669,6 +5074,7 @@ xmlParseEntityDecl(xmlParserCtxtPtr ctxt) { xmlErrMemory(ctxt, "New Doc failed"); return; } + ctxt->myDoc->properties = XML_DOC_INTERNAL; } if (ctxt->myDoc->intSubset == NULL) ctxt->myDoc->intSubset = xmlNewDtd(ctxt->myDoc, @@ -4741,6 +5147,7 @@ xmlParseEntityDecl(xmlParserCtxtPtr ctxt) { xmlErrMemory(ctxt, "New Doc failed"); return; } + ctxt->myDoc->properties = XML_DOC_INTERNAL; } if (ctxt->myDoc->intSubset == NULL) @@ -4879,7 +5286,7 @@ xmlParseDefaultDecl(xmlParserCtxtPtr ctxt, xmlChar **value) { xmlEnumerationPtr xmlParseNotationType(xmlParserCtxtPtr ctxt) { const xmlChar *name; - xmlEnumerationPtr ret = NULL, last = NULL, cur; + xmlEnumerationPtr ret = NULL, last = NULL, cur, tmp; if (RAW != '(') { xmlFatalErr(ctxt, XML_ERR_NOTATION_NOT_STARTED, NULL); @@ -4895,12 +5302,26 @@ xmlParseNotationType(xmlParserCtxtPtr ctxt) { "Name expected in NOTATION declaration\n"); return(ret); } - cur = xmlCreateEnumeration(name); - if (cur == NULL) return(ret); - if (last == NULL) ret = last = cur; - else { - last->next = cur; - last = cur; + tmp = ret; + while (tmp != NULL) { + if (xmlStrEqual(name, tmp->name)) { + xmlValidityError(ctxt, XML_DTD_DUP_TOKEN, + "standalone: attribute notation value token %s duplicated\n", + name, NULL); + if (!xmlDictOwns(ctxt->dict, name)) + xmlFree((xmlChar *) name); + break; + } + tmp = tmp->next; + } + if (tmp == NULL) { + cur = xmlCreateEnumeration(name); + if (cur == NULL) return(ret); + if (last == NULL) ret = last = cur; + else { + last->next = cur; + last = cur; + } } SKIP_BLANKS; } while (RAW == '|'); @@ -4932,7 +5353,7 @@ xmlParseNotationType(xmlParserCtxtPtr ctxt) { xmlEnumerationPtr xmlParseEnumerationType(xmlParserCtxtPtr ctxt) { xmlChar *name; - xmlEnumerationPtr ret = NULL, last = NULL, cur; + xmlEnumerationPtr ret = NULL, last = NULL, cur, tmp; if (RAW != '(') { xmlFatalErr(ctxt, XML_ERR_ATTLIST_NOT_STARTED, NULL); @@ -4947,13 +5368,28 @@ xmlParseEnumerationType(xmlParserCtxtPtr ctxt) { xmlFatalErr(ctxt, XML_ERR_NMTOKEN_REQUIRED, NULL); return(ret); } - cur = xmlCreateEnumeration(name); - xmlFree(name); - if (cur == NULL) return(ret); - if (last == NULL) ret = last = cur; - else { - last->next = cur; - last = cur; + tmp = ret; + while (tmp != NULL) { + if (xmlStrEqual(name, tmp->name)) { + xmlValidityError(ctxt, XML_DTD_DUP_TOKEN, + "standalone: attribute enumeration value token %s duplicated\n", + name, NULL); + if (!xmlDictOwns(ctxt->dict, name)) + xmlFree(name); + break; + } + tmp = tmp->next; + } + if (tmp == NULL) { + cur = xmlCreateEnumeration(name); + if (!xmlDictOwns(ctxt->dict, name)) + xmlFree(name); + if (cur == NULL) return(ret); + if (last == NULL) ret = last = cur; + else { + last->next = cur; + last = cur; + } } SKIP_BLANKS; } while (RAW == '|'); @@ -5200,8 +5636,9 @@ xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt) { } if (RAW == '>') { if (input != ctxt->input) { - xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY, - "Attribute list declaration doesn't start and stop in the same entity\n"); + xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY, + "Attribute list declaration doesn't start and stop in the same entity\n", + NULL, NULL); } NEXT; } @@ -5241,7 +5678,7 @@ xmlParseElementMixedContentDecl(xmlParserCtxtPtr ctxt, int inputchk) { if ((ctxt->validate) && (ctxt->input->id != inputchk)) { xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY, "Element content declaration doesn't start and stop in the same entity\n", - NULL); + NULL, NULL); } NEXT; ret = xmlNewDocElementContent(ctxt->myDoc, NULL, XML_ELEMENT_CONTENT_PCDATA); @@ -5299,7 +5736,7 @@ xmlParseElementMixedContentDecl(xmlParserCtxtPtr ctxt, int inputchk) { if ((ctxt->validate) && (ctxt->input->id != inputchk)) { xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY, "Element content declaration doesn't start and stop in the same entity\n", - NULL); + NULL, NULL); } SKIP(2); } else { @@ -5531,7 +5968,7 @@ xmlParseElementChildrenContentDecl (xmlParserCtxtPtr ctxt, int inputchk) { if ((ctxt->validate) && (ctxt->input->id != inputchk)) { xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY, "Element content declaration doesn't start and stop in the same entity\n", - NULL); + NULL, NULL); } NEXT; if (RAW == '?') { @@ -5773,6 +6210,8 @@ xmlParseElementDecl(xmlParserCtxtPtr ctxt) { static void xmlParseConditionalSections(xmlParserCtxtPtr ctxt) { + int id = ctxt->input->id; + SKIP(3); SKIP_BLANKS; if (CMP7(CUR_PTR, 'I', 'N', 'C', 'L', 'U', 'D', 'E')) { @@ -5781,6 +6220,11 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) { if (RAW != '[') { xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL); } else { + if (ctxt->input->id != id) { + xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY, + "All markup of the conditional section is not in the same entity\n", + NULL, NULL); + } NEXT; } if (xmlParserDebugEntities) { @@ -5836,6 +6280,11 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) { if (RAW != '[') { xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL); } else { + if (ctxt->input->id != id) { + xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY, + "All markup of the conditional section is not in the same entity\n", + NULL, NULL); + } NEXT; } if (xmlParserDebugEntities) { @@ -5892,6 +6341,11 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) { if (RAW == 0) { xmlFatalErr(ctxt, XML_ERR_CONDSEC_NOT_FINISHED, NULL); } else { + if (ctxt->input->id != id) { + xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY, + "All markup of the conditional section is not in the same entity\n", + NULL, NULL); + } SKIP(3); } } @@ -5970,12 +6424,10 @@ xmlParseMarkupDecl(xmlParserCtxtPtr ctxt) { /** * xmlParseTextDecl: * @ctxt: an XML parser context - * + * * parse an XML declaration header for external entities * * [77] TextDecl ::= '' - * - * Question: Seems that EncodingDecl is mandatory ? Is that a typo ? */ void @@ -6086,6 +6538,11 @@ xmlParseExternalSubset(xmlParserCtxtPtr ctxt, const xmlChar *ExternalID, } if (ctxt->myDoc == NULL) { ctxt->myDoc = xmlNewDoc(BAD_CAST "1.0"); + if (ctxt->myDoc == NULL) { + xmlErrMemory(ctxt, "New Doc failed"); + return; + } + ctxt->myDoc->properties = XML_DOC_INTERNAL; } if ((ctxt->myDoc != NULL) && (ctxt->myDoc->intSubset == NULL)) xmlCreateIntSubset(ctxt->myDoc, NULL, ExternalID, SystemID); @@ -6129,7 +6586,7 @@ xmlParseExternalSubset(xmlParserCtxtPtr ctxt, const xmlChar *ExternalID, /** * xmlParseReference: * @ctxt: an XML parser context - * + * * parse and handle entity references in content, depending on the SAX * interface, this may end-up in a call to character() if this is a * CharRef, a predefined entity, if there is no reference() callback. @@ -6141,14 +6598,23 @@ void xmlParseReference(xmlParserCtxtPtr ctxt) { xmlEntityPtr ent; xmlChar *val; - if (RAW != '&') return; + int was_checked; + xmlNodePtr list = NULL; + xmlParserErrors ret = XML_ERR_OK; + + + if (RAW != '&') + return; + /* + * Simple case of a CharRef + */ if (NXT(1) == '#') { int i = 0; xmlChar out[10]; int hex = NXT(2); int value = xmlParseCharRef(ctxt); - + if (value == 0) return; if (ctxt->charset != XML_CHAR_ENCODING_UTF8) { @@ -6182,360 +6648,342 @@ xmlParseReference(xmlParserCtxtPtr ctxt) { (!ctxt->disableSAX)) ctxt->sax->characters(ctxt->userData, out, i); } - } else { - int was_checked; + return; + } - ent = xmlParseEntityRef(ctxt); - if (ent == NULL) return; - if (!ctxt->wellFormed) - return; - was_checked = ent->checked; - if ((ent->name != NULL) && - (ent->etype != XML_INTERNAL_PREDEFINED_ENTITY)) { - xmlNodePtr list = NULL; - xmlParserErrors ret = XML_ERR_OK; + /* + * We are seeing an entity reference + */ + ent = xmlParseEntityRef(ctxt); + if (ent == NULL) return; + if (!ctxt->wellFormed) + return; + was_checked = ent->checked; + /* special case of predefined entities */ + if ((ent->name == NULL) || + (ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) { + val = ent->content; + if (val == NULL) return; + /* + * inline the entity. + */ + if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL) && + (!ctxt->disableSAX)) + ctxt->sax->characters(ctxt->userData, val, xmlStrlen(val)); + return; + } - /* - * The first reference to the entity trigger a parsing phase - * where the ent->children is filled with the result from - * the parsing. - */ - if (ent->checked == 0) { - xmlChar *value; + /* + * The first reference to the entity trigger a parsing phase + * where the ent->children is filled with the result from + * the parsing. + */ + if (ent->checked == 0) { + unsigned long oldnbent = ctxt->nbentities; - value = ent->content; + /* + * This is a bit hackish but this seems the best + * way to make sure both SAX and DOM entity support + * behaves okay. + */ + void *user_data; + if (ctxt->userData == ctxt) + user_data = NULL; + else + user_data = ctxt->userData; - /* - * Check that this entity is well formed - */ - if ((value != NULL) && (value[0] != 0) && - (value[1] == 0) && (value[0] == '<') && - (xmlStrEqual(ent->name, BAD_CAST "lt"))) { - /* - * DONE: get definite answer on this !!! - * Lots of entity decls are used to declare a single - * char - * - * Which seems to be valid since - * 2.4: The ampersand character (&) and the left angle - * bracket (<) may appear in their literal form only - * when used ... They are also legal within the literal - * entity value of an internal entity declaration;i - * see "4.3.2 Well-Formed Parsed Entities". - * IMHO 2.4 and 4.3.2 are directly in contradiction. - * Looking at the OASIS test suite and James Clark - * tests, this is broken. However the XML REC uses - * it. Is the XML REC not well-formed ???? - * This is a hack to avoid this problem - * - * ANSWER: since lt gt amp .. are already defined, - * this is a redefinition and hence the fact that the - * content is not well balanced is not a Wf error, this - * is lousy but acceptable. - */ - list = xmlNewDocText(ctxt->myDoc, value); - if (list != NULL) { - if ((ent->etype == XML_INTERNAL_GENERAL_ENTITY) && - (ent->children == NULL)) { - ent->children = list; - ent->last = list; - ent->owner = 1; - list->parent = (xmlNodePtr) ent; - } else { - xmlFreeNodeList(list); - } - } else if (list != NULL) { - xmlFreeNodeList(list); - } - } else { - /* - * 4.3.2: An internal general parsed entity is well-formed - * if its replacement text matches the production labeled - * content. - */ + /* + * Check that this entity is well formed + * 4.3.2: An internal general parsed entity is well-formed + * if its replacement text matches the production labeled + * content. + */ + if (ent->etype == XML_INTERNAL_GENERAL_ENTITY) { + ctxt->depth++; + ret = xmlParseBalancedChunkMemoryInternal(ctxt, ent->content, + user_data, &list); + ctxt->depth--; + + } else if (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY) { + ctxt->depth++; + ret = xmlParseExternalEntityPrivate(ctxt->myDoc, ctxt, ctxt->sax, + user_data, ctxt->depth, ent->URI, + ent->ExternalID, &list); + ctxt->depth--; + } else { + ret = XML_ERR_ENTITY_PE_INTERNAL; + xmlErrMsgStr(ctxt, XML_ERR_INTERNAL_ERROR, + "invalid entity type found\n", NULL); + } + + /* + * Store the number of entities needing parsing for this entity + * content and do checkings + */ + ent->checked = ctxt->nbentities - oldnbent; + if (ret == XML_ERR_ENTITY_LOOP) { + xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL); + xmlFreeNodeList(list); + return; + } + if (xmlParserEntityCheck(ctxt, 0, ent)) { + xmlFreeNodeList(list); + return; + } - void *user_data; + if ((ret == XML_ERR_OK) && (list != NULL)) { + if (((ent->etype == XML_INTERNAL_GENERAL_ENTITY) || + (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY))&& + (ent->children == NULL)) { + ent->children = list; + if (ctxt->replaceEntities) { /* - * This is a bit hackish but this seems the best - * way to make sure both SAX and DOM entity support - * behaves okay. + * Prune it directly in the generated document + * except for single text nodes. */ - if (ctxt->userData == ctxt) - user_data = NULL; - else - user_data = ctxt->userData; - - if (ent->etype == XML_INTERNAL_GENERAL_ENTITY) { - ctxt->depth++; - ret = xmlParseBalancedChunkMemoryInternal(ctxt, - value, user_data, &list); - ctxt->depth--; - } else if (ent->etype == - XML_EXTERNAL_GENERAL_PARSED_ENTITY) { - ctxt->depth++; - ret = xmlParseExternalEntityPrivate(ctxt->myDoc, ctxt, - ctxt->sax, user_data, ctxt->depth, - ent->URI, ent->ExternalID, &list); - ctxt->depth--; + if (((list->type == XML_TEXT_NODE) && + (list->next == NULL)) || + (ctxt->parseMode == XML_PARSE_READER)) { + list->parent = (xmlNodePtr) ent; + list = NULL; + ent->owner = 1; } else { - ret = XML_ERR_ENTITY_PE_INTERNAL; - xmlErrMsgStr(ctxt, XML_ERR_INTERNAL_ERROR, - "invalid entity type found\n", NULL); - } - if (ret == XML_ERR_ENTITY_LOOP) { - xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL); - return; - } else if ((ret == XML_ERR_OK) && (list != NULL)) { - if (((ent->etype == XML_INTERNAL_GENERAL_ENTITY) || - (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY))&& - (ent->children == NULL)) { - ent->children = list; - if (ctxt->replaceEntities) { - /* - * Prune it directly in the generated document - * except for single text nodes. - */ - if (((list->type == XML_TEXT_NODE) && - (list->next == NULL)) || - (ctxt->parseMode == XML_PARSE_READER)) { - list->parent = (xmlNodePtr) ent; - list = NULL; - ent->owner = 1; - } else { - ent->owner = 0; - while (list != NULL) { - list->parent = (xmlNodePtr) ctxt->node; - list->doc = ctxt->myDoc; - if (list->next == NULL) - ent->last = list; - list = list->next; - } - list = ent->children; + ent->owner = 0; + while (list != NULL) { + list->parent = (xmlNodePtr) ctxt->node; + list->doc = ctxt->myDoc; + if (list->next == NULL) + ent->last = list; + list = list->next; + } + list = ent->children; #ifdef LIBXML_LEGACY_ENABLED - if (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY) - xmlAddEntityReference(ent, list, NULL); + if (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY) + xmlAddEntityReference(ent, list, NULL); #endif /* LIBXML_LEGACY_ENABLED */ - } - } else { - ent->owner = 1; - while (list != NULL) { - list->parent = (xmlNodePtr) ent; - if (list->next == NULL) - ent->last = list; - list = list->next; - } - } - } else { - xmlFreeNodeList(list); - list = NULL; - } - } else if ((ret != XML_ERR_OK) && - (ret != XML_WAR_UNDECLARED_ENTITY)) { - xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY, - "Entity '%s' failed to parse\n", ent->name); - } else if (list != NULL) { - xmlFreeNodeList(list); - list = NULL; + } + } else { + ent->owner = 1; + while (list != NULL) { + list->parent = (xmlNodePtr) ent; + if (list->next == NULL) + ent->last = list; + list = list->next; } } - ent->checked = 1; + } else { + xmlFreeNodeList(list); + list = NULL; } + } else if ((ret != XML_ERR_OK) && + (ret != XML_WAR_UNDECLARED_ENTITY)) { + xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY, + "Entity '%s' failed to parse\n", ent->name); + } else if (list != NULL) { + xmlFreeNodeList(list); + list = NULL; + } + if (ent->checked == 0) + ent->checked = 1; + } else if (ent->checked != 1) { + ctxt->nbentities += ent->checked; + } - if (ent->children == NULL) { - /* - * Probably running in SAX mode and the callbacks don't - * build the entity content. So unless we already went - * though parsing for first checking go though the entity - * content to generate callbacks associated to the entity - */ - if (was_checked == 1) { - void *user_data; - /* - * This is a bit hackish but this seems the best - * way to make sure both SAX and DOM entity support - * behaves okay. - */ - if (ctxt->userData == ctxt) - user_data = NULL; - else - user_data = ctxt->userData; - - if (ent->etype == XML_INTERNAL_GENERAL_ENTITY) { - ctxt->depth++; - ret = xmlParseBalancedChunkMemoryInternal(ctxt, - ent->content, user_data, NULL); - ctxt->depth--; - } else if (ent->etype == - XML_EXTERNAL_GENERAL_PARSED_ENTITY) { - ctxt->depth++; - ret = xmlParseExternalEntityPrivate(ctxt->myDoc, ctxt, - ctxt->sax, user_data, ctxt->depth, - ent->URI, ent->ExternalID, NULL); - ctxt->depth--; - } else { - ret = XML_ERR_ENTITY_PE_INTERNAL; - xmlErrMsgStr(ctxt, XML_ERR_INTERNAL_ERROR, - "invalid entity type found\n", NULL); - } - if (ret == XML_ERR_ENTITY_LOOP) { - xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL); - return; - } - } - if ((ctxt->sax != NULL) && (ctxt->sax->reference != NULL) && - (ctxt->replaceEntities == 0) && (!ctxt->disableSAX)) { - /* - * Entity reference callback comes second, it's somewhat - * superfluous but a compatibility to historical behaviour - */ - ctxt->sax->reference(ctxt->userData, ent->name); - } - return; + /* + * Now that the entity content has been gathered + * provide it to the application, this can take different forms based + * on the parsing modes. + */ + if (ent->children == NULL) { + /* + * Probably running in SAX mode and the callbacks don't + * build the entity content. So unless we already went + * though parsing for first checking go though the entity + * content to generate callbacks associated to the entity + */ + if (was_checked != 0) { + void *user_data; + /* + * This is a bit hackish but this seems the best + * way to make sure both SAX and DOM entity support + * behaves okay. + */ + if (ctxt->userData == ctxt) + user_data = NULL; + else + user_data = ctxt->userData; + + if (ent->etype == XML_INTERNAL_GENERAL_ENTITY) { + ctxt->depth++; + ret = xmlParseBalancedChunkMemoryInternal(ctxt, + ent->content, user_data, NULL); + ctxt->depth--; + } else if (ent->etype == + XML_EXTERNAL_GENERAL_PARSED_ENTITY) { + ctxt->depth++; + ret = xmlParseExternalEntityPrivate(ctxt->myDoc, ctxt, + ctxt->sax, user_data, ctxt->depth, + ent->URI, ent->ExternalID, NULL); + ctxt->depth--; + } else { + ret = XML_ERR_ENTITY_PE_INTERNAL; + xmlErrMsgStr(ctxt, XML_ERR_INTERNAL_ERROR, + "invalid entity type found\n", NULL); } - if ((ctxt->sax != NULL) && (ctxt->sax->reference != NULL) && - (ctxt->replaceEntities == 0) && (!ctxt->disableSAX)) { - /* - * Create a node. - */ - ctxt->sax->reference(ctxt->userData, ent->name); + if (ret == XML_ERR_ENTITY_LOOP) { + xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL); return; } - if ((ctxt->replaceEntities) || (ent->children == NULL)) { - /* - * There is a problem on the handling of _private for entities - * (bug 155816): Should we copy the content of the field from - * the entity (possibly overwriting some value set by the user - * when a copy is created), should we leave it alone, or should - * we try to take care of different situations? The problem - * is exacerbated by the usage of this field by the xmlReader. - * To fix this bug, we look at _private on the created node - * and, if it's NULL, we copy in whatever was in the entity. - * If it's not NULL we leave it alone. This is somewhat of a - * hack - maybe we should have further tests to determine - * what to do. - */ - if ((ctxt->node != NULL) && (ent->children != NULL)) { - /* - * Seems we are generating the DOM content, do - * a simple tree copy for all references except the first - * In the first occurrence list contains the replacement. - * progressive == 2 means we are operating on the Reader - * and since nodes are discarded we must copy all the time. - */ - if (((list == NULL) && (ent->owner == 0)) || - (ctxt->parseMode == XML_PARSE_READER)) { - xmlNodePtr nw = NULL, cur, firstChild = NULL; - - /* - * when operating on a reader, the entities definitions - * are always owning the entities subtree. - if (ctxt->parseMode == XML_PARSE_READER) - ent->owner = 1; - */ + } + if ((ctxt->sax != NULL) && (ctxt->sax->reference != NULL) && + (ctxt->replaceEntities == 0) && (!ctxt->disableSAX)) { + /* + * Entity reference callback comes second, it's somewhat + * superfluous but a compatibility to historical behaviour + */ + ctxt->sax->reference(ctxt->userData, ent->name); + } + return; + } - cur = ent->children; - while (cur != NULL) { - nw = xmlDocCopyNode(cur, ctxt->myDoc, 1); - if (nw != NULL) { - if (nw->_private == NULL) - nw->_private = cur->_private; - if (firstChild == NULL){ - firstChild = nw; - } - nw = xmlAddChild(ctxt->node, nw); - } - if (cur == ent->last) { - /* - * needed to detect some strange empty - * node cases in the reader tests - */ - if ((ctxt->parseMode == XML_PARSE_READER) && - (nw != NULL) && - (nw->type == XML_ELEMENT_NODE) && - (nw->children == NULL)) - nw->extra = 1; - - break; - } - cur = cur->next; + /* + * If we didn't get any children for the entity being built + */ + if ((ctxt->sax != NULL) && (ctxt->sax->reference != NULL) && + (ctxt->replaceEntities == 0) && (!ctxt->disableSAX)) { + /* + * Create a node. + */ + ctxt->sax->reference(ctxt->userData, ent->name); + return; + } + + if ((ctxt->replaceEntities) || (ent->children == NULL)) { + /* + * There is a problem on the handling of _private for entities + * (bug 155816): Should we copy the content of the field from + * the entity (possibly overwriting some value set by the user + * when a copy is created), should we leave it alone, or should + * we try to take care of different situations? The problem + * is exacerbated by the usage of this field by the xmlReader. + * To fix this bug, we look at _private on the created node + * and, if it's NULL, we copy in whatever was in the entity. + * If it's not NULL we leave it alone. This is somewhat of a + * hack - maybe we should have further tests to determine + * what to do. + */ + if ((ctxt->node != NULL) && (ent->children != NULL)) { + /* + * Seems we are generating the DOM content, do + * a simple tree copy for all references except the first + * In the first occurrence list contains the replacement. + * progressive == 2 means we are operating on the Reader + * and since nodes are discarded we must copy all the time. + */ + if (((list == NULL) && (ent->owner == 0)) || + (ctxt->parseMode == XML_PARSE_READER)) { + xmlNodePtr nw = NULL, cur, firstChild = NULL; + + /* + * when operating on a reader, the entities definitions + * are always owning the entities subtree. + if (ctxt->parseMode == XML_PARSE_READER) + ent->owner = 1; + */ + + cur = ent->children; + while (cur != NULL) { + nw = xmlDocCopyNode(cur, ctxt->myDoc, 1); + if (nw != NULL) { + if (nw->_private == NULL) + nw->_private = cur->_private; + if (firstChild == NULL){ + firstChild = nw; } -#ifdef LIBXML_LEGACY_ENABLED - if (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY) - xmlAddEntityReference(ent, firstChild, nw); -#endif /* LIBXML_LEGACY_ENABLED */ - } else if (list == NULL) { - xmlNodePtr nw = NULL, cur, next, last, - firstChild = NULL; + nw = xmlAddChild(ctxt->node, nw); + } + if (cur == ent->last) { /* - * Copy the entity child list and make it the new - * entity child list. The goal is to make sure any - * ID or REF referenced will be the one from the - * document content and not the entity copy. + * needed to detect some strange empty + * node cases in the reader tests */ - cur = ent->children; - ent->children = NULL; - last = ent->last; - ent->last = NULL; - while (cur != NULL) { - next = cur->next; - cur->next = NULL; - cur->parent = NULL; - nw = xmlDocCopyNode(cur, ctxt->myDoc, 1); - if (nw != NULL) { - if (nw->_private == NULL) - nw->_private = cur->_private; - if (firstChild == NULL){ - firstChild = cur; - } - xmlAddChild((xmlNodePtr) ent, nw); - xmlAddChild(ctxt->node, cur); - } - if (cur == last) - break; - cur = next; - } - ent->owner = 1; + if ((ctxt->parseMode == XML_PARSE_READER) && + (nw != NULL) && + (nw->type == XML_ELEMENT_NODE) && + (nw->children == NULL)) + nw->extra = 1; + + break; + } + cur = cur->next; + } #ifdef LIBXML_LEGACY_ENABLED - if (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY) - xmlAddEntityReference(ent, firstChild, nw); + if (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY) + xmlAddEntityReference(ent, firstChild, nw); #endif /* LIBXML_LEGACY_ENABLED */ - } else { - const xmlChar *nbktext; - - /* - * the name change is to avoid coalescing of the - * node with a possible previous text one which - * would make ent->children a dangling pointer - */ - nbktext = xmlDictLookup(ctxt->dict, BAD_CAST "nbktext", - -1); - if (ent->children->type == XML_TEXT_NODE) - ent->children->name = nbktext; - if ((ent->last != ent->children) && - (ent->last->type == XML_TEXT_NODE)) - ent->last->name = nbktext; - xmlAddChildList(ctxt->node, ent->children); + } else if (list == NULL) { + xmlNodePtr nw = NULL, cur, next, last, + firstChild = NULL; + /* + * Copy the entity child list and make it the new + * entity child list. The goal is to make sure any + * ID or REF referenced will be the one from the + * document content and not the entity copy. + */ + cur = ent->children; + ent->children = NULL; + last = ent->last; + ent->last = NULL; + while (cur != NULL) { + next = cur->next; + cur->next = NULL; + cur->parent = NULL; + nw = xmlDocCopyNode(cur, ctxt->myDoc, 1); + if (nw != NULL) { + if (nw->_private == NULL) + nw->_private = cur->_private; + if (firstChild == NULL){ + firstChild = cur; + } + xmlAddChild((xmlNodePtr) ent, nw); + xmlAddChild(ctxt->node, cur); } - - /* - * This is to avoid a nasty side effect, see - * characters() in SAX.c - */ - ctxt->nodemem = 0; - ctxt->nodelen = 0; - return; + if (cur == last) + break; + cur = next; } + if (ent->owner == 0) + ent->owner = 1; +#ifdef LIBXML_LEGACY_ENABLED + if (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY) + xmlAddEntityReference(ent, firstChild, nw); +#endif /* LIBXML_LEGACY_ENABLED */ + } else { + const xmlChar *nbktext; + + /* + * the name change is to avoid coalescing of the + * node with a possible previous text one which + * would make ent->children a dangling pointer + */ + nbktext = xmlDictLookup(ctxt->dict, BAD_CAST "nbktext", + -1); + if (ent->children->type == XML_TEXT_NODE) + ent->children->name = nbktext; + if ((ent->last != ent->children) && + (ent->last->type == XML_TEXT_NODE)) + ent->last->name = nbktext; + xmlAddChildList(ctxt->node, ent->children); } - } else { - val = ent->content; - if (val == NULL) return; + /* - * inline the entity. + * This is to avoid a nasty side effect, see + * characters() in SAX.c */ - if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL) && - (!ctxt->disableSAX)) - ctxt->sax->characters(ctxt->userData, val, xmlStrlen(val)); + ctxt->nodemem = 0; + ctxt->nodelen = 0; + return; } } } @@ -6574,132 +7022,140 @@ xmlParseEntityRef(xmlParserCtxtPtr ctxt) { xmlEntityPtr ent = NULL; GROW; - - if (RAW == '&') { - NEXT; - name = xmlParseName(ctxt); - if (name == NULL) { - xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, - "xmlParseEntityRef: no name\n"); - } else { - if (RAW == ';') { - NEXT; - /* - * Ask first SAX for entity resolution, otherwise try the - * predefined set. - */ - if (ctxt->sax != NULL) { - if (ctxt->sax->getEntity != NULL) - ent = ctxt->sax->getEntity(ctxt->userData, name); - if ((ctxt->wellFormed == 1 ) && (ent == NULL)) - ent = xmlGetPredefinedEntity(name); - if ((ctxt->wellFormed == 1 ) && (ent == NULL) && - (ctxt->userData==ctxt)) { - ent = xmlSAX2GetEntity(ctxt, name); - } - } - /* - * [ WFC: Entity Declared ] - * In a document without any DTD, a document with only an - * internal DTD subset which contains no parameter entity - * references, or a document with "standalone='yes'", the - * Name given in the entity reference must match that in an - * entity declaration, except that well-formed documents - * need not declare any of the following entities: amp, lt, - * gt, apos, quot. - * The declaration of a parameter entity must precede any - * reference to it. - * Similarly, the declaration of a general entity must - * precede any reference to it which appears in a default - * value in an attribute-list declaration. Note that if - * entities are declared in the external subset or in - * external parameter entities, a non-validating processor - * is not obligated to read and process their declarations; - * for such documents, the rule that an entity must be - * declared is a well-formedness constraint only if - * standalone='yes'. - */ - if (ent == NULL) { - if ((ctxt->standalone == 1) || - ((ctxt->hasExternalSubset == 0) && - (ctxt->hasPErefs == 0))) { - xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY, - "Entity '%s' not defined\n", name); - } else { - xmlErrMsgStr(ctxt, XML_WAR_UNDECLARED_ENTITY, - "Entity '%s' not defined\n", name); - if ((ctxt->inSubset == 0) && - (ctxt->sax != NULL) && - (ctxt->sax->reference != NULL)) { - ctxt->sax->reference(ctxt->userData, name); - } - } - ctxt->valid = 0; - } - /* - * [ WFC: Parsed Entity ] - * An entity reference must not contain the name of an - * unparsed entity - */ - else if (ent->etype == XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) { - xmlFatalErrMsgStr(ctxt, XML_ERR_UNPARSED_ENTITY, - "Entity reference to unparsed entity %s\n", name); - } - - /* - * [ WFC: No External Entity References ] - * Attribute values cannot contain direct or indirect - * entity references to external entities. - */ - else if ((ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE) && - (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY)) { - xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_IS_EXTERNAL, - "Attribute references external entity '%s'\n", name); - } - /* - * [ WFC: No < in Attribute Values ] - * The replacement text of any entity referred to directly or - * indirectly in an attribute value (other than "<") must - * not contain a <. - */ - else if ((ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE) && - (ent != NULL) && - (!xmlStrEqual(ent->name, BAD_CAST "lt")) && - (ent->content != NULL) && - (xmlStrchr(ent->content, '<'))) { - xmlFatalErrMsgStr(ctxt, XML_ERR_LT_IN_ATTRIBUTE, - "'<' in entity '%s' is not allowed in attributes values\n", name); - } + if (RAW != '&') + return(NULL); + NEXT; + name = xmlParseName(ctxt); + if (name == NULL) { + xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, + "xmlParseEntityRef: no name\n"); + return(NULL); + } + if (RAW != ';') { + xmlFatalErr(ctxt, XML_ERR_ENTITYREF_SEMICOL_MISSING, NULL); + return(NULL); + } + NEXT; - /* - * Internal check, no parameter entities here ... - */ - else { - switch (ent->etype) { - case XML_INTERNAL_PARAMETER_ENTITY: - case XML_EXTERNAL_PARAMETER_ENTITY: - xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_IS_PARAMETER, - "Attempt to reference the parameter entity '%s'\n", - name); - break; - default: - break; - } - } + /* + * Predefined entites override any extra definition + */ + ent = xmlGetPredefinedEntity(name); + if (ent != NULL) + return(ent); - /* - * [ WFC: No Recursion ] - * A parsed entity must not contain a recursive reference - * to itself, either directly or indirectly. - * Done somewhere else - */ + /* + * Increate the number of entity references parsed + */ + ctxt->nbentities++; - } else { - xmlFatalErr(ctxt, XML_ERR_ENTITYREF_SEMICOL_MISSING, NULL); + /* + * Ask first SAX for entity resolution, otherwise try the + * entities which may have stored in the parser context. + */ + if (ctxt->sax != NULL) { + if (ctxt->sax->getEntity != NULL) + ent = ctxt->sax->getEntity(ctxt->userData, name); + if ((ctxt->wellFormed == 1 ) && (ent == NULL) && + (ctxt->userData==ctxt)) { + ent = xmlSAX2GetEntity(ctxt, name); + } + } + /* + * [ WFC: Entity Declared ] + * In a document without any DTD, a document with only an + * internal DTD subset which contains no parameter entity + * references, or a document with "standalone='yes'", the + * Name given in the entity reference must match that in an + * entity declaration, except that well-formed documents + * need not declare any of the following entities: amp, lt, + * gt, apos, quot. + * The declaration of a parameter entity must precede any + * reference to it. + * Similarly, the declaration of a general entity must + * precede any reference to it which appears in a default + * value in an attribute-list declaration. Note that if + * entities are declared in the external subset or in + * external parameter entities, a non-validating processor + * is not obligated to read and process their declarations; + * for such documents, the rule that an entity must be + * declared is a well-formedness constraint only if + * standalone='yes'. + */ + if (ent == NULL) { + if ((ctxt->standalone == 1) || + ((ctxt->hasExternalSubset == 0) && + (ctxt->hasPErefs == 0))) { + xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY, + "Entity '%s' not defined\n", name); + } else { + xmlErrMsgStr(ctxt, XML_WAR_UNDECLARED_ENTITY, + "Entity '%s' not defined\n", name); + if ((ctxt->inSubset == 0) && + (ctxt->sax != NULL) && + (ctxt->sax->reference != NULL)) { + ctxt->sax->reference(ctxt->userData, name); } } + ctxt->valid = 0; + } + + /* + * [ WFC: Parsed Entity ] + * An entity reference must not contain the name of an + * unparsed entity + */ + else if (ent->etype == XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) { + xmlFatalErrMsgStr(ctxt, XML_ERR_UNPARSED_ENTITY, + "Entity reference to unparsed entity %s\n", name); } + + /* + * [ WFC: No External Entity References ] + * Attribute values cannot contain direct or indirect + * entity references to external entities. + */ + else if ((ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE) && + (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY)) { + xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_IS_EXTERNAL, + "Attribute references external entity '%s'\n", name); + } + /* + * [ WFC: No < in Attribute Values ] + * The replacement text of any entity referred to directly or + * indirectly in an attribute value (other than "<") must + * not contain a <. + */ + else if ((ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE) && + (ent != NULL) && (ent->content != NULL) && + (xmlStrchr(ent->content, '<'))) { + xmlFatalErrMsgStr(ctxt, XML_ERR_LT_IN_ATTRIBUTE, + "'<' in entity '%s' is not allowed in attributes values\n", name); + } + + /* + * Internal check, no parameter entities here ... + */ + else { + switch (ent->etype) { + case XML_INTERNAL_PARAMETER_ENTITY: + case XML_EXTERNAL_PARAMETER_ENTITY: + xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_IS_PARAMETER, + "Attempt to reference the parameter entity '%s'\n", + name); + break; + default: + break; + } + } + + /* + * [ WFC: No Recursion ] + * A parsed entity must not contain a recursive reference + * to itself, either directly or indirectly. + * Done somewhere else + */ return(ent); } @@ -6745,129 +7201,143 @@ xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, const xmlChar ** str) { return(NULL); ptr = *str; cur = *ptr; - if (cur == '&') { - ptr++; - cur = *ptr; - name = xmlParseStringName(ctxt, &ptr); - if (name == NULL) { - xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, - "xmlParseStringEntityRef: no name\n"); - } else { - if (*ptr == ';') { - ptr++; - /* - * Ask first SAX for entity resolution, otherwise try the - * predefined set. - */ - if (ctxt->sax != NULL) { - if (ctxt->sax->getEntity != NULL) - ent = ctxt->sax->getEntity(ctxt->userData, name); - if (ent == NULL) - ent = xmlGetPredefinedEntity(name); - if ((ent == NULL) && (ctxt->userData==ctxt)) { - ent = xmlSAX2GetEntity(ctxt, name); - } - } - /* - * [ WFC: Entity Declared ] - * In a document without any DTD, a document with only an - * internal DTD subset which contains no parameter entity - * references, or a document with "standalone='yes'", the - * Name given in the entity reference must match that in an - * entity declaration, except that well-formed documents - * need not declare any of the following entities: amp, lt, - * gt, apos, quot. - * The declaration of a parameter entity must precede any - * reference to it. - * Similarly, the declaration of a general entity must - * precede any reference to it which appears in a default - * value in an attribute-list declaration. Note that if - * entities are declared in the external subset or in - * external parameter entities, a non-validating processor - * is not obligated to read and process their declarations; - * for such documents, the rule that an entity must be - * declared is a well-formedness constraint only if - * standalone='yes'. - */ - if (ent == NULL) { - if ((ctxt->standalone == 1) || - ((ctxt->hasExternalSubset == 0) && - (ctxt->hasPErefs == 0))) { - xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY, - "Entity '%s' not defined\n", name); - } else { - xmlErrMsgStr(ctxt, XML_WAR_UNDECLARED_ENTITY, - "Entity '%s' not defined\n", - name); - } - /* TODO ? check regressions ctxt->valid = 0; */ - } + if (cur != '&') + return(NULL); - /* - * [ WFC: Parsed Entity ] - * An entity reference must not contain the name of an - * unparsed entity - */ - else if (ent->etype == XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) { - xmlFatalErrMsgStr(ctxt, XML_ERR_UNPARSED_ENTITY, - "Entity reference to unparsed entity %s\n", name); - } + ptr++; + cur = *ptr; + name = xmlParseStringName(ctxt, &ptr); + if (name == NULL) { + xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, + "xmlParseStringEntityRef: no name\n"); + *str = ptr; + return(NULL); + } + if (*ptr != ';') { + xmlFatalErr(ctxt, XML_ERR_ENTITYREF_SEMICOL_MISSING, NULL); + *str = ptr; + return(NULL); + } + ptr++; - /* - * [ WFC: No External Entity References ] - * Attribute values cannot contain direct or indirect - * entity references to external entities. - */ - else if ((ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE) && - (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY)) { - xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_IS_EXTERNAL, - "Attribute references external entity '%s'\n", name); - } - /* - * [ WFC: No < in Attribute Values ] - * The replacement text of any entity referred to directly or - * indirectly in an attribute value (other than "<") must - * not contain a <. - */ - else if ((ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE) && - (ent != NULL) && - (!xmlStrEqual(ent->name, BAD_CAST "lt")) && - (ent->content != NULL) && - (xmlStrchr(ent->content, '<'))) { - xmlFatalErrMsgStr(ctxt, XML_ERR_LT_IN_ATTRIBUTE, - "'<' in entity '%s' is not allowed in attributes values\n", - name); - } - /* - * Internal check, no parameter entities here ... - */ - else { - switch (ent->etype) { - case XML_INTERNAL_PARAMETER_ENTITY: - case XML_EXTERNAL_PARAMETER_ENTITY: - xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_IS_PARAMETER, - "Attempt to reference the parameter entity '%s'\n", - name); - break; - default: - break; - } - } + /* + * Predefined entites override any extra definition + */ + ent = xmlGetPredefinedEntity(name); + if (ent != NULL) + return(ent); - /* - * [ WFC: No Recursion ] - * A parsed entity must not contain a recursive reference - * to itself, either directly or indirectly. - * Done somewhere else - */ + /* + * Increate the number of entity references parsed + */ + ctxt->nbentities++; - } else { - xmlFatalErr(ctxt, XML_ERR_ENTITYREF_SEMICOL_MISSING, NULL); - } - xmlFree(name); + /* + * Ask first SAX for entity resolution, otherwise try the + * entities which may have stored in the parser context. + */ + if (ctxt->sax != NULL) { + if (ctxt->sax->getEntity != NULL) + ent = ctxt->sax->getEntity(ctxt->userData, name); + if ((ent == NULL) && (ctxt->userData==ctxt)) { + ent = xmlSAX2GetEntity(ctxt, name); } } + + /* + * [ WFC: Entity Declared ] + * In a document without any DTD, a document with only an + * internal DTD subset which contains no parameter entity + * references, or a document with "standalone='yes'", the + * Name given in the entity reference must match that in an + * entity declaration, except that well-formed documents + * need not declare any of the following entities: amp, lt, + * gt, apos, quot. + * The declaration of a parameter entity must precede any + * reference to it. + * Similarly, the declaration of a general entity must + * precede any reference to it which appears in a default + * value in an attribute-list declaration. Note that if + * entities are declared in the external subset or in + * external parameter entities, a non-validating processor + * is not obligated to read and process their declarations; + * for such documents, the rule that an entity must be + * declared is a well-formedness constraint only if + * standalone='yes'. + */ + if (ent == NULL) { + if ((ctxt->standalone == 1) || + ((ctxt->hasExternalSubset == 0) && + (ctxt->hasPErefs == 0))) { + xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY, + "Entity '%s' not defined\n", name); + } else { + xmlErrMsgStr(ctxt, XML_WAR_UNDECLARED_ENTITY, + "Entity '%s' not defined\n", + name); + } + /* TODO ? check regressions ctxt->valid = 0; */ + } + + /* + * [ WFC: Parsed Entity ] + * An entity reference must not contain the name of an + * unparsed entity + */ + else if (ent->etype == XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) { + xmlFatalErrMsgStr(ctxt, XML_ERR_UNPARSED_ENTITY, + "Entity reference to unparsed entity %s\n", name); + } + + /* + * [ WFC: No External Entity References ] + * Attribute values cannot contain direct or indirect + * entity references to external entities. + */ + else if ((ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE) && + (ent->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY)) { + xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_IS_EXTERNAL, + "Attribute references external entity '%s'\n", name); + } + /* + * [ WFC: No < in Attribute Values ] + * The replacement text of any entity referred to directly or + * indirectly in an attribute value (other than "<") must + * not contain a <. + */ + else if ((ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE) && + (ent != NULL) && (ent->content != NULL) && + (xmlStrchr(ent->content, '<'))) { + xmlFatalErrMsgStr(ctxt, XML_ERR_LT_IN_ATTRIBUTE, + "'<' in entity '%s' is not allowed in attributes values\n", + name); + } + + /* + * Internal check, no parameter entities here ... + */ + else { + switch (ent->etype) { + case XML_INTERNAL_PARAMETER_ENTITY: + case XML_EXTERNAL_PARAMETER_ENTITY: + xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_IS_PARAMETER, + "Attempt to reference the parameter entity '%s'\n", + name); + break; + default: + break; + } + } + + /* + * [ WFC: No Recursion ] + * A parsed entity must not contain a recursive reference + * to itself, either directly or indirectly. + * Done somewhere else + */ + + xmlFree(name); *str = ptr; return(ent); } @@ -6908,90 +7378,101 @@ xmlParsePEReference(xmlParserCtxtPtr ctxt) xmlEntityPtr entity = NULL; xmlParserInputPtr input; - if (RAW == '%') { - NEXT; - name = xmlParseName(ctxt); - if (name == NULL) { - xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, - "xmlParsePEReference: no name\n"); - } else { - if (RAW == ';') { - NEXT; - if ((ctxt->sax != NULL) && - (ctxt->sax->getParameterEntity != NULL)) - entity = ctxt->sax->getParameterEntity(ctxt->userData, - name); - if (entity == NULL) { - /* - * [ WFC: Entity Declared ] - * In a document without any DTD, a document with only an - * internal DTD subset which contains no parameter entity - * references, or a document with "standalone='yes'", ... - * ... The declaration of a parameter entity must precede - * any reference to it... - */ - if ((ctxt->standalone == 1) || - ((ctxt->hasExternalSubset == 0) && - (ctxt->hasPErefs == 0))) { - xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY, - "PEReference: %%%s; not found\n", - name); - } else { - /* - * [ VC: Entity Declared ] - * In a document with an external subset or external - * parameter entities with "standalone='no'", ... - * ... The declaration of a parameter entity must - * precede any reference to it... - */ - xmlWarningMsg(ctxt, XML_WAR_UNDECLARED_ENTITY, - "PEReference: %%%s; not found\n", - name, NULL); - ctxt->valid = 0; - } - } else { - /* - * Internal checking in case the entity quest barfed - */ - if ((entity->etype != XML_INTERNAL_PARAMETER_ENTITY) && - (entity->etype != XML_EXTERNAL_PARAMETER_ENTITY)) { - xmlWarningMsg(ctxt, XML_WAR_UNDECLARED_ENTITY, - "Internal: %%%s; is not a parameter entity\n", - name, NULL); - } else if (ctxt->input->free != deallocblankswrapper) { - input = - xmlNewBlanksWrapperInputStream(ctxt, entity); - xmlPushInput(ctxt, input); - } else { - /* - * TODO !!! - * handle the extra spaces added before and after - * c.f. http://www.w3.org/TR/REC-xml#as-PE - */ - input = xmlNewEntityInputStream(ctxt, entity); - xmlPushInput(ctxt, input); - if ((entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) && - (CMP5(CUR_PTR, '<', '?', 'x', 'm', 'l')) && - (IS_BLANK_CH(NXT(5)))) { - xmlParseTextDecl(ctxt); - if (ctxt->errNo == - XML_ERR_UNSUPPORTED_ENCODING) { - /* - * The XML REC instructs us to stop parsing - * right here - */ - ctxt->instate = XML_PARSER_EOF; - return; - } - } - } - } - ctxt->hasPErefs = 1; - } else { - xmlFatalErr(ctxt, XML_ERR_ENTITYREF_SEMICOL_MISSING, NULL); - } - } + if (RAW != '%') + return; + NEXT; + name = xmlParseName(ctxt); + if (name == NULL) { + xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, + "xmlParsePEReference: no name\n"); + return; + } + if (RAW != ';') { + xmlFatalErr(ctxt, XML_ERR_ENTITYREF_SEMICOL_MISSING, NULL); + return; + } + + NEXT; + + /* + * Increate the number of entity references parsed + */ + ctxt->nbentities++; + + /* + * Request the entity from SAX + */ + if ((ctxt->sax != NULL) && + (ctxt->sax->getParameterEntity != NULL)) + entity = ctxt->sax->getParameterEntity(ctxt->userData, + name); + if (entity == NULL) { + /* + * [ WFC: Entity Declared ] + * In a document without any DTD, a document with only an + * internal DTD subset which contains no parameter entity + * references, or a document with "standalone='yes'", ... + * ... The declaration of a parameter entity must precede + * any reference to it... + */ + if ((ctxt->standalone == 1) || + ((ctxt->hasExternalSubset == 0) && + (ctxt->hasPErefs == 0))) { + xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY, + "PEReference: %%%s; not found\n", + name); + } else { + /* + * [ VC: Entity Declared ] + * In a document with an external subset or external + * parameter entities with "standalone='no'", ... + * ... The declaration of a parameter entity must + * precede any reference to it... + */ + xmlWarningMsg(ctxt, XML_WAR_UNDECLARED_ENTITY, + "PEReference: %%%s; not found\n", + name, NULL); + ctxt->valid = 0; + } + } else { + /* + * Internal checking in case the entity quest barfed + */ + if ((entity->etype != XML_INTERNAL_PARAMETER_ENTITY) && + (entity->etype != XML_EXTERNAL_PARAMETER_ENTITY)) { + xmlWarningMsg(ctxt, XML_WAR_UNDECLARED_ENTITY, + "Internal: %%%s; is not a parameter entity\n", + name, NULL); + } else if (ctxt->input->free != deallocblankswrapper) { + input = xmlNewBlanksWrapperInputStream(ctxt, entity); + if (xmlPushInput(ctxt, input) < 0) + return; + } else { + /* + * TODO !!! + * handle the extra spaces added before and after + * c.f. http://www.w3.org/TR/REC-xml#as-PE + */ + input = xmlNewEntityInputStream(ctxt, entity); + if (xmlPushInput(ctxt, input) < 0) + return; + if ((entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) && + (CMP5(CUR_PTR, '<', '?', 'x', 'm', 'l')) && + (IS_BLANK_CH(NXT(5)))) { + xmlParseTextDecl(ctxt); + if (ctxt->errNo == + XML_ERR_UNSUPPORTED_ENCODING) { + /* + * The XML REC instructs us to stop parsing + * right here + */ + ctxt->instate = XML_PARSER_EOF; + return; + } + } + } } + ctxt->hasPErefs = 1; } /** @@ -7044,7 +7525,11 @@ xmlLoadEntityContent(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) { * Push the entity as the current input, read char by char * saving to the buffer until the end of the entity or an error */ - xmlPushInput(ctxt, input); + if (xmlPushInput(ctxt, input) < 0) { + xmlBufferFree(buf); + return(-1); + } + GROW; c = CUR_CHAR(l); while ((ctxt->input == input) && (ctxt->input->cur < ctxt->input->end) && @@ -7115,67 +7600,77 @@ xmlParseStringPEReference(xmlParserCtxtPtr ctxt, const xmlChar **str) { if ((str == NULL) || (*str == NULL)) return(NULL); ptr = *str; cur = *ptr; - if (cur == '%') { - ptr++; - cur = *ptr; - name = xmlParseStringName(ctxt, &ptr); - if (name == NULL) { - xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, - "xmlParseStringPEReference: no name\n"); - } else { - cur = *ptr; - if (cur == ';') { - ptr++; - cur = *ptr; - if ((ctxt->sax != NULL) && - (ctxt->sax->getParameterEntity != NULL)) - entity = ctxt->sax->getParameterEntity(ctxt->userData, - name); - if (entity == NULL) { - /* - * [ WFC: Entity Declared ] - * In a document without any DTD, a document with only an - * internal DTD subset which contains no parameter entity - * references, or a document with "standalone='yes'", ... - * ... The declaration of a parameter entity must precede - * any reference to it... - */ - if ((ctxt->standalone == 1) || - ((ctxt->hasExternalSubset == 0) && - (ctxt->hasPErefs == 0))) { - xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY, - "PEReference: %%%s; not found\n", name); - } else { - /* - * [ VC: Entity Declared ] - * In a document with an external subset or external - * parameter entities with "standalone='no'", ... - * ... The declaration of a parameter entity must - * precede any reference to it... - */ - xmlWarningMsg(ctxt, XML_WAR_UNDECLARED_ENTITY, - "PEReference: %%%s; not found\n", - name, NULL); - ctxt->valid = 0; - } - } else { - /* - * Internal checking in case the entity quest barfed - */ - if ((entity->etype != XML_INTERNAL_PARAMETER_ENTITY) && - (entity->etype != XML_EXTERNAL_PARAMETER_ENTITY)) { - xmlWarningMsg(ctxt, XML_WAR_UNDECLARED_ENTITY, - "%%%s; is not a parameter entity\n", - name, NULL); - } - } - ctxt->hasPErefs = 1; - } else { - xmlFatalErr(ctxt, XML_ERR_ENTITYREF_SEMICOL_MISSING, NULL); - } - xmlFree(name); + if (cur != '%') + return(NULL); + ptr++; + cur = *ptr; + name = xmlParseStringName(ctxt, &ptr); + if (name == NULL) { + xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, + "xmlParseStringPEReference: no name\n"); + *str = ptr; + return(NULL); + } + cur = *ptr; + if (cur != ';') { + xmlFatalErr(ctxt, XML_ERR_ENTITYREF_SEMICOL_MISSING, NULL); + xmlFree(name); + *str = ptr; + return(NULL); + } + ptr++; + + /* + * Increate the number of entity references parsed + */ + ctxt->nbentities++; + + /* + * Request the entity from SAX + */ + if ((ctxt->sax != NULL) && + (ctxt->sax->getParameterEntity != NULL)) + entity = ctxt->sax->getParameterEntity(ctxt->userData, + name); + if (entity == NULL) { + /* + * [ WFC: Entity Declared ] + * In a document without any DTD, a document with only an + * internal DTD subset which contains no parameter entity + * references, or a document with "standalone='yes'", ... + * ... The declaration of a parameter entity must precede + * any reference to it... + */ + if ((ctxt->standalone == 1) || + ((ctxt->hasExternalSubset == 0) && (ctxt->hasPErefs == 0))) { + xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY, + "PEReference: %%%s; not found\n", name); + } else { + /* + * [ VC: Entity Declared ] + * In a document with an external subset or external + * parameter entities with "standalone='no'", ... + * ... The declaration of a parameter entity must + * precede any reference to it... + */ + xmlWarningMsg(ctxt, XML_WAR_UNDECLARED_ENTITY, + "PEReference: %%%s; not found\n", + name, NULL); + ctxt->valid = 0; + } + } else { + /* + * Internal checking in case the entity quest barfed + */ + if ((entity->etype != XML_INTERNAL_PARAMETER_ENTITY) && + (entity->etype != XML_EXTERNAL_PARAMETER_ENTITY)) { + xmlWarningMsg(ctxt, XML_WAR_UNDECLARED_ENTITY, + "%%%s; is not a parameter entity\n", + name, NULL); } } + ctxt->hasPErefs = 1; + xmlFree(name); *str = ptr; return(entity); } @@ -7652,38 +8147,6 @@ xmlParseEndTag(xmlParserCtxtPtr ctxt) { * * ************************************************************************/ -static const xmlChar * -xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) { - int len = 0, l; - int c; - int count = 0; - - /* - * Handler for more complex cases - */ - GROW; - c = CUR_CHAR(l); - if ((c == ' ') || (c == '>') || (c == '/') || /* accelerators */ - (!IS_LETTER(c) && (c != '_'))) { - return(NULL); - } - - while ((c != ' ') && (c != '>') && (c != '/') && /* test bigname.xml */ - ((IS_LETTER(c)) || (IS_DIGIT(c)) || - (c == '.') || (c == '-') || (c == '_') || - (IS_COMBINING(c)) || - (IS_EXTENDER(c)))) { - if (count++ > 100) { - count = 0; - GROW; - } - len += l; - NEXTL(l); - c = CUR_CHAR(l); - } - return(xmlDictLookup(ctxt->dict, ctxt->input->cur - len, len)); -} - /* * xmlGetNamespace: * @ctxt: an XML parser context @@ -7708,56 +8171,6 @@ xmlGetNamespace(xmlParserCtxtPtr ctxt, const xmlChar *prefix) { return(NULL); } -/** - * xmlParseNCName: - * @ctxt: an XML parser context - * @len: lenght of the string parsed - * - * parse an XML name. - * - * [4NS] NCNameChar ::= Letter | Digit | '.' | '-' | '_' | - * CombiningChar | Extender - * - * [5NS] NCName ::= (Letter | '_') (NCNameChar)* - * - * Returns the Name parsed or NULL - */ - -static const xmlChar * -xmlParseNCName(xmlParserCtxtPtr ctxt) { - const xmlChar *in; - const xmlChar *ret; - int count = 0; - - /* - * Accelerator for simple ASCII names - */ - in = ctxt->input->cur; - if (((*in >= 0x61) && (*in <= 0x7A)) || - ((*in >= 0x41) && (*in <= 0x5A)) || - (*in == '_')) { - in++; - while (((*in >= 0x61) && (*in <= 0x7A)) || - ((*in >= 0x41) && (*in <= 0x5A)) || - ((*in >= 0x30) && (*in <= 0x39)) || - (*in == '_') || (*in == '-') || - (*in == '.')) - in++; - if ((*in > 0) && (*in < 0x80)) { - count = in - ctxt->input->cur; - ret = xmlDictLookup(ctxt->dict, ctxt->input->cur, count); - ctxt->input->cur = in; - ctxt->nbChars += count; - ctxt->input->col += count; - if (ret == NULL) { - xmlErrMemory(ctxt, NULL); - } - return(ret); - } - } - return(xmlParseNCNameComplex(ctxt)); -} - /** * xmlParseQName: * @ctxt: an XML parser context @@ -7800,7 +8213,13 @@ xmlParseQName(xmlParserCtxtPtr ctxt, const xmlChar **prefix) { xmlNsErr(ctxt, XML_NS_ERR_QNAME, "Failed to parse QName '%s:'\n", p, NULL, NULL); - tmp = xmlBuildQName(BAD_CAST "", p, NULL, 0); + l = xmlParseNmtoken(ctxt); + if (l == NULL) + tmp = xmlBuildQName(BAD_CAST "", p, NULL, 0); + else { + tmp = xmlBuildQName(l, p, NULL, 0); + xmlFree((char *)l); + } p = xmlDictLookup(ctxt->dict, tmp, -1); if (tmp != NULL) xmlFree(tmp); *prefix = NULL; @@ -8108,7 +8527,7 @@ xmlParseAttribute2(xmlParserCtxtPtr ctxt, const xmlChar *val2; val2 = xmlAttrNormalizeSpace2(ctxt, val, len); - if (val2 != NULL) { + if ((val2 != NULL) && (val2 != val)) { xmlFree(val); val = (xmlChar *) val2; } @@ -8271,17 +8690,33 @@ reparse: if (*URL != 0) { uri = xmlParseURI((const char *) URL); if (uri == NULL) { - xmlWarningMsg(ctxt, XML_WAR_NS_URI, - "xmlns: %s not a valid URI\n", - URL, NULL); + xmlNsErr(ctxt, XML_WAR_NS_URI, + "xmlns: '%s' is not a valid URI\n", + URL, NULL, NULL); } else { - if (uri->scheme == NULL) { - xmlWarningMsg(ctxt, XML_WAR_NS_URI_RELATIVE, - "xmlns: URI %s is not absolute\n", - URL, NULL); + if ((ctxt->pedantic) && (uri->scheme == NULL)) { + xmlNsWarn(ctxt, XML_WAR_NS_URI_RELATIVE, + "xmlns: URI %s is not absolute\n", + URL, NULL, NULL); } xmlFreeURI(uri); } + if (URL == ctxt->str_xml_ns) { + if (attname != ctxt->str_xml) { + xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE, + "xml namespace URI cannot be the default namespace\n", + NULL, NULL, NULL); + } + goto skip_default_ns; + } + if ((len == 29) && + (xmlStrEqual(URL, + BAD_CAST "http://www.w3.org/2000/xmlns/"))) { + xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE, + "reuse of the xmlns namespace name is forbidden\n", + NULL, NULL, NULL); + goto skip_default_ns; + } } /* * check that it's not a defined namespace @@ -8293,6 +8728,7 @@ reparse: xmlErrAttributeDup(ctxt, NULL, attname); else if (nsPush(ctxt, NULL, URL) > 0) nbNs++; +skip_default_ns: if (alloc != 0) xmlFree(attvalue); SKIP_BLANKS; continue; @@ -8310,22 +8746,49 @@ reparse: /* * Do not keep a namespace definition node */ - if (alloc != 0) xmlFree(attvalue); - SKIP_BLANKS; - continue; + goto skip_ns; + } + if (URL == ctxt->str_xml_ns) { + if (attname != ctxt->str_xml) { + xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE, + "xml namespace URI mapped to wrong prefix\n", + NULL, NULL, NULL); + } + goto skip_ns; + } + if (attname == ctxt->str_xmlns) { + xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE, + "redefinition of the xmlns prefix is forbidden\n", + NULL, NULL, NULL); + goto skip_ns; } - uri = xmlParseURI((const char *) URL); - if (uri == NULL) { - xmlWarningMsg(ctxt, XML_WAR_NS_URI, - "xmlns:%s: '%s' is not a valid URI\n", - attname, URL); + if ((len == 29) && + (xmlStrEqual(URL, + BAD_CAST "http://www.w3.org/2000/xmlns/"))) { + xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE, + "reuse of the xmlns namespace name is forbidden\n", + NULL, NULL, NULL); + goto skip_ns; + } + if ((URL == NULL) || (URL[0] == 0)) { + xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE, + "xmlns:%s: Empty XML namespace is not allowed\n", + attname, NULL, NULL); + goto skip_ns; } else { - if ((ctxt->pedantic) && (uri->scheme == NULL)) { - xmlWarningMsg(ctxt, XML_WAR_NS_URI_RELATIVE, + uri = xmlParseURI((const char *) URL); + if (uri == NULL) { + xmlNsErr(ctxt, XML_WAR_NS_URI, + "xmlns:%s: '%s' is not a valid URI\n", + attname, URL, NULL); + } else { + if ((ctxt->pedantic) && (uri->scheme == NULL)) { + xmlNsWarn(ctxt, XML_WAR_NS_URI_RELATIVE, "xmlns:%s: URI %s is not absolute\n", - attname, URL); + attname, URL, NULL); + } + xmlFreeURI(uri); } - xmlFreeURI(uri); } /* @@ -8338,6 +8801,7 @@ reparse: xmlErrAttributeDup(ctxt, aprefix, attname); else if (nsPush(ctxt, attname, URL) > 0) nbNs++; +skip_ns: if (alloc != 0) xmlFree(attvalue); SKIP_BLANKS; if (ctxt->input->base != base) goto base_changed; @@ -8372,7 +8836,7 @@ reparse: xmlFree(attvalue); } -failed: +failed: GROW if (ctxt->input->base != base) goto base_changed; @@ -8403,8 +8867,8 @@ failed: defaults = xmlHashLookup2(ctxt->attsDefault, localname, prefix); if (defaults != NULL) { for (i = 0;i < defaults->nbAttrs;i++) { - attname = defaults->values[4 * i]; - aprefix = defaults->values[4 * i + 1]; + attname = defaults->values[5 * i]; + aprefix = defaults->values[5 * i + 1]; /* * special work for namespaces defaulted defs @@ -8419,9 +8883,9 @@ failed: if (j <= nbNs) continue; nsname = xmlGetNamespace(ctxt, NULL); - if (nsname != defaults->values[4 * i + 2]) { + if (nsname != defaults->values[5 * i + 2]) { if (nsPush(ctxt, NULL, - defaults->values[4 * i + 2]) > 0) + defaults->values[5 * i + 2]) > 0) nbNs++; } } else if (aprefix == ctxt->str_xmlns) { @@ -8436,7 +8900,7 @@ failed: nsname = xmlGetNamespace(ctxt, attname); if (nsname != defaults->values[2]) { if (nsPush(ctxt, attname, - defaults->values[4 * i + 2]) > 0) + defaults->values[5 * i + 2]) > 0) nbNs++; } } else { @@ -8462,8 +8926,14 @@ failed: atts[nbatts++] = NULL; else atts[nbatts++] = xmlGetNamespace(ctxt, aprefix); - atts[nbatts++] = defaults->values[4 * i + 2]; - atts[nbatts++] = defaults->values[4 * i + 3]; + atts[nbatts++] = defaults->values[5 * i + 2]; + atts[nbatts++] = defaults->values[5 * i + 3]; + if ((ctxt->standalone == 1) && + (defaults->values[5 * i + 4] != NULL)) { + xmlValidityError(ctxt, XML_DTD_STANDALONE_DEFAULTED, + "standalone: attribute %s on %s defaulted from external subset\n", + attname, localname); + } nbdef++; } } @@ -8846,10 +9316,11 @@ xmlParseElement(xmlParserCtxtPtr ctxt) { xmlNodePtr ret; int nsNr = ctxt->nsNr; - if ((unsigned int) ctxt->nameNr > xmlParserMaxDepth) { - xmlFatalErrMsgInt(ctxt, XML_ERR_INTERNAL_ERROR, - "Excessive depth in document: change xmlParserMaxDepth = %d\n", - xmlParserMaxDepth); + if (((unsigned int) ctxt->nameNr > xmlParserMaxDepth) && + ((ctxt->options & XML_PARSE_HUGE) == 0)) { + xmlFatalErrMsgInt(ctxt, XML_ERR_INTERNAL_ERROR, + "Excessive depth in document: %d use XML_PARSE_HUGE option\n", + xmlParserMaxDepth); ctxt->instate = XML_PARSER_EOF; return; } @@ -9003,7 +9474,9 @@ xmlParseElement(xmlParserCtxtPtr ctxt) { * * parse the XML version value. * - * [26] VersionNum ::= ([a-zA-Z0-9_.:] | '-')+ + * [26] VersionNum ::= '1.' [0-9]+ + * + * In practice allow [0-9].[0-9]+ at that level * * Returns the string giving the XML version number, or NULL */ @@ -9020,11 +9493,21 @@ xmlParseVersionNum(xmlParserCtxtPtr ctxt) { return(NULL); } cur = CUR; - while (((cur >= 'a') && (cur <= 'z')) || - ((cur >= 'A') && (cur <= 'Z')) || - ((cur >= '0') && (cur <= '9')) || - (cur == '_') || (cur == '.') || - (cur == ':') || (cur == '-')) { + if (!((cur >= '0') && (cur <= '9'))) { + xmlFree(buf); + return(NULL); + } + buf[len++] = cur; + NEXT; + cur=CUR; + if (cur != '.') { + xmlFree(buf); + return(NULL); + } + buf[len++] = cur; + NEXT; + cur=CUR; + while ((cur >= '0') && (cur <= '9')) { if (len + 1 >= size) { xmlChar *tmp; @@ -9117,7 +9600,7 @@ xmlParseEncName(xmlParserCtxtPtr ctxt) { xmlErrMemory(ctxt, NULL); return(NULL); } - + buf[len++] = cur; NEXT; cur = CUR; @@ -9205,6 +9688,18 @@ xmlParseEncodingDecl(xmlParserCtxtPtr ctxt) { if ((encoding != NULL) && ((!xmlStrcasecmp(encoding, BAD_CAST "UTF-16")) || (!xmlStrcasecmp(encoding, BAD_CAST "UTF16")))) { + /* + * If no encoding was passed to the parser, that we are + * using UTF-16 and no decoder is present i.e. the + * document is apparently UTF-8 compatible, then raise an + * encoding mismatch fatal error + */ + if ((ctxt->encoding == NULL) && + (ctxt->input->buf != NULL) && + (ctxt->input->buf->encoder == NULL)) { + xmlFatalErrMsg(ctxt, XML_ERR_INVALID_ENCODING, + "Document labelled UTF-16 but has UTF-8 content\n"); + } if (ctxt->encoding != NULL) xmlFree((xmlChar *) ctxt->encoding); ctxt->encoding = encoding; @@ -9363,11 +9858,23 @@ xmlParseXMLDecl(xmlParserCtxtPtr ctxt) { } else { if (!xmlStrEqual(version, (const xmlChar *) XML_DEFAULT_VERSION)) { /* - * TODO: Blueberry should be detected here + * Changed here for XML-1.0 5th edition */ - xmlWarningMsg(ctxt, XML_WAR_UNKNOWN_VERSION, - "Unsupported version '%s'\n", - version, NULL); + if (ctxt->options & XML_PARSE_OLD10) { + xmlFatalErrMsgStr(ctxt, XML_ERR_UNKNOWN_VERSION, + "Unsupported version '%s'\n", + version); + } else { + if ((version[0] == '1') && ((version[1] == '.'))) { + xmlWarningMsg(ctxt, XML_WAR_UNKNOWN_VERSION, + "Unsupported version '%s'\n", + version, NULL); + } else { + xmlFatalErrMsgStr(ctxt, XML_ERR_UNKNOWN_VERSION, + "Unsupported version '%s'\n", + version); + } + } } if (ctxt->version != NULL) xmlFree((void *) ctxt->version); @@ -9601,6 +10108,15 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) { ctxt->myDoc = NULL; } + if ((ctxt->wellFormed) && (ctxt->myDoc != NULL)) { + ctxt->myDoc->properties |= XML_DOC_WELLFORMED; + if (ctxt->valid) + ctxt->myDoc->properties |= XML_DOC_DTDVALID; + if (ctxt->nsWellFormed) + ctxt->myDoc->properties |= XML_DOC_NSVALID; + if (ctxt->options & XML_PARSE_OLD10) + ctxt->myDoc->properties |= XML_DOC_OLD10; + } if (! ctxt->wellFormed) { ctxt->valid = 0; return(-1); @@ -11245,7 +11761,11 @@ xmlIOParseDTD(xmlSAXHandlerPtr sax, xmlParserInputBufferPtr input, /* * plug some encoding conversion routines here. */ - xmlPushInput(ctxt, pinput); + if (xmlPushInput(ctxt, pinput) < 0) { + if (sax != NULL) ctxt->sax = NULL; + xmlFreeParserCtxt(ctxt); + return(NULL); + } if (enc != XML_CHAR_ENCODING_NONE) { xmlSwitchEncoding(ctxt, enc); } @@ -11262,6 +11782,11 @@ xmlIOParseDTD(xmlSAXHandlerPtr sax, xmlParserInputBufferPtr input, */ ctxt->inSubset = 2; ctxt->myDoc = xmlNewDoc(BAD_CAST "1.0"); + if (ctxt->myDoc == NULL) { + xmlErrMemory(ctxt, "New Doc failed"); + return(NULL); + } + ctxt->myDoc->properties = XML_DOC_INTERNAL; ctxt->myDoc->extSubset = xmlNewDtd(ctxt->myDoc, BAD_CAST "none", BAD_CAST "none", BAD_CAST "none"); @@ -11374,7 +11899,13 @@ xmlSAXParseDTD(xmlSAXHandlerPtr sax, const xmlChar *ExternalID, /* * plug some encoding conversion routines here. */ - xmlPushInput(ctxt, input); + if (xmlPushInput(ctxt, input) < 0) { + if (sax != NULL) ctxt->sax = NULL; + xmlFreeParserCtxt(ctxt); + if (systemIdCanonic != NULL) + xmlFree(systemIdCanonic); + return(NULL); + } if ((ctxt->input->end - ctxt->input->cur) >= 4) { enc = xmlDetectCharEncoding(ctxt->input->cur, 4); xmlSwitchEncoding(ctxt, enc); @@ -11395,6 +11926,13 @@ xmlSAXParseDTD(xmlSAXHandlerPtr sax, const xmlChar *ExternalID, */ ctxt->inSubset = 2; ctxt->myDoc = xmlNewDoc(BAD_CAST "1.0"); + if (ctxt->myDoc == NULL) { + xmlErrMemory(ctxt, "New Doc failed"); + if (sax != NULL) ctxt->sax = NULL; + xmlFreeParserCtxt(ctxt); + return(NULL); + } + ctxt->myDoc->properties = XML_DOC_INTERNAL; ctxt->myDoc->extSubset = xmlNewDtd(ctxt->myDoc, BAD_CAST "none", ExternalID, SystemID); xmlParseExternalSubset(ctxt, ExternalID, SystemID); @@ -11421,7 +11959,7 @@ xmlSAXParseDTD(xmlSAXHandlerPtr sax, const xmlChar *ExternalID, } if (sax != NULL) ctxt->sax = NULL; xmlFreeParserCtxt(ctxt); - + return(ret); } @@ -11432,7 +11970,7 @@ xmlSAXParseDTD(xmlSAXHandlerPtr sax, const xmlChar *ExternalID, * @SystemID: a NAME* containing the URL to the DTD * * Load and parse an external subset. - * + * * Returns the resulting xmlDtdPtr or NULL in case of error. */ @@ -11480,7 +12018,8 @@ xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, const xmlChar *URL, if (ctx == NULL) return(-1); - if (ctx->depth > 40) { + if (((ctx->depth > 40) && ((ctx->options & XML_PARSE_HUGE) == 0)) || + (ctx->depth > 1024)) { return(XML_ERR_ENTITY_LOOP); } @@ -11495,10 +12034,10 @@ xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, const xmlChar *URL, if (ctxt == NULL) { return(-1); } - + ctxt->userData = ctxt; ctxt->_private = ctx->_private; - + inputStream = xmlLoadExternalEntity((char *)URL, (char *)ID, ctxt); if (inputStream == NULL) { xmlFreeParserCtxt(ctxt); @@ -11511,7 +12050,7 @@ xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, const xmlChar *URL, directory = xmlParserGetDirectory((char *)URL); if ((ctxt->directory == NULL) && (directory != NULL)) ctxt->directory = directory; - + oldsax = ctxt->sax; ctxt->sax = ctx->sax; xmlDetectSAX2(ctxt); @@ -11520,6 +12059,7 @@ xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, const xmlChar *URL, xmlFreeParserCtxt(ctxt); return(-1); } + newDoc->properties = XML_DOC_INTERNAL; if (ctx->myDoc->dict) { newDoc->dict = ctx->myDoc->dict; xmlDictReference(newDoc->dict); @@ -11549,7 +12089,7 @@ xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, const xmlChar *URL, newDoc->children->doc = ctx->myDoc; } - /* + /* * Get the 4 first bytes and decode the charset * if enc != XML_CHAR_ENCODING_NONE * plug some encoding conversion routines. @@ -11571,6 +12111,14 @@ xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, const xmlChar *URL, */ if ((CMP5(CUR_PTR, '<', '?', 'x', 'm', 'l')) && (IS_BLANK_CH(NXT(5)))) { xmlParseTextDecl(ctxt); + /* + * An XML-1.0 document can't reference an entity not XML-1.0 + */ + if ((xmlStrEqual(ctx->version, BAD_CAST "1.0")) && + (!xmlStrEqual(ctxt->input->version, BAD_CAST "1.0"))) { + xmlFatalErrMsg(ctxt, XML_ERR_VERSION_MISMATCH, + "Version mismatch between document and entity\n"); + } } /* @@ -11604,7 +12152,7 @@ xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, const xmlChar *URL, ctxt->linenumbers = ctx->linenumbers; xmlParseContent(ctxt); - + ctx->validate = ctxt->validate; ctx->valid = ctxt->valid; if ((RAW == '<') && (NXT(1) == '/')) { @@ -11647,7 +12195,7 @@ xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, const xmlChar *URL, newDoc->intSubset = NULL; newDoc->extSubset = NULL; xmlFreeDoc(newDoc); - + return(ret); } @@ -11681,12 +12229,12 @@ xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt, xmlChar start[4]; xmlCharEncoding enc; - if (depth > 40) { + if (((depth > 40) && + ((oldctxt == NULL) || (oldctxt->options & XML_PARSE_HUGE) == 0)) || + (depth > 1024)) { return(XML_ERR_ENTITY_LOOP); } - - if (list != NULL) *list = NULL; if ((URL == NULL) && (ID == NULL)) @@ -11732,6 +12280,7 @@ xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt, xmlFreeParserCtxt(ctxt); return(XML_ERR_INTERNAL_ERROR); } + newDoc->properties = XML_DOC_INTERNAL; newDoc->intSubset = doc->intSubset; newDoc->extSubset = doc->extSubset; newDoc->dict = doc->dict; @@ -11758,7 +12307,7 @@ xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt, ctxt->myDoc = doc; newRoot->doc = doc; - /* + /* * Get the 4 first bytes and decode the charset * if enc != XML_CHAR_ENCODING_NONE * plug some encoding conversion routines. @@ -11786,7 +12335,7 @@ xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt, ctxt->depth = depth; xmlParseContent(ctxt); - + if ((RAW == '<') && (NXT(1) == '/')) { xmlFatalErr(ctxt, XML_ERR_NOT_WELL_BALANCED, NULL); } else if (RAW != 0) { @@ -11819,6 +12368,25 @@ xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt, } ret = XML_ERR_OK; } + + /* + * Record in the parent context the number of entities replacement + * done when parsing that reference. + */ + oldctxt->nbentities += ctxt->nbentities; + /* + * Also record the size of the entity parsed + */ + if (ctxt->input != NULL) { + oldctxt->sizeentities += ctxt->input->consumed; + oldctxt->sizeentities += (ctxt->input->cur - ctxt->input->base); + } + /* + * And record the last error if any + */ + if (ctxt->lastError.code != XML_ERR_OK) + xmlCopyError(&ctxt->lastError, &oldctxt->lastError); + if (sax != NULL) ctxt->sax = oldsax; oldctxt->node_seq.maximum = ctxt->node_seq.maximum; @@ -11831,7 +12399,7 @@ xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt, newDoc->intSubset = NULL; newDoc->extSubset = NULL; xmlFreeDoc(newDoc); - + return(ret); } @@ -11908,9 +12476,9 @@ xmlParseBalancedChunkMemory(xmlDocPtr doc, xmlSAXHandlerPtr sax, * * Returns XML_ERR_OK if the chunk is well balanced, and the parser * error code otherwise - * + * * In case recover is set to 1, the nodelist will not be empty even if - * the parsed chunk is not well balanced. + * the parsed chunk is not well balanced. */ static xmlParserErrors xmlParseBalancedChunkMemoryInternal(xmlParserCtxtPtr oldctxt, @@ -11924,7 +12492,8 @@ xmlParseBalancedChunkMemoryInternal(xmlParserCtxtPtr oldctxt, int size; xmlParserErrors ret = XML_ERR_OK; - if (oldctxt->depth > 40) { + if (((oldctxt->depth > 40) && ((oldctxt->options & XML_PARSE_HUGE) == 0)) || + (oldctxt->depth > 1024)) { return(XML_ERR_ENTITY_LOOP); } @@ -11953,7 +12522,7 @@ xmlParseBalancedChunkMemoryInternal(xmlParserCtxtPtr oldctxt, xmlDetectSAX2(ctxt); ctxt->replaceEntities = oldctxt->replaceEntities; ctxt->options = oldctxt->options; - + ctxt->_private = oldctxt->_private; if (oldctxt->myDoc == NULL) { newDoc = xmlNewDoc(BAD_CAST "1.0"); @@ -11963,6 +12532,7 @@ xmlParseBalancedChunkMemoryInternal(xmlParserCtxtPtr oldctxt, xmlFreeParserCtxt(ctxt); return(XML_ERR_INTERNAL_ERROR); } + newDoc->properties = XML_DOC_INTERNAL; newDoc->dict = ctxt->dict; xmlDictReference(newDoc->dict); ctxt->myDoc = newDoc; @@ -12018,7 +12588,7 @@ xmlParseBalancedChunkMemoryInternal(xmlParserCtxtPtr oldctxt, } else { ret = XML_ERR_OK; } - + if ((lst != NULL) && (ret == XML_ERR_OK)) { xmlNodePtr cur; @@ -12047,7 +12617,18 @@ xmlParseBalancedChunkMemoryInternal(xmlParserCtxtPtr oldctxt, ctxt->myDoc->children = content; ctxt->myDoc->last = last; } - + + /* + * Record in the parent context the number of entities replacement + * done when parsing that reference. + */ + oldctxt->nbentities += ctxt->nbentities; + /* + * Also record the last error if any + */ + if (ctxt->lastError.code != XML_ERR_OK) + xmlCopyError(&ctxt->lastError, &oldctxt->lastError); + ctxt->sax = oldsax; ctxt->dict = NULL; ctxt->attsDefault = NULL; @@ -12056,7 +12637,7 @@ xmlParseBalancedChunkMemoryInternal(xmlParserCtxtPtr oldctxt, if (newDoc != NULL) { xmlFreeDoc(newDoc); } - + return(ret); } @@ -12157,7 +12738,7 @@ xmlParseInNodeContext(xmlNodePtr node, const char *data, int datalen, } else options |= XML_PARSE_NODICT; - xmlCtxtUseOptions(ctxt, options); + xmlCtxtUseOptionsInternal(ctxt, options, NULL); xmlDetectSAX2(ctxt); ctxt->myDoc = doc; @@ -12189,7 +12770,7 @@ xmlParseInNodeContext(xmlNodePtr node, const char *data, int datalen, cur = cur->parent; } ctxt->instate = XML_PARSER_CONTENT; - } + } if ((ctxt->validate) || (ctxt->replaceEntities != 0)) { /* @@ -12224,12 +12805,12 @@ xmlParseInNodeContext(xmlNodePtr node, const char *data, int datalen, } else { ret = XML_ERR_OK; } - + /* * Return the newly created nodeset after unlinking it from * the pseudo sibling. */ - + cur = fake->next; fake->next = NULL; node->last = fake; @@ -12257,7 +12838,7 @@ xmlParseInNodeContext(xmlNodePtr node, const char *data, int datalen, if (doc->dict != NULL) ctxt->dict = NULL; xmlFreeParserCtxt(ctxt); - + return(ret); #else /* !SAX2 */ return(XML_ERR_INTERNAL_ERROR); @@ -12327,6 +12908,7 @@ xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, xmlSAXHandlerPtr sax, xmlFreeParserCtxt(ctxt); return(-1); } + newDoc->properties = XML_DOC_INTERNAL; if ((doc != NULL) && (doc->dict != NULL)) { xmlDictFree(ctxt->dict); ctxt->dict = doc->dict; @@ -12336,7 +12918,7 @@ xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, xmlSAXHandlerPtr sax, ctxt->str_xml_ns = xmlDictLookup(ctxt->dict, XML_XML_NAMESPACE, 36); ctxt->dictNames = 1; } else { - xmlCtxtUseOptions(ctxt, XML_PARSE_NODICT); + xmlCtxtUseOptionsInternal(ctxt, XML_PARSE_NODICT, NULL); } if (doc != NULL) { newDoc->intSubset = doc->intSubset; @@ -12399,7 +12981,7 @@ xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, xmlSAXHandlerPtr sax, } else { ret = 0; } - + if ((lst != NULL) && ((ret == 0) || (recover == 1))) { xmlNodePtr cur; @@ -12416,15 +12998,15 @@ xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, xmlSAXHandlerPtr sax, } newDoc->children->children = NULL; } - - if (sax != NULL) + + if (sax != NULL) ctxt->sax = oldsax; xmlFreeParserCtxt(ctxt); newDoc->intSubset = NULL; newDoc->extSubset = NULL; newDoc->oldNs = NULL; xmlFreeDoc(newDoc); - + return(ret); } @@ -12472,7 +13054,7 @@ xmlSAXParseEntity(xmlSAXHandlerPtr sax, const char *filename) { if (sax != NULL) ctxt->sax = NULL; xmlFreeParserCtxt(ctxt); - + return(ret); } @@ -12514,7 +13096,7 @@ xmlCreateEntityParserCtxt(const xmlChar *URL, const xmlChar *ID, xmlParserInputPtr inputStream; char *directory = NULL; xmlChar *uri; - + ctxt = xmlNewParserCtxt(); if (ctxt == NULL) { return(NULL); @@ -12556,7 +13138,7 @@ xmlCreateEntityParserCtxt(const xmlChar *URL, const xmlChar *ID, /************************************************************************ * * - * Front ends when parsing from a file * + * Front ends when parsing from a file * * * ************************************************************************/ @@ -12585,9 +13167,9 @@ xmlCreateURLParserCtxt(const char *filename, int options) } if (options) - xmlCtxtUseOptions(ctxt, options); + xmlCtxtUseOptionsInternal(ctxt, options, NULL); ctxt->linenumbers = 1; - + inputStream = xmlLoadExternalEntity(filename, NULL, ctxt); if (inputStream == NULL) { xmlFreeParserCtxt(ctxt); @@ -13363,6 +13945,8 @@ xmlCtxtReset(xmlParserCtxtPtr ctxt) ctxt->depth = 0; ctxt->charset = XML_CHAR_ENCODING_UTF8; ctxt->catalogs = NULL; + ctxt->nbentities = 0; + ctxt->sizeentities = 0; xmlInitNodeInfoSeq(&ctxt->node_seq); if (ctxt->attsDefault != NULL) { @@ -13474,6 +14058,10 @@ xmlCtxtResetPush(xmlParserCtxtPtr ctxt, const char *chunk, if (encoding != NULL) { xmlCharEncodingHandlerPtr hdlr; + if (ctxt->encoding != NULL) + xmlFree((xmlChar *) ctxt->encoding); + ctxt->encoding = xmlStrdup((const xmlChar *) encoding); + hdlr = xmlFindCharEncodingHandler(encoding); if (hdlr != NULL) { xmlSwitchToEncoding(ctxt, hdlr); @@ -13488,50 +14076,63 @@ xmlCtxtResetPush(xmlParserCtxtPtr ctxt, const char *chunk, return(0); } + /** - * xmlCtxtUseOptions: + * xmlCtxtUseOptionsInternal: * @ctxt: an XML parser context * @options: a combination of xmlParserOption + * @encoding: the user provided encoding to use * * Applies the options to the parser context * * Returns 0 in case of success, the set of unknown or unimplemented options * in case of error. */ -int -xmlCtxtUseOptions(xmlParserCtxtPtr ctxt, int options) +static int +xmlCtxtUseOptionsInternal(xmlParserCtxtPtr ctxt, int options, const char *encoding) { if (ctxt == NULL) return(-1); + if (encoding != NULL) { + if (ctxt->encoding != NULL) + xmlFree((xmlChar *) ctxt->encoding); + ctxt->encoding = xmlStrdup((const xmlChar *) encoding); + } if (options & XML_PARSE_RECOVER) { ctxt->recovery = 1; options -= XML_PARSE_RECOVER; + ctxt->options |= XML_PARSE_RECOVER; } else ctxt->recovery = 0; if (options & XML_PARSE_DTDLOAD) { ctxt->loadsubset = XML_DETECT_IDS; options -= XML_PARSE_DTDLOAD; + ctxt->options |= XML_PARSE_DTDLOAD; } else ctxt->loadsubset = 0; if (options & XML_PARSE_DTDATTR) { ctxt->loadsubset |= XML_COMPLETE_ATTRS; options -= XML_PARSE_DTDATTR; + ctxt->options |= XML_PARSE_DTDATTR; } if (options & XML_PARSE_NOENT) { ctxt->replaceEntities = 1; /* ctxt->loadsubset |= XML_DETECT_IDS; */ options -= XML_PARSE_NOENT; + ctxt->options |= XML_PARSE_NOENT; } else ctxt->replaceEntities = 0; if (options & XML_PARSE_PEDANTIC) { ctxt->pedantic = 1; options -= XML_PARSE_PEDANTIC; + ctxt->options |= XML_PARSE_PEDANTIC; } else ctxt->pedantic = 0; if (options & XML_PARSE_NOBLANKS) { ctxt->keepBlanks = 0; ctxt->sax->ignorableWhitespace = xmlSAX2IgnorableWhitespace; options -= XML_PARSE_NOBLANKS; + ctxt->options |= XML_PARSE_NOBLANKS; } else ctxt->keepBlanks = 1; if (options & XML_PARSE_DTDVALID) { @@ -13541,6 +14142,7 @@ xmlCtxtUseOptions(xmlParserCtxtPtr ctxt, int options) if (options & XML_PARSE_NOERROR) ctxt->vctxt.error = NULL; options -= XML_PARSE_DTDVALID; + ctxt->options |= XML_PARSE_DTDVALID; } else ctxt->validate = 0; if (options & XML_PARSE_NOWARNING) { @@ -13560,17 +14162,20 @@ xmlCtxtUseOptions(xmlParserCtxtPtr ctxt, int options) ctxt->sax->endElementNs = NULL; ctxt->sax->initialized = 1; options -= XML_PARSE_SAX1; + ctxt->options |= XML_PARSE_SAX1; } #endif /* LIBXML_SAX1_ENABLED */ if (options & XML_PARSE_NODICT) { ctxt->dictNames = 0; options -= XML_PARSE_NODICT; + ctxt->options |= XML_PARSE_NODICT; } else { ctxt->dictNames = 1; } if (options & XML_PARSE_NOCDATA) { ctxt->sax->cdataBlock = NULL; options -= XML_PARSE_NOCDATA; + ctxt->options |= XML_PARSE_NOCDATA; } if (options & XML_PARSE_NSCLEAN) { ctxt->options |= XML_PARSE_NSCLEAN; @@ -13584,10 +14189,38 @@ xmlCtxtUseOptions(xmlParserCtxtPtr ctxt, int options) ctxt->options |= XML_PARSE_COMPACT; options -= XML_PARSE_COMPACT; } + if (options & XML_PARSE_OLD10) { + ctxt->options |= XML_PARSE_OLD10; + options -= XML_PARSE_OLD10; + } + if (options & XML_PARSE_NOBASEFIX) { + ctxt->options |= XML_PARSE_NOBASEFIX; + options -= XML_PARSE_NOBASEFIX; + } + if (options & XML_PARSE_HUGE) { + ctxt->options |= XML_PARSE_HUGE; + options -= XML_PARSE_HUGE; + } ctxt->linenumbers = 1; return (options); } +/** + * xmlCtxtUseOptions: + * @ctxt: an XML parser context + * @options: a combination of xmlParserOption + * + * Applies the options to the parser context + * + * Returns 0 in case of success, the set of unknown or unimplemented options + * in case of error. + */ +int +xmlCtxtUseOptions(xmlParserCtxtPtr ctxt, int options) +{ + return(xmlCtxtUseOptionsInternal(ctxt, options, NULL)); +} + /** * xmlDoRead: * @ctxt: an XML parser context @@ -13597,7 +14230,7 @@ xmlCtxtUseOptions(xmlParserCtxtPtr ctxt, int options) * @reuse: keep the context for reuse * * Common front-end for the xmlRead functions - * + * * Returns the resulting document tree or NULL */ static xmlDocPtr @@ -13605,8 +14238,8 @@ xmlDoRead(xmlParserCtxtPtr ctxt, const char *URL, const char *encoding, int options, int reuse) { xmlDocPtr ret; - - xmlCtxtUseOptions(ctxt, options); + + xmlCtxtUseOptionsInternal(ctxt, options, encoding); if (encoding != NULL) { xmlCharEncodingHandlerPtr hdlr; diff --git a/parserInternals.c b/parserInternals.c index d7aa4cf..758c6b3 100644 --- a/parserInternals.c +++ b/parserInternals.c @@ -1399,7 +1399,8 @@ xmlNewEntityInputStream(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) { if (input == NULL) { return(NULL); } - input->filename = (char *) entity->URI; + if (entity->URI != NULL) + input->filename = (char *) xmlStrdup((xmlChar *) entity->URI); input->base = entity->content; input->cur = entity->content; input->length = entity->length; @@ -1669,6 +1670,7 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt) ctxt->depth = 0; ctxt->charset = XML_CHAR_ENCODING_UTF8; ctxt->catalogs = NULL; + ctxt->nbentities = 0; xmlInitNodeInfoSeq(&ctxt->node_seq); return(0); } diff --git a/pattern.c b/pattern.c index ee51968..0e38c2d 100644 --- a/pattern.c +++ b/pattern.c @@ -2285,9 +2285,13 @@ xmlStreamPop(xmlStreamCtxtPtr stream) { if (stream->blockLevel == stream->level) stream->blockLevel = -1; - stream->level--; - if (stream->level < 0) - return(-1); + /* + * stream->level can be zero when XML_FINAL_IS_ANY_NODE is set + * (see the thread at + * http://mail.gnome.org/archives/xslt/2008-July/msg00027.html) + */ + if (stream->level) + stream->level--; /* * Check evolution of existing states */ diff --git a/python/Makefile.in b/python/Makefile.in index 7ffe750..5f96636 100644 --- a/python/Makefile.in +++ b/python/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -65,7 +65,7 @@ libxml2mod_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libxml2mod_la_LDFLAGS) $(LDFLAGS) -o $@ @WITH_PYTHON_TRUE@am_libxml2mod_la_rpath = -rpath $(pythondir) -DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ @@ -397,8 +397,8 @@ install-pythonLTLIBRARIES: $(python_LTLIBRARIES) @list='$(python_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pythonLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pythondir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pythonLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pythondir)/$$f"; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(pythonLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pythondir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(pythonLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pythondir)/$$f"; \ else :; fi; \ done @@ -406,8 +406,8 @@ uninstall-pythonLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(python_LTLIBRARIES)'; for p in $$list; do \ p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pythondir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pythondir)/$$p"; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pythondir)/$$p'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pythondir)/$$p"; \ done clean-pythonLTLIBRARIES: @@ -584,8 +584,8 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS @@ -610,8 +610,8 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ @@ -621,13 +621,12 @@ ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ - here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique diff --git a/python/generator.py b/python/generator.py index 8cf327b..4e22815 100755 --- a/python/generator.py +++ b/python/generator.py @@ -409,10 +409,10 @@ def print_function_wrapper(name, output, export, include): if skip_function(name) == 1: return 0 if name in skip_impl: - # Don't delete the function entry in the caller. - return 1 + # Don't delete the function entry in the caller. + return 1 - c_call = ""; + c_call = "" format="" format_args="" c_args="" @@ -426,8 +426,8 @@ def print_function_wrapper(name, output, export, include): c_args = c_args + " %s %s;\n" % (arg[1], arg[0]) if py_types.has_key(arg[1]): (f, t, n, c) = py_types[arg[1]] - if (f == 'z') and (name in foreign_encoding_args) and (num_bufs == 0): - f = 't#' + if (f == 'z') and (name in foreign_encoding_args) and (num_bufs == 0): + f = 't#' if f != None: format = format + f if t != None: @@ -435,15 +435,15 @@ def print_function_wrapper(name, output, export, include): c_args = c_args + " PyObject *pyobj_%s;\n" % (arg[0]) c_convert = c_convert + \ " %s = (%s) Py%s_Get(pyobj_%s);\n" % (arg[0], - arg[1], t, arg[0]); + arg[1], t, arg[0]) else: format_args = format_args + ", &%s" % (arg[0]) - if f == 't#': - format_args = format_args + ", &py_buffsize%d" % num_bufs - c_args = c_args + " int py_buffsize%d;\n" % num_bufs - num_bufs = num_bufs + 1 + if f == 't#': + format_args = format_args + ", &py_buffsize%d" % num_bufs + c_args = c_args + " int py_buffsize%d;\n" % num_bufs + num_bufs = num_bufs + 1 if c_call != "": - c_call = c_call + ", "; + c_call = c_call + ", " c_call = c_call + "%s" % (arg[0]) else: if skipped_types.has_key(arg[1]): @@ -459,16 +459,16 @@ def print_function_wrapper(name, output, export, include): if ret[0] == 'void': if file == "python_accessor": - if args[1][1] == "char *" or args[1][1] == "xmlChar *": - c_call = "\n if (%s->%s != NULL) xmlFree(%s->%s);\n" % ( - args[0][0], args[1][0], args[0][0], args[1][0]) - c_call = c_call + " %s->%s = (%s)xmlStrdup((const xmlChar *)%s);\n" % (args[0][0], - args[1][0], args[1][1], args[1][0]) - else: - c_call = "\n %s->%s = %s;\n" % (args[0][0], args[1][0], - args[1][0]) + if args[1][1] == "char *" or args[1][1] == "xmlChar *": + c_call = "\n if (%s->%s != NULL) xmlFree(%s->%s);\n" % ( + args[0][0], args[1][0], args[0][0], args[1][0]) + c_call = c_call + " %s->%s = (%s)xmlStrdup((const xmlChar *)%s);\n" % (args[0][0], + args[1][0], args[1][1], args[1][0]) + else: + c_call = "\n %s->%s = %s;\n" % (args[0][0], args[1][0], + args[1][0]) else: - c_call = "\n %s(%s);\n" % (name, c_call); + c_call = "\n %s(%s);\n" % (name, c_call) ret_convert = " Py_INCREF(Py_None);\n return(Py_None);\n" elif py_types.has_key(ret[0]): (f, t, n, c) = py_types[ret[0]] @@ -476,13 +476,13 @@ def print_function_wrapper(name, output, export, include): if file == "python_accessor" and ret[2] != None: c_call = "\n c_retval = %s->%s;\n" % (args[0][0], ret[2]) else: - c_call = "\n c_retval = %s(%s);\n" % (name, c_call); + c_call = "\n c_retval = %s(%s);\n" % (name, c_call) ret_convert = " py_retval = libxml_%sWrap((%s) c_retval);\n" % (n,c) ret_convert = ret_convert + " return(py_retval);\n" elif py_return_types.has_key(ret[0]): (f, t, n, c) = py_return_types[ret[0]] c_return = " %s c_retval;\n" % (ret[0]) - c_call = "\n c_retval = %s(%s);\n" % (name, c_call); + c_call = "\n c_retval = %s(%s);\n" % (name, c_call) ret_convert = " py_retval = libxml_%sWrap((%s) c_retval);\n" % (n,c) ret_convert = ret_convert + " return(py_retval);\n" else: @@ -501,31 +501,31 @@ def print_function_wrapper(name, output, export, include): output.write("#if %s\n" % cond) include.write("PyObject * ") - include.write("libxml_%s(PyObject *self, PyObject *args);\n" % (name)); + include.write("libxml_%s(PyObject *self, PyObject *args);\n" % (name)) export.write(" { (char *)\"%s\", libxml_%s, METH_VARARGS, NULL },\n" % (name, name)) if file == "python": # Those have been manually generated - if cond != None and cond != "": - include.write("#endif\n"); - export.write("#endif\n"); - output.write("#endif\n"); + if cond != None and cond != "": + include.write("#endif\n") + export.write("#endif\n") + output.write("#endif\n") return 1 if file == "python_accessor" and ret[0] != "void" and ret[2] is None: # Those have been manually generated - if cond != None and cond != "": - include.write("#endif\n"); - export.write("#endif\n"); - output.write("#endif\n"); + if cond != None and cond != "": + include.write("#endif\n") + export.write("#endif\n") + output.write("#endif\n") return 1 output.write("PyObject *\n") output.write("libxml_%s(PyObject *self ATTRIBUTE_UNUSED," % (name)) output.write(" PyObject *args") if format == "": - output.write(" ATTRIBUTE_UNUSED") + output.write(" ATTRIBUTE_UNUSED") output.write(") {\n") if ret[0] != 'void': output.write(" PyObject *py_retval;\n") @@ -555,38 +555,38 @@ def buildStubs(): global unknown_types try: - f = open(os.path.join(srcPref,"libxml2-api.xml")) - data = f.read() - (parser, target) = getparser() - parser.feed(data) - parser.close() + f = open(os.path.join(srcPref,"libxml2-api.xml")) + data = f.read() + (parser, target) = getparser() + parser.feed(data) + parser.close() except IOError, msg: - try: - f = open(os.path.join(srcPref,"..","doc","libxml2-api.xml")) - data = f.read() - (parser, target) = getparser() - parser.feed(data) - parser.close() - except IOError, msg: - print file, ":", msg - sys.exit(1) + try: + f = open(os.path.join(srcPref,"..","doc","libxml2-api.xml")) + data = f.read() + (parser, target) = getparser() + parser.feed(data) + parser.close() + except IOError, msg: + print file, ":", msg + sys.exit(1) n = len(functions.keys()) print "Found %d functions in libxml2-api.xml" % (n) py_types['pythonObject'] = ('O', "pythonObject", "pythonObject", "pythonObject") try: - f = open(os.path.join(srcPref,"libxml2-python-api.xml")) - data = f.read() - (parser, target) = getparser() - parser.feed(data) - parser.close() + f = open(os.path.join(srcPref,"libxml2-python-api.xml")) + data = f.read() + (parser, target) = getparser() + parser.feed(data) + parser.close() except IOError, msg: - print file, ":", msg + print file, ":", msg print "Found %d functions in libxml2-python-api.xml" % ( - len(functions.keys()) - n) + len(functions.keys()) - n) nb_wrap = 0 failed = 0 skipped = 0 @@ -604,24 +604,24 @@ def buildStubs(): wrapper.write("#include \"libxml_wrap.h\"\n") wrapper.write("#include \"libxml2-py.h\"\n\n") for function in functions.keys(): - ret = print_function_wrapper(function, wrapper, export, include) - if ret < 0: - failed = failed + 1 - del functions[function] - if ret == 0: - skipped = skipped + 1 - del functions[function] - if ret == 1: - nb_wrap = nb_wrap + 1 + ret = print_function_wrapper(function, wrapper, export, include) + if ret < 0: + failed = failed + 1 + del functions[function] + if ret == 0: + skipped = skipped + 1 + del functions[function] + if ret == 1: + nb_wrap = nb_wrap + 1 include.close() export.close() wrapper.close() print "Generated %d wrapper functions, %d failed, %d skipped\n" % (nb_wrap, - failed, skipped); + failed, skipped) print "Missing type converters: " for type in unknown_types.keys(): - print "%s:%d " % (type, len(unknown_types[type])), + print "%s:%d " % (type, len(unknown_types[type])), print ####################################################################### @@ -713,9 +713,9 @@ classes_destructors = { "relaxNgSchema": "xmlRelaxNGFree", "relaxNgParserCtxt": "xmlRelaxNGFreeParserCtxt", "relaxNgValidCtxt": "xmlRelaxNGFreeValidCtxt", - "Schema": "xmlSchemaFree", - "SchemaParserCtxt": "xmlSchemaFreeParserCtxt", - "SchemaValidCtxt": "xmlSchemaFreeValidCtxt", + "Schema": "xmlSchemaFree", + "SchemaParserCtxt": "xmlSchemaFreeParserCtxt", + "SchemaValidCtxt": "xmlSchemaFreeValidCtxt", "ValidCtxt": "xmlFreeValidCtxt", } @@ -730,7 +730,7 @@ functions_noexcept = { reference_keepers = { "xmlTextReader": [('inputBuffer', 'input')], "relaxNgValidCtxt": [('relaxNgSchema', 'schema')], - "SchemaValidCtxt": [('Schema', 'schema')], + "SchemaValidCtxt": [('Schema', 'schema')], } function_classes = {} @@ -845,23 +845,23 @@ def writeDoc(name, args, indent, output): if functions[name][0] is None or functions[name][0] == "": return val = functions[name][0] - val = string.replace(val, "NULL", "None"); + val = string.replace(val, "NULL", "None") output.write(indent) output.write('"""') while len(val) > 60: if val[0] == " ": - val = val[1:] - continue + val = val[1:] + continue str = val[0:60] - i = string.rfind(str, " "); + i = string.rfind(str, " ") if i < 0: i = 60 str = val[0:i] val = val[i:] output.write(str) - output.write('\n '); + output.write('\n ') output.write(indent) - output.write(val); + output.write(val) output.write(' """\n') def buildWrappers(): @@ -884,7 +884,7 @@ def buildWrappers(): global functions_noexcept for type in classes_type.keys(): - function_classes[classes_type[type][2]] = [] + function_classes[classes_type[type][2]] = [] # # Build the list of C types to look for ordered to start @@ -895,63 +895,63 @@ def buildWrappers(): ctypes_processed = {} classes_processed = {} for classe in primary_classes: - classes_list.append(classe) - classes_processed[classe] = () - for type in classes_type.keys(): - tinfo = classes_type[type] - if tinfo[2] == classe: - ctypes.append(type) - ctypes_processed[type] = () + classes_list.append(classe) + classes_processed[classe] = () + for type in classes_type.keys(): + tinfo = classes_type[type] + if tinfo[2] == classe: + ctypes.append(type) + ctypes_processed[type] = () for type in classes_type.keys(): - if ctypes_processed.has_key(type): - continue - tinfo = classes_type[type] - if not classes_processed.has_key(tinfo[2]): - classes_list.append(tinfo[2]) - classes_processed[tinfo[2]] = () - - ctypes.append(type) - ctypes_processed[type] = () + if ctypes_processed.has_key(type): + continue + tinfo = classes_type[type] + if not classes_processed.has_key(tinfo[2]): + classes_list.append(tinfo[2]) + classes_processed[tinfo[2]] = () + + ctypes.append(type) + ctypes_processed[type] = () for name in functions.keys(): - found = 0; - (desc, ret, args, file, cond) = functions[name] - for type in ctypes: - classe = classes_type[type][2] - - if name[0:3] == "xml" and len(args) >= 1 and args[0][1] == type: - found = 1 - func = nameFixup(name, classe, type, file) - info = (0, func, name, ret, args, file) - function_classes[classe].append(info) - elif name[0:3] == "xml" and len(args) >= 2 and args[1][1] == type \ - and file != "python_accessor": - found = 1 - func = nameFixup(name, classe, type, file) - info = (1, func, name, ret, args, file) - function_classes[classe].append(info) - elif name[0:4] == "html" and len(args) >= 1 and args[0][1] == type: - found = 1 - func = nameFixup(name, classe, type, file) - info = (0, func, name, ret, args, file) - function_classes[classe].append(info) - elif name[0:4] == "html" and len(args) >= 2 and args[1][1] == type \ - and file != "python_accessor": - found = 1 - func = nameFixup(name, classe, type, file) - info = (1, func, name, ret, args, file) - function_classes[classe].append(info) - if found == 1: - continue - if name[0:8] == "xmlXPath": - continue - if name[0:6] == "xmlStr": - continue - if name[0:10] == "xmlCharStr": - continue - func = nameFixup(name, "None", file, file) - info = (0, func, name, ret, args, file) - function_classes['None'].append(info) + found = 0 + (desc, ret, args, file, cond) = functions[name] + for type in ctypes: + classe = classes_type[type][2] + + if name[0:3] == "xml" and len(args) >= 1 and args[0][1] == type: + found = 1 + func = nameFixup(name, classe, type, file) + info = (0, func, name, ret, args, file) + function_classes[classe].append(info) + elif name[0:3] == "xml" and len(args) >= 2 and args[1][1] == type \ + and file != "python_accessor": + found = 1 + func = nameFixup(name, classe, type, file) + info = (1, func, name, ret, args, file) + function_classes[classe].append(info) + elif name[0:4] == "html" and len(args) >= 1 and args[0][1] == type: + found = 1 + func = nameFixup(name, classe, type, file) + info = (0, func, name, ret, args, file) + function_classes[classe].append(info) + elif name[0:4] == "html" and len(args) >= 2 and args[1][1] == type \ + and file != "python_accessor": + found = 1 + func = nameFixup(name, classe, type, file) + info = (1, func, name, ret, args, file) + function_classes[classe].append(info) + if found == 1: + continue + if name[0:8] == "xmlXPath": + continue + if name[0:6] == "xmlStr": + continue + if name[0:10] == "xmlCharStr": + continue + func = nameFixup(name, "None", file, file) + info = (0, func, name, ret, args, file) + function_classes['None'].append(info) classes = open("libxml2class.py", "w") txt = open("libxml2class.txt", "w") @@ -959,261 +959,261 @@ def buildWrappers(): txt.write("#\n# Global functions of the module\n#\n\n") if function_classes.has_key("None"): - flist = function_classes["None"] - flist.sort(functionCompare) - oldfile = "" - for info in flist: - (index, func, name, ret, args, file) = info - if file != oldfile: - classes.write("#\n# Functions from module %s\n#\n\n" % file) - txt.write("\n# functions from module %s\n" % file) - oldfile = file - classes.write("def %s(" % func) - txt.write("%s()\n" % func); - n = 0 - for arg in args: - if n != 0: - classes.write(", ") - classes.write("%s" % arg[0]) - n = n + 1 - classes.write("):\n") - writeDoc(name, args, ' ', classes); - - for arg in args: - if classes_type.has_key(arg[1]): - classes.write(" if %s is None: %s__o = None\n" % - (arg[0], arg[0])) - classes.write(" else: %s__o = %s%s\n" % - (arg[0], arg[0], classes_type[arg[1]][0])) - if ret[0] != "void": - classes.write(" ret = "); - else: - classes.write(" "); - classes.write("libxml2mod.%s(" % name) - n = 0 - for arg in args: - if n != 0: - classes.write(", "); - classes.write("%s" % arg[0]) - if classes_type.has_key(arg[1]): - classes.write("__o"); - n = n + 1 - classes.write(")\n"); - if ret[0] != "void": - if classes_type.has_key(ret[0]): - # - # Raise an exception - # - if functions_noexcept.has_key(name): - classes.write(" if ret is None:return None\n"); - elif string.find(name, "URI") >= 0: - classes.write( - " if ret is None:raise uriError('%s() failed')\n" - % (name)) - elif string.find(name, "XPath") >= 0: - classes.write( - " if ret is None:raise xpathError('%s() failed')\n" - % (name)) - elif string.find(name, "Parse") >= 0: - classes.write( - " if ret is None:raise parserError('%s() failed')\n" - % (name)) - else: - classes.write( - " if ret is None:raise treeError('%s() failed')\n" - % (name)) - classes.write(" return "); - classes.write(classes_type[ret[0]][1] % ("ret")); - classes.write("\n"); - else: - classes.write(" return ret\n"); - classes.write("\n"); + flist = function_classes["None"] + flist.sort(functionCompare) + oldfile = "" + for info in flist: + (index, func, name, ret, args, file) = info + if file != oldfile: + classes.write("#\n# Functions from module %s\n#\n\n" % file) + txt.write("\n# functions from module %s\n" % file) + oldfile = file + classes.write("def %s(" % func) + txt.write("%s()\n" % func) + n = 0 + for arg in args: + if n != 0: + classes.write(", ") + classes.write("%s" % arg[0]) + n = n + 1 + classes.write("):\n") + writeDoc(name, args, ' ', classes) + + for arg in args: + if classes_type.has_key(arg[1]): + classes.write(" if %s is None: %s__o = None\n" % + (arg[0], arg[0])) + classes.write(" else: %s__o = %s%s\n" % + (arg[0], arg[0], classes_type[arg[1]][0])) + if ret[0] != "void": + classes.write(" ret = ") + else: + classes.write(" ") + classes.write("libxml2mod.%s(" % name) + n = 0 + for arg in args: + if n != 0: + classes.write(", ") + classes.write("%s" % arg[0]) + if classes_type.has_key(arg[1]): + classes.write("__o") + n = n + 1 + classes.write(")\n") + if ret[0] != "void": + if classes_type.has_key(ret[0]): + # + # Raise an exception + # + if functions_noexcept.has_key(name): + classes.write(" if ret is None:return None\n") + elif string.find(name, "URI") >= 0: + classes.write( + " if ret is None:raise uriError('%s() failed')\n" + % (name)) + elif string.find(name, "XPath") >= 0: + classes.write( + " if ret is None:raise xpathError('%s() failed')\n" + % (name)) + elif string.find(name, "Parse") >= 0: + classes.write( + " if ret is None:raise parserError('%s() failed')\n" + % (name)) + else: + classes.write( + " if ret is None:raise treeError('%s() failed')\n" + % (name)) + classes.write(" return ") + classes.write(classes_type[ret[0]][1] % ("ret")) + classes.write("\n") + else: + classes.write(" return ret\n") + classes.write("\n") txt.write("\n\n#\n# Set of classes of the module\n#\n\n") for classname in classes_list: - if classname == "None": - pass - else: - if classes_ancestor.has_key(classname): - txt.write("\n\nClass %s(%s)\n" % (classname, - classes_ancestor[classname])) - classes.write("class %s(%s):\n" % (classname, - classes_ancestor[classname])) - classes.write(" def __init__(self, _obj=None):\n") - if classes_ancestor[classname] == "xmlCore" or \ - classes_ancestor[classname] == "xmlNode": - classes.write(" if type(_obj).__name__ != ") - classes.write("'PyCObject':\n") - classes.write(" raise TypeError, ") - classes.write("'%s needs a PyCObject argument'\n" % \ - classname) - if reference_keepers.has_key(classname): - rlist = reference_keepers[classname] - for ref in rlist: - classes.write(" self.%s = None\n" % ref[1]) - classes.write(" self._o = _obj\n") - classes.write(" %s.__init__(self, _obj=_obj)\n\n" % ( - classes_ancestor[classname])) - if classes_ancestor[classname] == "xmlCore" or \ - classes_ancestor[classname] == "xmlNode": - classes.write(" def __repr__(self):\n") - format = "<%s (%%s) object at 0x%%x>" % (classname) - classes.write(" return \"%s\" %% (self.name, long(pos_id (self)))\n\n" % ( - format)) - else: - txt.write("Class %s()\n" % (classname)) - classes.write("class %s:\n" % (classname)) - classes.write(" def __init__(self, _obj=None):\n") - if reference_keepers.has_key(classname): - list = reference_keepers[classname] - for ref in list: - classes.write(" self.%s = None\n" % ref[1]) - classes.write(" if _obj != None:self._o = _obj;return\n") - classes.write(" self._o = None\n\n"); - destruct=None - if classes_destructors.has_key(classname): - classes.write(" def __del__(self):\n") - classes.write(" if self._o != None:\n") - classes.write(" libxml2mod.%s(self._o)\n" % - classes_destructors[classname]); - classes.write(" self._o = None\n\n"); - destruct=classes_destructors[classname] - flist = function_classes[classname] - flist.sort(functionCompare) - oldfile = "" - for info in flist: - (index, func, name, ret, args, file) = info - # - # Do not provide as method the destructors for the class - # to avoid double free - # - if name == destruct: - continue; - if file != oldfile: - if file == "python_accessor": - classes.write(" # accessors for %s\n" % (classname)) - txt.write(" # accessors\n") - else: - classes.write(" #\n") - classes.write(" # %s functions from module %s\n" % ( - classname, file)) - txt.write("\n # functions from module %s\n" % file) - classes.write(" #\n\n") - oldfile = file - classes.write(" def %s(self" % func) - txt.write(" %s()\n" % func); - n = 0 - for arg in args: - if n != index: - classes.write(", %s" % arg[0]) - n = n + 1 - classes.write("):\n") - writeDoc(name, args, ' ', classes); - n = 0 - for arg in args: - if classes_type.has_key(arg[1]): - if n != index: - classes.write(" if %s is None: %s__o = None\n" % - (arg[0], arg[0])) - classes.write(" else: %s__o = %s%s\n" % - (arg[0], arg[0], classes_type[arg[1]][0])) - n = n + 1 - if ret[0] != "void": - classes.write(" ret = "); - else: - classes.write(" "); - classes.write("libxml2mod.%s(" % name) - n = 0 - for arg in args: - if n != 0: - classes.write(", "); - if n != index: - classes.write("%s" % arg[0]) - if classes_type.has_key(arg[1]): - classes.write("__o"); - else: - classes.write("self"); - if classes_type.has_key(arg[1]): - classes.write(classes_type[arg[1]][0]) - n = n + 1 - classes.write(")\n"); - if ret[0] != "void": - if classes_type.has_key(ret[0]): - # - # Raise an exception - # - if functions_noexcept.has_key(name): - classes.write( - " if ret is None:return None\n"); - elif string.find(name, "URI") >= 0: - classes.write( - " if ret is None:raise uriError('%s() failed')\n" - % (name)) - elif string.find(name, "XPath") >= 0: - classes.write( - " if ret is None:raise xpathError('%s() failed')\n" - % (name)) - elif string.find(name, "Parse") >= 0: - classes.write( - " if ret is None:raise parserError('%s() failed')\n" - % (name)) - else: - classes.write( - " if ret is None:raise treeError('%s() failed')\n" - % (name)) - - # - # generate the returned class wrapper for the object - # - classes.write(" __tmp = "); - classes.write(classes_type[ret[0]][1] % ("ret")); - classes.write("\n"); + if classname == "None": + pass + else: + if classes_ancestor.has_key(classname): + txt.write("\n\nClass %s(%s)\n" % (classname, + classes_ancestor[classname])) + classes.write("class %s(%s):\n" % (classname, + classes_ancestor[classname])) + classes.write(" def __init__(self, _obj=None):\n") + if classes_ancestor[classname] == "xmlCore" or \ + classes_ancestor[classname] == "xmlNode": + classes.write(" if type(_obj).__name__ != ") + classes.write("'PyCObject':\n") + classes.write(" raise TypeError, ") + classes.write("'%s needs a PyCObject argument'\n" % \ + classname) + if reference_keepers.has_key(classname): + rlist = reference_keepers[classname] + for ref in rlist: + classes.write(" self.%s = None\n" % ref[1]) + classes.write(" self._o = _obj\n") + classes.write(" %s.__init__(self, _obj=_obj)\n\n" % ( + classes_ancestor[classname])) + if classes_ancestor[classname] == "xmlCore" or \ + classes_ancestor[classname] == "xmlNode": + classes.write(" def __repr__(self):\n") + format = "<%s (%%s) object at 0x%%x>" % (classname) + classes.write(" return \"%s\" %% (self.name, long(pos_id (self)))\n\n" % ( + format)) + else: + txt.write("Class %s()\n" % (classname)) + classes.write("class %s:\n" % (classname)) + classes.write(" def __init__(self, _obj=None):\n") + if reference_keepers.has_key(classname): + list = reference_keepers[classname] + for ref in list: + classes.write(" self.%s = None\n" % ref[1]) + classes.write(" if _obj != None:self._o = _obj;return\n") + classes.write(" self._o = None\n\n") + destruct=None + if classes_destructors.has_key(classname): + classes.write(" def __del__(self):\n") + classes.write(" if self._o != None:\n") + classes.write(" libxml2mod.%s(self._o)\n" % + classes_destructors[classname]) + classes.write(" self._o = None\n\n") + destruct=classes_destructors[classname] + flist = function_classes[classname] + flist.sort(functionCompare) + oldfile = "" + for info in flist: + (index, func, name, ret, args, file) = info + # + # Do not provide as method the destructors for the class + # to avoid double free + # + if name == destruct: + continue + if file != oldfile: + if file == "python_accessor": + classes.write(" # accessors for %s\n" % (classname)) + txt.write(" # accessors\n") + else: + classes.write(" #\n") + classes.write(" # %s functions from module %s\n" % ( + classname, file)) + txt.write("\n # functions from module %s\n" % file) + classes.write(" #\n\n") + oldfile = file + classes.write(" def %s(self" % func) + txt.write(" %s()\n" % func) + n = 0 + for arg in args: + if n != index: + classes.write(", %s" % arg[0]) + n = n + 1 + classes.write("):\n") + writeDoc(name, args, ' ', classes) + n = 0 + for arg in args: + if classes_type.has_key(arg[1]): + if n != index: + classes.write(" if %s is None: %s__o = None\n" % + (arg[0], arg[0])) + classes.write(" else: %s__o = %s%s\n" % + (arg[0], arg[0], classes_type[arg[1]][0])) + n = n + 1 + if ret[0] != "void": + classes.write(" ret = ") + else: + classes.write(" ") + classes.write("libxml2mod.%s(" % name) + n = 0 + for arg in args: + if n != 0: + classes.write(", ") + if n != index: + classes.write("%s" % arg[0]) + if classes_type.has_key(arg[1]): + classes.write("__o") + else: + classes.write("self") + if classes_type.has_key(arg[1]): + classes.write(classes_type[arg[1]][0]) + n = n + 1 + classes.write(")\n") + if ret[0] != "void": + if classes_type.has_key(ret[0]): + # + # Raise an exception + # + if functions_noexcept.has_key(name): + classes.write( + " if ret is None:return None\n") + elif string.find(name, "URI") >= 0: + classes.write( + " if ret is None:raise uriError('%s() failed')\n" + % (name)) + elif string.find(name, "XPath") >= 0: + classes.write( + " if ret is None:raise xpathError('%s() failed')\n" + % (name)) + elif string.find(name, "Parse") >= 0: + classes.write( + " if ret is None:raise parserError('%s() failed')\n" + % (name)) + else: + classes.write( + " if ret is None:raise treeError('%s() failed')\n" + % (name)) # - # Sometime one need to keep references of the source - # class in the returned class object. - # See reference_keepers for the list - # - tclass = classes_type[ret[0]][2] - if reference_keepers.has_key(tclass): - list = reference_keepers[tclass] - for pref in list: - if pref[0] == classname: - classes.write(" __tmp.%s = self\n" % - pref[1]) - # - # return the class - # - classes.write(" return __tmp\n"); - elif converter_type.has_key(ret[0]): - # - # Raise an exception - # - if functions_noexcept.has_key(name): - classes.write( - " if ret is None:return None"); - elif string.find(name, "URI") >= 0: - classes.write( - " if ret is None:raise uriError('%s() failed')\n" - % (name)) - elif string.find(name, "XPath") >= 0: - classes.write( - " if ret is None:raise xpathError('%s() failed')\n" - % (name)) - elif string.find(name, "Parse") >= 0: - classes.write( - " if ret is None:raise parserError('%s() failed')\n" - % (name)) - else: - classes.write( - " if ret is None:raise treeError('%s() failed')\n" - % (name)) - classes.write(" return "); - classes.write(converter_type[ret[0]] % ("ret")); - classes.write("\n"); - else: - classes.write(" return ret\n"); - classes.write("\n"); + # generate the returned class wrapper for the object + # + classes.write(" __tmp = ") + classes.write(classes_type[ret[0]][1] % ("ret")) + classes.write("\n") + + # + # Sometime one need to keep references of the source + # class in the returned class object. + # See reference_keepers for the list + # + tclass = classes_type[ret[0]][2] + if reference_keepers.has_key(tclass): + list = reference_keepers[tclass] + for pref in list: + if pref[0] == classname: + classes.write(" __tmp.%s = self\n" % + pref[1]) + # + # return the class + # + classes.write(" return __tmp\n") + elif converter_type.has_key(ret[0]): + # + # Raise an exception + # + if functions_noexcept.has_key(name): + classes.write( + " if ret is None:return None") + elif string.find(name, "URI") >= 0: + classes.write( + " if ret is None:raise uriError('%s() failed')\n" + % (name)) + elif string.find(name, "XPath") >= 0: + classes.write( + " if ret is None:raise xpathError('%s() failed')\n" + % (name)) + elif string.find(name, "Parse") >= 0: + classes.write( + " if ret is None:raise parserError('%s() failed')\n" + % (name)) + else: + classes.write( + " if ret is None:raise treeError('%s() failed')\n" + % (name)) + classes.write(" return ") + classes.write(converter_type[ret[0]] % ("ret")) + classes.write("\n") + else: + classes.write(" return ret\n") + classes.write("\n") # # Generate enum constants @@ -1224,7 +1224,7 @@ def buildWrappers(): items.sort(lambda i1,i2: cmp(long(i1[1]),long(i2[1]))) for name,value in items: classes.write("%s = %s\n" % (name,value)) - classes.write("\n"); + classes.write("\n") txt.close() classes.close() diff --git a/python/libxml.c b/python/libxml.c index 747e44c..95b3cb9 100644 --- a/python/libxml.c +++ b/python/libxml.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "libxml_wrap.h" #include "libxml2-py.h" @@ -1890,6 +1891,7 @@ libxml_xmlFreeValidCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { return(Py_None); } +#ifdef LIBXML_READER_ENABLED /************************************************************************ * * * Per xmlTextReader error handler * @@ -2059,6 +2061,7 @@ libxml_xmlFreeTextReader(ATTRIBUTE_UNUSED PyObject *self, PyObject *args) { Py_INCREF(Py_None); return(Py_None); } +#endif /************************************************************************ * * @@ -3750,9 +3753,11 @@ static PyMethodDef libxmlMethods[] = { {(char *)"xmlParserCtxtSetErrorHandler", libxml_xmlParserCtxtSetErrorHandler, METH_VARARGS, NULL }, {(char *)"xmlParserCtxtGetErrorHandler", libxml_xmlParserCtxtGetErrorHandler, METH_VARARGS, NULL }, {(char *)"xmlFreeParserCtxt", libxml_xmlFreeParserCtxt, METH_VARARGS, NULL }, +#ifdef LIBXML_READER_ENABLED {(char *)"xmlTextReaderSetErrorHandler", libxml_xmlTextReaderSetErrorHandler, METH_VARARGS, NULL }, {(char *)"xmlTextReaderGetErrorHandler", libxml_xmlTextReaderGetErrorHandler, METH_VARARGS, NULL }, {(char *)"xmlFreeTextReader", libxml_xmlFreeTextReader, METH_VARARGS, NULL }, +#endif {(char *)"addLocalCatalog", libxml_addLocalCatalog, METH_VARARGS, NULL }, #ifdef LIBXML_SCHEMAS_ENABLED {(char *)"xmlRelaxNGSetValidErrors", libxml_xmlRelaxNGSetValidErrors, METH_VARARGS, NULL}, diff --git a/python/libxml_wrap.h b/python/libxml_wrap.h index 2758e99..eaa5e96 100644 --- a/python/libxml_wrap.h +++ b/python/libxml_wrap.h @@ -99,6 +99,7 @@ typedef struct { } PyxmlReg_Object; #endif /* LIBXML_REGEXP_ENABLED */ +#ifdef LIBXML_READER_ENABLED #define PyxmlTextReader_Get(v) (((v) == Py_None) ? NULL : \ (((PyxmlTextReader_Object *)(v))->obj)) @@ -114,6 +115,7 @@ typedef struct { PyObject_HEAD xmlTextReaderLocatorPtr obj; } PyxmlTextReaderLocator_Object; +#endif #define PyURI_Get(v) (((v) == Py_None) ? NULL : \ (((PyURI_Object *)(v))->obj)) @@ -229,8 +231,10 @@ PyObject * libxml_xmlParserInputBufferPtrWrap(xmlParserInputBufferPtr buffer); #ifdef LIBXML_REGEXP_ENABLED PyObject * libxml_xmlRegexpPtrWrap(xmlRegexpPtr regexp); #endif /* LIBXML_REGEXP_ENABLED */ +#ifdef LIBXML_READER_ENABLED PyObject * libxml_xmlTextReaderPtrWrap(xmlTextReaderPtr reader); PyObject * libxml_xmlTextReaderLocatorPtrWrap(xmlTextReaderLocatorPtr locator); +#endif xmlXPathObjectPtr libxml_xmlXPathObjectPtrConvert(PyObject * obj); #ifdef LIBXML_SCHEMAS_ENABLED diff --git a/python/setup.py b/python/setup.py index b54da49..723a4c9 100755 --- a/python/setup.py +++ b/python/setup.py @@ -226,7 +226,7 @@ else: setup (name = "libxml2-python", # On *nix, the version number is created from setup.py.in # On windows, it is set by configure.js - version = "2.6.32", + version = "2.7.0", description = descr, author = "Daniel Veillard", author_email = "veillard@redhat.com", diff --git a/python/tests/Makefile.in b/python/tests/Makefile.in index 914e222..d7c00e5 100644 --- a/python/tests/Makefile.in +++ b/python/tests/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. diff --git a/python/types.c b/python/types.c index 80e4304..54b50de 100644 --- a/python/types.c +++ b/python/types.c @@ -720,6 +720,7 @@ libxml_xmlRegexpPtrWrap(xmlRegexpPtr regexp) } #endif /* LIBXML_REGEXP_ENABLED */ +#ifdef LIBXML_READER_ENABLED PyObject * libxml_xmlTextReaderPtrWrap(xmlTextReaderPtr reader) { @@ -755,6 +756,7 @@ libxml_xmlTextReaderLocatorPtrWrap(xmlTextReaderLocatorPtr locator) (char *) "xmlTextReaderLocatorPtr", NULL); return (ret); } +#endif /* LIBXML_READER_ENABLED */ #ifdef LIBXML_SCHEMAS_ENABLED PyObject * diff --git a/relaxng.c b/relaxng.c index 60fdbab..6459769 100644 --- a/relaxng.c +++ b/relaxng.c @@ -6495,6 +6495,8 @@ xmlRelaxNGParseGrammar(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr nodes) ctxt); } + /* @@@@ */ + ctxt->grammar = old; return (ret); } @@ -8812,6 +8814,8 @@ xmlRelaxNGValidateValue(xmlRelaxNGValidCtxtPtr ctxt, } case XML_RELAXNG_REF: case XML_RELAXNG_PARENTREF: + if (define->content == NULL) { + } ret = xmlRelaxNGValidateValue(ctxt, define->content); break; default: diff --git a/runsuite.c b/runsuite.c index 744875c..af8ee5e 100644 --- a/runsuite.c +++ b/runsuite.c @@ -358,7 +358,7 @@ done: if (rng != NULL) xmlRelaxNGFree(rng); xmlResetLastError(); - if ((memt != xmlMemUsed()) && (extraMemoryFromResolver == 0)) { + if ((memt < xmlMemUsed()) && (extraMemoryFromResolver == 0)) { test_log("Validation of tests starting line %ld leaked %d\n", xmlGetLineNo(cur), xmlMemUsed() - memt); nb_leaks++; diff --git a/runtest.c b/runtest.c index b694d56..c7d11fa 100644 --- a/runtest.c +++ b/runtest.c @@ -129,7 +129,7 @@ static int glob(const char *pattern, int flags, int len; if ((pattern == NULL) || (pglob == NULL)) return(-1); - + strncpy(directory, pattern, 499); for (len = strlen(directory);len >= 0;len--) { if (directory[len] == '/') { @@ -141,12 +141,12 @@ static int glob(const char *pattern, int flags, if (len <= 0) len = 0; - + ret = pglob; memset(ret, 0, sizeof(glob_t)); - + hFind = FindFirstFileA(pattern, &FindFileData); - if (hFind == INVALID_HANDLE_VALUE) + if (hFind == INVALID_HANDLE_VALUE) return(0); nb_paths = 20; ret->gl_pathv = (char **) malloc(nb_paths * sizeof(char *)); @@ -181,14 +181,14 @@ done: FindClose(hFind); return(0); } - + static void globfree(glob_t *pglob) { unsigned int i; if (pglob == NULL) return; - + for (i = 0;i < pglob->gl_pathc;i++) { if (pglob->gl_pathv[i] != NULL) free(pglob->gl_pathv[i]); @@ -222,7 +222,7 @@ fatalError(void) { * which is shared to the current running test. We also don't want to have * network downloads modifying tests. */ -static xmlParserInputPtr +static xmlParserInputPtr testExternalEntityLoader(const char *URL, const char *ID, xmlParserCtxtPtr ctxt) { xmlParserInputPtr ret; @@ -234,7 +234,7 @@ testExternalEntityLoader(const char *URL, const char *ID, ret = xmlNoNetExternalEntityLoader(URL, ID, ctxt); extraMemoryFromResolver += xmlMemUsed() - memused; } - + return(ret); } @@ -292,12 +292,12 @@ channel(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) { /** * xmlParserPrintFileContext: * @input: an xmlParserInputPtr input - * + * * Displays current context within the input content for error tracking */ static void -xmlParserPrintFileContextInternal(xmlParserInputPtr input , +xmlParserPrintFileContextInternal(xmlParserInputPtr input , xmlGenericErrorFunc chanl, void *data ) { const xmlChar *cur, *base; unsigned int n, col; /* GCC warns if signed, because compared with sizeof() */ @@ -313,8 +313,8 @@ xmlParserPrintFileContextInternal(xmlParserInputPtr input , } n = 0; /* search backwards for beginning-of-line (to max buff size) */ - while ((n++ < (sizeof(content)-1)) && (cur > base) && - (*(cur) != '\n') && (*(cur) != '\r')) + while ((n++ < (sizeof(content)-1)) && (cur > base) && + (*(cur) != '\n') && (*(cur) != '\r')) cur--; if ((*(cur) == '\n') || (*(cur) == '\r')) cur++; /* calculate the error position in terms of the current position */ @@ -323,8 +323,8 @@ xmlParserPrintFileContextInternal(xmlParserInputPtr input , n = 0; ctnt = content; /* copy selected text to our buffer */ - while ((*cur != 0) && (*(cur) != '\n') && - (*(cur) != '\r') && (n < sizeof(content)-1)) { + while ((*cur != 0) && (*(cur) != '\n') && + (*(cur) != '\r') && (n < sizeof(content)-1)) { *ctnt++ = *cur++; n++; } @@ -573,7 +573,7 @@ static char *resultFilename(const char *filename, const char *out, (filename[4] == '/')) filename = &filename[5]; *************/ - + base = baseFilename(filename); if (suffix == NULL) suffix = ".tmp"; @@ -650,7 +650,7 @@ static int compareFileMem(const char *filename, const char *mem, int size) { int idx = 0; struct stat info; - if (stat(filename, &info) < 0) + if (stat(filename, &info) < 0) return(-1); if (info.st_size != size) return(-1); @@ -661,7 +661,7 @@ static int compareFileMem(const char *filename, const char *mem, int size) { res = read(fd, bytes, 4096); if (res <= 0) break; - if (res + idx > size) + if (res + idx > size) break; if (memcmp(bytes, &mem[idx], res) != 0) { int ix; @@ -683,7 +683,7 @@ static int loadMem(const char *filename, const char **mem, int *size) { struct stat info; char *base; int siz = 0; - if (stat(filename, &info) < 0) + if (stat(filename, &info) < 0) return(-1); base = malloc(info.st_size + 1); if (base == NULL) @@ -893,7 +893,7 @@ resolveEntityDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *publicId, const xm return(NULL); /* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */ - + fprintf(SAXdebug, "SAX.resolveEntity("); if (publicId != NULL) fprintf(SAXdebug, "%s", (char *)publicId); @@ -953,8 +953,8 @@ getParameterEntityDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name) /** * entityDeclDebug: * @ctxt: An XML parser context - * @name: the entity name - * @type: the entity type + * @name: the entity name + * @type: the entity type * @publicId: The public ID of the entity * @systemId: The system ID of the entity * @content: the entity value (without processing). @@ -983,8 +983,8 @@ const xmlChar *nullstr = BAD_CAST "(null)"; /** * attributeDeclDebug: * @ctxt: An XML parser context - * @name: the attribute name - * @type: the attribute type + * @name: the attribute name + * @type: the attribute type * * An attribute definition has been parsed */ @@ -1008,8 +1008,8 @@ attributeDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar * elem, /** * elementDeclDebug: * @ctxt: An XML parser context - * @name: the element name - * @type: the element type + * @name: the element name + * @type: the element type * @content: the element value (without processing). * * An element definition has been parsed @@ -1195,7 +1195,7 @@ charactersDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch, int len) * @ctxt: An XML parser context * @name: The entity name * - * called when an entity reference is detected. + * called when an entity reference is detected. */ static void referenceDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name) @@ -1431,7 +1431,7 @@ startElementNsDebug(void *ctx ATTRIBUTE_UNUSED, else fprintf(SAXdebug, ", '%s'", (char *) URI); fprintf(SAXdebug, ", %d", nb_namespaces); - + if (namespaces != NULL) { for (i = 0;i < nb_namespaces * 2;i++) { fprintf(SAXdebug, ", xmlns"); @@ -1707,7 +1707,7 @@ saxParseTest(const char *filename, const char *result, } else unlink(temp); free(temp); - + /* switch back to structured error handling */ xmlSetGenericErrorFunc(NULL, NULL); xmlSetStructuredErrorFunc(NULL, testStructuredErrorHandler); @@ -1814,7 +1814,7 @@ pushParseTest(const char *filename, const char *result, fprintf(stderr, "Failed to load %s\n", filename); return(-1); } - + #ifdef LIBXML_HTML_ENABLED if (options & XML_PARSE_HTML) ctxt = htmlCreatePushParserCtxt(NULL, NULL, base + cur, 4, filename, @@ -1911,7 +1911,7 @@ memParseTest(const char *filename, const char *result, fprintf(stderr, "Failed to load %s\n", filename); return(-1); } - + doc = xmlReadMemory(base, size, filename, NULL, 0); unloadMem(base); if (doc == NULL) { @@ -2076,8 +2076,8 @@ static void processNode(FILE *out, xmlTextReaderPtr reader) { value = xmlTextReaderConstValue(reader); - - fprintf(out, "%d %d %s %d %d", + + fprintf(out, "%d %d %s %d %d", xmlTextReaderDepth(reader), type, name, @@ -2265,7 +2265,7 @@ static void testXPath(const char *str, int xptr, int expr) { xmlXPathObjectPtr res; xmlXPathContextPtr ctxt; - + nb_tests++; #if defined(LIBXML_XPTR_ENABLED) if (xptr) { @@ -2336,10 +2336,10 @@ xpathCommonTest(const char *filename, const char *result, while (fgets(expression, 4500, input) != NULL) { len = strlen(expression); len--; - while ((len >= 0) && + while ((len >= 0) && ((expression[len] == '\n') || (expression[len] == '\t') || (expression[len] == '\r') || (expression[len] == ' '))) len--; - expression[len + 1] = 0; + expression[len + 1] = 0; if (len >= 0) { fprintf(xpathOutput, "\n========================\nExpression: %s\n", @@ -3217,7 +3217,7 @@ rngTest(const char *filename, * @result: the file with expected result * @err: the file with error messages * - * Parse a set of files with streaming, applying an RNG schemas + * Parse a set of files with streaming, applying an RNG schemas * * Returns 0 in case of success, an error code otherwise */ @@ -3257,7 +3257,7 @@ rngStreamTest(const char *filename, * hack is also done in the Makefile */ if ((!strcmp(prefix, "tutor10_1")) || (!strcmp(prefix, "tutor10_2")) || - (!strcmp(prefix, "tutor3_2")) || (!strcmp(prefix, "307377"))) + (!strcmp(prefix, "tutor3_2")) || (!strcmp(prefix, "307377"))) disable_err = 1; snprintf(pattern, 499, "./test/relaxng/%s_?.xml", prefix); @@ -3321,7 +3321,7 @@ static void patternNode(FILE *out, xmlTextReaderPtr reader, type = xmlTextReaderNodeType(reader); empty = xmlTextReaderIsEmptyElement(reader); - + if (type == XML_READER_TYPE_ELEMENT) { /* do the check only on element start */ match = xmlPatternMatch(patternc, xmlTextReaderCurrentNode(reader)); @@ -3353,9 +3353,9 @@ static void patternNode(FILE *out, xmlTextReaderPtr reader, " pattern %s node %s\n", pattern, path); } - - } + + } if ((type == XML_READER_TYPE_END_ELEMENT) || ((type == XML_READER_TYPE_ELEMENT) && (empty))) { ret = xmlStreamPop(patstream); @@ -3376,7 +3376,7 @@ static void patternNode(FILE *out, xmlTextReaderPtr reader, * @result: the file with expected result * @err: the file with error messages * - * Parse a set of files with streaming, applying an RNG schemas + * Parse a set of files with streaming, applying an RNG schemas * * Returns 0 in case of success, an error code otherwise */ @@ -3525,13 +3525,13 @@ patternTest(const char *filename, ************************************************************************/ static xmlXPathObjectPtr load_xpath_expr (xmlDocPtr parent_doc, const char* filename) { - xmlXPathObjectPtr xpath; + xmlXPathObjectPtr xpath; xmlDocPtr doc; xmlChar *expr; - xmlXPathContextPtr ctx; + xmlXPathContextPtr ctx; xmlNodePtr node; xmlNsPtr ns; - + /* * load XPath expr as a file */ @@ -3543,10 +3543,10 @@ load_xpath_expr (xmlDocPtr parent_doc, const char* filename) { fprintf(stderr, "Error: unable to parse file \"%s\"\n", filename); return(NULL); } - + /* * Check the document is of the right kind - */ + */ if(xmlDocGetRootElement(doc) == NULL) { fprintf(stderr,"Error: empty document for file \"%s\"\n", filename); xmlFreeDoc(doc); @@ -3557,8 +3557,8 @@ load_xpath_expr (xmlDocPtr parent_doc, const char* filename) { while(node != NULL && !xmlStrEqual(node->name, (const xmlChar *)"XPath")) { node = node->next; } - - if(node == NULL) { + + if(node == NULL) { fprintf(stderr,"Error: XPath element expected in the file \"%s\"\n", filename); xmlFreeDoc(doc); return(NULL); @@ -3574,8 +3574,8 @@ load_xpath_expr (xmlDocPtr parent_doc, const char* filename) { ctx = xmlXPathNewContext(parent_doc); if(ctx == NULL) { fprintf(stderr,"Error: unable to create new context\n"); - xmlFree(expr); - xmlFreeDoc(doc); + xmlFree(expr); + xmlFreeDoc(doc); return(NULL); } @@ -3586,31 +3586,31 @@ load_xpath_expr (xmlDocPtr parent_doc, const char* filename) { while(ns != NULL) { if(xmlXPathRegisterNs(ctx, ns->prefix, ns->href) != 0) { fprintf(stderr,"Error: unable to register NS with prefix=\"%s\" and href=\"%s\"\n", ns->prefix, ns->href); - xmlFree(expr); - xmlXPathFreeContext(ctx); - xmlFreeDoc(doc); + xmlFree(expr); + xmlXPathFreeContext(ctx); + xmlFreeDoc(doc); return(NULL); } ns = ns->next; } - /* + /* * Evaluate xpath */ xpath = xmlXPathEvalExpression(expr, ctx); if(xpath == NULL) { fprintf(stderr,"Error: unable to evaluate xpath expression\n"); - xmlFree(expr); - xmlXPathFreeContext(ctx); - xmlFreeDoc(doc); +xmlFree(expr); + xmlXPathFreeContext(ctx); + xmlFreeDoc(doc); return(NULL); } /* print_xpath_nodes(xpath->nodesetval); */ - xmlFree(expr); - xmlXPathFreeContext(ctx); - xmlFreeDoc(doc); + xmlFree(expr); + xmlXPathFreeContext(ctx); + xmlFreeDoc(doc); return(xpath); } @@ -3620,7 +3620,7 @@ load_xpath_expr (xmlDocPtr parent_doc, const char* filename) { #define xxx_growBufferReentrant() { \ buffer_size *= 2; \ buffer = (xmlChar **) \ - xmlRealloc(buffer, buffer_size * sizeof(xmlChar*)); \ + xmlRealloc(buffer, buffer_size * sizeof(xmlChar*)); \ if (buffer == NULL) { \ perror("realloc failed"); \ return(NULL); \ @@ -3654,7 +3654,7 @@ parse_list(xmlChar *str) { return(NULL); } out = buffer; - + while(*str != '\0') { if (out - buffer > buffer_size - 10) { int indx = out - buffer; @@ -3670,12 +3670,12 @@ parse_list(xmlChar *str) { return buffer; } -static int +static int c14nRunTest(const char* xml_filename, int with_comments, int exclusive, const char* xpath_filename, const char *ns_filename, const char* result_file) { xmlDocPtr doc; - xmlXPathObjectPtr xpath = NULL; + xmlXPathObjectPtr xpath = NULL; xmlChar *result = NULL; int ret; xmlChar **inclusive_namespaces = NULL; @@ -3695,24 +3695,24 @@ c14nRunTest(const char* xml_filename, int with_comments, int exclusive, fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_filename); return(-1); } - + /* * Check the document is of the right kind - */ + */ if(xmlDocGetRootElement(doc) == NULL) { fprintf(stderr,"Error: empty document for file \"%s\"\n", xml_filename); xmlFreeDoc(doc); return(-1); } - /* - * load xpath file if specified + /* + * load xpath file if specified */ if(xpath_filename) { xpath = load_xpath_expr(doc, xpath_filename); if(xpath == NULL) { fprintf(stderr,"Error: unable to evaluate xpath expression\n"); - xmlFreeDoc(doc); + xmlFreeDoc(doc); return(-1); } } @@ -3721,7 +3721,7 @@ c14nRunTest(const char* xml_filename, int with_comments, int exclusive, if (loadMem(ns_filename, &nslist, &nssize)) { fprintf(stderr,"Error: unable to evaluate xpath expression\n"); if(xpath != NULL) xmlXPathFreeObject(xpath); - xmlFreeDoc(doc); + xmlFreeDoc(doc); return(-1); } inclusive_namespaces = parse_list((xmlChar *) nslist); @@ -3729,10 +3729,10 @@ c14nRunTest(const char* xml_filename, int with_comments, int exclusive, /* * Canonical form - */ + */ /* fprintf(stderr,"File \"%s\" loaded: start canonization\n", xml_filename); */ - ret = xmlC14NDocDumpMemory(doc, - (xpath) ? xpath->nodesetval : NULL, + ret = xmlC14NDocDumpMemory(doc, + (xpath) ? xpath->nodesetval : NULL, exclusive, inclusive_namespaces, with_comments, &result); if (ret >= 0) { @@ -3746,15 +3746,15 @@ c14nRunTest(const char* xml_filename, int with_comments, int exclusive, fprintf(stderr,"Error: failed to canonicalize XML file \"%s\" (ret=%d)\n", xml_filename, ret); ret = -1; } - + /* * Cleanup - */ + */ if (result != NULL) xmlFree(result); if(xpath != NULL) xmlXPathFreeObject(xpath); if (inclusive_namespaces != NULL) xmlFree(inclusive_namespaces); if (nslist != NULL) free((char *) nslist); - xmlFreeDoc(doc); + xmlFreeDoc(doc); return(ret); } @@ -3903,7 +3903,7 @@ thread_specific_data(void *private_data) return ((void *) Okay); } -#if defined(linux) || defined(solaris) +#if defined(linux) || defined(solaris) || defined(__APPLE_CC__) #include @@ -3917,7 +3917,7 @@ testThread(void) void *results[MAX_ARGC]; int ret; int res = 0; - + xmlInitParser(); for (repeat = 0; repeat < 500; repeat++) { @@ -3993,7 +3993,7 @@ testThread(void) DWORD useless; tid[i] = CreateThread(NULL, 0, - win32_thread_specific_data, + win32_thread_specific_data, (void *) testfiles[i], 0, &useless); if (tid[i] == NULL) { @@ -4091,7 +4091,7 @@ testThread(void) return (-1); } #endif -static int +static int threadsTest(const char *filename ATTRIBUTE_UNUSED, const char *resul ATTRIBUTE_UNUSED, const char *err ATTRIBUTE_UNUSED, @@ -4183,19 +4183,23 @@ testDesc testDescriptions[] = { errParseTest, "./test/XInclude/docs/*", "result/XInclude/", "", NULL, /* Ignore errors at this point ".err", */ XML_PARSE_XINCLUDE }, +#ifdef LIBXML_READER_ENABLED { "XInclude xmlReader regression tests", streamParseTest, "./test/XInclude/docs/*", "result/XInclude/", ".rdr", /* Ignore errors at this point ".err", */ NULL, XML_PARSE_XINCLUDE }, +#endif { "XInclude regression tests stripping include nodes" , errParseTest, "./test/XInclude/docs/*", "result/XInclude/", "", NULL, /* Ignore errors at this point ".err", */ XML_PARSE_XINCLUDE | XML_PARSE_NOXINCNODE }, +#ifdef LIBXML_READER_ENABLED { "XInclude xmlReader regression tests stripping include nodes", streamParseTest, "./test/XInclude/docs/*", "result/XInclude/", ".rdr", /* Ignore errors at this point ".err", */ NULL, XML_PARSE_XINCLUDE | XML_PARSE_NOXINCNODE }, #endif +#endif #ifdef LIBXML_XPATH_ENABLED #ifdef LIBXML_DEBUG_ENABLED { "XPath expressions regression tests" , @@ -4388,7 +4392,6 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { initializeLibxml2(); - for (a = 1; a < argc;a++) { if (!strcmp(argv[a], "-v")) verbose = 1; diff --git a/runxmlconf.c b/runxmlconf.c new file mode 100644 index 0000000..0529058 --- /dev/null +++ b/runxmlconf.c @@ -0,0 +1,603 @@ +/* + * runsuite.c: C program to run libxml2 againts published testsuites + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#ifdef HAVE_CONFIG_H +#include "libxml.h" +#else +#include +#endif + +#if !defined(_WIN32) || defined(__CYGWIN__) +#include +#endif +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#define LOGFILE "runxmlconf.log" +static FILE *logfile = NULL; +static int verbose = 0; + + + +#if defined(_WIN32) && !defined(__CYGWIN__) + +#define vsnprintf _vsnprintf + +#define snprintf _snprintf + +#endif + +const char *skipped_tests[] = { +/* http://lists.w3.org/Archives/Public/public-xml-testsuite/2008Jul/0000.html */ + "rmt-ns10-035", + NULL +}; + +/************************************************************************ + * * + * File name and path utilities * + * * + ************************************************************************/ + +static int checkTestFile(const char *filename) { + struct stat buf; + + if (stat(filename, &buf) == -1) + return(0); + +#if defined(_WIN32) && !defined(__CYGWIN__) + if (!(buf.st_mode & _S_IFREG)) + return(0); +#else + if (!S_ISREG(buf.st_mode)) + return(0); +#endif + + return(1); +} + +static xmlChar *composeDir(const xmlChar *dir, const xmlChar *path) { + char buf[500]; + + if (dir == NULL) return(xmlStrdup(path)); + if (path == NULL) return(NULL); + + snprintf(buf, 500, "%s/%s", (const char *) dir, (const char *) path); + return(xmlStrdup((const xmlChar *) buf)); +} + +/************************************************************************ + * * + * Libxml2 specific routines * + * * + ************************************************************************/ + +static int nb_skipped = 0; +static int nb_tests = 0; +static int nb_errors = 0; +static int nb_leaks = 0; + +/* + * We need to trap calls to the resolver to not account memory for the catalog + * and not rely on any external resources. + */ +static xmlParserInputPtr +testExternalEntityLoader(const char *URL, const char *ID ATTRIBUTE_UNUSED, + xmlParserCtxtPtr ctxt) { + xmlParserInputPtr ret; + + ret = xmlNewInputFromFile(ctxt, (const char *) URL); + + return(ret); +} + +/* + * Trapping the error messages at the generic level to grab the equivalent of + * stderr messages on CLI tools. + */ +static char testErrors[32769]; +static int testErrorsSize = 0; +static int nbError = 0; +static int nbFatal = 0; + +static void test_log(const char *msg, ...) { + va_list args; + if (logfile != NULL) { + fprintf(logfile, "\n------------\n"); + va_start(args, msg); + vfprintf(logfile, msg, args); + va_end(args); + fprintf(logfile, "%s", testErrors); + testErrorsSize = 0; testErrors[0] = 0; + } + if (verbose) { + va_start(args, msg); + vfprintf(stderr, msg, args); + va_end(args); + } +} + +static void +testErrorHandler(void *userData ATTRIBUTE_UNUSED, xmlErrorPtr error) { + int res; + + if (testErrorsSize >= 32768) + return; + res = snprintf(&testErrors[testErrorsSize], + 32768 - testErrorsSize, + "%s:%d: %s\n", (error->file ? error->file : "entity"), + error->line, error->message); + if (error->level == XML_ERR_FATAL) + nbFatal++; + else if (error->level == XML_ERR_ERROR) + nbError++; + if (testErrorsSize + res >= 32768) { + /* buffer is full */ + testErrorsSize = 32768; + testErrors[testErrorsSize] = 0; + } else { + testErrorsSize += res; + } + testErrors[testErrorsSize] = 0; +} + +static xmlXPathContextPtr ctxtXPath; + +static void +initializeLibxml2(void) { + xmlGetWarningsDefaultValue = 0; + xmlPedanticParserDefault(0); + + xmlMemSetup(xmlMemFree, xmlMemMalloc, xmlMemRealloc, xmlMemoryStrdup); + xmlInitParser(); + xmlSetExternalEntityLoader(testExternalEntityLoader); + ctxtXPath = xmlXPathNewContext(NULL); + /* + * Deactivate the cache if created; otherwise we have to create/free it + * for every test, since it will confuse the memory leak detection. + * Note that normally this need not be done, since the cache is not + * created until set explicitely with xmlXPathContextSetCache(); + * but for test purposes it is sometimes usefull to activate the + * cache by default for the whole library. + */ + if (ctxtXPath->cache != NULL) + xmlXPathContextSetCache(ctxtXPath, 0, -1, 0); + xmlSetStructuredErrorFunc(NULL, testErrorHandler); +} + +/************************************************************************ + * * + * Run the xmlconf test if found * + * * + ************************************************************************/ + +static int +xmlconfTestInvalid(const char *id, const char *filename, int options) { + xmlDocPtr doc; + xmlParserCtxtPtr ctxt; + int ret = 1; + + ctxt = xmlNewParserCtxt(); + if (ctxt == NULL) { + test_log("test %s : %s out of memory\n", + id, filename); + return(0); + } + doc = xmlCtxtReadFile(ctxt, filename, NULL, options); + if (doc == NULL) { + test_log("test %s : %s invalid document turned not well-formed too\n", + id, filename); + } else { + /* invalidity should be reported both in the context and in the document */ + if ((ctxt->valid != 0) || (doc->properties & XML_DOC_DTDVALID)) { + test_log("test %s : %s failed to detect invalid document\n", + id, filename); + nb_errors++; + ret = 0; + } + xmlFreeDoc(doc); + } + xmlFreeParserCtxt(ctxt); + return(ret); +} + +static int +xmlconfTestValid(const char *id, const char *filename, int options) { + xmlDocPtr doc; + xmlParserCtxtPtr ctxt; + int ret = 1; + + ctxt = xmlNewParserCtxt(); + if (ctxt == NULL) { + test_log("test %s : %s out of memory\n", + id, filename); + return(0); + } + doc = xmlCtxtReadFile(ctxt, filename, NULL, options); + if (doc == NULL) { + test_log("test %s : %s failed to parse a valid document\n", + id, filename); + nb_errors++; + ret = 0; + } else { + /* validity should be reported both in the context and in the document */ + if ((ctxt->valid == 0) || ((doc->properties & XML_DOC_DTDVALID) == 0)) { + test_log("test %s : %s failed to validate a valid document\n", + id, filename); + nb_errors++; + ret = 0; + } + xmlFreeDoc(doc); + } + xmlFreeParserCtxt(ctxt); + return(ret); +} + +static int +xmlconfTestNotNSWF(const char *id, const char *filename, int options) { + xmlDocPtr doc; + int ret = 1; + + /* + * In case of Namespace errors, libxml2 will still parse the document + * but log a Namesapce error. + */ + doc = xmlReadFile(filename, NULL, options); + if (doc == NULL) { + test_log("test %s : %s failed to parse the XML\n", + id, filename); + nb_errors++; + ret = 0; + } else { + if ((xmlLastError.code == XML_ERR_OK) || + (xmlLastError.domain != XML_FROM_NAMESPACE)) { + test_log("test %s : %s failed to detect namespace error\n", + id, filename); + nb_errors++; + ret = 0; + } + xmlFreeDoc(doc); + } + return(ret); +} + +static int +xmlconfTestNotWF(const char *id, const char *filename, int options) { + xmlDocPtr doc; + int ret = 1; + + doc = xmlReadFile(filename, NULL, options); + if (doc != NULL) { + test_log("test %s : %s failed to detect not well formedness\n", + id, filename); + nb_errors++; + xmlFreeDoc(doc); + ret = 0; + } + return(ret); +} + +static int +xmlconfTestItem(xmlDocPtr doc, xmlNodePtr cur) { + int ret = -1; + xmlChar *type = NULL; + xmlChar *filename = NULL; + xmlChar *uri = NULL; + xmlChar *base = NULL; + xmlChar *id = NULL; + xmlChar *rec = NULL; + xmlChar *version = NULL; + xmlChar *entities = NULL; + xmlChar *edition = NULL; + int options = 0; + int nstest = 0; + int mem, final; + int i; + + testErrorsSize = 0; testErrors[0] = 0; + nbError = 0; + nbFatal = 0; + id = xmlGetProp(cur, BAD_CAST "ID"); + if (id == NULL) { + test_log("test missing ID, line %ld\n", xmlGetLineNo(cur)); + goto error; + } + for (i = 0;skipped_tests[i] != NULL;i++) { + if (!strcmp(skipped_tests[i], (char *) id)) { + test_log("Skipping test %s from skipped list\n", (char *) id); + ret = 0; + nb_skipped++; + goto error; + } + } + type = xmlGetProp(cur, BAD_CAST "TYPE"); + if (type == NULL) { + test_log("test %s missing TYPE\n", (char *) id); + goto error; + } + uri = xmlGetProp(cur, BAD_CAST "URI"); + if (uri == NULL) { + test_log("test %s missing URI\n", (char *) id); + goto error; + } + base = xmlNodeGetBase(doc, cur); + filename = composeDir(base, uri); + if (!checkTestFile((char *) filename)) { + test_log("test %s missing file %s \n", id, + (filename ? (char *)filename : "NULL")); + goto error; + } + + version = xmlGetProp(cur, BAD_CAST "VERSION"); + + entities = xmlGetProp(cur, BAD_CAST "ENTITIES"); + if (!xmlStrEqual(entities, BAD_CAST "none")) { + options |= XML_PARSE_DTDLOAD; + options |= XML_PARSE_NOENT; + } + rec = xmlGetProp(cur, BAD_CAST "RECOMMENDATION"); + if ((rec == NULL) || + (xmlStrEqual(rec, BAD_CAST "XML1.0")) || + (xmlStrEqual(rec, BAD_CAST "XML1.0-errata2e")) || + (xmlStrEqual(rec, BAD_CAST "XML1.0-errata3e")) || + (xmlStrEqual(rec, BAD_CAST "XML1.0-errata4e"))) { + if ((version != NULL) && (!xmlStrEqual(version, BAD_CAST "1.0"))) { + test_log("Skipping test %s for %s\n", (char *) id, + (char *) version); + ret = 0; + nb_skipped++; + goto error; + } + ret = 1; + } else if ((xmlStrEqual(rec, BAD_CAST "NS1.0")) || + (xmlStrEqual(rec, BAD_CAST "NS1.0-errata1e"))) { + ret = 1; + nstest = 1; + } else { + test_log("Skipping test %s for REC %s\n", (char *) id, (char *) rec); + ret = 0; + nb_skipped++; + goto error; + } + edition = xmlGetProp(cur, BAD_CAST "EDITION"); + if ((edition != NULL) && (xmlStrchr(edition, '5') == NULL)) { + /* test limited to all versions before 5th */ + options |= XML_PARSE_OLD10; + } + + /* + * Reset errors and check memory usage before the test + */ + xmlResetLastError(); + testErrorsSize = 0; testErrors[0] = 0; + mem = xmlMemUsed(); + + if (xmlStrEqual(type, BAD_CAST "not-wf")) { + if (nstest == 0) + xmlconfTestNotWF((char *) id, (char *) filename, options); + else + xmlconfTestNotNSWF((char *) id, (char *) filename, options); + } else if (xmlStrEqual(type, BAD_CAST "valid")) { + options |= XML_PARSE_DTDVALID; + xmlconfTestValid((char *) id, (char *) filename, options); + } else if (xmlStrEqual(type, BAD_CAST "invalid")) { + options |= XML_PARSE_DTDVALID; + xmlconfTestInvalid((char *) id, (char *) filename, options); + } else if (xmlStrEqual(type, BAD_CAST "error")) { + test_log("Skipping error test %s \n", (char *) id); + ret = 0; + nb_skipped++; + goto error; + } else { + test_log("test %s unknown TYPE value %s\n", (char *) id, (char *)type); + ret = -1; + goto error; + } + + /* + * Reset errors and check memory usage after the test + */ + xmlResetLastError(); + final = xmlMemUsed(); + if (final > mem) { + test_log("test %s : %s leaked %d bytes\n", + id, filename, final - mem); + nb_leaks++; + xmlMemDisplayLast(logfile, final - mem); + } + nb_tests++; + +error: + if (type != NULL) + xmlFree(type); + if (entities != NULL) + xmlFree(entities); + if (edition != NULL) + xmlFree(edition); + if (version != NULL) + xmlFree(version); + if (filename != NULL) + xmlFree(filename); + if (uri != NULL) + xmlFree(uri); + if (base != NULL) + xmlFree(base); + if (id != NULL) + xmlFree(id); + if (rec != NULL) + xmlFree(rec); + return(ret); +} + +static int +xmlconfTestCases(xmlDocPtr doc, xmlNodePtr cur, int level) { + xmlChar *profile; + int ret = 0; + int tests = 0; + int output = 0; + + if (level == 1) { + profile = xmlGetProp(cur, BAD_CAST "PROFILE"); + if (profile != NULL) { + output = 1; + level++; + printf("Test cases: %s\n", (char *) profile); + xmlFree(profile); + } + } + cur = cur->children; + while (cur != NULL) { + /* look only at elements we ignore everything else */ + if (cur->type == XML_ELEMENT_NODE) { + if (xmlStrEqual(cur->name, BAD_CAST "TESTCASES")) { + ret += xmlconfTestCases(doc, cur, level); + } else if (xmlStrEqual(cur->name, BAD_CAST "TEST")) { + if (xmlconfTestItem(doc, cur) >= 0) + ret++; + tests++; + } else { + fprintf(stderr, "Unhandled element %s\n", (char *)cur->name); + } + } + cur = cur->next; + } + if (output == 1) { + if (tests > 0) + printf("Test cases: %d tests\n", tests); + } + return(ret); +} + +static int +xmlconfTestSuite(xmlDocPtr doc, xmlNodePtr cur) { + xmlChar *profile; + int ret = 0; + + profile = xmlGetProp(cur, BAD_CAST "PROFILE"); + if (profile != NULL) { + printf("Test suite: %s\n", (char *) profile); + xmlFree(profile); + } else + printf("Test suite\n"); + cur = cur->children; + while (cur != NULL) { + /* look only at elements we ignore everything else */ + if (cur->type == XML_ELEMENT_NODE) { + if (xmlStrEqual(cur->name, BAD_CAST "TESTCASES")) { + ret += xmlconfTestCases(doc, cur, 1); + } else { + fprintf(stderr, "Unhandled element %s\n", (char *)cur->name); + } + } + cur = cur->next; + } + return(ret); +} + +static void +xmlconfInfo(void) { + fprintf(stderr, " you need to fetch and extract the\n"); + fprintf(stderr, " latest XML Conformance Test Suites\n"); + fprintf(stderr, " http://www.w3.org/XML/Test/xmlts20080205.tar.gz\n"); + fprintf(stderr, " see http://www.w3.org/XML/Test/ for informations\n"); +} + +static int +xmlconfTest(void) { + const char *confxml = "xmlconf/xmlconf.xml"; + xmlDocPtr doc; + xmlNodePtr cur; + int ret = 0; + + if (!checkTestFile(confxml)) { + fprintf(stderr, "%s is missing \n", confxml); + xmlconfInfo(); + return(-1); + } + doc = xmlReadFile(confxml, NULL, XML_PARSE_NOENT); + if (doc == NULL) { + fprintf(stderr, "%s is corrupted \n", confxml); + xmlconfInfo(); + return(-1); + } + + cur = xmlDocGetRootElement(doc); + if ((cur == NULL) || (!xmlStrEqual(cur->name, BAD_CAST "TESTSUITE"))) { + fprintf(stderr, "Unexpected format %s\n", confxml); + xmlconfInfo(); + ret = -1; + } else { + ret = xmlconfTestSuite(doc, cur); + } + xmlFreeDoc(doc); + return(ret); +} + +/************************************************************************ + * * + * The driver for the tests * + * * + ************************************************************************/ + +int +main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { + int ret = 0; + int old_errors, old_tests, old_leaks; + + logfile = fopen(LOGFILE, "w"); + if (logfile == NULL) { + fprintf(stderr, + "Could not open the log file, running in verbose mode\n"); + verbose = 1; + } + initializeLibxml2(); + + if ((argc >= 2) && (!strcmp(argv[1], "-v"))) + verbose = 1; + + + old_errors = nb_errors; + old_tests = nb_tests; + old_leaks = nb_leaks; + xmlconfTest(); + if ((nb_errors == old_errors) && (nb_leaks == old_leaks)) + printf("Ran %d tests, no errors\n", nb_tests - old_tests); + else + printf("Ran %d tests, %d errors, %d leaks\n", + nb_tests - old_tests, + nb_errors - old_errors, + nb_leaks - old_leaks); + if ((nb_errors == 0) && (nb_leaks == 0)) { + ret = 0; + printf("Total %d tests, no errors\n", + nb_tests); + } else { + ret = 1; + printf("Total %d tests, %d errors, %d leaks\n", + nb_tests, nb_errors, nb_leaks); + printf("See %s for detailed output\n", LOGFILE); + } + xmlXPathFreeContext(ctxtXPath); + xmlCleanupParser(); + xmlMemoryDump(); + + if (logfile != NULL) + fclose(logfile); + return(ret); +} diff --git a/testapi.c b/testapi.c index 8a50e88..037f7e4 100644 --- a/testapi.c +++ b/testapi.c @@ -212,7 +212,7 @@ void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra); name resolution delays, so we use these */ #define REMOTE1GOOD "http://localhost/" -#define REMOTE1BAD "http://missing. example.org/" +#define REMOTE1BAD "http:http://http" #define REMOTE2GOOD "ftp://localhost/foo" #define gen_nb_void_ptr 2 @@ -494,10 +494,11 @@ static void des_xmlParserInputBufferPtr(int no ATTRIBUTE_UNUSED, xmlParserInputB xmlFreeParserInputBuffer(val); } -#define gen_nb_xmlDocPtr 3 +#define gen_nb_xmlDocPtr 4 static xmlDocPtr gen_xmlDocPtr(int no, int nr ATTRIBUTE_UNUSED) { if (no == 0) return(xmlNewDoc(BAD_CAST "1.0")); if (no == 1) return(xmlReadMemory("", 6, "test", NULL, 0)); + if (no == 2) return(xmlReadMemory(" ", 24, "test", NULL, 0)); return(NULL); } static void des_xmlDocPtr(int no ATTRIBUTE_UNUSED, xmlDocPtr val, int nr ATTRIBUTE_UNUSED) { @@ -720,6 +721,23 @@ static void des_xmlExpNodePtr(int no ATTRIBUTE_UNUSED, xmlExpNodePtr val ATTRIBU #endif +#if defined(LIBXML_SCHEMAS_ENABLED) +#define gen_nb_xmlSchemaPtr 1 +static xmlSchemaPtr gen_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, xmlSchemaPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +#define gen_nb_xmlSchemaValidCtxtPtr 1 +static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +#endif /* LIBXML_SCHEMAS_ENABLED */ + #define gen_nb_xmlHashDeallocator 2 static void test_xmlHashDeallocator(void *payload ATTRIBUTE_UNUSED, xmlChar *name ATTRIBUTE_UNUSED) { @@ -1010,11 +1028,12 @@ static xmlAttributeType gen_xmlAttributeType(int no, int nr ATTRIBUTE_UNUSED) { static void des_xmlAttributeType(int no ATTRIBUTE_UNUSED, xmlAttributeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { } -#define gen_nb_xmlBufferAllocationScheme 3 +#define gen_nb_xmlBufferAllocationScheme 4 static xmlBufferAllocationScheme gen_xmlBufferAllocationScheme(int no, int nr ATTRIBUTE_UNUSED) { if (no == 1) return(XML_BUFFER_ALLOC_DOUBLEIT); if (no == 2) return(XML_BUFFER_ALLOC_EXACT); if (no == 3) return(XML_BUFFER_ALLOC_IMMUTABLE); + if (no == 4) return(XML_BUFFER_ALLOC_IO); return(0); } @@ -6164,7 +6183,6 @@ test_xmlCatalogResolve(void) { int test_ret = 0; #if defined(LIBXML_CATALOG_ENABLED) - int mem_base; xmlChar * ret_val; xmlChar * pubID; /* the public ID string */ int n_pubID; @@ -6173,7 +6191,6 @@ test_xmlCatalogResolve(void) { for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) { for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) { - mem_base = xmlMemBlocks(); pubID = gen_const_xmlChar_ptr(n_pubID, 0); sysID = gen_const_xmlChar_ptr(n_sysID, 1); @@ -6183,14 +6200,6 @@ test_xmlCatalogResolve(void) { des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0); des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1); xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlCatalogResolve", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_pubID); - printf(" %d", n_sysID); - printf("\n"); - } } } function_tests++; @@ -9607,11 +9616,78 @@ test_xmlInitializePredefinedEntities(void) { return(test_ret); } + +static int +test_xmlNewEntity(void) { + int test_ret = 0; + + int mem_base; + xmlEntityPtr ret_val; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlChar * name; /* the entity name */ + int n_name; + int type; /* the entity type XML_xxx_yyy_ENTITY */ + int n_type; + xmlChar * ExternalID; /* the entity external ID if available */ + int n_ExternalID; + xmlChar * SystemID; /* the entity system ID if available */ + int n_SystemID; + xmlChar * content; /* the entity content */ + int n_content; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_type = 0;n_type < gen_nb_int;n_type++) { + for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { + for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + type = gen_int(n_type, 2); + ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3); + SystemID = gen_const_xmlChar_ptr(n_SystemID, 4); + content = gen_const_xmlChar_ptr(n_content, 5); + + ret_val = xmlNewEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content); + desret_xmlEntityPtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); + des_int(n_type, type, 2); + des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3); + des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4); + des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewEntity", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_name); + printf(" %d", n_type); + printf(" %d", n_ExternalID); + printf(" %d", n_SystemID); + printf(" %d", n_content); + printf("\n"); + } + } + } + } + } + } + } + function_tests++; + + return(test_ret); +} + static int test_entities(void) { int test_ret = 0; - if (quiet == 0) printf("Testing entities : 12 of 16 functions ...\n"); + if (quiet == 0) printf("Testing entities : 13 of 17 functions ...\n"); test_ret += test_xmlAddDocEntity(); test_ret += test_xmlAddDtdEntity(); test_ret += test_xmlCleanupPredefinedEntities(); @@ -9626,6 +9702,7 @@ test_entities(void) { test_ret += test_xmlGetParameterEntity(); test_ret += test_xmlGetPredefinedEntity(); test_ret += test_xmlInitializePredefinedEntities(); + test_ret += test_xmlNewEntity(); if (test_ret != 0) printf("Module entities: %d errors\n", test_ret); @@ -13136,7 +13213,6 @@ test_xmlIOParseDTD(void) { #if defined(LIBXML_VALID_ENABLED) #ifdef LIBXML_VALID_ENABLED - int mem_base; xmlDtdPtr ret_val; xmlSAXHandlerPtr sax; /* the SAX handler block or NULL */ int n_sax; @@ -13148,7 +13224,6 @@ test_xmlIOParseDTD(void) { for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) { for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { - mem_base = xmlMemBlocks(); sax = gen_xmlSAXHandlerPtr(n_sax, 0); input = gen_xmlParserInputBufferPtr(n_input, 1); enc = gen_xmlCharEncoding(n_enc, 2); @@ -13161,15 +13236,6 @@ test_xmlIOParseDTD(void) { des_xmlParserInputBufferPtr(n_input, input, 1); des_xmlCharEncoding(n_enc, enc, 2); xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlIOParseDTD", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_sax); - printf(" %d", n_input); - printf(" %d", n_enc); - printf("\n"); - } } } } @@ -16294,6 +16360,7 @@ test_xmlPushInput(void) { int test_ret = 0; int mem_base; + int ret_val; xmlParserCtxtPtr ctxt; /* an XML parser context */ int n_ctxt; xmlParserInputPtr input; /* an XML parser input fragment (entity, XML fragment ...). */ @@ -16305,7 +16372,8 @@ test_xmlPushInput(void) { ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); input = gen_xmlParserInputPtr(n_input, 1); - xmlPushInput(ctxt, input); + ret_val = xmlPushInput(ctxt, input); + desret_int(ret_val); call_tests++; des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); des_xmlParserInputPtr(n_input, input, 1); @@ -25899,9 +25967,9 @@ test_xmlValidateAttributeValue(void) { #if defined(LIBXML_VALID_ENABLED) int mem_base; int ret_val; - xmlAttributeType type; /* an attribute type */ + xmlAttributeType type; /* */ int n_type; - xmlChar * value; /* an attribute value */ + xmlChar * value; /* */ int n_value; for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) { @@ -32068,16 +32136,6 @@ test_xmlTextReaderSchemaValidate(void) { return(test_ret); } -#ifdef LIBXML_READER_ENABLED - -#define gen_nb_xmlSchemaValidCtxtPtr 1 -static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - static int test_xmlTextReaderSchemaValidateCtxt(void) { @@ -32184,16 +32242,6 @@ test_xmlTextReaderSetParserProp(void) { return(test_ret); } -#ifdef LIBXML_READER_ENABLED - -#define gen_nb_xmlSchemaPtr 1 -static xmlSchemaPtr gen_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { - return(NULL); -} -static void des_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, xmlSchemaPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { -} -#endif - static int test_xmlTextReaderSetSchema(void) { @@ -33725,13 +33773,13 @@ test_xmlSchemaGetValidErrors(void) { #if defined(LIBXML_SCHEMAS_ENABLED) int mem_base; int ret_val; - xmlSchemaValidCtxtPtr ctxt; /* */ + xmlSchemaValidCtxtPtr ctxt; /* a XML-Schema validation context */ int n_ctxt; - xmlSchemaValidityErrorFunc * err; /* */ + xmlSchemaValidityErrorFunc * err; /* the error function result */ int n_err; - xmlSchemaValidityWarningFunc * warn; /* */ + xmlSchemaValidityWarningFunc * warn; /* the warning function result */ int n_warn; - void ** ctx; /* */ + void ** ctx; /* the functions context result */ int n_ctx; for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { @@ -33780,7 +33828,7 @@ test_xmlSchemaIsValid(void) { #if defined(LIBXML_SCHEMAS_ENABLED) int mem_base; int ret_val; - xmlSchemaValidCtxtPtr ctxt; /* */ + xmlSchemaValidCtxtPtr ctxt; /* the schema validation context */ int n_ctxt; for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { @@ -33973,7 +34021,7 @@ test_xmlSchemaSAXUnplug(void) { #if defined(LIBXML_SCHEMAS_ENABLED) int mem_base; int ret_val; - xmlSchemaSAXPlugPtr plug; /* */ + xmlSchemaSAXPlugPtr plug; /* a data structure returned by xmlSchemaSAXPlug */ int n_plug; for (n_plug = 0;n_plug < gen_nb_xmlSchemaSAXPlugPtr;n_plug++) { @@ -34037,9 +34085,9 @@ test_xmlSchemaSetValidOptions(void) { #if defined(LIBXML_SCHEMAS_ENABLED) int mem_base; int ret_val; - xmlSchemaValidCtxtPtr ctxt; /* */ + xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */ int n_ctxt; - int options; /* */ + int options; /* a combination of xmlSchemaValidOption */ int n_options; for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { @@ -34088,7 +34136,7 @@ test_xmlSchemaValidCtxtGetOptions(void) { #if defined(LIBXML_SCHEMAS_ENABLED) int mem_base; int ret_val; - xmlSchemaValidCtxtPtr ctxt; /* */ + xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */ int n_ctxt; for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { @@ -34115,6 +34163,40 @@ test_xmlSchemaValidCtxtGetOptions(void) { } +static int +test_xmlSchemaValidCtxtGetParserCtxt(void) { + int test_ret = 0; + +#if defined(LIBXML_SCHEMAS_ENABLED) + int mem_base; + xmlParserCtxtPtr ret_val; + xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0); + + ret_val = xmlSchemaValidCtxtGetParserCtxt(ctxt); + desret_xmlParserCtxtPtr(ret_val); + call_tests++; + des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSchemaValidCtxtGetParserCtxt", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + static int test_xmlSchemaValidateDoc(void) { int test_ret = 0; @@ -34122,29 +34204,29 @@ test_xmlSchemaValidateDoc(void) { #if defined(LIBXML_SCHEMAS_ENABLED) int mem_base; int ret_val; - xmlSchemaValidCtxtPtr ctxt; /* */ + xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */ int n_ctxt; - xmlDocPtr instance; /* */ - int n_instance; + xmlDocPtr doc; /* a parsed document tree */ + int n_doc; for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { - for (n_instance = 0;n_instance < gen_nb_xmlDocPtr;n_instance++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { mem_base = xmlMemBlocks(); ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0); - instance = gen_xmlDocPtr(n_instance, 1); + doc = gen_xmlDocPtr(n_doc, 1); - ret_val = xmlSchemaValidateDoc(ctxt, instance); + ret_val = xmlSchemaValidateDoc(ctxt, doc); desret_int(ret_val); call_tests++; des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0); - des_xmlDocPtr(n_instance, instance, 1); + des_xmlDocPtr(n_doc, doc, 1); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { printf("Leak of %d blocks found in xmlSchemaValidateDoc", xmlMemBlocks() - mem_base); test_ret++; printf(" %d", n_ctxt); - printf(" %d", n_instance); + printf(" %d", n_doc); printf("\n"); } } @@ -34163,11 +34245,11 @@ test_xmlSchemaValidateFile(void) { #if defined(LIBXML_SCHEMAS_ENABLED) int mem_base; int ret_val; - xmlSchemaValidCtxtPtr ctxt; /* */ + xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */ int n_ctxt; - const char * filename; /* */ + const char * filename; /* the URI of the instance */ int n_filename; - int options; /* */ + int options; /* a future set of options, currently unused */ int n_options; for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { @@ -34211,9 +34293,9 @@ test_xmlSchemaValidateOneElement(void) { #if defined(LIBXML_SCHEMAS_ENABLED) int mem_base; int ret_val; - xmlSchemaValidCtxtPtr ctxt; /* */ + xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */ int n_ctxt; - xmlNodePtr elem; /* */ + xmlNodePtr elem; /* an element node */ int n_elem; for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { @@ -34252,15 +34334,15 @@ test_xmlSchemaValidateStream(void) { #if defined(LIBXML_SCHEMAS_ENABLED) int mem_base; int ret_val; - xmlSchemaValidCtxtPtr ctxt; /* */ + xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */ int n_ctxt; - xmlParserInputBufferPtr input; /* */ + xmlParserInputBufferPtr input; /* the input to use for reading the data */ int n_input; - xmlCharEncoding enc; /* */ + xmlCharEncoding enc; /* an optional encoding information */ int n_enc; - xmlSAXHandlerPtr sax; /* */ + xmlSAXHandlerPtr sax; /* a SAX handler for the resulting events */ int n_sax; - void * user_data; /* */ + void * user_data; /* the context to provide to the SAX handler. */ int n_user_data; for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { @@ -34310,7 +34392,7 @@ static int test_xmlschemas(void) { int test_ret = 0; - if (quiet == 0) printf("Testing xmlschemas : 14 of 24 functions ...\n"); + if (quiet == 0) printf("Testing xmlschemas : 15 of 25 functions ...\n"); test_ret += test_xmlSchemaDump(); test_ret += test_xmlSchemaGetParserErrors(); test_ret += test_xmlSchemaGetValidErrors(); @@ -34328,6 +34410,7 @@ test_xmlschemas(void) { test_ret += test_xmlSchemaSetValidOptions(); test_ret += test_xmlSchemaSetValidStructuredErrors(); test_ret += test_xmlSchemaValidCtxtGetOptions(); + test_ret += test_xmlSchemaValidCtxtGetParserCtxt(); test_ret += test_xmlSchemaValidateDoc(); test_ret += test_xmlSchemaValidateFile(); test_ret += test_xmlSchemaValidateOneElement(); diff --git a/testchar.c b/testchar.c new file mode 100644 index 0000000..3bfd9c0 --- /dev/null +++ b/testchar.c @@ -0,0 +1,615 @@ +/** + * Test the UTF-8 decoding routines + * + * author: Daniel Veillard + * copy: see Copyright for the status of this software. + */ + +#include +#include +#include +#include + +int lastError; + +static void errorHandler(void *unused, xmlErrorPtr err) { + if ((unused == NULL) && (err != NULL) && (lastError == 0)) { + lastError = err->code; + } +} + +char document1[100] = "XXXX"; +char document2[100] = ""; + +static void testDocumentRangeByte1(xmlParserCtxtPtr ctxt, char *document, + int len, char *data, int forbid1, int forbid2) { + int i; + xmlDocPtr res; + + for (i = 0;i <= 0xFF;i++) { + lastError = 0; + xmlCtxtReset(ctxt); + + data[0] = i; + + res = xmlReadMemory(document, len, "test", NULL, 0); + + if ((i == forbid1) || (i == forbid2)) { + if ((lastError == 0) || (res != NULL)) + fprintf(stderr, + "Failed to detect invalid char for Byte 0x%02X: %c\n", + i, i); + } + + else if ((i == '<') || (i == '&')) { + if ((lastError == 0) || (res != NULL)) + fprintf(stderr, + "Failed to detect illegal char %c for Byte 0x%02X\n", i, i); + } + else if (((i < 0x20) || (i >= 0x80)) && + (i != 0x9) && (i != 0xA) && (i != 0xD)) { + if ((lastError != XML_ERR_INVALID_CHAR) && (res != NULL)) + fprintf(stderr, + "Failed to detect invalid char for Byte 0x%02X\n", i); + } + else if (res == NULL) { + fprintf(stderr, + "Failed to parse valid char for Byte 0x%02X : %c\n", i, i); + } + if (res != NULL) + xmlFreeDoc(res); + } +} + +static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document, + int len, char *data) { + int i, j; + xmlDocPtr res; + + for (i = 0x80;i <= 0xFF;i++) { + for (j = 0;j <= 0xFF;j++) { + lastError = 0; + xmlCtxtReset(ctxt); + + data[0] = i; + data[1] = j; + + res = xmlReadMemory(document, len, "test", NULL, 0); + + /* if first bit of first char is set, then second bit must too */ + if ((i & 0x80) && ((i & 0x40) == 0)) { + if ((lastError == 0) || (res != NULL)) + fprintf(stderr, + "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n", + i, j); + } + + /* + * if first bit of first char is set, then second char first + * bits must be 10 + */ + else if ((i & 0x80) && ((j & 0xC0) != 0x80)) { + if ((lastError == 0) || (res != NULL)) + fprintf(stderr, + "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n", + i, j); + } + + /* + * if using a 2 byte encoding then the value must be greater + * than 0x80, i.e. one of bits 5 to 1 of i must be set + */ + else if ((i & 0x80) && ((i & 0x1E) == 0)) { + if ((lastError == 0) || (res != NULL)) + fprintf(stderr, + "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n", + i, j); + } + + /* + * if third bit of first char is set, then the sequence would need + * at least 3 bytes, but we give only 2 ! + */ + else if ((i & 0xE0) == 0xE0) { + if ((lastError == 0) || (res != NULL)) + fprintf(stderr, + "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x00\n", + i, j); + } + + /* + * We should see no error in remaning cases + */ + else if ((lastError != 0) || (res == NULL)) { + fprintf(stderr, + "Failed to parse document for Bytes 0x%02X 0x%02X\n", i, j); + } + if (res != NULL) + xmlFreeDoc(res); + } + } +} + +/** + * testDocumentRanges: + * + * Test the correct UTF8 character parsing in context of XML documents + * Those are in-context injection tests checking the parser behaviour on + * edge case values at different point in content, beginning and end of + * CDATA in text or in attribute values. + */ + +static void testDocumentRanges(void) { + xmlParserCtxtPtr ctxt; + char *data; + + /* + * Set up a parsing context using the first document as + * the current input source. + */ + ctxt = xmlNewParserCtxt(); + if (ctxt == NULL) { + fprintf(stderr, "Failed to allocate parser context\n"); + return; + } + + printf("testing 1 byte char in document: 1"); + fflush(stdout); + data = &document1[5]; + data[0] = ' '; + data[1] = ' '; + data[2] = ' '; + data[3] = ' '; + /* test 1 byte injection at beginning of area */ + testDocumentRangeByte1(ctxt, &document1[0], strlen(document1), + data, -1, -1); + printf(" 2"); + fflush(stdout); + data[0] = ' '; + data[1] = ' '; + data[2] = ' '; + data[3] = ' '; + /* test 1 byte injection at end of area */ + testDocumentRangeByte1(ctxt, &document1[0], strlen(document1), + data + 3, -1, -1); + + printf(" 3"); + fflush(stdout); + data = &document2[10]; + data[0] = ' '; + data[1] = ' '; + data[2] = ' '; + data[3] = ' '; + /* test 1 byte injection at beginning of area */ + testDocumentRangeByte1(ctxt, &document2[0], strlen(document2), + data, '\'', -1); + printf(" 4"); + fflush(stdout); + data[0] = ' '; + data[1] = ' '; + data[2] = ' '; + data[3] = ' '; + /* test 1 byte injection at end of area */ + testDocumentRangeByte1(ctxt, &document2[0], strlen(document2), + data + 3, '\'', -1); + printf(" done\n"); + + printf("testing 2 byte char in document: 1"); + fflush(stdout); + data = &document1[5]; + data[0] = ' '; + data[1] = ' '; + data[2] = ' '; + data[3] = ' '; + /* test 2 byte injection at beginning of area */ + testDocumentRangeByte2(ctxt, &document1[0], strlen(document1), + data); + printf(" 2"); + fflush(stdout); + data[0] = ' '; + data[1] = ' '; + data[2] = ' '; + data[3] = ' '; + /* test 2 byte injection at end of area */ + testDocumentRangeByte2(ctxt, &document1[0], strlen(document1), + data + 2); + + printf(" 3"); + fflush(stdout); + data = &document2[10]; + data[0] = ' '; + data[1] = ' '; + data[2] = ' '; + data[3] = ' '; + /* test 2 byte injection at beginning of area */ + testDocumentRangeByte2(ctxt, &document2[0], strlen(document2), + data); + printf(" 4"); + fflush(stdout); + data[0] = ' '; + data[1] = ' '; + data[2] = ' '; + data[3] = ' '; + /* test 2 byte injection at end of area */ + testDocumentRangeByte2(ctxt, &document2[0], strlen(document2), + data + 2); + printf(" done\n"); + + xmlFreeParserCtxt(ctxt); +} + +static void testCharRangeByte1(xmlParserCtxtPtr ctxt, char *data) { + int i = 0; + int len, c; + + data[1] = 0; + data[2] = 0; + data[3] = 0; + for (i = 0;i <= 0xFF;i++) { + data[0] = i; + ctxt->charset = XML_CHAR_ENCODING_UTF8; + + lastError = 0; + c = xmlCurrentChar(ctxt, &len); + if ((i == 0) || (i >= 0x80)) { + /* we must see an error there */ + if (lastError != XML_ERR_INVALID_CHAR) + fprintf(stderr, + "Failed to detect invalid char for Byte 0x%02X\n", i); + } else if (i == 0xD) { + if ((c != 0xA) || (len != 1)) + fprintf(stderr, "Failed to convert char for Byte 0x%02X\n", i); + } else if ((c != i) || (len != 1)) { + fprintf(stderr, "Failed to parse char for Byte 0x%02X\n", i); + } + } +} + +static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) { + int i, j; + int len, c; + + data[2] = 0; + data[3] = 0; + for (i = 0x80;i <= 0xFF;i++) { + for (j = 0;j <= 0xFF;j++) { + data[0] = i; + data[1] = j; + ctxt->charset = XML_CHAR_ENCODING_UTF8; + + lastError = 0; + c = xmlCurrentChar(ctxt, &len); + + /* if first bit of first char is set, then second bit must too */ + if ((i & 0x80) && ((i & 0x40) == 0)) { + if (lastError != XML_ERR_INVALID_CHAR) + fprintf(stderr, + "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n", + i, j); + } + + /* + * if first bit of first char is set, then second char first + * bits must be 10 + */ + else if ((i & 0x80) && ((j & 0xC0) != 0x80)) { + if (lastError != XML_ERR_INVALID_CHAR) + fprintf(stderr, + "Failed to detect invalid char for Bytes 0x%02X 0x%02X: %d\n", + i, j, c); + } + + /* + * if using a 2 byte encoding then the value must be greater + * than 0x80, i.e. one of bits 5 to 1 of i must be set + */ + else if ((i & 0x80) && ((i & 0x1E) == 0)) { + if (lastError != XML_ERR_INVALID_CHAR) + fprintf(stderr, + "Failed to detect invalid char for Bytes 0x%02X 0x%02X: %d\n", + i, j, c); + } + + /* + * if third bit of first char is set, then the sequence would need + * at least 3 bytes, but we give only 2 ! + */ + else if ((i & 0xE0) == 0xE0) { + if (lastError != XML_ERR_INVALID_CHAR) + fprintf(stderr, + "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x00\n", + i, j); + } + + /* + * We should see no error in remaning cases + */ + else if ((lastError != 0) || (len != 2)) { + fprintf(stderr, + "Failed to parse char for Bytes 0x%02X 0x%02X\n", i, j); + } + + /* + * Finally check the value is right + */ + else if (c != (j & 0x3F) + ((i & 0x1F) << 6)) { + fprintf(stderr, + "Failed to parse char for Bytes 0x%02X 0x%02X: expect %d got %d\n", + i, j, ((j & 0x3F) + ((i & 0x1F) << 6)), c); + } + } + } +} + +static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) { + int i, j, k, K; + int len, c; + unsigned char lows[6] = {0, 0x80, 0x81, 0xC1, 0xFF, 0xBF}; + int value; + + data[3] = 0; + for (i = 0xE0;i <= 0xFF;i++) { + for (j = 0;j <= 0xFF;j++) { + for (k = 0;k < 6;k++) { + data[0] = i; + data[1] = j; + K = lows[k]; + data[2] = (char) K; + value = (K & 0x3F) + ((j & 0x3F) << 6) + ((i & 0xF) << 12); + ctxt->charset = XML_CHAR_ENCODING_UTF8; + + lastError = 0; + c = xmlCurrentChar(ctxt, &len); + + /* + * if fourth bit of first char is set, then the sequence would need + * at least 4 bytes, but we give only 3 ! + */ + if ((i & 0xF0) == 0xF0) { + if (lastError != XML_ERR_INVALID_CHAR) + fprintf(stderr, + "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n", + i, j, K, data[3]); + } + + /* + * The second and the third bytes must start with 10 + */ + else if (((j & 0xC0) != 0x80) || ((K & 0xC0) != 0x80)) { + if (lastError != XML_ERR_INVALID_CHAR) + fprintf(stderr, + "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X\n", + i, j, K); + } + + /* + * if using a 3 byte encoding then the value must be greater + * than 0x800, i.e. one of bits 4 to 0 of i must be set or + * the 6th byte of data[1] must be set + */ + else if (((i & 0xF) == 0) && ((j & 0x20) == 0)) { + if (lastError != XML_ERR_INVALID_CHAR) + fprintf(stderr, + "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X\n", + i, j, K); + } + + /* + * There are values in that range that are not allowed in XML-1.0 + */ + else if (((value > 0xD7FF) && (value <0xE000)) || + ((value > 0xFFFD) && (value <0x10000))) { + if (lastError != XML_ERR_INVALID_CHAR) + fprintf(stderr, + "Failed to detect invalid char 0x%04X for Bytes 0x%02X 0x%02X 0x%02X\n", + value, i, j, K); + } + + /* + * We should see no error in remaining cases + */ + else if ((lastError != 0) || (len != 3)) { + fprintf(stderr, + "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X\n", + i, j, K); + } + + /* + * Finally check the value is right + */ + else if (c != value) { + fprintf(stderr, + "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X: expect %d got %d\n", + i, j, data[2], value, c); + } + } + } + } +} + +static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) { + int i, j, k, K, l, L; + int len, c; + unsigned char lows[6] = {0, 0x80, 0x81, 0xC1, 0xFF, 0xBF}; + int value; + + data[4] = 0; + for (i = 0xF0;i <= 0xFF;i++) { + for (j = 0;j <= 0xFF;j++) { + for (k = 0;k < 6;k++) { + for (l = 0;l < 6;l++) { + data[0] = i; + data[1] = j; + K = lows[k]; + data[2] = (char) K; + L = lows[l]; + data[3] = (char) L; + value = (L & 0x3F) + ((K & 0x3F) << 6) + ((j & 0x3F) << 12) + + ((i & 0x7) << 18); + ctxt->charset = XML_CHAR_ENCODING_UTF8; + + lastError = 0; + c = xmlCurrentChar(ctxt, &len); + + /* + * if fifth bit of first char is set, then the sequence would need + * at least 5 bytes, but we give only 4 ! + */ + if ((i & 0xF8) == 0xF8) { + if (lastError != XML_ERR_INVALID_CHAR) + fprintf(stderr, + "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n", + i, j, K, data[3]); + } + + /* + * The second, third and fourth bytes must start with 10 + */ + else if (((j & 0xC0) != 0x80) || ((K & 0xC0) != 0x80) || + ((L & 0xC0) != 0x80)) { + if (lastError != XML_ERR_INVALID_CHAR) + fprintf(stderr, + "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n", + i, j, K, L); + } + + /* + * if using a 3 byte encoding then the value must be greater + * than 0x10000, i.e. one of bits 3 to 0 of i must be set or + * the 6 or 5th byte of j must be set + */ + else if (((i & 0x7) == 0) && ((j & 0x30) == 0)) { + if (lastError != XML_ERR_INVALID_CHAR) + fprintf(stderr, + "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n", + i, j, K, L); + } + + /* + * There are values in that range that are not allowed in XML-1.0 + */ + else if (((value > 0xD7FF) && (value <0xE000)) || + ((value > 0xFFFD) && (value <0x10000)) || + (value > 0x10FFFF)) { + if (lastError != XML_ERR_INVALID_CHAR) + fprintf(stderr, +"Failed to detect invalid char 0x%04X for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n", + value, i, j, K, L); + } + + /* + * We should see no error in remaining cases + */ + else if ((lastError != 0) || (len != 4)) { + fprintf(stderr, + "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X\n", + i, j, K); + } + + /* + * Finally check the value is right + */ + else if (c != value) { + fprintf(stderr, + "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X: expect %d got %d\n", + i, j, data[2], value, c); + } + } + } + } + } +} + +/** + * testCharRanges: + * + * Test the correct UTF8 character parsing in isolation i.e. + * not when parsing a full document, this is less expensive and we can + * cover the full range of UTF-8 chars accepted by XML-1.0 + */ + +static void testCharRanges(void) { + char data[5]; + xmlParserCtxtPtr ctxt; + xmlParserInputBufferPtr buf; + xmlParserInputPtr input; + + memset(data, 0, 5); + + /* + * Set up a parsing context using the above data buffer as + * the current input source. + */ + ctxt = xmlNewParserCtxt(); + if (ctxt == NULL) { + fprintf(stderr, "Failed to allocate parser context\n"); + return; + } + buf = xmlParserInputBufferCreateStatic(data, sizeof(data), + XML_CHAR_ENCODING_NONE); + if (buf == NULL) { + fprintf(stderr, "Failed to allocate input buffer\n"); + goto error; + } + input = xmlNewInputStream(ctxt); + if (input == NULL) { + xmlFreeParserInputBuffer(buf); + goto error; + } + input->filename = NULL; + input->buf = buf; + input->base = input->buf->buffer->content; + input->cur = input->buf->buffer->content; + input->end = &input->buf->buffer->content[4]; + inputPush(ctxt, input); + + printf("testing char range: 1"); + fflush(stdout); + testCharRangeByte1(ctxt, data); + printf(" 2"); + fflush(stdout); + testCharRangeByte2(ctxt, data); + printf(" 3"); + fflush(stdout); + testCharRangeByte3(ctxt, data); + printf(" 4"); + fflush(stdout); + testCharRangeByte4(ctxt, data); + printf(" done\n"); + fflush(stdout); + +error: + xmlFreeParserCtxt(ctxt); +} + +int main(void) { + + /* + * this initialize the library and check potential ABI mismatches + * between the version it was compiled for and the actual shared + * library used. + */ + LIBXML_TEST_VERSION + + /* + * Catch errors separately + */ + + xmlSetStructuredErrorFunc(NULL, errorHandler); + + /* + * Run the tests + */ + testCharRanges(); + testDocumentRanges(); + + /* + * Cleanup function for the XML library. + */ + xmlCleanupParser(); + /* + * this is to debug memory for regression tests + */ + xmlMemoryDump(); + return(0); +} diff --git a/testdict.c b/testdict.c new file mode 100644 index 0000000..4e8581f --- /dev/null +++ b/testdict.c @@ -0,0 +1,444 @@ +#include +#include +#include + +/* #define WITH_PRINT */ + +static const char *seeds1[] = { + "a", "b", "c", + "d", "e", "f", + "g", "h", "i", + "j", "k", "l", + + NULL +}; + +static const char *seeds2[] = { + "m", "n", "o", + "p", "q", "r", + "s", "t", "u", + "v", "w", "x", + + NULL +}; + +#define NB_STRINGS_NS 100 +#define NB_STRINGS_MAX 10000 +#define NB_STRINGS_MIN 10 + +static xmlChar *strings1[NB_STRINGS_MAX]; +static xmlChar *strings2[NB_STRINGS_MAX]; +static const xmlChar *test1[NB_STRINGS_MAX]; +static const xmlChar *test2[NB_STRINGS_MAX]; +static int nbErrors = 0; + +static void fill_strings(void) { + int i, j, k; + + /* + * That's a bit nasty but the output is fine and it doesn't take hours + * there is a small but sufficient number of duplicates, and we have + * ":xxx" and full QNames in the last NB_STRINGS_NS values + */ + for (i = 0; seeds1[i] != NULL; i++) { + strings1[i] = xmlStrdup((const xmlChar *) seeds1[i]); + if (strings1[i] == NULL) { + fprintf(stderr, "Out of memory while generating strings1\n"); + exit(1); + } + } + for (j = 0, k = 0;i < NB_STRINGS_MAX - NB_STRINGS_NS;i++,j++) { + strings1[i] = xmlStrncatNew(strings1[j], strings1[k], -1); + if (strings1[i] == NULL) { + fprintf(stderr, "Out of memory while generating strings1\n"); + exit(1); + } + if (j >= 50) { + j = 0; + k++; + } + } + for (j = 0; (j < 50) && (i < NB_STRINGS_MAX); i++, j+=2) { + strings1[i] = xmlStrncatNew(strings1[j], (const xmlChar *) ":", -1); + if (strings1[i] == NULL) { + fprintf(stderr, "Out of memory while generating strings1\n"); + exit(1); + } + } + for (j = NB_STRINGS_MAX - NB_STRINGS_NS, k = 0; + i < NB_STRINGS_MAX;i++,j++) { + strings1[i] = xmlStrncatNew(strings1[j], strings1[k], -1); + if (strings1[i] == NULL) { + fprintf(stderr, "Out of memory while generating strings1\n"); + exit(1); + } + k += 3; + if (k >= 50) k = 0; + } + + /* + * Now do the same with the second pool of strings + */ + for (i = 0; seeds2[i] != NULL; i++) { + strings2[i] = xmlStrdup((const xmlChar *) seeds2[i]); + if (strings2[i] == NULL) { + fprintf(stderr, "Out of memory while generating strings2\n"); + exit(1); + } + } + for (j = 0, k = 0;i < NB_STRINGS_MAX - NB_STRINGS_NS;i++,j++) { + strings2[i] = xmlStrncatNew(strings2[j], strings2[k], -1); + if (strings2[i] == NULL) { + fprintf(stderr, "Out of memory while generating strings2\n"); + exit(1); + } + if (j >= 50) { + j = 0; + k++; + } + } + for (j = 0; (j < 50) && (i < NB_STRINGS_MAX); i++, j+=2) { + strings2[i] = xmlStrncatNew(strings2[j], (const xmlChar *) ":", -1); + if (strings2[i] == NULL) { + fprintf(stderr, "Out of memory while generating strings2\n"); + exit(1); + } + } + for (j = NB_STRINGS_MAX - NB_STRINGS_NS, k = 0; + i < NB_STRINGS_MAX;i++,j++) { + strings2[i] = xmlStrncatNew(strings2[j], strings2[k], -1); + if (strings2[i] == NULL) { + fprintf(stderr, "Out of memory while generating strings2\n"); + exit(1); + } + k += 3; + if (k >= 50) k = 0; + } + +} + +#ifdef WITH_PRINT +static void print_strings(void) { + int i; + + for (i = 0; i < NB_STRINGS_MAX;i++) { + printf("%s\n", strings1[i]); + } + for (i = 0; i < NB_STRINGS_MAX;i++) { + printf("%s\n", strings2[i]); + } +} +#endif + +static void clean_strings(void) { + int i; + + for (i = 0; i < NB_STRINGS_MAX; i++) { + if (strings1[i] != NULL) /* really should not happen */ + xmlFree(strings1[i]); + } + for (i = 0; i < NB_STRINGS_MAX; i++) { + if (strings2[i] != NULL) /* really should not happen */ + xmlFree(strings2[i]); + } +} + +/* + * This tests the sub-dictionary support + */ +static int run_test2(xmlDictPtr parent) { + int i, j; + xmlDictPtr dict; + int ret = 0; + xmlChar prefix[40]; + xmlChar *cur, *pref; + const xmlChar *tmp; + + dict = xmlDictCreateSub(parent); + if (dict == NULL) { + fprintf(stderr, "Out of memory while creating sub-dictionary\n"); + exit(1); + } + memset(test2, 0, sizeof(test2)); + + /* + * Fill in NB_STRINGS_MIN, at this point the dictionary should not grow + * and we allocate all those doing the fast key computations + * All the strings are based on a different seeds subset so we know + * they are allocated in the main dictionary, not coming from the parent + */ + for (i = 0;i < NB_STRINGS_MIN;i++) { + test2[i] = xmlDictLookup(dict, strings2[i], -1); + if (test2[i] == NULL) { + fprintf(stderr, "Failed lookup for '%s'\n", strings2[i]); + ret = 1; + nbErrors++; + } + } + j = NB_STRINGS_MAX - NB_STRINGS_NS; + /* ":foo" like strings2 */ + for (i = 0;i < NB_STRINGS_MIN;i++, j++) { + test2[j] = xmlDictLookup(dict, strings2[j], xmlStrlen(strings2[j])); + if (test2[j] == NULL) { + fprintf(stderr, "Failed lookup for '%s'\n", strings2[j]); + ret = 1; + nbErrors++; + } + } + /* "a:foo" like strings2 */ + j = NB_STRINGS_MAX - NB_STRINGS_MIN; + for (i = 0;i < NB_STRINGS_MIN;i++, j++) { + test2[j] = xmlDictLookup(dict, strings2[j], xmlStrlen(strings2[j])); + if (test2[j] == NULL) { + fprintf(stderr, "Failed lookup for '%s'\n", strings2[j]); + ret = 1; + nbErrors++; + } + } + + /* + * At this point allocate all the strings + * the dictionary will grow in the process, reallocate more string tables + * and switch to the better key generator + */ + for (i = 0;i < NB_STRINGS_MAX;i++) { + if (test2[i] != NULL) + continue; + test2[i] = xmlDictLookup(dict, strings2[i], -1); + if (test2[i] == NULL) { + fprintf(stderr, "Failed lookup for '%s'\n", strings2[i]); + ret = 1; + nbErrors++; + } + } + + /* + * Now we can start to test things, first that all strings2 belongs to + * the dict, and that none of them was actually allocated in the parent + */ + for (i = 0;i < NB_STRINGS_MAX;i++) { + if (!xmlDictOwns(dict, test2[i])) { + fprintf(stderr, "Failed ownership failure for '%s'\n", + strings2[i]); + ret = 1; + nbErrors++; + } + if (xmlDictOwns(parent, test2[i])) { + fprintf(stderr, "Failed parent ownership failure for '%s'\n", + strings2[i]); + ret = 1; + nbErrors++; + } + } + + /* + * Also verify that all strings from the parent are seen from the subdict + */ + for (i = 0;i < NB_STRINGS_MAX;i++) { + if (!xmlDictOwns(dict, test1[i])) { + fprintf(stderr, "Failed sub-ownership failure for '%s'\n", + strings1[i]); + ret = 1; + nbErrors++; + } + } + + /* + * Then that another lookup to the string in sub will return the same + */ + for (i = 0;i < NB_STRINGS_MAX;i++) { + if (xmlDictLookup(dict, strings2[i], -1) != test2[i]) { + fprintf(stderr, "Failed re-lookup check for %d, '%s'\n", + i, strings2[i]); + ret = 1; + nbErrors++; + } + } + /* + * But also that any lookup for a string in the parent will be provided + * as in the parent + */ + for (i = 0;i < NB_STRINGS_MAX;i++) { + if (xmlDictLookup(dict, strings1[i], -1) != test1[i]) { + fprintf(stderr, "Failed parent string lookup check for %d, '%s'\n", + i, strings1[i]); + ret = 1; + nbErrors++; + } + } + + /* + * check the QName lookups + */ + for (i = NB_STRINGS_MAX - NB_STRINGS_NS;i < NB_STRINGS_MAX;i++) { + cur = strings2[i]; + pref = &prefix[0]; + while (*cur != ':') *pref++ = *cur++; + cur++; + *pref = 0; + tmp = xmlDictQLookup(dict, &prefix[0], cur); + if (xmlDictQLookup(dict, &prefix[0], cur) != test2[i]) { + fprintf(stderr, "Failed lookup check for '%s':'%s'\n", + &prefix[0], cur); + ret = 1; + nbErrors++; + } + } + /* + * check the QName lookups for strings from the parent + */ + for (i = NB_STRINGS_MAX - NB_STRINGS_NS;i < NB_STRINGS_MAX;i++) { + cur = strings1[i]; + pref = &prefix[0]; + while (*cur != ':') *pref++ = *cur++; + cur++; + *pref = 0; + tmp = xmlDictQLookup(dict, &prefix[0], cur); + if (xmlDictQLookup(dict, &prefix[0], cur) != test1[i]) { + fprintf(stderr, "Failed parent lookup check for '%s':'%s'\n", + &prefix[0], cur); + ret = 1; + nbErrors++; + } + } + + xmlDictFree(dict); + return(ret); +} + +/* + * Test a single dictionary + */ +static int run_test1(void) { + int i, j; + xmlDictPtr dict; + int ret = 0; + xmlChar prefix[40]; + xmlChar *cur, *pref; + const xmlChar *tmp; + + dict = xmlDictCreate(); + if (dict == NULL) { + fprintf(stderr, "Out of memory while creating dictionary\n"); + exit(1); + } + memset(test1, 0, sizeof(test1)); + + /* + * Fill in NB_STRINGS_MIN, at this point the dictionary should not grow + * and we allocate all those doing the fast key computations + */ + for (i = 0;i < NB_STRINGS_MIN;i++) { + test1[i] = xmlDictLookup(dict, strings1[i], -1); + if (test1[i] == NULL) { + fprintf(stderr, "Failed lookup for '%s'\n", strings1[i]); + ret = 1; + nbErrors++; + } + } + j = NB_STRINGS_MAX - NB_STRINGS_NS; + /* ":foo" like strings1 */ + for (i = 0;i < NB_STRINGS_MIN;i++, j++) { + test1[j] = xmlDictLookup(dict, strings1[j], xmlStrlen(strings1[j])); + if (test1[j] == NULL) { + fprintf(stderr, "Failed lookup for '%s'\n", strings1[j]); + ret = 1; + nbErrors++; + } + } + /* "a:foo" like strings1 */ + j = NB_STRINGS_MAX - NB_STRINGS_MIN; + for (i = 0;i < NB_STRINGS_MIN;i++, j++) { + test1[j] = xmlDictLookup(dict, strings1[j], xmlStrlen(strings1[j])); + if (test1[j] == NULL) { + fprintf(stderr, "Failed lookup for '%s'\n", strings1[j]); + ret = 1; + nbErrors++; + } + } + + /* + * At this point allocate all the strings + * the dictionary will grow in the process, reallocate more string tables + * and switch to the better key generator + */ + for (i = 0;i < NB_STRINGS_MAX;i++) { + if (test1[i] != NULL) + continue; + test1[i] = xmlDictLookup(dict, strings1[i], -1); + if (test1[i] == NULL) { + fprintf(stderr, "Failed lookup for '%s'\n", strings1[i]); + ret = 1; + nbErrors++; + } + } + + /* + * Now we can start to test things, first that all strings1 belongs to + * the dict + */ + for (i = 0;i < NB_STRINGS_MAX;i++) { + if (!xmlDictOwns(dict, test1[i])) { + fprintf(stderr, "Failed ownership failure for '%s'\n", + strings1[i]); + ret = 1; + nbErrors++; + } + } + + /* + * Then that another lookup to the string will return the same + */ + for (i = 0;i < NB_STRINGS_MAX;i++) { + if (xmlDictLookup(dict, strings1[i], -1) != test1[i]) { + fprintf(stderr, "Failed re-lookup check for %d, '%s'\n", + i, strings1[i]); + ret = 1; + nbErrors++; + } + } + + /* + * More complex, check the QName lookups + */ + for (i = NB_STRINGS_MAX - NB_STRINGS_NS;i < NB_STRINGS_MAX;i++) { + cur = strings1[i]; + pref = &prefix[0]; + while (*cur != ':') *pref++ = *cur++; + cur++; + *pref = 0; + tmp = xmlDictQLookup(dict, &prefix[0], cur); + if (xmlDictQLookup(dict, &prefix[0], cur) != test1[i]) { + fprintf(stderr, "Failed lookup check for '%s':'%s'\n", + &prefix[0], cur); + ret = 1; + nbErrors++; + } + } + + run_test2(dict); + + xmlDictFree(dict); + return(ret); +} + +int main(void) +{ + int ret; + + LIBXML_TEST_VERSION + fill_strings(); +#ifdef WITH_PRINT + print_strings(); +#endif + ret = run_test1(); + if (ret == 0) { + printf("dictionary tests succeeded %d strings\n", 2 * NB_STRINGS_MAX); + } else { + printf("dictionary tests failed with %d errors\n", nbErrors); + } + clean_strings(); + xmlCleanupParser(); + xmlMemoryDump(); + return(ret); +} diff --git a/testrecurse.c b/testrecurse.c new file mode 100644 index 0000000..3515048 --- /dev/null +++ b/testrecurse.c @@ -0,0 +1,973 @@ +/* + * testrecurse.c: C program to run libxml2 regression tests checking entities + * recursions + * + * To compile on Unixes: + * cc -o testrecurse `xml2-config --cflags` testrecurse.c `xml2-config --libs` -lpthread + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#ifdef HAVE_CONFIG_H +#include "libxml.h" +#else +#include +#endif + +#if !defined(_WIN32) || defined(__CYGWIN__) +#include +#endif +#include +#include +#include +#include + +#include +#include +#include +#ifdef LIBXML_READER_ENABLED +#include +#endif + +/* + * O_BINARY is just for Windows compatibility - if it isn't defined + * on this system, avoid any compilation error + */ +#ifdef O_BINARY +#define RD_FLAGS O_RDONLY | O_BINARY +#else +#define RD_FLAGS O_RDONLY +#endif + +typedef int (*functest) (const char *filename, const char *result, + const char *error, int options); + +typedef struct testDesc testDesc; +typedef testDesc *testDescPtr; +struct testDesc { + const char *desc; /* descripton of the test */ + functest func; /* function implementing the test */ + const char *in; /* glob to path for input files */ + const char *out; /* output directory */ + const char *suffix;/* suffix for output files */ + const char *err; /* suffix for error output files */ + int options; /* parser options for the test */ +}; + +static int checkTestFile(const char *filename); + + +#if defined(_WIN32) && !defined(__CYGWIN__) + +#include +#include + +typedef struct +{ + size_t gl_pathc; /* Count of paths matched so far */ + char **gl_pathv; /* List of matched pathnames. */ + size_t gl_offs; /* Slots to reserve in 'gl_pathv'. */ +} glob_t; + +#define GLOB_DOOFFS 0 +static int glob(const char *pattern, int flags, + int errfunc(const char *epath, int eerrno), + glob_t *pglob) { + glob_t *ret; + WIN32_FIND_DATA FindFileData; + HANDLE hFind; + unsigned int nb_paths = 0; + char directory[500]; + int len; + + if ((pattern == NULL) || (pglob == NULL)) return(-1); + + strncpy(directory, pattern, 499); + for (len = strlen(directory);len >= 0;len--) { + if (directory[len] == '/') { + len++; + directory[len] = 0; + break; + } + } + if (len <= 0) + len = 0; + + + ret = pglob; + memset(ret, 0, sizeof(glob_t)); + + hFind = FindFirstFileA(pattern, &FindFileData); + if (hFind == INVALID_HANDLE_VALUE) + return(0); + nb_paths = 20; + ret->gl_pathv = (char **) malloc(nb_paths * sizeof(char *)); + if (ret->gl_pathv == NULL) { + FindClose(hFind); + return(-1); + } + strncpy(directory + len, FindFileData.cFileName, 499 - len); + ret->gl_pathv[ret->gl_pathc] = strdup(directory); + if (ret->gl_pathv[ret->gl_pathc] == NULL) + goto done; + ret->gl_pathc++; + while(FindNextFileA(hFind, &FindFileData)) { + if (FindFileData.cFileName[0] == '.') + continue; + if (ret->gl_pathc + 2 > nb_paths) { + char **tmp = realloc(ret->gl_pathv, nb_paths * 2 * sizeof(char *)); + if (tmp == NULL) + break; + ret->gl_pathv = tmp; + nb_paths *= 2; + } + strncpy(directory + len, FindFileData.cFileName, 499 - len); + ret->gl_pathv[ret->gl_pathc] = strdup(directory); + if (ret->gl_pathv[ret->gl_pathc] == NULL) + break; + ret->gl_pathc++; + } + ret->gl_pathv[ret->gl_pathc] = NULL; + +done: + FindClose(hFind); + return(0); +} + + + +static void globfree(glob_t *pglob) { + unsigned int i; + if (pglob == NULL) + return; + + for (i = 0;i < pglob->gl_pathc;i++) { + if (pglob->gl_pathv[i] != NULL) + free(pglob->gl_pathv[i]); + } +} +#define vsnprintf _vsnprintf +#define snprintf _snprintf +#else +#include +#endif + +/************************************************************************ + * * + * Huge document generator * + * * + ************************************************************************/ + +#include + + +static const char *start = " \ + \ + \ +]> \ +"; + +static const char *segment = " &e; &f; &d;\n"; +static const char *finish = ""; + +static int curseg = 0; +static const char *current; +static int rlen; + +/** + * hugeMatch: + * @URI: an URI to test + * + * Check for an huge: query + * + * Returns 1 if yes and 0 if another Input module should be used + */ +static int +hugeMatch(const char * URI) { + if ((URI != NULL) && (!strncmp(URI, "huge:", 4))) + return(1); + return(0); +} + +/** + * hugeOpen: + * @URI: an URI to test + * + * Return a pointer to the huge: query handler, in this example simply + * the current pointer... + * + * Returns an Input context or NULL in case or error + */ +static void * +hugeOpen(const char * URI) { + if ((URI == NULL) || (strncmp(URI, "huge:", 4))) + return(NULL); + rlen = strlen(start); + current = start; + return((void *) current); +} + +/** + * hugeClose: + * @context: the read context + * + * Close the huge: query handler + * + * Returns 0 or -1 in case of error + */ +static int +hugeClose(void * context) { + if (context == NULL) return(-1); + return(0); +} + +#define MAX_NODES 1000000 + +/** + * hugeRead: + * @context: the read context + * @buffer: where to store data + * @len: number of bytes to read + * + * Implement an huge: query read. + * + * Returns the number of bytes read or -1 in case of error + */ +static int +hugeRead(void *context, char *buffer, int len) +{ + if ((context == NULL) || (buffer == NULL) || (len < 0)) + return (-1); + + if (len >= rlen) { + if (curseg >= MAX_NODES + 1) { + rlen = 0; + return(0); + } + len = rlen; + rlen = 0; + memcpy(buffer, current, len); + curseg ++; + if (curseg == MAX_NODES) { + fprintf(stderr, "\n"); + rlen = strlen(finish); + current = finish; + } else { + if (curseg % (MAX_NODES / 10) == 0) + fprintf(stderr, "."); + rlen = strlen(segment); + current = segment; + } + } else { + memcpy(buffer, current, len); + rlen -= len; + current += len; + } + return (len); +} + +/************************************************************************ + * * + * Libxml2 specific routines * + * * + ************************************************************************/ + +static int nb_tests = 0; +static int nb_errors = 0; +static int nb_leaks = 0; +static int extraMemoryFromResolver = 0; + +static int +fatalError(void) { + fprintf(stderr, "Exitting tests on fatal error\n"); + exit(1); +} + +/* + * We need to trap calls to the resolver to not account memory for the catalog + * which is shared to the current running test. We also don't want to have + * network downloads modifying tests. + */ +static xmlParserInputPtr +testExternalEntityLoader(const char *URL, const char *ID, + xmlParserCtxtPtr ctxt) { + xmlParserInputPtr ret; + + if (checkTestFile(URL)) { + ret = xmlNoNetExternalEntityLoader(URL, ID, ctxt); + } else { + int memused = xmlMemUsed(); + ret = xmlNoNetExternalEntityLoader(URL, ID, ctxt); + extraMemoryFromResolver += xmlMemUsed() - memused; + } + + return(ret); +} + +/* + * Trapping the error messages at the generic level to grab the equivalent of + * stderr messages on CLI tools. + */ +static char testErrors[32769]; +static int testErrorsSize = 0; + +static void XMLCDECL +channel(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) { + va_list args; + int res; + + if (testErrorsSize >= 32768) + return; + va_start(args, msg); + res = vsnprintf(&testErrors[testErrorsSize], + 32768 - testErrorsSize, + msg, args); + va_end(args); + if (testErrorsSize + res >= 32768) { + /* buffer is full */ + testErrorsSize = 32768; + testErrors[testErrorsSize] = 0; + } else { + testErrorsSize += res; + } + testErrors[testErrorsSize] = 0; +} + +/** + * xmlParserPrintFileContext: + * @input: an xmlParserInputPtr input + * + * Displays current context within the input content for error tracking + */ + +static void +xmlParserPrintFileContextInternal(xmlParserInputPtr input , + xmlGenericErrorFunc chanl, void *data ) { + const xmlChar *cur, *base; + unsigned int n, col; /* GCC warns if signed, because compared with sizeof() */ + xmlChar content[81]; /* space for 80 chars + line terminator */ + xmlChar *ctnt; + + if (input == NULL) return; + cur = input->cur; + base = input->base; + /* skip backwards over any end-of-lines */ + while ((cur > base) && ((*(cur) == '\n') || (*(cur) == '\r'))) { + cur--; + } + n = 0; + /* search backwards for beginning-of-line (to max buff size) */ + while ((n++ < (sizeof(content)-1)) && (cur > base) && + (*(cur) != '\n') && (*(cur) != '\r')) + cur--; + if ((*(cur) == '\n') || (*(cur) == '\r')) cur++; + /* calculate the error position in terms of the current position */ + col = input->cur - cur; + /* search forward for end-of-line (to max buff size) */ + n = 0; + ctnt = content; + /* copy selected text to our buffer */ + while ((*cur != 0) && (*(cur) != '\n') && + (*(cur) != '\r') && (n < sizeof(content)-1)) { + *ctnt++ = *cur++; + n++; + } + *ctnt = 0; + /* print out the selected text */ + chanl(data ,"%s\n", content); + /* create blank line with problem pointer */ + n = 0; + ctnt = content; + /* (leave buffer space for pointer + line terminator) */ + while ((nfile; + line = err->line; + code = err->code; + domain = err->domain; + level = err->level; + node = err->node; + if ((domain == XML_FROM_PARSER) || (domain == XML_FROM_HTML) || + (domain == XML_FROM_DTD) || (domain == XML_FROM_NAMESPACE) || + (domain == XML_FROM_IO) || (domain == XML_FROM_VALID)) { + ctxt = err->ctxt; + } + str = err->message; + + if (code == XML_ERR_OK) + return; + + if ((node != NULL) && (node->type == XML_ELEMENT_NODE)) + name = node->name; + + /* + * Maintain the compatibility with the legacy error handling + */ + if (ctxt != NULL) { + input = ctxt->input; + if ((input != NULL) && (input->filename == NULL) && + (ctxt->inputNr > 1)) { + cur = input; + input = ctxt->inputTab[ctxt->inputNr - 2]; + } + if (input != NULL) { + if (input->filename) + channel(data, "%s:%d: ", input->filename, input->line); + else if ((line != 0) && (domain == XML_FROM_PARSER)) + channel(data, "Entity: line %d: ", input->line); + } + } else { + if (file != NULL) + channel(data, "%s:%d: ", file, line); + else if ((line != 0) && (domain == XML_FROM_PARSER)) + channel(data, "Entity: line %d: ", line); + } + if (name != NULL) { + channel(data, "element %s: ", name); + } + if (code == XML_ERR_OK) + return; + switch (domain) { + case XML_FROM_PARSER: + channel(data, "parser "); + break; + case XML_FROM_NAMESPACE: + channel(data, "namespace "); + break; + case XML_FROM_DTD: + case XML_FROM_VALID: + channel(data, "validity "); + break; + case XML_FROM_HTML: + channel(data, "HTML parser "); + break; + case XML_FROM_MEMORY: + channel(data, "memory "); + break; + case XML_FROM_OUTPUT: + channel(data, "output "); + break; + case XML_FROM_IO: + channel(data, "I/O "); + break; + case XML_FROM_XINCLUDE: + channel(data, "XInclude "); + break; + case XML_FROM_XPATH: + channel(data, "XPath "); + break; + case XML_FROM_XPOINTER: + channel(data, "parser "); + break; + case XML_FROM_REGEXP: + channel(data, "regexp "); + break; + case XML_FROM_MODULE: + channel(data, "module "); + break; + case XML_FROM_SCHEMASV: + channel(data, "Schemas validity "); + break; + case XML_FROM_SCHEMASP: + channel(data, "Schemas parser "); + break; + case XML_FROM_RELAXNGP: + channel(data, "Relax-NG parser "); + break; + case XML_FROM_RELAXNGV: + channel(data, "Relax-NG validity "); + break; + case XML_FROM_CATALOG: + channel(data, "Catalog "); + break; + case XML_FROM_C14N: + channel(data, "C14N "); + break; + case XML_FROM_XSLT: + channel(data, "XSLT "); + break; + default: + break; + } + if (code == XML_ERR_OK) + return; + switch (level) { + case XML_ERR_NONE: + channel(data, ": "); + break; + case XML_ERR_WARNING: + channel(data, "warning : "); + break; + case XML_ERR_ERROR: + channel(data, "error : "); + break; + case XML_ERR_FATAL: + channel(data, "error : "); + break; + } + if (code == XML_ERR_OK) + return; + if (str != NULL) { + int len; + len = xmlStrlen((const xmlChar *)str); + if ((len > 0) && (str[len - 1] != '\n')) + channel(data, "%s\n", str); + else + channel(data, "%s", str); + } else { + channel(data, "%s\n", "out of memory error"); + } + if (code == XML_ERR_OK) + return; + + if (ctxt != NULL) { + xmlParserPrintFileContextInternal(input, channel, data); + if (cur != NULL) { + if (cur->filename) + channel(data, "%s:%d: \n", cur->filename, cur->line); + else if ((line != 0) && (domain == XML_FROM_PARSER)) + channel(data, "Entity: line %d: \n", cur->line); + xmlParserPrintFileContextInternal(cur, channel, data); + } + } + if ((domain == XML_FROM_XPATH) && (err->str1 != NULL) && + (err->int1 < 100) && + (err->int1 < xmlStrlen((const xmlChar *)err->str1))) { + xmlChar buf[150]; + int i; + + channel(data, "%s\n", err->str1); + for (i=0;i < err->int1;i++) + buf[i] = ' '; + buf[i++] = '^'; + buf[i] = 0; + channel(data, "%s\n", buf); + } +} + +static void +initializeLibxml2(void) { + xmlGetWarningsDefaultValue = 0; + xmlPedanticParserDefault(0); + + xmlMemSetup(xmlMemFree, xmlMemMalloc, xmlMemRealloc, xmlMemoryStrdup); + xmlInitParser(); + xmlSetExternalEntityLoader(testExternalEntityLoader); + xmlSetStructuredErrorFunc(NULL, testStructuredErrorHandler); + /* + * register the new I/O handlers + */ + if (xmlRegisterInputCallbacks(hugeMatch, hugeOpen, + hugeRead, hugeClose) < 0) { + fprintf(stderr, "failed to register Huge handler\n"); + exit(1); + } +} + +/************************************************************************ + * * + * File name and path utilities * + * * + ************************************************************************/ + +static const char *baseFilename(const char *filename) { + const char *cur; + if (filename == NULL) + return(NULL); + cur = &filename[strlen(filename)]; + while ((cur > filename) && (*cur != '/')) + cur--; + if (*cur == '/') + return(cur + 1); + return(cur); +} + +static char *resultFilename(const char *filename, const char *out, + const char *suffix) { + const char *base; + char res[500]; + char suffixbuff[500]; + +/************* + if ((filename[0] == 't') && (filename[1] == 'e') && + (filename[2] == 's') && (filename[3] == 't') && + (filename[4] == '/')) + filename = &filename[5]; + *************/ + + base = baseFilename(filename); + if (suffix == NULL) + suffix = ".tmp"; + if (out == NULL) + out = ""; + + strncpy(suffixbuff,suffix,499); +#ifdef VMS + if(strstr(base,".") && suffixbuff[0]=='.') + suffixbuff[0]='_'; +#endif + + snprintf(res, 499, "%s%s%s", out, base, suffixbuff); + res[499] = 0; + return(strdup(res)); +} + +static int checkTestFile(const char *filename) { + struct stat buf; + + if (stat(filename, &buf) == -1) + return(0); + +#if defined(_WIN32) && !defined(__CYGWIN__) + if (!(buf.st_mode & _S_IFREG)) + return(0); +#else + if (!S_ISREG(buf.st_mode)) + return(0); +#endif + + return(1); +} + + + +/************************************************************************ + * * + * Test to detect or not recursive entities * + * * + ************************************************************************/ +/** + * recursiveDetectTest: + * @filename: the file to parse + * @result: the file with expected result + * @err: the file with error messages: unused + * + * Parse a file loading DTD and replacing entities check it fails for + * lol cases + * + * Returns 0 in case of success, an error code otherwise + */ +static int +recursiveDetectTest(const char *filename, + const char *result ATTRIBUTE_UNUSED, + const char *err ATTRIBUTE_UNUSED, + int options ATTRIBUTE_UNUSED) { + xmlDocPtr doc; + xmlParserCtxtPtr ctxt; + int res = 0; + int mem; + + nb_tests++; + + ctxt = xmlNewParserCtxt(); + mem = xmlMemUsed(); + /* + * base of the test, parse with the old API + */ + doc = xmlCtxtReadFile(ctxt, filename, NULL, + XML_PARSE_NOENT | XML_PARSE_DTDLOAD); + if ((doc != NULL) || (ctxt->lastError.code != XML_ERR_ENTITY_LOOP)) { + fprintf(stderr, "Failed to detect recursion in %s\n", filename); + xmlFreeParserCtxt(ctxt); + xmlFreeDoc(doc); + return(1); + } + xmlFreeParserCtxt(ctxt); + + return(res); +} + +/** + * notRecursiveDetectTest: + * @filename: the file to parse + * @result: the file with expected result + * @err: the file with error messages: unused + * + * Parse a file loading DTD and replacing entities check it works for + * good cases + * + * Returns 0 in case of success, an error code otherwise + */ +static int +notRecursiveDetectTest(const char *filename, + const char *result ATTRIBUTE_UNUSED, + const char *err ATTRIBUTE_UNUSED, + int options ATTRIBUTE_UNUSED) { + xmlDocPtr doc; + xmlParserCtxtPtr ctxt; + int res = 0; + int mem; + + nb_tests++; + + ctxt = xmlNewParserCtxt(); + mem = xmlMemUsed(); + /* + * base of the test, parse with the old API + */ + doc = xmlCtxtReadFile(ctxt, filename, NULL, + XML_PARSE_NOENT | XML_PARSE_DTDLOAD); + if (doc == NULL) { + fprintf(stderr, "Failed to parse correct file %s\n", filename); + xmlFreeParserCtxt(ctxt); + return(1); + } + xmlFreeDoc(doc); + xmlFreeParserCtxt(ctxt); + + return(res); +} + +#ifdef LIBXML_READER_ENABLED +/** + * notRecursiveHugeTest: + * @filename: the file to parse + * @result: the file with expected result + * @err: the file with error messages: unused + * + * Parse a memory generated file + * good cases + * + * Returns 0 in case of success, an error code otherwise + */ +static int +notRecursiveHugeTest(const char *filename ATTRIBUTE_UNUSED, + const char *result ATTRIBUTE_UNUSED, + const char *err ATTRIBUTE_UNUSED, + int options ATTRIBUTE_UNUSED) { + xmlTextReaderPtr reader; + int res = 0; + int ret; + + nb_tests++; + + reader = xmlReaderForFile("huge:test" , NULL, + XML_PARSE_NOENT | XML_PARSE_DTDLOAD); + if (reader == NULL) { + fprintf(stderr, "Failed to open huge:test\n"); + return(1); + } + ret = xmlTextReaderRead(reader); + while (ret == 1) { + ret = xmlTextReaderRead(reader); + } + if (ret != 0) { + fprintf(stderr, "Failed to parser huge:test with entities\n"); + res = 1; + } + xmlFreeTextReader(reader); + + return(res); +} +#endif + +/************************************************************************ + * * + * Tests Descriptions * + * * + ************************************************************************/ + +static +testDesc testDescriptions[] = { + { "Parsing recursive test cases" , + recursiveDetectTest, "./test/recurse/lol*.xml", NULL, NULL, NULL, + 0 }, + { "Parsing non-recursive test cases" , + notRecursiveDetectTest, "./test/recurse/good*.xml", NULL, NULL, NULL, + 0 }, +#ifdef LIBXML_READER_ENABLED + { "Parsing non-recursive huge case" , + notRecursiveHugeTest, NULL, NULL, NULL, NULL, + 0 }, +#endif + {NULL, NULL, NULL, NULL, NULL, NULL, 0} +}; + +/************************************************************************ + * * + * The main code driving the tests * + * * + ************************************************************************/ + +static int +launchTests(testDescPtr tst) { + int res = 0, err = 0; + size_t i; + char *result; + char *error; + int mem; + + if (tst == NULL) return(-1); + if (tst->in != NULL) { + glob_t globbuf; + + globbuf.gl_offs = 0; + glob(tst->in, GLOB_DOOFFS, NULL, &globbuf); + for (i = 0;i < globbuf.gl_pathc;i++) { + if (!checkTestFile(globbuf.gl_pathv[i])) + continue; + if (tst->suffix != NULL) { + result = resultFilename(globbuf.gl_pathv[i], tst->out, + tst->suffix); + if (result == NULL) { + fprintf(stderr, "Out of memory !\n"); + fatalError(); + } + } else { + result = NULL; + } + if (tst->err != NULL) { + error = resultFilename(globbuf.gl_pathv[i], tst->out, + tst->err); + if (error == NULL) { + fprintf(stderr, "Out of memory !\n"); + fatalError(); + } + } else { + error = NULL; + } + if ((result) &&(!checkTestFile(result))) { + fprintf(stderr, "Missing result file %s\n", result); + } else if ((error) &&(!checkTestFile(error))) { + fprintf(stderr, "Missing error file %s\n", error); + } else { + mem = xmlMemUsed(); + extraMemoryFromResolver = 0; + testErrorsSize = 0; + testErrors[0] = 0; + res = tst->func(globbuf.gl_pathv[i], result, error, + tst->options | XML_PARSE_COMPACT); + xmlResetLastError(); + if (res != 0) { + fprintf(stderr, "File %s generated an error\n", + globbuf.gl_pathv[i]); + nb_errors++; + err++; + } + else if (xmlMemUsed() != mem) { + if ((xmlMemUsed() != mem) && + (extraMemoryFromResolver == 0)) { + fprintf(stderr, "File %s leaked %d bytes\n", + globbuf.gl_pathv[i], xmlMemUsed() - mem); + nb_leaks++; + err++; + } + } + testErrorsSize = 0; + } + if (result) + free(result); + if (error) + free(error); + } + globfree(&globbuf); + } else { + testErrorsSize = 0; + testErrors[0] = 0; + extraMemoryFromResolver = 0; + res = tst->func(NULL, NULL, NULL, tst->options); + if (res != 0) { + nb_errors++; + err++; + } + } + return(err); +} + +static int verbose = 0; +static int tests_quiet = 0; + +static int +runtest(int i) { + int ret = 0, res; + int old_errors, old_tests, old_leaks; + + old_errors = nb_errors; + old_tests = nb_tests; + old_leaks = nb_leaks; + if ((tests_quiet == 0) && (testDescriptions[i].desc != NULL)) + printf("## %s\n", testDescriptions[i].desc); + res = launchTests(&testDescriptions[i]); + if (res != 0) + ret++; + if (verbose) { + if ((nb_errors == old_errors) && (nb_leaks == old_leaks)) + printf("Ran %d tests, no errors\n", nb_tests - old_tests); + else + printf("Ran %d tests, %d errors, %d leaks\n", + nb_tests - old_tests, + nb_errors - old_errors, + nb_leaks - old_leaks); + } + return(ret); +} + +int +main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { + int i, a, ret = 0; + int subset = 0; + + initializeLibxml2(); + + for (a = 1; a < argc;a++) { + if (!strcmp(argv[a], "-v")) + verbose = 1; + else if (!strcmp(argv[a], "-quiet")) + tests_quiet = 1; + else { + for (i = 0; testDescriptions[i].func != NULL; i++) { + if (strstr(testDescriptions[i].desc, argv[a])) { + ret += runtest(i); + subset++; + } + } + } + } + if (subset == 0) { + for (i = 0; testDescriptions[i].func != NULL; i++) { + ret += runtest(i); + } + } + if ((nb_errors == 0) && (nb_leaks == 0)) { + ret = 0; + printf("Total %d tests, no errors\n", + nb_tests); + } else { + ret = 1; + printf("Total %d tests, %d errors, %d leaks\n", + nb_tests, nb_errors, nb_leaks); + } + xmlCleanupParser(); + xmlMemoryDump(); + + return(ret); +} diff --git a/threads.c b/threads.c index 6481b40..23cb200 100644 --- a/threads.c +++ b/threads.c @@ -1,5 +1,5 @@ /** - * threads.c: set of generic threading related routines + * threads.c: set of generic threading related routines * * See Copyright for the status of this software. * @@ -73,6 +73,10 @@ extern int pthread_mutex_unlock () __attribute((weak)); extern int pthread_cond_init () __attribute((weak)); +extern int pthread_cond_destroy () + __attribute((weak)); +extern int pthread_cond_wait () + __attribute((weak)); extern int pthread_equal () __attribute((weak)); extern pthread_t pthread_self () @@ -860,6 +864,8 @@ xmlInitThreads(void) (pthread_mutex_lock != NULL) && (pthread_mutex_unlock != NULL) && (pthread_cond_init != NULL) && + (pthread_cond_destroy != NULL) && + (pthread_cond_wait != NULL) && (pthread_equal != NULL) && (pthread_self != NULL) && (pthread_cond_signal != NULL)) { diff --git a/tree.c b/tree.c index 763381b..f26748e 100644 --- a/tree.c +++ b/tree.c @@ -45,7 +45,7 @@ int __xmlRegisterCallbacks = 0; /************************************************************************ * * - * Forward declarations * + * Forward declarations * * * ************************************************************************/ @@ -55,7 +55,7 @@ static xmlChar* xmlGetPropNodeValueInternal(xmlAttrPtr prop); /************************************************************************ * * - * Tree memory error handler * + * Tree memory error handler * * * ************************************************************************/ /** @@ -103,7 +103,7 @@ xmlTreeErr(int code, xmlNodePtr node, const char *extra) /************************************************************************ * * - * A few static variables and macros * + * A few static variables and macros * * * ************************************************************************/ /* #undef xmlStringText */ @@ -123,7 +123,7 @@ static int xmlCheckDTD = 1; (n)->last = NULL; \ } else { \ while (ulccur->next != NULL) { \ - ulccur->parent = (n); \ + ulccur->parent = (n); \ ulccur = ulccur->next; \ } \ ulccur->parent = (n); \ @@ -138,12 +138,12 @@ static int xmlCheckDTD = 1; /************************************************************************ * * - * Functions to move to entities.c once the * + * Functions to move to entities.c once the * * API freeze is smoothen and they can be made public. * * * ************************************************************************/ #include - + #ifdef LIBXML_TREE_ENABLED /** * xmlGetEntityFromDtd: @@ -152,17 +152,17 @@ static int xmlCheckDTD = 1; * * Do an entity lookup in the DTD entity hash table and * return the corresponding entity, if found. - * + * * Returns A pointer to the entity structure or NULL if not found. */ static xmlEntityPtr xmlGetEntityFromDtd(xmlDtdPtr dtd, const xmlChar *name) { xmlEntitiesTablePtr table; - + if((dtd != NULL) && (dtd->entities != NULL)) { table = (xmlEntitiesTablePtr) dtd->entities; return((xmlEntityPtr) xmlHashLookup(table, name)); - /* return(xmlGetEntityFromTable(table, name)); */ + /* return(xmlGetEntityFromTable(table, name)); */ } return(NULL); } @@ -170,7 +170,7 @@ xmlGetEntityFromDtd(xmlDtdPtr dtd, const xmlChar *name) { * xmlGetParameterEntityFromDtd: * @dtd: A pointer to the DTD to search * @name: The entity name - * + * * Do an entity lookup in the DTD pararmeter entity hash table and * return the corresponding entity, if found. * @@ -179,7 +179,7 @@ xmlGetEntityFromDtd(xmlDtdPtr dtd, const xmlChar *name) { static xmlEntityPtr xmlGetParameterEntityFromDtd(xmlDtdPtr dtd, const xmlChar *name) { xmlEntitiesTablePtr table; - + if ((dtd != NULL) && (dtd->pentities != NULL)) { table = (xmlEntitiesTablePtr) dtd->pentities; return((xmlEntityPtr) xmlHashLookup(table, name)); @@ -240,7 +240,7 @@ xmlBuildQName(const xmlChar *ncname, const xmlChar *prefix, /** * xmlSplitQName2: * @name: the full QName - * @prefix: a xmlChar ** + * @prefix: a xmlChar ** * * parse an XML qualified name string * @@ -278,9 +278,9 @@ xmlSplitQName2(const xmlChar *name, xmlChar **prefix) { * we are not trying to validate but just to cut, and yes it will * work even if this is as set of UTF-8 encoded chars */ - while ((name[len] != 0) && (name[len] != ':')) + while ((name[len] != 0) && (name[len] != ':')) len++; - + if (name[len] == 0) return(NULL); @@ -329,9 +329,9 @@ xmlSplitQName3(const xmlChar *name, int *len) { * we are not trying to validate but just to cut, and yes it will * work even if this is as set of UTF-8 encoded chars */ - while ((name[l] != 0) && (name[l] != ':')) + while ((name[l] != 0) && (name[l] != ':')) l++; - + if (name[l] == 0) return(NULL); @@ -345,7 +345,7 @@ xmlSplitQName3(const xmlChar *name, int *len) { * Check Name, NCName and QName strings * * * ************************************************************************/ - + #define CUR_SCHAR(s, l) xmlStringCurrentChar(NULL, s, &l) #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) @@ -668,14 +668,14 @@ try_complex: * Allocation and deallocation of basic structures * * * ************************************************************************/ - + /** * xmlSetBufferAllocationScheme: * @scheme: allocation method to use - * + * * Set the buffer allocation method. Types are * XML_BUFFER_ALLOC_EXACT - use exact sizes, keeps memory usage down - * XML_BUFFER_ALLOC_DOUBLEIT - double buffer when extra needed, + * XML_BUFFER_ALLOC_DOUBLEIT - double buffer when extra needed, * improves performance */ void @@ -688,9 +688,9 @@ xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme) { * * Types are * XML_BUFFER_ALLOC_EXACT - use exact sizes, keeps memory usage down - * XML_BUFFER_ALLOC_DOUBLEIT - double buffer when extra needed, + * XML_BUFFER_ALLOC_DOUBLEIT - double buffer when extra needed, * improves performance - * + * * Returns the current allocation scheme */ xmlBufferAllocationScheme @@ -733,9 +733,9 @@ xmlNewNs(xmlNodePtr node, const xmlChar *href, const xmlChar *prefix) { cur->type = XML_LOCAL_NAMESPACE; if (href != NULL) - cur->href = xmlStrdup(href); + cur->href = xmlStrdup(href); if (prefix != NULL) - cur->prefix = xmlStrdup(prefix); + cur->prefix = xmlStrdup(prefix); /* * Add it at the end to preserve parsing order ... @@ -751,14 +751,14 @@ xmlNewNs(xmlNodePtr node, const xmlChar *href, const xmlChar *prefix) { (xmlStrEqual(prev->prefix, cur->prefix))) { xmlFreeNs(cur); return(NULL); - } + } while (prev->next != NULL) { prev = prev->next; if (((prev->prefix == NULL) && (cur->prefix == NULL)) || (xmlStrEqual(prev->prefix, cur->prefix))) { xmlFreeNs(cur); return(NULL); - } + } } prev->next = cur; } @@ -867,11 +867,11 @@ xmlNewDtd(xmlDocPtr doc, const xmlChar *name, cur->type = XML_DTD_NODE; if (name != NULL) - cur->name = xmlStrdup(name); + cur->name = xmlStrdup(name); if (ExternalID != NULL) - cur->ExternalID = xmlStrdup(ExternalID); + cur->ExternalID = xmlStrdup(ExternalID); if (SystemID != NULL) - cur->SystemID = xmlStrdup(SystemID); + cur->SystemID = xmlStrdup(SystemID); if (doc != NULL) doc->extSubset = cur; cur->doc = doc; @@ -949,7 +949,7 @@ xmlCreateIntSubset(xmlDocPtr doc, const xmlChar *name, } } if (ExternalID != NULL) { - cur->ExternalID = xmlStrdup(ExternalID); + cur->ExternalID = xmlStrdup(ExternalID); if (cur->ExternalID == NULL) { xmlTreeErrMemory("building internal subset"); if (cur->name != NULL) @@ -959,7 +959,7 @@ xmlCreateIntSubset(xmlDocPtr doc, const xmlChar *name, } } if (SystemID != NULL) { - cur->SystemID = xmlStrdup(SystemID); + cur->SystemID = xmlStrdup(SystemID); if (cur->SystemID == NULL) { xmlTreeErrMemory("building internal subset"); if (cur->name != NULL) @@ -1022,7 +1022,7 @@ xmlCreateIntSubset(xmlDocPtr doc, const xmlChar *name, * current scope */ #define DICT_FREE(str) \ - if ((str) && ((!dict) || \ + if ((str) && ((!dict) || \ (xmlDictOwns(dict, (const xmlChar *)(str)) == 0))) \ xmlFree((char *)(str)); @@ -1105,7 +1105,7 @@ xmlFreeDtd(xmlDtdPtr cur) { /* TODO !!! */ if (cur->notations != NULL) xmlFreeNotationTable((xmlNotationTablePtr) cur->notations); - + if (cur->elements != NULL) xmlFreeElementTable((xmlElementTablePtr) cur->elements); if (cur->attributes != NULL) @@ -1144,15 +1144,17 @@ xmlNewDoc(const xmlChar *version) { memset(cur, 0, sizeof(xmlDoc)); cur->type = XML_DOCUMENT_NODE; - cur->version = xmlStrdup(version); + cur->version = xmlStrdup(version); if (cur->version == NULL) { xmlTreeErrMemory("building doc"); xmlFree(cur); - return(NULL); + return(NULL); } cur->standalone = -1; cur->compression = -1; /* not initialized */ cur->doc = cur; + cur->parseFlags = 0; + cur->properties = XML_DOC_USERBUILT; /* * The in memory encoding is always UTF8 * This field will never change and would @@ -1280,7 +1282,7 @@ xmlStringLenGetNodeList(xmlDocPtr doc, const xmlChar *value, int len) { else tmp = 0; while (tmp != ';') { /* Non input consuming loop */ - if ((tmp >= '0') && (tmp <= '9')) + if ((tmp >= '0') && (tmp <= '9')) charval = charval * 16 + (tmp - '0'); else if ((tmp >= 'a') && (tmp <= 'f')) charval = charval * 16 + (tmp - 'a') + 10; @@ -1308,7 +1310,7 @@ xmlStringLenGetNodeList(xmlDocPtr doc, const xmlChar *value, int len) { else tmp = 0; while (tmp != ';') { /* Non input consuming loops */ - if ((tmp >= '0') && (tmp <= '9')) + if ((tmp >= '0') && (tmp <= '9')) charval = charval * 10 + (tmp - '0'); else { xmlTreeErr(XML_TREE_INVALID_DEC, (xmlNodePtr) doc, @@ -1353,7 +1355,7 @@ xmlStringLenGetNodeList(xmlDocPtr doc, const xmlChar *value, int len) { last = xmlAddNextSibling(last, node); } else xmlNodeAddContent(last, ent->content); - + } else { /* * Create a new REFERENCE_REF node @@ -1474,7 +1476,7 @@ xmlStringGetNodeList(xmlDocPtr doc, const xmlChar *value) { cur += 3; tmp = *cur; while (tmp != ';') { /* Non input consuming loop */ - if ((tmp >= '0') && (tmp <= '9')) + if ((tmp >= '0') && (tmp <= '9')) charval = charval * 16 + (tmp - '0'); else if ((tmp >= 'a') && (tmp <= 'f')) charval = charval * 16 + (tmp - 'a') + 10; @@ -1496,7 +1498,7 @@ xmlStringGetNodeList(xmlDocPtr doc, const xmlChar *value) { cur += 2; tmp = *cur; while (tmp != ';') { /* Non input consuming loops */ - if ((tmp >= '0') && (tmp <= '9')) + if ((tmp >= '0') && (tmp <= '9')) charval = charval * 10 + (tmp - '0'); else { xmlTreeErr(XML_TREE_INVALID_DEC, (xmlNodePtr) doc, @@ -1538,7 +1540,7 @@ xmlStringGetNodeList(xmlDocPtr doc, const xmlChar *value) { last = xmlAddNextSibling(last, node); } else xmlNodeAddContent(last, ent->content); - + } else { /* * Create a new REFERENCE_REF node @@ -1976,7 +1978,7 @@ xmlNewDocProp(xmlDocPtr doc, const xmlChar *name, const xmlChar *value) { cur->name = xmlDictLookup(doc->dict, name, -1); else cur->name = xmlStrdup(name); - cur->doc = doc; + cur->doc = doc; if (value != NULL) { xmlNodePtr tmp; @@ -2183,7 +2185,7 @@ xmlNewNode(xmlNsPtr ns, const xmlChar *name) { } memset(cur, 0, sizeof(xmlNode)); cur->type = XML_ELEMENT_NODE; - + cur->name = xmlStrdup(name); cur->ns = ns; @@ -2226,7 +2228,7 @@ xmlNewNodeEatName(xmlNsPtr ns, xmlChar *name) { } memset(cur, 0, sizeof(xmlNode)); cur->type = XML_ELEMENT_NODE; - + cur->name = name; cur->ns = ns; @@ -2414,9 +2416,9 @@ xmlNewText(const xmlChar *content) { * a child TEXT node will be created containing the string @content. * NOTE: Use xmlNewChild() if @content will contain entities that need to be * preserved. Use this function, xmlNewTextChild(), if you need to ensure that - * reserved XML chars that might appear in @content, such as the ampersand, - * greater-than or less-than signs, are automatically replaced by their XML - * escaped entity representations. + * reserved XML chars that might appear in @content, such as the ampersand, + * greater-than or less-than signs, are automatically replaced by their XML + * escaped entity representations. * * Returns a pointer to the new node object. */ @@ -2864,14 +2866,14 @@ xmlNewChild(xmlNodePtr parent, xmlNsPtr ns, /** * xmlAddPropSibling: - * @prev: the attribute to which @prop is added after + * @prev: the attribute to which @prop is added after * @cur: the base attribute passed to calling function * @prop: the new attribute * * Add a new attribute after @prev using @cur as base attribute. * When inserting before @cur, @prev is passed as @cur->prev. * When inserting after @cur, @prev is passed as @cur. - * If an existing attribute is found it is detroyed prior to adding @prop. + * If an existing attribute is found it is detroyed prior to adding @prop. * * Returns the attribute being inserted or NULL in case of error. */ @@ -2921,7 +2923,7 @@ xmlAddPropSibling(xmlNodePtr prev, xmlNodePtr cur, xmlNodePtr prop) { * first unlinked from its existing context. * As a result of text merging @elem may be freed. * If the new node is ATTRIBUTE, it is added into properties instead of children. - * If there is an attribute with equal name, it is first destroyed. + * If there is an attribute with equal name, it is first destroyed. * * Returns the new node or NULL in case of error. */ @@ -2999,7 +3001,7 @@ xmlAddNextSibling(xmlNodePtr cur, xmlNodePtr elem) { * If the new node was already inserted in a document it is * first unlinked from its existing context. * If the new node is ATTRIBUTE, it is added into properties instead of children. - * If there is an attribute with equal name, it is first destroyed. + * If there is an attribute with equal name, it is first destroyed. * * Returns the new node or NULL in case of error. */ @@ -3103,7 +3105,7 @@ xmlAddSibling(xmlNodePtr cur, xmlNodePtr elem) { * Constant time is we can rely on the ->parent->last to find * the last sibling. */ - if ((cur->type != XML_ATTRIBUTE_NODE) && (cur->parent != NULL) && + if ((cur->type != XML_ATTRIBUTE_NODE) && (cur->parent != NULL) && (cur->parent->children != NULL) && (cur->parent->last != NULL) && (cur->parent->last->next == NULL)) { @@ -3185,10 +3187,10 @@ xmlAddChildList(xmlNodePtr parent, xmlNodePtr cur) { /* * If cur and parent->last both are TEXT nodes, then merge them. */ - if ((cur->type == XML_TEXT_NODE) && + if ((cur->type == XML_TEXT_NODE) && (parent->last->type == XML_TEXT_NODE) && (cur->name == parent->last->name)) { - xmlNodeAddContent(parent->last, cur->content); + xmlNodeAddContent(parent->last, cur->content); /* * if it's the only child, nothing more to be done. */ @@ -3226,7 +3228,7 @@ xmlAddChildList(xmlNodePtr parent, xmlNodePtr cur) { * Add a new node to @parent, at the end of the child (or property) list * merging adjacent TEXT nodes (in which case @cur is freed) * If the new node is ATTRIBUTE, it is added into properties instead of children. - * If there is an attribute with equal name, it is first destroyed. + * If there is an attribute with equal name, it is first destroyed. * * Returns the child or NULL in case of error. */ @@ -3465,6 +3467,11 @@ xmlFreeNode(xmlNodePtr cur) { if (cur->doc != NULL) dict = cur->doc->dict; + if (cur->type == XML_ENTITY_DECL) { + xmlEntityPtr ent = (xmlEntityPtr) cur; + DICT_FREE(ent->SystemID); + DICT_FREE(ent->ExternalID); + } if ((cur->children != NULL) && (cur->type != XML_ENTITY_REF_NODE)) xmlFreeNodeList(cur->children); @@ -3525,6 +3532,28 @@ xmlUnlinkNode(xmlNodePtr cur) { doc->extSubset = NULL; } } + if (cur->type == XML_ENTITY_DECL) { + xmlDocPtr doc; + doc = cur->doc; + if (doc != NULL) { + if (doc->intSubset != NULL) { + if (xmlHashLookup(doc->intSubset->entities, cur->name) == cur) + xmlHashRemoveEntry(doc->intSubset->entities, cur->name, + NULL); + if (xmlHashLookup(doc->intSubset->pentities, cur->name) == cur) + xmlHashRemoveEntry(doc->intSubset->pentities, cur->name, + NULL); + } + if (doc->extSubset != NULL) { + if (xmlHashLookup(doc->extSubset->entities, cur->name) == cur) + xmlHashRemoveEntry(doc->extSubset->entities, cur->name, + NULL); + if (xmlHashLookup(doc->extSubset->pentities, cur->name) == cur) + xmlHashRemoveEntry(doc->extSubset->pentities, cur->name, + NULL); + } + } + } if (cur->parent != NULL) { xmlNodePtr parent; parent = cur->parent; @@ -3620,7 +3649,7 @@ xmlReplaceNode(xmlNodePtr old, xmlNodePtr cur) { * Copy operations * * * ************************************************************************/ - + /** * xmlCopyNamespace: * @cur: the namespace @@ -3737,7 +3766,7 @@ xmlCopyPropInternal(xmlDocPtr doc, xmlNodePtr target, xmlAttrPtr cur) { ret->ns = xmlNewReconciliedNs(target->doc, target, cur->ns); } } - + } else ret->ns = NULL; @@ -3858,7 +3887,7 @@ xmlStaticCopyNode(const xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent, return((xmlNodePtr) xmlCopyPropInternal(doc, parent, (xmlAttrPtr) node)); case XML_NAMESPACE_DECL: return((xmlNodePtr) xmlCopyNamespaceList((xmlNsPtr) node)); - + case XML_DOCUMENT_NODE: case XML_HTML_DOCUMENT_NODE: #ifdef LIBXML_DOCB_ENABLED @@ -3888,7 +3917,7 @@ xmlStaticCopyNode(const xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent, ret->type = node->type; ret->doc = doc; - ret->parent = parent; + ret->parent = parent; if (node->name == xmlStringText) ret->name = xmlStringText; else if (node->name == xmlStringTextNoenc) @@ -3927,7 +3956,7 @@ xmlStaticCopyNode(const xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent, if (tmp != ret) return(tmp); } - + if (!extended) goto out; if ((node->type == XML_ELEMENT_NODE) && (node->nsDef != NULL)) @@ -4123,7 +4152,7 @@ xmlCopyDtd(xmlDtdPtr dtd) { if (dtd->pentities != NULL) ret->pentities = (void *) xmlCopyEntitiesTable( (xmlEntitiesTablePtr) dtd->pentities); - + cur = dtd->children; while (cur != NULL) { q = NULL; @@ -4138,7 +4167,7 @@ xmlCopyDtd(xmlDtdPtr dtd) { break; case XML_INTERNAL_PARAMETER_ENTITY: case XML_EXTERNAL_PARAMETER_ENTITY: - q = (xmlNodePtr) + q = (xmlNodePtr) xmlGetParameterEntityFromDtd(ret, tmp->name); break; case XML_INTERNAL_PREDEFINED_ENTITY: @@ -4150,27 +4179,27 @@ xmlCopyDtd(xmlDtdPtr dtd) { xmlGetDtdQElementDesc(ret, tmp->name, tmp->prefix); } else if (cur->type == XML_ATTRIBUTE_DECL) { xmlAttributePtr tmp = (xmlAttributePtr) cur; - q = (xmlNodePtr) + q = (xmlNodePtr) xmlGetDtdQAttrDesc(ret, tmp->elem, tmp->name, tmp->prefix); } else if (cur->type == XML_COMMENT_NODE) { q = xmlCopyNode(cur, 0); } - + if (q == NULL) { cur = cur->next; continue; } - + if (p == NULL) ret->children = q; else - p->next = q; - - q->prev = p; - q->parent = (xmlNodePtr) ret; + p->next = q; + + q->prev = p; + q->parent = (xmlNodePtr) ret; q->next = NULL; ret->last = q; - p = q; + p = q; cur = cur->next; } @@ -4220,7 +4249,7 @@ xmlCopyDoc(xmlDocPtr doc, int recursive) { ret->oldNs = xmlCopyNamespaceList(doc->oldNs); if (doc->children != NULL) { xmlNodePtr tmp; - + ret->children = xmlStaticCopyNodeList(doc->children, ret, (xmlNodePtr)ret); ret->last = NULL; @@ -4240,7 +4269,7 @@ xmlCopyDoc(xmlDocPtr doc, int recursive) { * Content access functions * * * ************************************************************************/ - + /** * xmlGetLineNo: * @node: valid node @@ -4332,7 +4361,7 @@ xmlGetNodePath(xmlNodePtr node) if (cur->ns) { if (cur->ns->prefix != NULL) { snprintf(nametemp, sizeof(nametemp) - 1, "%s:%s", - (char *)cur->ns->prefix, (char *)cur->name); + (char *)cur->ns->prefix, (char *)cur->name); nametemp[sizeof(nametemp) - 1] = 0; name = nametemp; } else { @@ -4342,7 +4371,7 @@ xmlGetNodePath(xmlNodePtr node) */ generic = 1; name = "*"; - } + } } next = cur->parent; @@ -4430,7 +4459,7 @@ xmlGetNodePath(xmlNodePtr node) { occur = 1; break; - } + } tmp = tmp->next; } } else @@ -4473,10 +4502,10 @@ xmlGetNodePath(xmlNodePtr node) if (cur->ns) { if (cur->ns->prefix != NULL) snprintf(nametemp, sizeof(nametemp) - 1, "%s:%s", - (char *)cur->ns->prefix, (char *)cur->name); + (char *)cur->ns->prefix, (char *)cur->name); else snprintf(nametemp, sizeof(nametemp) - 1, "%s", - (char *)cur->name); + (char *)cur->name); nametemp[sizeof(nametemp) - 1] = 0; name = nametemp; } @@ -4544,7 +4573,7 @@ xmlDocGetRootElement(xmlDocPtr doc) { } return(ret); } - + #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) /** * xmlDocSetRootElement: @@ -4586,7 +4615,7 @@ xmlDocSetRootElement(xmlDocPtr doc, xmlNodePtr root) { return(old); } #endif - + #if defined(LIBXML_TREE_ENABLED) /** * xmlNodeSetLang: @@ -4634,7 +4663,7 @@ xmlNodeSetLang(xmlNodePtr cur, const xmlChar *lang) { xmlSetNsProp(cur, ns, BAD_CAST "lang", lang); } #endif /* LIBXML_TREE_ENABLED */ - + /** * xmlNodeGetLang: * @cur: the node being checked @@ -4657,7 +4686,7 @@ xmlNodeGetLang(xmlNodePtr cur) { } return(NULL); } - + #ifdef LIBXML_TREE_ENABLED /** @@ -4745,7 +4774,7 @@ xmlNodeGetSpacePreserve(xmlNodePtr cur) { } return(-1); } - + #ifdef LIBXML_TREE_ENABLED /** * xmlNodeSetName: @@ -4803,7 +4832,7 @@ xmlNodeSetName(xmlNodePtr cur, const xmlChar *name) { } } #endif - + #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) /** * xmlNodeSetBase: @@ -4856,7 +4885,7 @@ xmlNodeSetBase(xmlNodePtr cur, const xmlChar* uri) { return; } } - + ns = xmlSearchNsByHref(cur->doc, cur, XML_XML_NAMESPACE); if (ns == NULL) return; @@ -4892,9 +4921,9 @@ xmlNodeGetBase(xmlDocPtr doc, xmlNodePtr cur) { xmlChar *oldbase = NULL; xmlChar *base, *newbase; - if ((cur == NULL) && (doc == NULL)) + if ((cur == NULL) && (doc == NULL)) return(NULL); - if (doc == NULL) doc = cur->doc; + if (doc == NULL) doc = cur->doc; if ((doc != NULL) && (doc->type == XML_HTML_DOCUMENT_NODE)) { cur = doc->children; while ((cur != NULL) && (cur->name != NULL)) { @@ -4956,7 +4985,7 @@ xmlNodeGetBase(xmlDocPtr doc, xmlNodePtr cur) { } return(oldbase); } - + /** * xmlNodeBufGetContent: * @buffer: a buffer @@ -4967,7 +4996,7 @@ xmlNodeGetBase(xmlDocPtr doc, xmlNodePtr cur) { * of the values carried by this node child's (TEXT and ENTITY_REF). * Entity references are substituted. * Fills up the buffer @buffer with this value - * + * * Returns 0 in case of success and -1 in case of error. */ int @@ -5246,12 +5275,12 @@ xmlNodeSetContent(xmlNodePtr cur, const xmlChar *content) { if (!((cur->doc != NULL) && (cur->doc->dict != NULL) && (xmlDictOwns(cur->doc->dict, cur->content)))) xmlFree(cur->content); - } + } if (cur->children != NULL) xmlFreeNodeList(cur->children); cur->last = cur->children = NULL; if (content != NULL) { cur->content = xmlStrdup(content); - } else + } else cur->content = NULL; cur->properties = NULL; cur->nsDef = NULL; @@ -5324,12 +5353,12 @@ xmlNodeSetContentLen(xmlNodePtr cur, const xmlChar *content, int len) { if (!((cur->doc != NULL) && (cur->doc->dict != NULL) && (xmlDictOwns(cur->doc->dict, cur->content)))) xmlFree(cur->content); - } + } if (cur->children != NULL) xmlFreeNodeList(cur->children); cur->children = cur->last = NULL; if (content != NULL) { cur->content = xmlStrndup(content, len); - } else + } else cur->content = NULL; cur->properties = NULL; cur->nsDef = NULL; @@ -5363,7 +5392,7 @@ xmlNodeSetContentLen(xmlNodePtr cur, const xmlChar *content, int len) { * @cur: the node being modified * @content: extra content * @len: the size of @content - * + * * Append the extra substring to the node content. * NOTE: In contrast to xmlNodeSetContentLen(), @content is supposed to be * raw text, so unescaped XML special chars are allowed, entity @@ -5438,7 +5467,7 @@ xmlNodeAddContentLen(xmlNodePtr cur, const xmlChar *content, int len) { * xmlNodeAddContent: * @cur: the node being modified * @content: extra content - * + * * Append the extra substring to the node content. * NOTE: In contrast to xmlNodeSetContent(), @content is supposed to be * raw text, so unescaped XML special chars are allowed, entity @@ -5464,7 +5493,7 @@ xmlNodeAddContent(xmlNodePtr cur, const xmlChar *content) { * xmlTextMerge: * @first: the first text node * @second: the second text node being merged - * + * * Merge two text nodes into one * Returns the first text node augmented */ @@ -5549,9 +5578,9 @@ xmlGetNsList(xmlDocPtr doc ATTRIBUTE_UNUSED, xmlNodePtr node) /* * xmlTreeEnsureXMLDecl: * @doc: the doc -* +* * Ensures that there is an XML namespace declaration on the doc. -* +* * Returns the XML ns-struct or NULL on API and internal errors. */ static xmlNsPtr @@ -5571,7 +5600,7 @@ xmlTreeEnsureXMLDecl(xmlDocPtr doc) } memset(ns, 0, sizeof(xmlNs)); ns->type = XML_LOCAL_NAMESPACE; - ns->href = xmlStrdup(XML_XML_NAMESPACE); + ns->href = xmlStrdup(XML_XML_NAMESPACE); ns->prefix = xmlStrdup((const xmlChar *)"xml"); doc->oldNs = ns; return (ns); @@ -5596,7 +5625,7 @@ xmlTreeEnsureXMLDecl(xmlDocPtr doc) */ xmlNsPtr xmlSearchNs(xmlDocPtr doc, xmlNodePtr node, const xmlChar *nameSpace) { - + xmlNsPtr cur; xmlNodePtr orig = node; @@ -5616,8 +5645,8 @@ xmlSearchNs(xmlDocPtr doc, xmlNodePtr node, const xmlChar *nameSpace) { } memset(cur, 0, sizeof(xmlNs)); cur->type = XML_LOCAL_NAMESPACE; - cur->href = xmlStrdup(XML_XML_NAMESPACE); - cur->prefix = xmlStrdup((const xmlChar *)"xml"); + cur->href = xmlStrdup(XML_XML_NAMESPACE); + cur->prefix = xmlStrdup((const xmlChar *)"xml"); cur->next = node->nsDef; node->nsDef = cur; return(cur); @@ -5652,7 +5681,7 @@ xmlSearchNs(xmlDocPtr doc, xmlNodePtr node, const xmlChar *nameSpace) { return(cur); cur = cur->next; } - if (orig != node) { + if (orig != node) { cur = node->ns; if (cur != NULL) { if ((cur->prefix == NULL) && (nameSpace == NULL) && @@ -5663,7 +5692,7 @@ xmlSearchNs(xmlDocPtr doc, xmlNodePtr node, const xmlChar *nameSpace) { (xmlStrEqual(cur->prefix, nameSpace))) return(cur); } - } + } } node = node->parent; } @@ -5679,7 +5708,7 @@ xmlSearchNs(xmlDocPtr doc, xmlNodePtr node, const xmlChar *nameSpace) { * * Verify that the given namespace held on @ancestor is still in scope * on node. - * + * * Returns 1 if true, 0 if false and -1 in case of error. */ static int @@ -5712,7 +5741,7 @@ xmlNsInScope(xmlDocPtr doc ATTRIBUTE_UNUSED, xmlNodePtr node, return (-1); return (1); } - + /** * xmlSearchNsByHref: * @doc: the document @@ -5766,7 +5795,7 @@ xmlSearchNsByHref(xmlDocPtr doc, xmlNodePtr node, const xmlChar * href) if (doc->oldNs == NULL) return(xmlTreeEnsureXMLDecl(doc)); else - return(doc->oldNs); + return(doc->oldNs); } is_attr = (node->type == XML_ATTRIBUTE_NODE); while (node != NULL) { @@ -5795,7 +5824,7 @@ xmlSearchNsByHref(xmlDocPtr doc, xmlNodePtr node, const xmlChar * href) return (cur); } } - } + } } node = node->parent; } @@ -5858,7 +5887,7 @@ xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns) { snprintf((char *) prefix, sizeof(prefix), "default%d", counter++); else snprintf((char *) prefix, sizeof(prefix), "%.20s%d", - (char *)ns->prefix, counter++); + (char *)ns->prefix, counter++); def = xmlSearchNs(doc, tree, prefix); } @@ -6053,7 +6082,7 @@ xmlReconciliateNs(xmlDocPtr doc, xmlNodePtr tree) { } } /* exit condition */ - if (node == tree) + if (node == tree) node = NULL; } else break; @@ -6109,14 +6138,14 @@ xmlGetPropNodeInternal(xmlNodePtr node, const xmlChar *name, /* * Check if there is a default/fixed attribute declaration in * the internal or external subset. - */ + */ if ((node->doc != NULL) && (node->doc->intSubset != NULL)) { xmlDocPtr doc = node->doc; xmlAttributePtr attrDecl = NULL; xmlChar *elemQName, *tmpstr = NULL; /* - * We need the QName of the element for the DTD-lookup. + * We need the QName of the element for the DTD-lookup. */ if ((node->ns != NULL) && (node->ns->prefix != NULL)) { tmpstr = xmlStrdup(node->ns->prefix); @@ -6167,7 +6196,7 @@ xmlGetPropNodeInternal(xmlNodePtr node, const xmlChar *name, cur++; } xmlFree(nsList); - } + } if (tmpstr != NULL) xmlFree(tmpstr); /* @@ -6211,7 +6240,7 @@ xmlGetPropNodeValueInternal(xmlAttrPtr prop) } else if (prop->type == XML_ATTRIBUTE_DECL) { return(xmlStrdup(((xmlAttributePtr)prop)->defaultValue)); } - return(NULL); + return(NULL); } /** @@ -6223,7 +6252,7 @@ xmlGetPropNodeValueInternal(xmlAttrPtr prop) * This function also looks in DTD attribute declaration for #FIXED or * default declaration values unless DTD use has been turned off. * - * Returns the attribute or the attribute declaration or NULL if + * Returns the attribute or the attribute declaration or NULL if * neither was found. */ xmlAttrPtr @@ -6305,12 +6334,12 @@ xmlHasNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace) { */ xmlChar * xmlGetProp(xmlNodePtr node, const xmlChar *name) { - xmlAttrPtr prop; + xmlAttrPtr prop; prop = xmlHasProp(node, name); if (prop == NULL) return(NULL); - return(xmlGetPropNodeValueInternal(prop)); + return(xmlGetPropNodeValueInternal(prop)); } /** @@ -6331,7 +6360,7 @@ xmlGetProp(xmlNodePtr node, const xmlChar *name) { xmlChar * xmlGetNoNsProp(xmlNodePtr node, const xmlChar *name) { xmlAttrPtr prop; - + prop = xmlGetPropNodeInternal(node, name, NULL, xmlCheckDTD); if (prop == NULL) return(NULL); @@ -6397,7 +6426,7 @@ xmlUnsetProp(xmlNodePtr node, const xmlChar *name) { int xmlUnsetNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name) { xmlAttrPtr prop; - + prop = xmlGetPropNodeInternal(node, name, (ns != NULL) ? ns->href : NULL, 0); if (prop == NULL) return(-1); @@ -6420,7 +6449,7 @@ xmlUnsetNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name) { * error it there's no such ns-binding for the prefix in * scope. * Returns the attribute pointer. - * + * */ xmlAttrPtr xmlSetProp(xmlNodePtr node, const xmlChar *name, const xmlChar *value) { @@ -6463,7 +6492,7 @@ xmlSetNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name, const xmlChar *value) { xmlAttrPtr prop; - + if (ns && (ns->href == NULL)) return(NULL); prop = xmlGetPropNodeInternal(node, name, (ns != NULL) ? ns->href : NULL, 0); @@ -6475,14 +6504,14 @@ xmlSetNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name, xmlRemoveID(node->doc, prop); prop->atype = XML_ATTRIBUTE_ID; } - if (prop->children != NULL) + if (prop->children != NULL) xmlFreeNodeList(prop->children); prop->children = NULL; prop->last = NULL; prop->ns = ns; if (value != NULL) { xmlNodePtr tmp; - + if(!xmlCheckUTF8(value)) { xmlTreeErr(XML_TREE_NOT_UTF8, (xmlNodePtr) node->doc, NULL); @@ -6514,7 +6543,7 @@ xmlSetNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name, /** * xmlNodeIsText: * @node: the node - * + * * Is this node a Text node ? * Returns 1 yes, 0 no */ @@ -6529,7 +6558,7 @@ xmlNodeIsText(xmlNodePtr node) { /** * xmlIsBlankNode: * @node: the node - * + * * Checks whether this node is an empty or whitespace only * (and possibly ignorable) text-node. * @@ -6558,7 +6587,7 @@ xmlIsBlankNode(xmlNodePtr node) { * @node: the node * @content: the content * @len: @content length - * + * * Concat the given string at the end of the existing node content * * Returns -1 in case of error, 0 otherwise @@ -6623,6 +6652,7 @@ xmlBufferCreate(void) { return(NULL); } ret->content[0] = 0; + ret->contentIO = NULL; return(ret); } @@ -6655,6 +6685,7 @@ xmlBufferCreateSize(size_t size) { ret->content[0] = 0; } else ret->content = NULL; + ret->contentIO = NULL; return(ret); } @@ -6696,7 +6727,7 @@ xmlBufferCreateStatic(void *mem, size_t size) { * Sets the allocation scheme for this buffer */ void -xmlBufferSetAllocationScheme(xmlBufferPtr buf, +xmlBufferSetAllocationScheme(xmlBufferPtr buf, xmlBufferAllocationScheme scheme) { if (buf == NULL) { #ifdef DEBUG_BUFFER @@ -6727,7 +6758,10 @@ xmlBufferFree(xmlBufferPtr buf) { return; } - if ((buf->content != NULL) && + if ((buf->alloc == XML_BUFFER_ALLOC_IO) && + (buf->contentIO != NULL)) { + xmlFree(buf->contentIO); + } else if ((buf->content != NULL) && (buf->alloc != XML_BUFFER_ALLOC_IMMUTABLE)) { xmlFree(buf->content); } @@ -6747,8 +6781,15 @@ xmlBufferEmpty(xmlBufferPtr buf) { buf->use = 0; if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) { buf->content = BAD_CAST ""; + } else if ((buf->alloc == XML_BUFFER_ALLOC_IO) && + (buf->contentIO != NULL)) { + size_t start_buf = buf->content - buf->contentIO; + + buf->size += start_buf; + buf->content = buf->contentIO; + buf->content[0] = 0; } else { - memset(buf->content, 0, buf->size); + buf->content[0] = 0; } } @@ -6768,10 +6809,30 @@ xmlBufferShrink(xmlBufferPtr buf, unsigned int len) { if (len > buf->use) return(-1); buf->use -= len; - if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) { + if ((buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) || + ((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL))) { + /* + * we just move the content pointer, but also make sure + * the perceived buffer size has shrinked accordingly + */ buf->content += len; + buf->size -= len; + + /* + * sometimes though it maybe be better to really shrink + * on IO buffers + */ + if ((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL)) { + size_t start_buf = buf->content - buf->contentIO; + if (start_buf >= buf->size) { + memmove(buf->contentIO, &buf->content[0], buf->use); + buf->content = buf->contentIO; + buf->content[buf->use] = 0; + buf->size += start_buf; + } + } } else { - memmove(buf->content, &buf->content[len], buf->use * sizeof(xmlChar)); + memmove(buf->content, &buf->content[len], buf->use); buf->content[buf->use] = 0; } return(len); @@ -6809,12 +6870,24 @@ xmlBufferGrow(xmlBufferPtr buf, unsigned int len) { size = buf->use + len + 100; #endif - newbuf = (xmlChar *) xmlRealloc(buf->content, size); - if (newbuf == NULL) { - xmlTreeErrMemory("growing buffer"); - return(-1); + if ((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL)) { + size_t start_buf = buf->content - buf->contentIO; + + newbuf = (xmlChar *) xmlRealloc(buf->contentIO, start_buf + size); + if (newbuf == NULL) { + xmlTreeErrMemory("growing buffer"); + return(-1); + } + buf->contentIO = newbuf; + buf->content = newbuf + start_buf; + } else { + newbuf = (xmlChar *) xmlRealloc(buf->content, size); + if (newbuf == NULL) { + xmlTreeErrMemory("growing buffer"); + return(-1); + } + buf->content = newbuf; } - buf->content = newbuf; buf->size = size; return(buf->size - buf->use); } @@ -6871,7 +6944,7 @@ xmlBufferContent(const xmlBufferPtr buf) /** * xmlBufferLength: - * @buf: the buffer + * @buf: the buffer * * Function to get the length of a buffer * @@ -6901,6 +6974,7 @@ xmlBufferResize(xmlBufferPtr buf, unsigned int size) { unsigned int newSize; xmlChar* rebuf = NULL; + size_t start_buf; if (buf == NULL) return(0); @@ -6913,42 +6987,62 @@ xmlBufferResize(xmlBufferPtr buf, unsigned int size) /* figure out new size */ switch (buf->alloc){ - case XML_BUFFER_ALLOC_DOUBLEIT: - /*take care of empty case*/ - newSize = (buf->size ? buf->size*2 : size + 10); - while (size > newSize) newSize *= 2; - break; - case XML_BUFFER_ALLOC_EXACT: - newSize = size+10; - break; - default: - newSize = size+10; - break; - } - - if (buf->content == NULL) - rebuf = (xmlChar *) xmlMallocAtomic(newSize * sizeof(xmlChar)); - else if (buf->size - buf->use < 100) { - rebuf = (xmlChar *) xmlRealloc(buf->content, - newSize * sizeof(xmlChar)); - } else { - /* - * if we are reallocating a buffer far from being full, it's - * better to make a new allocation and copy only the used range - * and free the old one. - */ - rebuf = (xmlChar *) xmlMallocAtomic(newSize * sizeof(xmlChar)); - if (rebuf != NULL) { - memcpy(rebuf, buf->content, buf->use); - xmlFree(buf->content); - rebuf[buf->use] = 0; - } + case XML_BUFFER_ALLOC_IO: + case XML_BUFFER_ALLOC_DOUBLEIT: + /*take care of empty case*/ + newSize = (buf->size ? buf->size*2 : size + 10); + while (size > newSize) newSize *= 2; + break; + case XML_BUFFER_ALLOC_EXACT: + newSize = size+10; + break; + default: + newSize = size+10; + break; } - if (rebuf == NULL) { - xmlTreeErrMemory("growing buffer"); - return 0; + + if ((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL)) { + start_buf = buf->content - buf->contentIO; + + if (start_buf > newSize) { + /* move data back to start */ + memmove(buf->contentIO, buf->content, buf->use); + buf->content = buf->contentIO; + buf->content[buf->use] = 0; + buf->size += start_buf; + } else { + rebuf = (xmlChar *) xmlRealloc(buf->contentIO, start_buf + newSize); + if (rebuf == NULL) { + xmlTreeErrMemory("growing buffer"); + return 0; + } + buf->contentIO = rebuf; + buf->content = rebuf + start_buf; + } + } else { + if (buf->content == NULL) { + rebuf = (xmlChar *) xmlMallocAtomic(newSize); + } else if (buf->size - buf->use < 100) { + rebuf = (xmlChar *) xmlRealloc(buf->content, newSize); + } else { + /* + * if we are reallocating a buffer far from being full, it's + * better to make a new allocation and copy only the used range + * and free the old one. + */ + rebuf = (xmlChar *) xmlMallocAtomic(newSize); + if (rebuf != NULL) { + memcpy(rebuf, buf->content, buf->use); + xmlFree(buf->content); + rebuf[buf->use] = 0; + } + } + if (rebuf == NULL) { + xmlTreeErrMemory("growing buffer"); + return 0; + } + buf->content = rebuf; } - buf->content = rebuf; buf->size = newSize; return 1; @@ -7043,6 +7137,20 @@ xmlBufferAddHead(xmlBufferPtr buf, const xmlChar *str, int len) { if (len <= 0) return -1; + if ((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL)) { + size_t start_buf = buf->content - buf->contentIO; + + if (start_buf > (unsigned int) len) { + /* + * We can add it in the space previously shrinked + */ + buf->content -= len; + memmove(&buf->content[0], str, len); + buf->use += len; + buf->size += len; + return(0); + } + } needSize = buf->use + len + 2; if (needSize > buf->size){ if (!xmlBufferResize(buf, needSize)){ @@ -7051,8 +7159,8 @@ xmlBufferAddHead(xmlBufferPtr buf, const xmlChar *str, int len) { } } - memmove(&buf->content[len], &buf->content[0], buf->use * sizeof(xmlChar)); - memmove(&buf->content[0], str, len * sizeof(xmlChar)); + memmove(&buf->content[len], &buf->content[0], buf->use); + memmove(&buf->content[0], str, len); buf->use += len; buf->content[buf->use] = 0; return 0; @@ -7299,7 +7407,7 @@ struct xmlNsMap { /* * xmlDOMWrapNsMapFree: * @map: the ns-map -* +* * Frees the ns-map */ static void @@ -7330,7 +7438,7 @@ xmlDOMWrapNsMapFree(xmlNsMapPtr nsmap) * @oldNs: the old ns-struct * @newNs: the new ns-struct * @depth: depth and ns-kind information -* +* * Adds an ns-mapping item. */ static xmlNsMapItemPtr @@ -7358,7 +7466,7 @@ xmlDOMWrapNsMapAddItem(xmlNsMapPtr *nsmap, int position, memset(map, 0, sizeof(struct xmlNsMap)); *nsmap = map; } - + if (map->pool != NULL) { /* * Reuse an item from the pool. @@ -7377,11 +7485,11 @@ xmlDOMWrapNsMapAddItem(xmlNsMapPtr *nsmap, int position, } memset(ret, 0, sizeof(struct xmlNsMapItem)); } - + if (map->first == NULL) { /* * First ever. - */ + */ map->first = ret; map->last = ret; } else if (position == -1) { @@ -7390,14 +7498,14 @@ xmlDOMWrapNsMapAddItem(xmlNsMapPtr *nsmap, int position, */ ret->prev = map->last; map->last->next = ret; - map->last = ret; + map->last = ret; } else if (position == 0) { /* * Set on first position. */ map->first->prev = ret; - ret->next = map->first; - map->first = ret; + ret->next = map->first; + map->first = ret; } else return(NULL); @@ -7413,10 +7521,10 @@ xmlDOMWrapNsMapAddItem(xmlNsMapPtr *nsmap, int position, * @doc: the doc * @nsName: the namespace name * @prefix: the prefix -* +* * Creates or reuses an xmlNs struct on doc->oldNs with * the given prefix and namespace name. -* +* * Returns the aquired ns struct or NULL in case of an API * or internal error. */ @@ -7456,7 +7564,7 @@ xmlDOMWrapStoreNs(xmlDocPtr doc, * * Allocates and initializes a new DOM-wrapper context. * -* Returns the xmlDOMWrapCtxtPtr or NULL in case of an internal errror. +* Returns the xmlDOMWrapCtxtPtr or NULL in case of an internal errror. */ xmlDOMWrapCtxtPtr xmlDOMWrapNewCtxt(void) @@ -7495,9 +7603,9 @@ xmlDOMWrapFreeCtxt(xmlDOMWrapCtxtPtr ctxt) * xmlTreeLookupNsListByPrefix: * @nsList: a list of ns-structs * @prefix: the searched prefix -* +* * Searches for a ns-decl with the given prefix in @nsList. -* +* * Returns the ns-decl if found, NULL if not found and on * API errors. */ @@ -7525,9 +7633,9 @@ xmlTreeNSListLookupByPrefix(xmlNsPtr nsList, const xmlChar *prefix) * xmlDOMWrapNSNormGatherInScopeNs: * @map: the namespace map * @node: the node to start with -* +* * Puts in-scope namespaces into the ns-map. -* +* * Returns 0 on success, -1 on API or internal errors. */ static int @@ -7619,7 +7727,7 @@ xmlDOMWrapNSNormGatherInScopeNs(xmlNsMapPtr *map, * * For internal use. Adds a ns-decl mapping. * -* Returns 0 on success, -1 on internal errors. +* Returns 0 on success, -1 on internal errors. */ static int xmlDOMWrapNSNormAddNsMapItem2(xmlNsPtr **list, int *size, int *number, @@ -7663,7 +7771,7 @@ xmlDOMWrapNSNormAddNsMapItem2(xmlNsPtr **list, int *size, int *number, * NOTE: This function was not intensively tested. * * Returns 0 on success, 1 if the node is not supported, -* -1 on API and internal errors. +* -1 on API and internal errors. */ int xmlDOMWrapRemoveNode(xmlDOMWrapCtxtPtr ctxt, xmlDocPtr doc, @@ -7680,7 +7788,7 @@ xmlDOMWrapRemoveNode(xmlDOMWrapCtxtPtr ctxt, xmlDocPtr doc, if (node->parent == NULL) return (0); - switch (node->type) { + switch (node->type) { case XML_TEXT_NODE: case XML_CDATA_SECTION_NODE: case XML_ENTITY_REF_NODE: @@ -7688,7 +7796,7 @@ xmlDOMWrapRemoveNode(xmlDOMWrapCtxtPtr ctxt, xmlDocPtr doc, case XML_COMMENT_NODE: xmlUnlinkNode(node); return (0); - case XML_ELEMENT_NODE: + case XML_ELEMENT_NODE: case XML_ATTRIBUTE_NODE: break; default: @@ -7712,7 +7820,7 @@ xmlDOMWrapRemoveNode(xmlDOMWrapCtxtPtr ctxt, xmlDocPtr doc, } /* No break on purpose. */ case XML_ATTRIBUTE_NODE: - if (node->ns != NULL) { + if (node->ns != NULL) { /* * Find a mapping. */ @@ -7756,14 +7864,14 @@ xmlDOMWrapRemoveNode(xmlDOMWrapCtxtPtr ctxt, xmlDocPtr doc, break; default: goto next_sibling; - } -next_node: + } +next_node: if ((node->type == XML_ELEMENT_NODE) && (node->children != NULL)) { node = node->children; continue; } -next_sibling: +next_sibling: if (node == NULL) break; if (node->next != NULL) @@ -7856,7 +7964,7 @@ xmlSearchNsByNamespaceStrict(xmlDocPtr doc, xmlNodePtr node, */ if (out) { int ret; - + ret = xmlNsInScope(doc, node, prev, ns->prefix); if (ret < 0) return (-1); @@ -7924,7 +8032,7 @@ xmlSearchNsByPrefixStrict(xmlDocPtr doc, xmlNodePtr node, if (cur->type == XML_ELEMENT_NODE) { if (cur->nsDef != NULL) { ns = cur->nsDef; - do { + do { if ((prefix == ns->prefix) || xmlStrEqual(prefix, ns->prefix)) { @@ -7938,7 +8046,7 @@ xmlSearchNsByPrefixStrict(xmlDocPtr doc, xmlNodePtr node, return (1); } ns = ns->next; - } while (ns != NULL); + } while (ns != NULL); } } else if ((cur->type == XML_ENTITY_NODE) || (cur->type == XML_ENTITY_DECL)) @@ -8045,12 +8153,12 @@ xmlDOMWrapNSNormAquireNormalizedNs(xmlDocPtr doc, xmlNsPtr ns, xmlNsPtr *retNs, xmlNsMapPtr *nsMap, - + int depth, int ancestorsOnly, int prefixed) { - xmlNsMapItemPtr mi; + xmlNsMapItemPtr mi; if ((doc == NULL) || (ns == NULL) || (retNs == NULL) || (nsMap == NULL)) @@ -8075,13 +8183,13 @@ xmlDOMWrapNSNormAquireNormalizedNs(xmlDocPtr doc, */ if ((XML_NSMAP_NOTEMPTY(*nsMap)) && (! (ancestorsOnly && (elem == NULL)))) - { + { /* * Try to find an equal ns-name in in-scope ns-decls. */ XML_NSMAP_FOREACH(*nsMap, mi) { - if ((mi->depth >= XML_TREE_NSMAP_PARENT) && - /* + if ((mi->depth >= XML_TREE_NSMAP_PARENT) && + /* * ancestorsOnly: This should be turned on to gain speed, * if one knows that the branch itself was already * ns-wellformed and no stale references existed. @@ -8089,10 +8197,10 @@ xmlDOMWrapNSNormAquireNormalizedNs(xmlDocPtr doc, */ ((! ancestorsOnly) || (mi->depth == XML_TREE_NSMAP_PARENT)) && /* Skip shadowed prefixes. */ - (mi->shadowDepth == -1) && + (mi->shadowDepth == -1) && /* Skip xmlns="" or xmlns:foo="". */ ((mi->newNs->href != NULL) && - (mi->newNs->href[0] != 0)) && + (mi->newNs->href[0] != 0)) && /* Ensure a prefix if wanted. */ ((! prefixed) || (mi->newNs->prefix != NULL)) && /* Equal ns name */ @@ -8119,7 +8227,7 @@ xmlDOMWrapNSNormAquireNormalizedNs(xmlDocPtr doc, return (-1); /* * Insert mapping. - */ + */ if (xmlDOMWrapNsMapAddItem(nsMap, -1, ns, tmpns, XML_TREE_NSMAP_DOC) == NULL) { xmlFreeNs(tmpns); @@ -8161,7 +8269,7 @@ xmlDOMWrapNSNormAquireNormalizedNs(xmlDocPtr doc, } typedef enum { - XML_DOM_RECONNS_REMOVEREDUND = 1<<0 + XML_DOM_RECONNS_REMOVEREDUND = 1<<0 } xmlDOMReconcileNSOptions; /* @@ -8179,7 +8287,7 @@ typedef enum { * NOTE: This function was not intensively tested. * * Returns 0 if succeeded, -1 otherwise and on API/internal errors. -*/ +*/ int xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt ATTRIBUTE_UNUSED, @@ -8194,7 +8302,7 @@ xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt ATTRIBUTE_UNUSED, xmlNsMapItemPtr /* topmi = NULL, */ mi; /* @ancestorsOnly should be set by an option flag. */ int ancestorsOnly = 0; - int optRemoveRedundantNS = + int optRemoveRedundantNS = ((xmlDOMReconcileNSOptions) options & XML_DOM_RECONNS_REMOVEREDUND) ? 1 : 0; xmlNsPtr *listRedund = NULL; int sizeRedund = 0, nbRedund = 0, ret, i, j; @@ -8230,7 +8338,7 @@ xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt ATTRIBUTE_UNUSED, } parnsdone = 1; } - + /* * Lookup the ns ancestor-axis for equal ns-decls in scope. */ @@ -8242,7 +8350,7 @@ xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt ATTRIBUTE_UNUSED, xmlStrEqual(ns->prefix, mi->newNs->prefix)) && ((ns->href == mi->newNs->href) || xmlStrEqual(ns->href, mi->newNs->href))) - { + { /* * A redundant ns-decl was found. * Add it to the list of redundant ns-decls. @@ -8252,11 +8360,11 @@ xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt ATTRIBUTE_UNUSED, goto internal_error; /* * Remove the ns-decl from the element-node. - */ + */ if (prevns) prevns->next = ns->next; else - cur->nsDef = ns->next; + cur->nsDef = ns->next; goto next_ns_decl; } } @@ -8267,7 +8375,7 @@ xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt ATTRIBUTE_UNUSED, * ns-decl is declared on the same element. */ if ((cur->ns != NULL) && adoptns && (cur->ns == ns)) - adoptns = 0; + adoptns = 0; /* * Does it shadow any ns-decl? */ @@ -8277,7 +8385,7 @@ xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt ATTRIBUTE_UNUSED, (mi->shadowDepth == -1) && ((ns->prefix == mi->newNs->prefix) || xmlStrEqual(ns->prefix, mi->newNs->prefix))) { - + mi->shadowDepth = depth; } } @@ -8287,11 +8395,11 @@ xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt ATTRIBUTE_UNUSED, */ if (xmlDOMWrapNsMapAddItem(&nsMap, -1, ns, ns, depth) == NULL) - goto internal_error; + goto internal_error; prevns = ns; next_ns_decl: - ns = ns->next; + ns = ns->next; } } if (! adoptns) @@ -8301,7 +8409,7 @@ next_ns_decl: /* No ns, no fun. */ if (cur->ns == NULL) goto ns_end; - + if (! parnsdone) { if ((elem->parent) && ((xmlNodePtr) elem->parent->doc != elem->parent)) { @@ -8320,7 +8428,7 @@ next_ns_decl: cur->ns = listRedund[++j]; break; } - } + } } /* * Adopt ns-references. @@ -8358,7 +8466,7 @@ ns_end: cur = (xmlNodePtr) cur->properties; continue; } - break; + break; default: goto next_sibling; } @@ -8371,18 +8479,18 @@ into_content: cur = cur->children; continue; } -next_sibling: +next_sibling: if (cur == elem) break; if (cur->type == XML_ELEMENT_NODE) { - if (XML_NSMAP_NOTEMPTY(nsMap)) { + if (XML_NSMAP_NOTEMPTY(nsMap)) { /* * Pop mappings. */ while ((nsMap->last != NULL) && (nsMap->last->depth >= depth)) { - XML_NSMAP_POP(nsMap, mi) + XML_NSMAP_POP(nsMap, mi) } /* * Unshadow. @@ -8391,7 +8499,7 @@ next_sibling: if (mi->shadowDepth >= depth) mi->shadowDepth = -1; } - } + } depth--; } if (cur->next != NULL) @@ -8405,13 +8513,13 @@ next_sibling: goto next_sibling; } } while (cur != NULL); - + ret = 0; goto exit; internal_error: ret = -1; exit: - if (listRedund) { + if (listRedund) { for (i = 0, j = 0; i < nbRedund; i++, j += 2) { xmlFreeNs(listRedund[j]); } @@ -8462,7 +8570,7 @@ xmlDOMWrapAdoptBranch(xmlDOMWrapCtxtPtr ctxt, int parnsdone; /* @ancestorsOnly should be set per option. */ int ancestorsOnly = 0; - + /* * Optimize string adoption for equal or none dicts. */ @@ -8516,17 +8624,17 @@ xmlDOMWrapAdoptBranch(xmlDOMWrapCtxtPtr ctxt, } cur->doc = destDoc; switch (cur->type) { - case XML_XINCLUDE_START: + case XML_XINCLUDE_START: case XML_XINCLUDE_END: /* * TODO */ return (-1); - case XML_ELEMENT_NODE: + case XML_ELEMENT_NODE: curElem = cur; depth++; /* - * Namespace declarations. + * Namespace declarations. * - ns->href and ns->prefix are never in the dict, so * we need not move the values over to the destination dict. * - Note that for custom handling of ns-references, @@ -8550,10 +8658,10 @@ xmlDOMWrapAdoptBranch(xmlDOMWrapCtxtPtr ctxt, * NOTE: ns->prefix and ns->href are never in the dict. * XML_TREE_ADOPT_STR(ns->prefix) * XML_TREE_ADOPT_STR(ns->href) - */ + */ /* * Does it shadow any ns-decl? - */ + */ if (XML_NSMAP_NOTEMPTY(nsMap)) { XML_NSMAP_FOREACH(nsMap, mi) { if ((mi->depth >= XML_TREE_NSMAP_PARENT) && @@ -8561,7 +8669,7 @@ xmlDOMWrapAdoptBranch(xmlDOMWrapCtxtPtr ctxt, ((ns->prefix == mi->newNs->prefix) || xmlStrEqual(ns->prefix, mi->newNs->prefix))) { - + mi->shadowDepth = depth; } } @@ -8624,7 +8732,7 @@ xmlDOMWrapAdoptBranch(xmlDOMWrapCtxtPtr ctxt, * Aquire a normalized ns-decl and add it to the map. */ if (xmlDOMWrapNSNormAquireNormalizedNs(destDoc, - /* ns-decls on curElem or on destDoc->oldNs */ + /* ns-decls on curElem or on destDoc->oldNs */ destParent ? curElem : NULL, cur->ns, &ns, &nsMap, depth, @@ -8660,7 +8768,7 @@ ns_end: */ if ((sourceDoc != NULL) && (((xmlAttrPtr) cur)->atype == XML_ATTRIBUTE_ID)) - { + { xmlRemoveID(sourceDoc, (xmlAttrPtr) cur); } ((xmlAttrPtr) cur)->atype = 0; @@ -8668,13 +8776,13 @@ ns_end: } break; case XML_TEXT_NODE: - case XML_CDATA_SECTION_NODE: + case XML_CDATA_SECTION_NODE: /* * This puts the content in the dest dict, only if * it was previously in the source dict. */ - XML_TREE_ADOPT_STR_2(cur->content) - goto leave_node; + XML_TREE_ADOPT_STR_2(cur->content) + goto leave_node; case XML_ENTITY_REF_NODE: /* * Remove reference to the entitity-node. @@ -8699,7 +8807,7 @@ ns_end: XML_TREE_ADOPT_STR(cur->name) XML_TREE_ADOPT_STR_2(cur->content) break; - case XML_COMMENT_NODE: + case XML_COMMENT_NODE: break; default: goto internal_error; @@ -8722,15 +8830,15 @@ leave_node: /* * TODO: Do we expect nsDefs on XML_XINCLUDE_START? */ - if (XML_NSMAP_NOTEMPTY(nsMap)) { + if (XML_NSMAP_NOTEMPTY(nsMap)) { /* * Pop mappings. */ while ((nsMap->last != NULL) && (nsMap->last->depth >= depth)) { - XML_NSMAP_POP(nsMap, mi) - } + XML_NSMAP_POP(nsMap, mi) + } /* * Unshadow. */ @@ -8752,10 +8860,10 @@ leave_node: goto leave_node; } } - + goto exit; -internal_error: +internal_error: ret = -1; exit: @@ -8773,7 +8881,7 @@ exit: nsMap->pool = nsMap->first; nsMap->first = NULL; } - } else + } else xmlDOMWrapNsMapFree(nsMap); } return(ret); @@ -8795,7 +8903,7 @@ exit: * 2) If *no* @destParent is given, then @destDoc->oldNs entries are used. * This is the case when you don't know already where the cloned branch * will be added to. -* +* * If @destParent is given, it ensures that the tree is namespace * wellformed by creating additional ns-decls where needed. * Note that, since prefixes of already existent ns-decls can be @@ -8829,7 +8937,7 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt, /* gather @parent's ns-decls. */ int parnsdone = 0; /* - * @ancestorsOnly: + * @ancestorsOnly: * TODO: @ancestorsOnly should be set per option. * */ @@ -8856,7 +8964,7 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt, return (-1); } if (sourceDoc == NULL) - sourceDoc = node->doc; + sourceDoc = node->doc; if (sourceDoc == NULL) return (-1); @@ -8868,7 +8976,7 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt, nsMap = (xmlNsMapPtr) ctxt->namespaceMap; *resNode = NULL; - + cur = node; while (cur != NULL) { if (cur->doc != sourceDoc) { @@ -8877,7 +8985,7 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt, * TODO: Do we need to reconciliate XIncluded nodes? * TODO: This here returns -1 in this case. */ - goto internal_error; + goto internal_error; } /* * Create a new node. @@ -8892,9 +9000,9 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt, break; case XML_ELEMENT_NODE: case XML_TEXT_NODE: - case XML_CDATA_SECTION_NODE: + case XML_CDATA_SECTION_NODE: case XML_COMMENT_NODE: - case XML_PI_NODE: + case XML_PI_NODE: case XML_DOCUMENT_FRAG_NODE: case XML_ENTITY_REF_NODE: case XML_ENTITY_NODE: @@ -8906,20 +9014,20 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt, xmlTreeErrMemory("xmlDOMWrapCloneNode(): allocating a node"); goto internal_error; } - memset(clone, 0, sizeof(xmlNode)); + memset(clone, 0, sizeof(xmlNode)); /* * Set hierachical links. */ - if (resultClone != NULL) { + if (resultClone != NULL) { clone->parent = parentClone; if (prevClone) { prevClone->next = clone; clone->prev = prevClone; - } else + } else parentClone->children = clone; } else resultClone = clone; - + break; case XML_ATTRIBUTE_NODE: /* @@ -8930,7 +9038,7 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt, xmlTreeErrMemory("xmlDOMWrapCloneNode(): allocating an attr-node"); goto internal_error; } - memset(clone, 0, sizeof(xmlAttr)); + memset(clone, 0, sizeof(xmlAttr)); /* * Set hierachical links. * TODO: Change this to add to the end of attributes. @@ -8940,7 +9048,7 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt, if (prevClone) { prevClone->next = clone; clone->prev = prevClone; - } else + } else parentClone->properties = (xmlAttrPtr) clone; } else resultClone = clone; @@ -8953,8 +9061,8 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt, } clone->type = cur->type; - clone->doc = destDoc; - + clone->doc = destDoc; + /* * Clone the name of the node if any. */ @@ -8964,14 +9072,14 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt, /* * NOTE: Although xmlStringTextNoenc is never assigned to a node * in tree.c, it might be set in Libxslt via - * "xsl:disable-output-escaping". + * "xsl:disable-output-escaping". */ clone->name = xmlStringTextNoenc; else if (cur->name == xmlStringComment) clone->name = xmlStringComment; else if (cur->name != NULL) { DICT_CONST_COPY(cur->name, clone->name); - } + } switch (cur->type) { case XML_XINCLUDE_START: @@ -8994,7 +9102,7 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt, */ if (xmlDOMWrapNSNormGatherInScopeNs(&nsMap, destParent) == -1) - goto internal_error; + goto internal_error; } parnsdone = 1; } @@ -9014,7 +9122,7 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt, } memset(cloneNs, 0, sizeof(xmlNs)); cloneNs->type = XML_LOCAL_NAMESPACE; - + if (ns->href != NULL) cloneNs->href = xmlStrdup(ns->href); if (ns->prefix != NULL) @@ -9035,7 +9143,7 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt, * Does it shadow any ns-decl? */ if (XML_NSMAP_NOTEMPTY(nsMap)) { - XML_NSMAP_FOREACH(nsMap, mi) { + XML_NSMAP_FOREACH(nsMap, mi) { if ((mi->depth >= XML_TREE_NSMAP_PARENT) && (mi->shadowDepth == -1) && ((ns->prefix == mi->newNs->prefix) || @@ -9060,7 +9168,7 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt, } /* cur->ns will be processed further down. */ break; - case XML_ATTRIBUTE_NODE: + case XML_ATTRIBUTE_NODE: /* IDs will be processed further down. */ /* cur->ns will be processed further down. */ break; @@ -9069,12 +9177,12 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt, /* * Note that this will also cover the values of attributes. */ - DICT_COPY(cur->content, clone->content); + DICT_COPY(cur->content, clone->content); goto leave_node; case XML_ENTITY_NODE: /* TODO: What to do here? */ goto leave_node; - case XML_ENTITY_REF_NODE: + case XML_ENTITY_REF_NODE: if (sourceDoc != destDoc) { if ((destDoc->intSubset) || (destDoc->extSubset)) { xmlEntityPtr ent; @@ -9114,13 +9222,13 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt, /* handle_ns_reference: */ /* ** The following will take care of references to ns-decls ******** - ** and is intended only for element- and attribute-nodes. + ** and is intended only for element- and attribute-nodes. ** */ if (! parnsdone) { if (destParent && (ctxt == NULL)) { if (xmlDOMWrapNSNormGatherInScopeNs(&nsMap, destParent) == -1) - goto internal_error; + goto internal_error; } parnsdone = 1; } @@ -9131,7 +9239,7 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt, /* * Search for a mapping. */ - XML_NSMAP_FOREACH(nsMap, mi) { + XML_NSMAP_FOREACH(nsMap, mi) { if ((mi->shadowDepth == -1) && (cur->ns == mi->oldNs)) { /* @@ -9163,7 +9271,7 @@ xmlDOMWrapCloneNode(xmlDOMWrapCtxtPtr ctxt, * Aquire a normalized ns-decl and add it to the map. */ if (xmlDOMWrapNSNormAquireNormalizedNs(destDoc, - /* ns-decls on curElem or on destDoc->oldNs */ + /* ns-decls on curElem or on destDoc->oldNs */ destParent ? curElem : NULL, cur->ns, &ns, &nsMap, depth, @@ -9186,9 +9294,9 @@ end_ns_reference: (clone->parent != NULL)) { if (xmlIsID(destDoc, clone->parent, (xmlAttrPtr) clone)) { - + xmlChar *idVal; - + idVal = xmlNodeListGetString(cur->doc, cur->children, 1); if (idVal != NULL) { if (xmlAddID(NULL, destDoc, idVal, (xmlAttrPtr) cur) == NULL) { @@ -9204,12 +9312,12 @@ end_ns_reference: ** ** The following will traverse the tree ************************** ** - * + * * Walk the element's attributes before descending into child-nodes. */ if ((cur->type == XML_ELEMENT_NODE) && (cur->properties != NULL)) { prevClone = NULL; - parentClone = clone; + parentClone = clone; cur = (xmlNodePtr) cur->properties; continue; } @@ -9239,14 +9347,14 @@ leave_node: /* * TODO: Do we expect nsDefs on XML_XINCLUDE_START? */ - if (XML_NSMAP_NOTEMPTY(nsMap)) { + if (XML_NSMAP_NOTEMPTY(nsMap)) { /* * Pop mappings. */ while ((nsMap->last != NULL) && (nsMap->last->depth >= depth)) { - XML_NSMAP_POP(nsMap, mi) + XML_NSMAP_POP(nsMap, mi) } /* * Unshadow. @@ -9255,7 +9363,7 @@ leave_node: if (mi->shadowDepth >= depth) mi->shadowDepth = -1; } - } + } depth--; } if (cur->next != NULL) { @@ -9268,7 +9376,7 @@ leave_node: if (clone->parent != NULL) clone->parent->last = clone; clone = clone->parent; - parentClone = clone->parent; + parentClone = clone->parent; /* * Process parent --> next; */ @@ -9277,14 +9385,14 @@ leave_node: } else { /* This is for attributes only. */ clone = clone->parent; - parentClone = clone->parent; + parentClone = clone->parent; /* * Process parent-element --> children. */ cur = cur->parent; - goto into_content; + goto into_content; } - } + } goto exit; internal_error: @@ -9305,7 +9413,7 @@ exit: nsMap->pool = nsMap->first; nsMap->first = NULL; } - } else + } else xmlDOMWrapNsMapFree(nsMap); } /* @@ -9345,7 +9453,7 @@ xmlDOMWrapAdoptAttr(xmlDOMWrapCtxtPtr ctxt, if ((attr == NULL) || (destDoc == NULL)) return (-1); - + attr->doc = destDoc; if (attr->ns != NULL) { xmlNsPtr ns = NULL; @@ -9372,13 +9480,13 @@ xmlDOMWrapAdoptAttr(xmlDOMWrapCtxtPtr ctxt, ns = xmlDOMWrapNSNormDeclareNsForced(destDoc, destParent, attr->ns->href, attr->ns->prefix, 1); } - } + } if (ns == NULL) goto internal_error; attr->ns = ns; - } - - XML_TREE_ADOPT_STR(attr->name); + } + + XML_TREE_ADOPT_STR(attr->name); attr->atype = 0; attr->psvi = NULL; /* @@ -9393,7 +9501,7 @@ xmlDOMWrapAdoptAttr(xmlDOMWrapCtxtPtr ctxt, case XML_TEXT_NODE: case XML_CDATA_SECTION_NODE: XML_TREE_ADOPT_STR_2(cur->content) - break; + break; case XML_ENTITY_REF_NODE: /* * Remove reference to the entitity-node. @@ -9411,7 +9519,7 @@ xmlDOMWrapAdoptAttr(xmlDOMWrapCtxtPtr ctxt, cur->content = ent->content; cur->children = (xmlNodePtr) ent; cur->last = (xmlNodePtr) ent; - } + } } break; default: @@ -9449,8 +9557,8 @@ internal_error: * 1) If @destParent is given, then nsDef entries on element-nodes are used * 2) If *no* @destParent is given, then @destDoc->oldNs entries are used * This is the case when you have an unliked node and just want to move it -* to the context of -* +* to the context of +* * If @destParent is given, it ensures that the tree is namespace * wellformed by creating additional ns-decls where needed. * Note that, since prefixes of already existent ns-decls can be @@ -9467,7 +9575,7 @@ int xmlDOMWrapAdoptNode(xmlDOMWrapCtxtPtr ctxt, xmlDocPtr sourceDoc, xmlNodePtr node, - xmlDocPtr destDoc, + xmlDocPtr destDoc, xmlNodePtr destParent, int options) { @@ -9476,7 +9584,7 @@ xmlDOMWrapAdoptNode(xmlDOMWrapCtxtPtr ctxt, return(-1); /* * Check node->doc sanity. - */ + */ if ((node->doc != NULL) && (sourceDoc != NULL) && (node->doc != sourceDoc)) { /* @@ -9489,7 +9597,7 @@ xmlDOMWrapAdoptNode(xmlDOMWrapCtxtPtr ctxt, if (sourceDoc == destDoc) return (-1); switch (node->type) { - case XML_ELEMENT_NODE: + case XML_ELEMENT_NODE: case XML_ATTRIBUTE_NODE: case XML_TEXT_NODE: case XML_CDATA_SECTION_NODE: @@ -9515,7 +9623,7 @@ xmlDOMWrapAdoptNode(xmlDOMWrapCtxtPtr ctxt, } else if (node->type == XML_ATTRIBUTE_NODE) { return (xmlDOMWrapAdoptAttr(ctxt, sourceDoc, (xmlAttrPtr) node, destDoc, destParent, options)); - } else { + } else { xmlNodePtr cur = node; int adoptStr = 1; @@ -9527,7 +9635,7 @@ xmlDOMWrapAdoptNode(xmlDOMWrapCtxtPtr ctxt, (sourceDoc->dict == destDoc->dict)) adoptStr = 0; switch (node->type) { - case XML_TEXT_NODE: + case XML_TEXT_NODE: case XML_CDATA_SECTION_NODE: XML_TREE_ADOPT_STR_2(node->content) break; @@ -9560,7 +9668,7 @@ xmlDOMWrapAdoptNode(xmlDOMWrapCtxtPtr ctxt, default: break; } - } + } return (0); } diff --git a/uri.c b/uri.c index fafd112..28401c8 100644 --- a/uri.c +++ b/uri.c @@ -1,7 +1,7 @@ /** * uri.c: set of generic URI related routines * - * Reference: RFCs 2396, 2732 and 2373 + * Reference: RFCs 3986, 2732 and 2373 * * See Copyright for the status of this software. * @@ -18,14 +18,10 @@ #include #include -/************************************************************************ - * * - * Macros to differentiate various character type * - * directly extracted from RFC 2396 * - * * - ************************************************************************/ +static void xmlCleanURI(xmlURIPtr uri); /* + * Old rule from 2396 used in legacy handling code * alpha = lowalpha | upalpha */ #define IS_ALPHA(x) (IS_LOWALPHA(x) || IS_UPALPHA(x)) @@ -60,32 +56,31 @@ #define IS_ALPHANUM(x) (IS_ALPHA(x) || IS_DIGIT(x)) -/* - * hex = digit | "A" | "B" | "C" | "D" | "E" | "F" | - * "a" | "b" | "c" | "d" | "e" | "f" - */ - -#define IS_HEX(x) ((IS_DIGIT(x)) || (((x) >= 'a') && ((x) <= 'f')) || \ - (((x) >= 'A') && ((x) <= 'F'))) - /* * mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")" */ -#define IS_MARK(x) (((x) == '-') || ((x) == '_') || ((x) == '.') || \ - ((x) == '!') || ((x) == '~') || ((x) == '*') || ((x) == '\'') || \ +#define IS_MARK(x) (((x) == '-') || ((x) == '_') || ((x) == '.') || \ + ((x) == '!') || ((x) == '~') || ((x) == '*') || ((x) == '\'') || \ ((x) == '(') || ((x) == ')')) +/* + * unwise = "{" | "}" | "|" | "\" | "^" | "`" + */ +#define IS_UNWISE(p) \ + (((*(p) == '{')) || ((*(p) == '}')) || ((*(p) == '|')) || \ + ((*(p) == '\\')) || ((*(p) == '^')) || ((*(p) == '[')) || \ + ((*(p) == ']')) || ((*(p) == '`'))) /* * reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | "," | - * "[" | "]" + * "[" | "]" */ -#define IS_RESERVED(x) (((x) == ';') || ((x) == '/') || ((x) == '?') || \ - ((x) == ':') || ((x) == '@') || ((x) == '&') || ((x) == '=') || \ - ((x) == '+') || ((x) == '$') || ((x) == ',') || ((x) == '[') || \ - ((x) == ']')) +#define IS_RESERVED(x) (((x) == ';') || ((x) == '/') || ((x) == '?') || \ + ((x) == ':') || ((x) == '@') || ((x) == '&') || ((x) == '=') || \ + ((x) == '+') || ((x) == '$') || ((x) == ',') || ((x) == '[') || \ + ((x) == ']')) /* * unreserved = alphanum | mark @@ -94,1808 +89,1833 @@ #define IS_UNRESERVED(x) (IS_ALPHANUM(x) || IS_MARK(x)) /* - * escaped = "%" hex hex + * Skip to next pointer char, handle escaped sequences */ -#define IS_ESCAPED(p) ((*(p) == '%') && (IS_HEX((p)[1])) && \ - (IS_HEX((p)[2]))) +#define NEXT(p) ((*p == '%')? p += 3 : p++) /* - * uric_no_slash = unreserved | escaped | ";" | "?" | ":" | "@" | - * "&" | "=" | "+" | "$" | "," + * Productions from the spec. + * + * authority = server | reg_name + * reg_name = 1*( unreserved | escaped | "$" | "," | + * ";" | ":" | "@" | "&" | "=" | "+" ) + * + * path = [ abs_path | opaque_part ] */ -#define IS_URIC_NO_SLASH(p) ((IS_UNRESERVED(*(p))) || (IS_ESCAPED(p)) ||\ - ((*(p) == ';')) || ((*(p) == '?')) || ((*(p) == ':')) ||\ - ((*(p) == '@')) || ((*(p) == '&')) || ((*(p) == '=')) ||\ - ((*(p) == '+')) || ((*(p) == '$')) || ((*(p) == ','))) + +#define STRNDUP(s, n) (char *) xmlStrndup((const xmlChar *)(s), (n)) + +/************************************************************************ + * * + * RFC 3986 parser * + * * + ************************************************************************/ + +#define ISA_DIGIT(p) ((*(p) >= '0') && (*(p) <= '9')) +#define ISA_ALPHA(p) (((*(p) >= 'a') && (*(p) <= 'z')) || \ + ((*(p) >= 'A') && (*(p) <= 'Z'))) +#define ISA_HEXDIG(p) \ + (ISA_DIGIT(p) || ((*(p) >= 'a') && (*(p) <= 'f')) || \ + ((*(p) >= 'A') && (*(p) <= 'F'))) /* - * pchar = unreserved | escaped | ":" | "@" | "&" | "=" | "+" | "$" | "," + * sub-delims = "!" / "$" / "&" / "'" / "(" / ")" + * / "*" / "+" / "," / ";" / "=" */ -#define IS_PCHAR(p) ((IS_UNRESERVED(*(p))) || (IS_ESCAPED(p)) || \ - ((*(p) == ':')) || ((*(p) == '@')) || ((*(p) == '&')) ||\ - ((*(p) == '=')) || ((*(p) == '+')) || ((*(p) == '$')) ||\ - ((*(p) == ','))) +#define ISA_SUB_DELIM(p) \ + (((*(p) == '!')) || ((*(p) == '$')) || ((*(p) == '&')) || \ + ((*(p) == '(')) || ((*(p) == ')')) || ((*(p) == '*')) || \ + ((*(p) == '+')) || ((*(p) == ',')) || ((*(p) == ';')) || \ + ((*(p) == '='))) /* - * rel_segment = 1*( unreserved | escaped | - * ";" | "@" | "&" | "=" | "+" | "$" | "," ) + * gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@" */ - -#define IS_SEGMENT(p) ((IS_UNRESERVED(*(p))) || (IS_ESCAPED(p)) || \ - ((*(p) == ';')) || ((*(p) == '@')) || ((*(p) == '&')) || \ - ((*(p) == '=')) || ((*(p) == '+')) || ((*(p) == '$')) || \ - ((*(p) == ','))) +#define ISA_GEN_DELIM(p) \ + (((*(p) == ':')) || ((*(p) == '/')) || ((*(p) == '?')) || \ + ((*(p) == '#')) || ((*(p) == '[')) || ((*(p) == ']')) || \ + ((*(p) == '@'))) /* - * scheme = alpha *( alpha | digit | "+" | "-" | "." ) + * reserved = gen-delims / sub-delims */ - -#define IS_SCHEME(x) ((IS_ALPHA(x)) || (IS_DIGIT(x)) || \ - ((x) == '+') || ((x) == '-') || ((x) == '.')) +#define ISA_RESERVED(p) (ISA_GEN_DELIM(p) || (ISA_SUB_DELIM(p))) /* - * reg_name = 1*( unreserved | escaped | "$" | "," | - * ";" | ":" | "@" | "&" | "=" | "+" ) + * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" */ - -#define IS_REG_NAME(p) ((IS_UNRESERVED(*(p))) || (IS_ESCAPED(p)) || \ - ((*(p) == '$')) || ((*(p) == ',')) || ((*(p) == ';')) || \ - ((*(p) == ':')) || ((*(p) == '@')) || ((*(p) == '&')) || \ - ((*(p) == '=')) || ((*(p) == '+'))) +#define ISA_UNRESERVED(p) \ + ((ISA_ALPHA(p)) || (ISA_DIGIT(p)) || ((*(p) == '-')) || \ + ((*(p) == '.')) || ((*(p) == '_')) || ((*(p) == '~'))) /* - * userinfo = *( unreserved | escaped | ";" | ":" | "&" | "=" | - * "+" | "$" | "," ) + * pct-encoded = "%" HEXDIG HEXDIG */ -#define IS_USERINFO(p) ((IS_UNRESERVED(*(p))) || (IS_ESCAPED(p)) || \ - ((*(p) == ';')) || ((*(p) == ':')) || ((*(p) == '&')) || \ - ((*(p) == '=')) || ((*(p) == '+')) || ((*(p) == '$')) || \ - ((*(p) == ','))) +#define ISA_PCT_ENCODED(p) \ + ((*(p) == '%') && (ISA_HEXDIG(p + 1)) && (ISA_HEXDIG(p + 2))) /* - * uric = reserved | unreserved | escaped + * pchar = unreserved / pct-encoded / sub-delims / ":" / "@" */ +#define ISA_PCHAR(p) \ + (ISA_UNRESERVED(p) || ISA_PCT_ENCODED(p) || ISA_SUB_DELIM(p) || \ + ((*(p) == ':')) || ((*(p) == '@'))) -#define IS_URIC(p) ((IS_UNRESERVED(*(p))) || (IS_ESCAPED(p)) || \ - (IS_RESERVED(*(p)))) +/** + * xmlParse3986Scheme: + * @uri: pointer to an URI structure + * @str: pointer to the string to analyze + * + * Parse an URI scheme + * + * ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) + * + * Returns 0 or the error code + */ +static int +xmlParse3986Scheme(xmlURIPtr uri, const char **str) { + const char *cur; -/* -* unwise = "{" | "}" | "|" | "\" | "^" | "`" -*/ + if (str == NULL) + return(-1); -#define IS_UNWISE(p) \ - (((*(p) == '{')) || ((*(p) == '}')) || ((*(p) == '|')) || \ - ((*(p) == '\\')) || ((*(p) == '^')) || ((*(p) == '[')) || \ - ((*(p) == ']')) || ((*(p) == '`'))) + cur = *str; + if (!ISA_ALPHA(cur)) + return(2); + cur++; + while (ISA_ALPHA(cur) || ISA_DIGIT(cur) || + (*cur == '+') || (*cur == '-') || (*cur == '.')) cur++; + if (uri != NULL) { + if (uri->scheme != NULL) xmlFree(uri->scheme); + uri->scheme = STRNDUP(*str, cur - *str); + } + *str = cur; + return(0); +} -/* - * Skip to next pointer char, handle escaped sequences +/** + * xmlParse3986Fragment: + * @uri: pointer to an URI structure + * @str: pointer to the string to analyze + * + * Parse the query part of an URI + * + * fragment = *( pchar / "/" / "?" ) + * NOTE: the strict syntax as defined by 3986 does not allow '[' and ']' + * in the fragment identifier but this is used very broadly for + * xpointer scheme selection, so we are allowing it here to not break + * for example all the DocBook processing chains. + * + * Returns 0 or the error code */ +static int +xmlParse3986Fragment(xmlURIPtr uri, const char **str) +{ + const char *cur; -#define NEXT(p) ((*p == '%')? p += 3 : p++) + if (str == NULL) + return (-1); -/* - * Productions from the spec. + cur = *str; + + while ((ISA_PCHAR(cur)) || (*cur == '/') || (*cur == '?') || + (*cur == '[') || (*cur == ']') || + ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur)))) + NEXT(cur); + if (uri != NULL) { + if (uri->fragment != NULL) + xmlFree(uri->fragment); + if (uri->cleanup & 2) + uri->fragment = STRNDUP(*str, cur - *str); + else + uri->fragment = xmlURIUnescapeString(*str, cur - *str, NULL); + } + *str = cur; + return (0); +} + +/** + * xmlParse3986Query: + * @uri: pointer to an URI structure + * @str: pointer to the string to analyze * - * authority = server | reg_name - * reg_name = 1*( unreserved | escaped | "$" | "," | - * ";" | ":" | "@" | "&" | "=" | "+" ) + * Parse the query part of an URI * - * path = [ abs_path | opaque_part ] + * query = *uric + * + * Returns 0 or the error code */ +static int +xmlParse3986Query(xmlURIPtr uri, const char **str) +{ + const char *cur; -#define STRNDUP(s, n) (char *) xmlStrndup((const xmlChar *)(s), (n)) + if (str == NULL) + return (-1); -/************************************************************************ - * * - * Generic URI structure functions * - * * - ************************************************************************/ + cur = *str; + + while ((ISA_PCHAR(cur)) || (*cur == '/') || (*cur == '?') || + ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur)))) + NEXT(cur); + if (uri != NULL) { + if (uri->query != NULL) + xmlFree(uri->query); + if (uri->cleanup & 2) + uri->query = STRNDUP(*str, cur - *str); + else + uri->query = xmlURIUnescapeString(*str, cur - *str, NULL); + + /* Save the raw bytes of the query as well. + * See: http://mail.gnome.org/archives/xml/2007-April/thread.html#00114 + */ + if (uri->query_raw != NULL) + xmlFree (uri->query_raw); + uri->query_raw = STRNDUP (*str, cur - *str); + } + *str = cur; + return (0); +} /** - * xmlCreateURI: + * xmlParse3986Port: + * @uri: pointer to an URI structure + * @str: the string to analyze * - * Simply creates an empty xmlURI + * Parse a port part and fills in the appropriate fields + * of the @uri structure * - * Returns the new structure or NULL in case of error + * port = *DIGIT + * + * Returns 0 or the error code */ -xmlURIPtr -xmlCreateURI(void) { - xmlURIPtr ret; +static int +xmlParse3986Port(xmlURIPtr uri, const char **str) +{ + const char *cur = *str; - ret = (xmlURIPtr) xmlMalloc(sizeof(xmlURI)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlCreateURI: out of memory\n"); - return(NULL); + if (ISA_DIGIT(cur)) { + if (uri != NULL) + uri->port = 0; + while (ISA_DIGIT(cur)) { + if (uri != NULL) + uri->port = uri->port * 10 + (*cur - '0'); + cur++; + } + *str = cur; + return(0); } - memset(ret, 0, sizeof(xmlURI)); - return(ret); + return(1); } /** - * xmlSaveUri: - * @uri: pointer to an xmlURI + * xmlParse3986Userinfo: + * @uri: pointer to an URI structure + * @str: the string to analyze * - * Save the URI as an escaped string + * Parse an user informations part and fills in the appropriate fields + * of the @uri structure * - * Returns a new string (to be deallocated by caller) + * userinfo = *( unreserved / pct-encoded / sub-delims / ":" ) + * + * Returns 0 or the error code */ -xmlChar * -xmlSaveUri(xmlURIPtr uri) { - xmlChar *ret = NULL; - const char *p; - int len; - int max; +static int +xmlParse3986Userinfo(xmlURIPtr uri, const char **str) +{ + const char *cur; - if (uri == NULL) return(NULL); + cur = *str; + while (ISA_UNRESERVED(cur) || ISA_PCT_ENCODED(cur) || + ISA_SUB_DELIM(cur) || (*cur == ':')) + NEXT(cur); + if (*cur == '@') { + if (uri != NULL) { + if (uri->user != NULL) xmlFree(uri->user); + if (uri->cleanup & 2) + uri->user = STRNDUP(*str, cur - *str); + else + uri->user = xmlURIUnescapeString(*str, cur - *str, NULL); + } + *str = cur; + return(0); + } + return(1); +} +/** + * xmlParse3986DecOctet: + * @str: the string to analyze + * + * dec-octet = DIGIT ; 0-9 + * / %x31-39 DIGIT ; 10-99 + * / "1" 2DIGIT ; 100-199 + * / "2" %x30-34 DIGIT ; 200-249 + * / "25" %x30-35 ; 250-255 + * + * Skip a dec-octet. + * + * Returns 0 if found and skipped, 1 otherwise + */ +static int +xmlParse3986DecOctet(const char **str) { + const char *cur = *str; - max = 80; - ret = (xmlChar *) xmlMallocAtomic((max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - len = 0; + if (!(ISA_DIGIT(cur))) + return(1); + if (!ISA_DIGIT(cur+1)) + cur++; + else if ((*cur != '0') && (ISA_DIGIT(cur + 1)) && (!ISA_DIGIT(cur+2))) + cur += 2; + else if ((*cur == '1') && (ISA_DIGIT(cur + 1)) && (ISA_DIGIT(cur + 2))) + cur += 3; + else if ((*cur == '2') && (*(cur + 1) >= '0') && + (*(cur + 1) <= '4') && (ISA_DIGIT(cur + 2))) + cur += 3; + else if ((*cur == '2') && (*(cur + 1) == '5') && + (*(cur + 2) >= '0') && (*(cur + 1) <= '5')) + cur += 3; + else + return(1); + *str = cur; + return(0); +} +/** + * xmlParse3986Host: + * @uri: pointer to an URI structure + * @str: the string to analyze + * + * Parse an host part and fills in the appropriate fields + * of the @uri structure + * + * host = IP-literal / IPv4address / reg-name + * IP-literal = "[" ( IPv6address / IPvFuture ) "]" + * IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet + * reg-name = *( unreserved / pct-encoded / sub-delims ) + * + * Returns 0 or the error code + */ +static int +xmlParse3986Host(xmlURIPtr uri, const char **str) +{ + const char *cur = *str; + const char *host; - if (uri->scheme != NULL) { - p = uri->scheme; - while (*p != 0) { - if (len >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - ret[len++] = *p++; - } - if (len >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - ret[len++] = ':'; - } - if (uri->opaque != NULL) { - p = uri->opaque; - while (*p != 0) { - if (len + 3 >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - if (IS_RESERVED(*(p)) || IS_UNRESERVED(*(p))) - ret[len++] = *p++; - else { - int val = *(unsigned char *)p++; - int hi = val / 0x10, lo = val % 0x10; - ret[len++] = '%'; - ret[len++] = hi + (hi > 9? 'A'-10 : '0'); - ret[len++] = lo + (lo > 9? 'A'-10 : '0'); - } - } - } else { - if (uri->server != NULL) { - if (len + 3 >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - ret[len++] = '/'; - ret[len++] = '/'; - if (uri->user != NULL) { - p = uri->user; - while (*p != 0) { - if (len + 3 >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - if ((IS_UNRESERVED(*(p))) || - ((*(p) == ';')) || ((*(p) == ':')) || - ((*(p) == '&')) || ((*(p) == '=')) || - ((*(p) == '+')) || ((*(p) == '$')) || - ((*(p) == ','))) - ret[len++] = *p++; - else { - int val = *(unsigned char *)p++; - int hi = val / 0x10, lo = val % 0x10; - ret[len++] = '%'; - ret[len++] = hi + (hi > 9? 'A'-10 : '0'); - ret[len++] = lo + (lo > 9? 'A'-10 : '0'); - } - } - if (len + 3 >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - ret[len++] = '@'; - } - p = uri->server; - while (*p != 0) { - if (len >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - ret[len++] = *p++; - } - if (uri->port > 0) { - if (len + 10 >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - len += snprintf((char *) &ret[len], max - len, ":%d", uri->port); - } - } else if (uri->authority != NULL) { - if (len + 3 >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - ret[len++] = '/'; - ret[len++] = '/'; - p = uri->authority; - while (*p != 0) { - if (len + 3 >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - if ((IS_UNRESERVED(*(p))) || - ((*(p) == '$')) || ((*(p) == ',')) || ((*(p) == ';')) || - ((*(p) == ':')) || ((*(p) == '@')) || ((*(p) == '&')) || - ((*(p) == '=')) || ((*(p) == '+'))) - ret[len++] = *p++; - else { - int val = *(unsigned char *)p++; - int hi = val / 0x10, lo = val % 0x10; - ret[len++] = '%'; - ret[len++] = hi + (hi > 9? 'A'-10 : '0'); - ret[len++] = lo + (lo > 9? 'A'-10 : '0'); - } - } - } else if (uri->scheme != NULL) { - if (len + 3 >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - ret[len++] = '/'; - ret[len++] = '/'; - } - if (uri->path != NULL) { - p = uri->path; - /* - * the colon in file:///d: should not be escaped or - * Windows accesses fail later. - */ - if ((uri->scheme != NULL) && - (p[0] == '/') && - (((p[1] >= 'a') && (p[1] <= 'z')) || - ((p[1] >= 'A') && (p[1] <= 'Z'))) && - (p[2] == ':') && - (xmlStrEqual(uri->scheme, BAD_CAST "file"))) { - if (len + 3 >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - ret[len++] = *p++; - ret[len++] = *p++; - ret[len++] = *p++; - } - while (*p != 0) { - if (len + 3 >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - if ((IS_UNRESERVED(*(p))) || ((*(p) == '/')) || - ((*(p) == ';')) || ((*(p) == '@')) || ((*(p) == '&')) || - ((*(p) == '=')) || ((*(p) == '+')) || ((*(p) == '$')) || - ((*(p) == ','))) - ret[len++] = *p++; - else { - int val = *(unsigned char *)p++; - int hi = val / 0x10, lo = val % 0x10; - ret[len++] = '%'; - ret[len++] = hi + (hi > 9? 'A'-10 : '0'); - ret[len++] = lo + (lo > 9? 'A'-10 : '0'); - } - } - } - if (uri->query_raw != NULL) { - if (len + 1 >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - ret[len++] = '?'; - p = uri->query_raw; - while (*p != 0) { - if (len + 1 >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - ret[len++] = *p++; - } - } else if (uri->query != NULL) { - if (len + 3 >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - ret[len++] = '?'; - p = uri->query; - while (*p != 0) { - if (len + 3 >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - if ((IS_UNRESERVED(*(p))) || (IS_RESERVED(*(p)))) - ret[len++] = *p++; - else { - int val = *(unsigned char *)p++; - int hi = val / 0x10, lo = val % 0x10; - ret[len++] = '%'; - ret[len++] = hi + (hi > 9? 'A'-10 : '0'); - ret[len++] = lo + (lo > 9? 'A'-10 : '0'); - } - } - } + host = cur; + /* + * IPv6 and future adressing scheme are enclosed between brackets + */ + if (*cur == '[') { + cur++; + while ((*cur != ']') && (*cur != 0)) + cur++; + if (*cur != ']') + return(1); + cur++; + goto found; } - if (uri->fragment != NULL) { - if (len + 3 >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - ret[len++] = '#'; - p = uri->fragment; - while (*p != 0) { - if (len + 3 >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - if ((IS_UNRESERVED(*(p))) || (IS_RESERVED(*(p)))) - ret[len++] = *p++; - else { - int val = *(unsigned char *)p++; - int hi = val / 0x10, lo = val % 0x10; - ret[len++] = '%'; - ret[len++] = hi + (hi > 9? 'A'-10 : '0'); - ret[len++] = lo + (lo > 9? 'A'-10 : '0'); - } - } + /* + * try to parse an IPv4 + */ + if (ISA_DIGIT(cur)) { + if (xmlParse3986DecOctet(&cur) != 0) + goto not_ipv4; + if (*cur != '.') + goto not_ipv4; + cur++; + if (xmlParse3986DecOctet(&cur) != 0) + goto not_ipv4; + if (*cur != '.') + goto not_ipv4; + if (xmlParse3986DecOctet(&cur) != 0) + goto not_ipv4; + if (*cur != '.') + goto not_ipv4; + if (xmlParse3986DecOctet(&cur) != 0) + goto not_ipv4; + goto found; +not_ipv4: + cur = *str; } - if (len >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } + /* + * then this should be a hostname which can be empty + */ + while (ISA_UNRESERVED(cur) || ISA_PCT_ENCODED(cur) || ISA_SUB_DELIM(cur)) + NEXT(cur); +found: + if (uri != NULL) { + if (uri->authority != NULL) xmlFree(uri->authority); + uri->authority = NULL; + if (uri->server != NULL) xmlFree(uri->server); + if (cur != host) { + if (uri->cleanup & 2) + uri->server = STRNDUP(host, cur - host); + else + uri->server = xmlURIUnescapeString(host, cur - host, NULL); + } else + uri->server = NULL; } - ret[len++] = 0; - return(ret); + *str = cur; + return(0); } /** - * xmlPrintURI: - * @stream: a FILE* for the output - * @uri: pointer to an xmlURI + * xmlParse3986Authority: + * @uri: pointer to an URI structure + * @str: the string to analyze * - * Prints the URI in the stream @stream. + * Parse an authority part and fills in the appropriate fields + * of the @uri structure + * + * authority = [ userinfo "@" ] host [ ":" port ] + * + * Returns 0 or the error code */ -void -xmlPrintURI(FILE *stream, xmlURIPtr uri) { - xmlChar *out; +static int +xmlParse3986Authority(xmlURIPtr uri, const char **str) +{ + const char *cur; + int ret; - out = xmlSaveUri(uri); - if (out != NULL) { - fprintf(stream, "%s", (char *) out); - xmlFree(out); + cur = *str; + /* + * try to parse an userinfo and check for the trailing @ + */ + ret = xmlParse3986Userinfo(uri, &cur); + if ((ret != 0) || (*cur != '@')) + cur = *str; + else + cur++; + ret = xmlParse3986Host(uri, &cur); + if (ret != 0) return(ret); + if (*cur == ':') { + cur++; + ret = xmlParse3986Port(uri, &cur); + if (ret != 0) return(ret); } + *str = cur; + return(0); } /** - * xmlCleanURI: - * @uri: pointer to an xmlURI + * xmlParse3986Segment: + * @str: the string to analyze + * @forbid: an optional forbidden character + * @empty: allow an empty segment * - * Make sure the xmlURI struct is free of content + * Parse a segment and fills in the appropriate fields + * of the @uri structure + * + * segment = *pchar + * segment-nz = 1*pchar + * segment-nz-nc = 1*( unreserved / pct-encoded / sub-delims / "@" ) + * ; non-zero-length segment without any colon ":" + * + * Returns 0 or the error code */ -static void -xmlCleanURI(xmlURIPtr uri) { - if (uri == NULL) return; +static int +xmlParse3986Segment(const char **str, char forbid, int empty) +{ + const char *cur; - if (uri->scheme != NULL) xmlFree(uri->scheme); - uri->scheme = NULL; - if (uri->server != NULL) xmlFree(uri->server); - uri->server = NULL; - if (uri->user != NULL) xmlFree(uri->user); - uri->user = NULL; - if (uri->path != NULL) xmlFree(uri->path); - uri->path = NULL; - if (uri->fragment != NULL) xmlFree(uri->fragment); - uri->fragment = NULL; - if (uri->opaque != NULL) xmlFree(uri->opaque); - uri->opaque = NULL; - if (uri->authority != NULL) xmlFree(uri->authority); - uri->authority = NULL; - if (uri->query != NULL) xmlFree(uri->query); - uri->query = NULL; - if (uri->query_raw != NULL) xmlFree(uri->query_raw); - uri->query_raw = NULL; + cur = *str; + if (!ISA_PCHAR(cur)) { + if (empty) + return(0); + return(1); + } + while (ISA_PCHAR(cur) && (*cur != forbid)) + NEXT(cur); + *str = cur; + return (0); +} + +/** + * xmlParse3986PathAbEmpty: + * @uri: pointer to an URI structure + * @str: the string to analyze + * + * Parse an path absolute or empty and fills in the appropriate fields + * of the @uri structure + * + * path-abempty = *( "/" segment ) + * + * Returns 0 or the error code + */ +static int +xmlParse3986PathAbEmpty(xmlURIPtr uri, const char **str) +{ + const char *cur; + int ret; + + cur = *str; + + while (*cur == '/') { + cur++; + ret = xmlParse3986Segment(&cur, 0, 1); + if (ret != 0) return(ret); + } + if (uri != NULL) { + if (uri->path != NULL) xmlFree(uri->path); + if (uri->cleanup & 2) + uri->path = STRNDUP(*str, cur - *str); + else + uri->path = xmlURIUnescapeString(*str, cur - *str, NULL); + } + *str = cur; + return (0); +} + +/** + * xmlParse3986PathAbsolute: + * @uri: pointer to an URI structure + * @str: the string to analyze + * + * Parse an path absolute and fills in the appropriate fields + * of the @uri structure + * + * path-absolute = "/" [ segment-nz *( "/" segment ) ] + * + * Returns 0 or the error code + */ +static int +xmlParse3986PathAbsolute(xmlURIPtr uri, const char **str) +{ + const char *cur; + int ret; + + cur = *str; + + if (*cur != '/') + return(1); + cur++; + ret = xmlParse3986Segment(&cur, 0, 0); + if (ret == 0) { + while (*cur == '/') { + cur++; + ret = xmlParse3986Segment(&cur, 0, 1); + if (ret != 0) return(ret); + } + } + if (uri != NULL) { + if (uri->path != NULL) xmlFree(uri->path); + if (uri->cleanup & 2) + uri->path = STRNDUP(*str, cur - *str); + else + uri->path = xmlURIUnescapeString(*str, cur - *str, NULL); + } + *str = cur; + return (0); +} + +/** + * xmlParse3986PathRootless: + * @uri: pointer to an URI structure + * @str: the string to analyze + * + * Parse an path without root and fills in the appropriate fields + * of the @uri structure + * + * path-rootless = segment-nz *( "/" segment ) + * + * Returns 0 or the error code + */ +static int +xmlParse3986PathRootless(xmlURIPtr uri, const char **str) +{ + const char *cur; + int ret; + + cur = *str; + + ret = xmlParse3986Segment(&cur, 0, 0); + if (ret != 0) return(ret); + while (*cur == '/') { + cur++; + ret = xmlParse3986Segment(&cur, 0, 1); + if (ret != 0) return(ret); + } + if (uri != NULL) { + if (uri->path != NULL) xmlFree(uri->path); + if (uri->cleanup & 2) + uri->path = STRNDUP(*str, cur - *str); + else + uri->path = xmlURIUnescapeString(*str, cur - *str, NULL); + } + *str = cur; + return (0); } /** - * xmlFreeURI: - * @uri: pointer to an xmlURI + * xmlParse3986PathNoScheme: + * @uri: pointer to an URI structure + * @str: the string to analyze * - * Free up the xmlURI struct + * Parse an path which is not a scheme and fills in the appropriate fields + * of the @uri structure + * + * path-noscheme = segment-nz-nc *( "/" segment ) + * + * Returns 0 or the error code */ -void -xmlFreeURI(xmlURIPtr uri) { - if (uri == NULL) return; +static int +xmlParse3986PathNoScheme(xmlURIPtr uri, const char **str) +{ + const char *cur; + int ret; - if (uri->scheme != NULL) xmlFree(uri->scheme); - if (uri->server != NULL) xmlFree(uri->server); - if (uri->user != NULL) xmlFree(uri->user); - if (uri->path != NULL) xmlFree(uri->path); - if (uri->fragment != NULL) xmlFree(uri->fragment); - if (uri->opaque != NULL) xmlFree(uri->opaque); - if (uri->authority != NULL) xmlFree(uri->authority); - if (uri->query != NULL) xmlFree(uri->query); - if (uri->query_raw != NULL) xmlFree(uri->query_raw); - xmlFree(uri); -} + cur = *str; -/************************************************************************ - * * - * Helper functions * - * * - ************************************************************************/ + ret = xmlParse3986Segment(&cur, ':', 0); + if (ret != 0) return(ret); + while (*cur == '/') { + cur++; + ret = xmlParse3986Segment(&cur, 0, 1); + if (ret != 0) return(ret); + } + if (uri != NULL) { + if (uri->path != NULL) xmlFree(uri->path); + if (uri->cleanup & 2) + uri->path = STRNDUP(*str, cur - *str); + else + uri->path = xmlURIUnescapeString(*str, cur - *str, NULL); + } + *str = cur; + return (0); +} /** - * xmlNormalizeURIPath: - * @path: pointer to the path string + * xmlParse3986HierPart: + * @uri: pointer to an URI structure + * @str: the string to analyze * - * Applies the 5 normalization steps to a path string--that is, RFC 2396 - * Section 5.2, steps 6.c through 6.g. + * Parse an hierarchical part and fills in the appropriate fields + * of the @uri structure * - * Normalization occurs directly on the string, no new allocation is done + * hier-part = "//" authority path-abempty + * / path-absolute + * / path-rootless + * / path-empty * - * Returns 0 or an error code + * Returns 0 or the error code */ -int -xmlNormalizeURIPath(char *path) { - char *cur, *out; - - if (path == NULL) - return(-1); - - /* Skip all initial "/" chars. We want to get to the beginning of the - * first non-empty segment. - */ - cur = path; - while (cur[0] == '/') - ++cur; - if (cur[0] == '\0') - return(0); +static int +xmlParse3986HierPart(xmlURIPtr uri, const char **str) +{ + const char *cur; + int ret; - /* Keep everything we've seen so far. */ - out = cur; + cur = *str; - /* - * Analyze each segment in sequence for cases (c) and (d). - */ - while (cur[0] != '\0') { - /* - * c) All occurrences of "./", where "." is a complete path segment, - * are removed from the buffer string. - */ - if ((cur[0] == '.') && (cur[1] == '/')) { - cur += 2; - /* '//' normalization should be done at this point too */ - while (cur[0] == '/') - cur++; - continue; + if ((*cur == '/') && (*(cur + 1) == '/')) { + cur += 2; + ret = xmlParse3986Authority(uri, &cur); + if (ret != 0) return(ret); + ret = xmlParse3986PathAbEmpty(uri, &cur); + if (ret != 0) return(ret); + *str = cur; + return(0); + } else if (*cur == '/') { + ret = xmlParse3986PathAbsolute(uri, &cur); + if (ret != 0) return(ret); + } else if (ISA_PCHAR(cur)) { + ret = xmlParse3986PathRootless(uri, &cur); + if (ret != 0) return(ret); + } else { + /* path-empty is effectively empty */ + if (uri != NULL) { + if (uri->path != NULL) xmlFree(uri->path); + uri->path = NULL; } + } + *str = cur; + return (0); +} - /* - * d) If the buffer string ends with "." as a complete path segment, - * that "." is removed. - */ - if ((cur[0] == '.') && (cur[1] == '\0')) - break; +/** + * xmlParse3986RelativeRef: + * @uri: pointer to an URI structure + * @str: the string to analyze + * + * Parse an URI string and fills in the appropriate fields + * of the @uri structure + * + * relative-ref = relative-part [ "?" query ] [ "#" fragment ] + * relative-part = "//" authority path-abempty + * / path-absolute + * / path-noscheme + * / path-empty + * + * Returns 0 or the error code + */ +static int +xmlParse3986RelativeRef(xmlURIPtr uri, const char *str) { + int ret; - /* Otherwise keep the segment. */ - while (cur[0] != '/') { - if (cur[0] == '\0') - goto done_cd; - (out++)[0] = (cur++)[0]; + if ((*str == '/') && (*(str + 1) == '/')) { + str += 2; + ret = xmlParse3986Authority(uri, &str); + if (ret != 0) return(ret); + ret = xmlParse3986PathAbEmpty(uri, &str); + if (ret != 0) return(ret); + } else if (*str == '/') { + ret = xmlParse3986PathAbsolute(uri, &str); + if (ret != 0) return(ret); + } else if (ISA_PCHAR(str)) { + ret = xmlParse3986PathNoScheme(uri, &str); + if (ret != 0) return(ret); + } else { + /* path-empty is effectively empty */ + if (uri != NULL) { + if (uri->path != NULL) xmlFree(uri->path); + uri->path = NULL; } - /* nomalize // */ - while ((cur[0] == '/') && (cur[1] == '/')) - cur++; - - (out++)[0] = (cur++)[0]; } - done_cd: - out[0] = '\0'; - - /* Reset to the beginning of the first segment for the next sequence. */ - cur = path; - while (cur[0] == '/') - ++cur; - if (cur[0] == '\0') - return(0); - - /* - * Analyze each segment in sequence for cases (e) and (f). - * - * e) All occurrences of "/../", where is a - * complete path segment not equal to "..", are removed from the - * buffer string. Removal of these path segments is performed - * iteratively, removing the leftmost matching pattern on each - * iteration, until no matching pattern remains. - * - * f) If the buffer string ends with "/..", where - * is a complete path segment not equal to "..", that - * "/.." is removed. - * - * To satisfy the "iterative" clause in (e), we need to collapse the - * string every time we find something that needs to be removed. Thus, - * we don't need to keep two pointers into the string: we only need a - * "current position" pointer. - */ - while (1) { - char *segp, *tmp; - - /* At the beginning of each iteration of this loop, "cur" points to - * the first character of the segment we want to examine. - */ - - /* Find the end of the current segment. */ - segp = cur; - while ((segp[0] != '/') && (segp[0] != '\0')) - ++segp; - - /* If this is the last segment, we're done (we need at least two - * segments to meet the criteria for the (e) and (f) cases). - */ - if (segp[0] == '\0') - break; - - /* If the first segment is "..", or if the next segment _isn't_ "..", - * keep this segment and try the next one. - */ - ++segp; - if (((cur[0] == '.') && (cur[1] == '.') && (segp == cur+3)) - || ((segp[0] != '.') || (segp[1] != '.') - || ((segp[2] != '/') && (segp[2] != '\0')))) { - cur = segp; - continue; - } - - /* If we get here, remove this segment and the next one and back up - * to the previous segment (if there is one), to implement the - * "iteratively" clause. It's pretty much impossible to back up - * while maintaining two pointers into the buffer, so just compact - * the whole buffer now. - */ - - /* If this is the end of the buffer, we're done. */ - if (segp[2] == '\0') { - cur[0] = '\0'; - break; - } - /* Valgrind complained, strcpy(cur, segp + 3); */ - /* string will overlap, do not use strcpy */ - tmp = cur; - segp += 3; - while ((*tmp++ = *segp++) != 0); - - /* If there are no previous segments, then keep going from here. */ - segp = cur; - while ((segp > path) && ((--segp)[0] == '/')) - ; - if (segp == path) - continue; - /* "segp" is pointing to the end of a previous segment; find it's - * start. We need to back up to the previous segment and start - * over with that to handle things like "foo/bar/../..". If we - * don't do this, then on the first pass we'll remove the "bar/..", - * but be pointing at the second ".." so we won't realize we can also - * remove the "foo/..". - */ - cur = segp; - while ((cur > path) && (cur[-1] != '/')) - --cur; + if (*str == '?') { + str++; + ret = xmlParse3986Query(uri, &str); + if (ret != 0) return(ret); + } + if (*str == '#') { + str++; + ret = xmlParse3986Fragment(uri, &str); + if (ret != 0) return(ret); + } + if (*str != 0) { + xmlCleanURI(uri); + return(1); } - out[0] = '\0'; + return(0); +} - /* - * g) If the resulting buffer string still begins with one or more - * complete path segments of "..", then the reference is - * considered to be in error. Implementations may handle this - * error by retaining these components in the resolved path (i.e., - * treating them as part of the final URI), by removing them from - * the resolved path (i.e., discarding relative levels above the - * root), or by avoiding traversal of the reference. - * - * We discard them from the final path. - */ - if (path[0] == '/') { - cur = path; - while ((cur[0] == '/') && (cur[1] == '.') && (cur[2] == '.') - && ((cur[3] == '/') || (cur[3] == '\0'))) - cur += 3; - if (cur != path) { - out = path; - while (cur[0] != '\0') - (out++)[0] = (cur++)[0]; - out[0] = 0; - } - } +/** + * xmlParse3986URI: + * @uri: pointer to an URI structure + * @str: the string to analyze + * + * Parse an URI string and fills in the appropriate fields + * of the @uri structure + * + * scheme ":" hier-part [ "?" query ] [ "#" fragment ] + * + * Returns 0 or the error code + */ +static int +xmlParse3986URI(xmlURIPtr uri, const char *str) { + int ret; + ret = xmlParse3986Scheme(uri, &str); + if (ret != 0) return(ret); + if (*str != ':') { + return(1); + } + str++; + ret = xmlParse3986HierPart(uri, &str); + if (ret != 0) return(ret); + if (*str == '?') { + str++; + ret = xmlParse3986Query(uri, &str); + if (ret != 0) return(ret); + } + if (*str == '#') { + str++; + ret = xmlParse3986Fragment(uri, &str); + if (ret != 0) return(ret); + } + if (*str != 0) { + xmlCleanURI(uri); + return(1); + } return(0); } -static int is_hex(char c) { - if (((c >= '0') && (c <= '9')) || - ((c >= 'a') && (c <= 'f')) || - ((c >= 'A') && (c <= 'F'))) - return(1); +/** + * xmlParse3986URIReference: + * @uri: pointer to an URI structure + * @str: the string to analyze + * + * Parse an URI reference string and fills in the appropriate fields + * of the @uri structure + * + * URI-reference = URI / relative-ref + * + * Returns 0 or the error code + */ +static int +xmlParse3986URIReference(xmlURIPtr uri, const char *str) { + int ret; + + if (str == NULL) + return(-1); + xmlCleanURI(uri); + + /* + * Try first to parse absolute refs, then fallback to relative if + * it fails. + */ + ret = xmlParse3986URI(uri, str); + if (ret != 0) { + xmlCleanURI(uri); + ret = xmlParse3986RelativeRef(uri, str); + if (ret != 0) { + xmlCleanURI(uri); + return(ret); + } + } return(0); } /** - * xmlURIUnescapeString: - * @str: the string to unescape - * @len: the length in bytes to unescape (or <= 0 to indicate full string) - * @target: optional destination buffer + * xmlParseURI: + * @str: the URI string to analyze * - * Unescaping routine, but does not check that the string is an URI. The - * output is a direct unsigned char translation of %XX values (no encoding) - * Note that the length of the result can only be smaller or same size as - * the input string. + * Parse an URI based on RFC 3986 * - * Returns a copy of the string, but unescaped, will return NULL only in case - * of error + * URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ] + * + * Returns a newly built xmlURIPtr or NULL in case of error */ -char * -xmlURIUnescapeString(const char *str, int len, char *target) { - char *ret, *out; - const char *in; +xmlURIPtr +xmlParseURI(const char *str) { + xmlURIPtr uri; + int ret; if (str == NULL) return(NULL); - if (len <= 0) len = strlen(str); - if (len < 0) return(NULL); - - if (target == NULL) { - ret = (char *) xmlMallocAtomic(len + 1); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlURIUnescapeString: out of memory\n"); + uri = xmlCreateURI(); + if (uri != NULL) { + ret = xmlParse3986URIReference(uri, str); + if (ret) { + xmlFreeURI(uri); return(NULL); } - } else - ret = target; - in = str; - out = ret; - while(len > 0) { - if ((len > 2) && (*in == '%') && (is_hex(in[1])) && (is_hex(in[2]))) { - in++; - if ((*in >= '0') && (*in <= '9')) - *out = (*in - '0'); - else if ((*in >= 'a') && (*in <= 'f')) - *out = (*in - 'a') + 10; - else if ((*in >= 'A') && (*in <= 'F')) - *out = (*in - 'A') + 10; - in++; - if ((*in >= '0') && (*in <= '9')) - *out = *out * 16 + (*in - '0'); - else if ((*in >= 'a') && (*in <= 'f')) - *out = *out * 16 + (*in - 'a') + 10; - else if ((*in >= 'A') && (*in <= 'F')) - *out = *out * 16 + (*in - 'A') + 10; - in++; - len -= 3; - out++; - } else { - *out++ = *in++; - len--; + } + return(uri); +} + +/** + * xmlParseURIReference: + * @uri: pointer to an URI structure + * @str: the string to analyze + * + * Parse an URI reference string based on RFC 3986 and fills in the + * appropriate fields of the @uri structure + * + * URI-reference = URI / relative-ref + * + * Returns 0 or the error code + */ +int +xmlParseURIReference(xmlURIPtr uri, const char *str) { + return(xmlParse3986URIReference(uri, str)); +} + +/** + * xmlParseURIRaw: + * @str: the URI string to analyze + * @raw: if 1 unescaping of URI pieces are disabled + * + * Parse an URI but allows to keep intact the original fragments. + * + * URI-reference = URI / relative-ref + * + * Returns a newly built xmlURIPtr or NULL in case of error + */ +xmlURIPtr +xmlParseURIRaw(const char *str, int raw) { + xmlURIPtr uri; + int ret; + + if (str == NULL) + return(NULL); + uri = xmlCreateURI(); + if (uri != NULL) { + if (raw) { + uri->cleanup |= 2; + } + ret = xmlParseURIReference(uri, str); + if (ret) { + xmlFreeURI(uri); + return(NULL); } } - *out = 0; + return(uri); +} + +/************************************************************************ + * * + * Generic URI structure functions * + * * + ************************************************************************/ + +/** + * xmlCreateURI: + * + * Simply creates an empty xmlURI + * + * Returns the new structure or NULL in case of error + */ +xmlURIPtr +xmlCreateURI(void) { + xmlURIPtr ret; + + ret = (xmlURIPtr) xmlMalloc(sizeof(xmlURI)); + if (ret == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xmlCreateURI: out of memory\n"); + return(NULL); + } + memset(ret, 0, sizeof(xmlURI)); return(ret); } /** - * xmlURIEscapeStr: - * @str: string to escape - * @list: exception list string of chars not to escape + * xmlSaveUri: + * @uri: pointer to an xmlURI * - * This routine escapes a string to hex, ignoring reserved characters (a-z) - * and the characters in the exception list. + * Save the URI as an escaped string * - * Returns a new escaped string or NULL in case of error. + * Returns a new string (to be deallocated by caller) */ xmlChar * -xmlURIEscapeStr(const xmlChar *str, const xmlChar *list) { - xmlChar *ret, ch; - const xmlChar *in; +xmlSaveUri(xmlURIPtr uri) { + xmlChar *ret = NULL; + xmlChar *temp; + const char *p; + int len; + int max; - unsigned int len, out; + if (uri == NULL) return(NULL); - if (str == NULL) - return(NULL); - if (str[0] == 0) - return(xmlStrdup(str)); - len = xmlStrlen(str); - if (!(len > 0)) return(NULL); - len += 20; - ret = (xmlChar *) xmlMallocAtomic(len); + max = 80; + ret = (xmlChar *) xmlMallocAtomic((max + 1) * sizeof(xmlChar)); if (ret == NULL) { xmlGenericError(xmlGenericErrorContext, - "xmlURIEscapeStr: out of memory\n"); + "xmlSaveUri: out of memory\n"); return(NULL); } - in = (const xmlChar *) str; - out = 0; - while(*in != 0) { - if (len - out <= 3) { - len += 20; - ret = (xmlChar *) xmlRealloc(ret, len); - if (ret == NULL) { + len = 0; + + if (uri->scheme != NULL) { + p = uri->scheme; + while (*p != 0) { + if (len >= max) { + max *= 2; + temp = (xmlChar *) xmlRealloc(ret, (max + 1) * sizeof(xmlChar)); + if (temp == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xmlSaveUri: out of memory\n"); + xmlFree(ret); + return(NULL); + } + ret = temp; + } + ret[len++] = *p++; + } + if (len >= max) { + max *= 2; + temp = (xmlChar *) xmlRealloc(ret, (max + 1) * sizeof(xmlChar)); + if (temp == NULL) { xmlGenericError(xmlGenericErrorContext, - "xmlURIEscapeStr: out of memory\n"); + "xmlSaveUri: out of memory\n"); + xmlFree(ret); return(NULL); } + ret = temp; } - - ch = *in; - - if ((ch != '@') && (!IS_UNRESERVED(ch)) && (!xmlStrchr(list, ch))) { - unsigned char val; - ret[out++] = '%'; - val = ch >> 4; - if (val <= 9) - ret[out++] = '0' + val; - else - ret[out++] = 'A' + val - 0xA; - val = ch & 0xF; - if (val <= 9) - ret[out++] = '0' + val; - else - ret[out++] = 'A' + val - 0xA; - in++; - } else { - ret[out++] = *in++; + ret[len++] = ':'; + } + if (uri->opaque != NULL) { + p = uri->opaque; + while (*p != 0) { + if (len + 3 >= max) { + max *= 2; + temp = (xmlChar *) xmlRealloc(ret, (max + 1) * sizeof(xmlChar)); + if (temp == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xmlSaveUri: out of memory\n"); + xmlFree(ret); + return(NULL); + } + ret = temp; + } + if (IS_RESERVED(*(p)) || IS_UNRESERVED(*(p))) + ret[len++] = *p++; + else { + int val = *(unsigned char *)p++; + int hi = val / 0x10, lo = val % 0x10; + ret[len++] = '%'; + ret[len++] = hi + (hi > 9? 'A'-10 : '0'); + ret[len++] = lo + (lo > 9? 'A'-10 : '0'); + } + } + } else { + if (uri->server != NULL) { + if (len + 3 >= max) { + max *= 2; + temp = (xmlChar *) xmlRealloc(ret, (max + 1) * sizeof(xmlChar)); + if (temp == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xmlSaveUri: out of memory\n"); + xmlFree(ret); + return(NULL); + } + ret = temp; + } + ret[len++] = '/'; + ret[len++] = '/'; + if (uri->user != NULL) { + p = uri->user; + while (*p != 0) { + if (len + 3 >= max) { + max *= 2; + temp = (xmlChar *) xmlRealloc(ret, + (max + 1) * sizeof(xmlChar)); + if (temp == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xmlSaveUri: out of memory\n"); + xmlFree(ret); + return(NULL); + } + ret = temp; + } + if ((IS_UNRESERVED(*(p))) || + ((*(p) == ';')) || ((*(p) == ':')) || + ((*(p) == '&')) || ((*(p) == '=')) || + ((*(p) == '+')) || ((*(p) == '$')) || + ((*(p) == ','))) + ret[len++] = *p++; + else { + int val = *(unsigned char *)p++; + int hi = val / 0x10, lo = val % 0x10; + ret[len++] = '%'; + ret[len++] = hi + (hi > 9? 'A'-10 : '0'); + ret[len++] = lo + (lo > 9? 'A'-10 : '0'); + } + } + if (len + 3 >= max) { + max *= 2; + temp = (xmlChar *) xmlRealloc(ret, + (max + 1) * sizeof(xmlChar)); + if (temp == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xmlSaveUri: out of memory\n"); + xmlFree(ret); + return(NULL); + } + ret = temp; + } + ret[len++] = '@'; + } + p = uri->server; + while (*p != 0) { + if (len >= max) { + max *= 2; + temp = (xmlChar *) xmlRealloc(ret, + (max + 1) * sizeof(xmlChar)); + if (temp == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xmlSaveUri: out of memory\n"); + xmlFree(ret); + return(NULL); + } + ret = temp; + } + ret[len++] = *p++; + } + if (uri->port > 0) { + if (len + 10 >= max) { + max *= 2; + temp = (xmlChar *) xmlRealloc(ret, + (max + 1) * sizeof(xmlChar)); + if (temp == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xmlSaveUri: out of memory\n"); + xmlFree(ret); + return(NULL); + } + ret = temp; + } + len += snprintf((char *) &ret[len], max - len, ":%d", uri->port); + } + } else if (uri->authority != NULL) { + if (len + 3 >= max) { + max *= 2; + temp = (xmlChar *) xmlRealloc(ret, + (max + 1) * sizeof(xmlChar)); + if (temp == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xmlSaveUri: out of memory\n"); + xmlFree(ret); + return(NULL); + } + ret = temp; + } + ret[len++] = '/'; + ret[len++] = '/'; + p = uri->authority; + while (*p != 0) { + if (len + 3 >= max) { + max *= 2; + temp = (xmlChar *) xmlRealloc(ret, + (max + 1) * sizeof(xmlChar)); + if (temp == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xmlSaveUri: out of memory\n"); + xmlFree(ret); + return(NULL); + } + ret = temp; + } + if ((IS_UNRESERVED(*(p))) || + ((*(p) == '$')) || ((*(p) == ',')) || ((*(p) == ';')) || + ((*(p) == ':')) || ((*(p) == '@')) || ((*(p) == '&')) || + ((*(p) == '=')) || ((*(p) == '+'))) + ret[len++] = *p++; + else { + int val = *(unsigned char *)p++; + int hi = val / 0x10, lo = val % 0x10; + ret[len++] = '%'; + ret[len++] = hi + (hi > 9? 'A'-10 : '0'); + ret[len++] = lo + (lo > 9? 'A'-10 : '0'); + } + } + } else if (uri->scheme != NULL) { + if (len + 3 >= max) { + max *= 2; + temp = (xmlChar *) xmlRealloc(ret, + (max + 1) * sizeof(xmlChar)); + if (temp == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xmlSaveUri: out of memory\n"); + xmlFree(ret); + return(NULL); + } + ret = temp; + } + ret[len++] = '/'; + ret[len++] = '/'; + } + if (uri->path != NULL) { + p = uri->path; + /* + * the colon in file:///d: should not be escaped or + * Windows accesses fail later. + */ + if ((uri->scheme != NULL) && + (p[0] == '/') && + (((p[1] >= 'a') && (p[1] <= 'z')) || + ((p[1] >= 'A') && (p[1] <= 'Z'))) && + (p[2] == ':') && + (xmlStrEqual(BAD_CAST uri->scheme, BAD_CAST "file"))) { + if (len + 3 >= max) { + max *= 2; + ret = (xmlChar *) xmlRealloc(ret, + (max + 1) * sizeof(xmlChar)); + if (ret == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xmlSaveUri: out of memory\n"); + return(NULL); + } + } + ret[len++] = *p++; + ret[len++] = *p++; + ret[len++] = *p++; + } + while (*p != 0) { + if (len + 3 >= max) { + max *= 2; + temp = (xmlChar *) xmlRealloc(ret, + (max + 1) * sizeof(xmlChar)); + if (temp == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xmlSaveUri: out of memory\n"); + xmlFree(ret); + return(NULL); + } + ret = temp; + } + if ((IS_UNRESERVED(*(p))) || ((*(p) == '/')) || + ((*(p) == ';')) || ((*(p) == '@')) || ((*(p) == '&')) || + ((*(p) == '=')) || ((*(p) == '+')) || ((*(p) == '$')) || + ((*(p) == ','))) + ret[len++] = *p++; + else { + int val = *(unsigned char *)p++; + int hi = val / 0x10, lo = val % 0x10; + ret[len++] = '%'; + ret[len++] = hi + (hi > 9? 'A'-10 : '0'); + ret[len++] = lo + (lo > 9? 'A'-10 : '0'); + } + } + } + if (uri->query_raw != NULL) { + if (len + 1 >= max) { + max *= 2; + temp = (xmlChar *) xmlRealloc(ret, + (max + 1) * sizeof(xmlChar)); + if (temp == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xmlSaveUri: out of memory\n"); + xmlFree(ret); + return(NULL); + } + ret = temp; + } + ret[len++] = '?'; + p = uri->query_raw; + while (*p != 0) { + if (len + 1 >= max) { + max *= 2; + temp = (xmlChar *) xmlRealloc(ret, + (max + 1) * sizeof(xmlChar)); + if (temp == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xmlSaveUri: out of memory\n"); + xmlFree(ret); + return(NULL); + } + ret = temp; + } + ret[len++] = *p++; + } + } else if (uri->query != NULL) { + if (len + 3 >= max) { + max *= 2; + temp = (xmlChar *) xmlRealloc(ret, + (max + 1) * sizeof(xmlChar)); + if (temp == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xmlSaveUri: out of memory\n"); + xmlFree(ret); + return(NULL); + } + ret = temp; + } + ret[len++] = '?'; + p = uri->query; + while (*p != 0) { + if (len + 3 >= max) { + max *= 2; + temp = (xmlChar *) xmlRealloc(ret, + (max + 1) * sizeof(xmlChar)); + if (temp == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xmlSaveUri: out of memory\n"); + xmlFree(ret); + return(NULL); + } + ret = temp; + } + if ((IS_UNRESERVED(*(p))) || (IS_RESERVED(*(p)))) + ret[len++] = *p++; + else { + int val = *(unsigned char *)p++; + int hi = val / 0x10, lo = val % 0x10; + ret[len++] = '%'; + ret[len++] = hi + (hi > 9? 'A'-10 : '0'); + ret[len++] = lo + (lo > 9? 'A'-10 : '0'); + } + } } - - } - ret[out] = 0; - return(ret); -} - -/** - * xmlURIEscape: - * @str: the string of the URI to escape - * - * Escaping routine, does not do validity checks ! - * It will try to escape the chars needing this, but this is heuristic - * based it's impossible to be sure. - * - * Returns an copy of the string, but escaped - * - * 25 May 2001 - * Uses xmlParseURI and xmlURIEscapeStr to try to escape correctly - * according to RFC2396. - * - Carl Douglas - */ -xmlChar * -xmlURIEscape(const xmlChar * str) -{ - xmlChar *ret, *segment = NULL; - xmlURIPtr uri; - int ret2; - -#define NULLCHK(p) if(!p) { \ - xmlGenericError(xmlGenericErrorContext, \ - "xmlURIEscape: out of memory\n"); \ - return NULL; } - - if (str == NULL) - return (NULL); - - uri = xmlCreateURI(); - if (uri != NULL) { - /* - * Allow escaping errors in the unescaped form - */ - uri->cleanup = 1; - ret2 = xmlParseURIReference(uri, (const char *)str); - if (ret2) { - xmlFreeURI(uri); - return (NULL); - } - } - - if (!uri) - return NULL; - - ret = NULL; - - if (uri->scheme) { - segment = xmlURIEscapeStr(BAD_CAST uri->scheme, BAD_CAST "+-."); - NULLCHK(segment) - ret = xmlStrcat(ret, segment); - ret = xmlStrcat(ret, BAD_CAST ":"); - xmlFree(segment); - } - - if (uri->authority) { - segment = - xmlURIEscapeStr(BAD_CAST uri->authority, BAD_CAST "/?;:@"); - NULLCHK(segment) - ret = xmlStrcat(ret, BAD_CAST "//"); - ret = xmlStrcat(ret, segment); - xmlFree(segment); - } - - if (uri->user) { - segment = xmlURIEscapeStr(BAD_CAST uri->user, BAD_CAST ";:&=+$,"); - NULLCHK(segment) - ret = xmlStrcat(ret,BAD_CAST "//"); - ret = xmlStrcat(ret, segment); - ret = xmlStrcat(ret, BAD_CAST "@"); - xmlFree(segment); - } - - if (uri->server) { - segment = xmlURIEscapeStr(BAD_CAST uri->server, BAD_CAST "/?;:@"); - NULLCHK(segment) - if (uri->user == NULL) - ret = xmlStrcat(ret, BAD_CAST "//"); - ret = xmlStrcat(ret, segment); - xmlFree(segment); - } - - if (uri->port) { - xmlChar port[10]; - - snprintf((char *) port, 10, "%d", uri->port); - ret = xmlStrcat(ret, BAD_CAST ":"); - ret = xmlStrcat(ret, port); - } - - if (uri->path) { - segment = - xmlURIEscapeStr(BAD_CAST uri->path, BAD_CAST ":@&=+$,/?;"); - NULLCHK(segment) - ret = xmlStrcat(ret, segment); - xmlFree(segment); - } - - if (uri->query_raw) { - ret = xmlStrcat(ret, BAD_CAST "?"); - ret = xmlStrcat(ret, BAD_CAST uri->query_raw); - } - else if (uri->query) { - segment = - xmlURIEscapeStr(BAD_CAST uri->query, BAD_CAST ";/?:@&=+,$"); - NULLCHK(segment) - ret = xmlStrcat(ret, BAD_CAST "?"); - ret = xmlStrcat(ret, segment); - xmlFree(segment); } - - if (uri->opaque) { - segment = xmlURIEscapeStr(BAD_CAST uri->opaque, BAD_CAST ""); - NULLCHK(segment) - ret = xmlStrcat(ret, segment); - xmlFree(segment); - } - - if (uri->fragment) { - segment = xmlURIEscapeStr(BAD_CAST uri->fragment, BAD_CAST "#"); - NULLCHK(segment) - ret = xmlStrcat(ret, BAD_CAST "#"); - ret = xmlStrcat(ret, segment); - xmlFree(segment); - } - - xmlFreeURI(uri); -#undef NULLCHK - - return (ret); -} - -/************************************************************************ - * * - * Escaped URI parsing * - * * - ************************************************************************/ - -/** - * xmlParseURIFragment: - * @uri: pointer to an URI structure - * @str: pointer to the string to analyze - * - * Parse an URI fragment string and fills in the appropriate fields - * of the @uri structure. - * - * fragment = *uric - * - * Returns 0 or the error code - */ -static int -xmlParseURIFragment(xmlURIPtr uri, const char **str) -{ - const char *cur; - - if (str == NULL) - return (-1); - - cur = *str; - - while (IS_URIC(cur) || IS_UNWISE(cur)) - NEXT(cur); - if (uri != NULL) { - if (uri->fragment != NULL) - xmlFree(uri->fragment); - if (uri->cleanup & 2) - uri->fragment = STRNDUP(*str, cur - *str); - else - uri->fragment = xmlURIUnescapeString(*str, cur - *str, NULL); - } - *str = cur; - return (0); -} - -/** - * xmlParseURIQuery: - * @uri: pointer to an URI structure - * @str: pointer to the string to analyze - * - * Parse the query part of an URI - * - * query = *uric - * - * Returns 0 or the error code - */ -static int -xmlParseURIQuery(xmlURIPtr uri, const char **str) -{ - const char *cur; - - if (str == NULL) - return (-1); - - cur = *str; - - while ((IS_URIC(cur)) || - ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur)))) - NEXT(cur); - if (uri != NULL) { - if (uri->query != NULL) - xmlFree(uri->query); - if (uri->cleanup & 2) - uri->query = STRNDUP(*str, cur - *str); - else - uri->query = xmlURIUnescapeString(*str, cur - *str, NULL); - - /* Save the raw bytes of the query as well. - * See: http://mail.gnome.org/archives/xml/2007-April/thread.html#00114 - */ - if (uri->query_raw != NULL) - xmlFree (uri->query_raw); - uri->query_raw = STRNDUP (*str, cur - *str); + if (uri->fragment != NULL) { + if (len + 3 >= max) { + max *= 2; + temp = (xmlChar *) xmlRealloc(ret, + (max + 1) * sizeof(xmlChar)); + if (temp == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xmlSaveUri: out of memory\n"); + xmlFree(ret); + return(NULL); + } + ret = temp; + } + ret[len++] = '#'; + p = uri->fragment; + while (*p != 0) { + if (len + 3 >= max) { + max *= 2; + temp = (xmlChar *) xmlRealloc(ret, + (max + 1) * sizeof(xmlChar)); + if (temp == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xmlSaveUri: out of memory\n"); + xmlFree(ret); + return(NULL); + } + ret = temp; + } + if ((IS_UNRESERVED(*(p))) || (IS_RESERVED(*(p)))) + ret[len++] = *p++; + else { + int val = *(unsigned char *)p++; + int hi = val / 0x10, lo = val % 0x10; + ret[len++] = '%'; + ret[len++] = hi + (hi > 9? 'A'-10 : '0'); + ret[len++] = lo + (lo > 9? 'A'-10 : '0'); + } + } } - *str = cur; - return (0); + if (len >= max) { + max *= 2; + temp = (xmlChar *) xmlRealloc(ret, (max + 1) * sizeof(xmlChar)); + if (temp == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xmlSaveUri: out of memory\n"); + xmlFree(ret); + return(NULL); + } + ret = temp; + } + ret[len++] = 0; + return(ret); } /** - * xmlParseURIScheme: - * @uri: pointer to an URI structure - * @str: pointer to the string to analyze - * - * Parse an URI scheme - * - * scheme = alpha *( alpha | digit | "+" | "-" | "." ) + * xmlPrintURI: + * @stream: a FILE* for the output + * @uri: pointer to an xmlURI * - * Returns 0 or the error code + * Prints the URI in the stream @stream. */ -static int -xmlParseURIScheme(xmlURIPtr uri, const char **str) { - const char *cur; +void +xmlPrintURI(FILE *stream, xmlURIPtr uri) { + xmlChar *out; - if (str == NULL) - return(-1); - - cur = *str; - if (!IS_ALPHA(*cur)) - return(2); - cur++; - while (IS_SCHEME(*cur)) cur++; - if (uri != NULL) { - if (uri->scheme != NULL) xmlFree(uri->scheme); - uri->scheme = STRNDUP(*str, cur - *str); + out = xmlSaveUri(uri); + if (out != NULL) { + fprintf(stream, "%s", (char *) out); + xmlFree(out); } - *str = cur; - return(0); } /** - * xmlParseURIOpaquePart: - * @uri: pointer to an URI structure - * @str: pointer to the string to analyze - * - * Parse an URI opaque part - * - * opaque_part = uric_no_slash *uric + * xmlCleanURI: + * @uri: pointer to an xmlURI * - * Returns 0 or the error code + * Make sure the xmlURI struct is free of content */ -static int -xmlParseURIOpaquePart(xmlURIPtr uri, const char **str) -{ - const char *cur; +static void +xmlCleanURI(xmlURIPtr uri) { + if (uri == NULL) return; - if (str == NULL) - return (-1); + if (uri->scheme != NULL) xmlFree(uri->scheme); + uri->scheme = NULL; + if (uri->server != NULL) xmlFree(uri->server); + uri->server = NULL; + if (uri->user != NULL) xmlFree(uri->user); + uri->user = NULL; + if (uri->path != NULL) xmlFree(uri->path); + uri->path = NULL; + if (uri->fragment != NULL) xmlFree(uri->fragment); + uri->fragment = NULL; + if (uri->opaque != NULL) xmlFree(uri->opaque); + uri->opaque = NULL; + if (uri->authority != NULL) xmlFree(uri->authority); + uri->authority = NULL; + if (uri->query != NULL) xmlFree(uri->query); + uri->query = NULL; + if (uri->query_raw != NULL) xmlFree(uri->query_raw); + uri->query_raw = NULL; +} - cur = *str; - if (!((IS_URIC_NO_SLASH(cur)) || - ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur))))) { - return (3); - } - NEXT(cur); - while ((IS_URIC(cur)) || - ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur)))) - NEXT(cur); - if (uri != NULL) { - if (uri->opaque != NULL) - xmlFree(uri->opaque); - if (uri->cleanup & 2) - uri->opaque = STRNDUP(*str, cur - *str); - else - uri->opaque = xmlURIUnescapeString(*str, cur - *str, NULL); - } - *str = cur; - return (0); +/** + * xmlFreeURI: + * @uri: pointer to an xmlURI + * + * Free up the xmlURI struct + */ +void +xmlFreeURI(xmlURIPtr uri) { + if (uri == NULL) return; + + if (uri->scheme != NULL) xmlFree(uri->scheme); + if (uri->server != NULL) xmlFree(uri->server); + if (uri->user != NULL) xmlFree(uri->user); + if (uri->path != NULL) xmlFree(uri->path); + if (uri->fragment != NULL) xmlFree(uri->fragment); + if (uri->opaque != NULL) xmlFree(uri->opaque); + if (uri->authority != NULL) xmlFree(uri->authority); + if (uri->query != NULL) xmlFree(uri->query); + if (uri->query_raw != NULL) xmlFree(uri->query_raw); + xmlFree(uri); } +/************************************************************************ + * * + * Helper functions * + * * + ************************************************************************/ + /** - * xmlParseURIServer: - * @uri: pointer to an URI structure - * @str: pointer to the string to analyze + * xmlNormalizeURIPath: + * @path: pointer to the path string + * + * Applies the 5 normalization steps to a path string--that is, RFC 2396 + * Section 5.2, steps 6.c through 6.g. * - * Parse a server subpart of an URI, it's a finer grain analysis - * of the authority part. - * - * server = [ [ userinfo "@" ] hostport ] - * userinfo = *( unreserved | escaped | - * ";" | ":" | "&" | "=" | "+" | "$" | "," ) - * hostport = host [ ":" port ] - * host = hostname | IPv4address | IPv6reference - * hostname = *( domainlabel "." ) toplabel [ "." ] - * domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum - * toplabel = alpha | alpha *( alphanum | "-" ) alphanum - * IPv6reference = "[" IPv6address "]" - * IPv6address = hexpart [ ":" IPv4address ] - * IPv4address = 1*3digit "." 1*3digit "." 1*3digit "." 1*3digit - * hexpart = hexseq | hexseq "::" [ hexseq ]| "::" [ hexseq ] - * hexseq = hex4 *( ":" hex4) - * hex4 = 1*4hexdig - * port = *digit + * Normalization occurs directly on the string, no new allocation is done * - * Returns 0 or the error code + * Returns 0 or an error code */ -static int -xmlParseURIServer(xmlURIPtr uri, const char **str) { - const char *cur; - const char *host, *tmp; - const int IPV4max = 4; - const int IPV6max = 8; - int oct; +int +xmlNormalizeURIPath(char *path) { + char *cur, *out; - if (str == NULL) + if (path == NULL) return(-1); - - cur = *str; - /* - * is there a userinfo ? - */ - while (IS_USERINFO(cur)) NEXT(cur); - if (*cur == '@') { - if (uri != NULL) { - if (uri->user != NULL) xmlFree(uri->user); - if (uri->cleanup & 2) - uri->user = STRNDUP(*str, cur - *str); - else - uri->user = xmlURIUnescapeString(*str, cur - *str, NULL); - } - cur++; - } else { - if (uri != NULL) { - if (uri->user != NULL) xmlFree(uri->user); - uri->user = NULL; - } - cur = *str; - } - /* - * This can be empty in the case where there is no server + /* Skip all initial "/" chars. We want to get to the beginning of the + * first non-empty segment. */ - host = cur; - if (*cur == '/') { - if (uri != NULL) { - if (uri->authority != NULL) xmlFree(uri->authority); - uri->authority = NULL; - if (uri->server != NULL) xmlFree(uri->server); - uri->server = NULL; - uri->port = 0; - } - return(0); - } + cur = path; + while (cur[0] == '/') + ++cur; + if (cur[0] == '\0') + return(0); + + /* Keep everything we've seen so far. */ + out = cur; + /* - * host part of hostport can denote an IPV4 address, an IPV6 address - * or an unresolved name. Check the IP first, its easier to detect - * errors if wrong one. - * An IPV6 address must start with a '[' and end with a ']'. + * Analyze each segment in sequence for cases (c) and (d). */ - if (*cur == '[') { - int compress=0; - cur++; - for (oct = 0; oct < IPV6max; ++oct) { - if (*cur == ':') { - if (compress) - return(3); /* multiple compression attempted */ - if (!oct) { /* initial char is compression */ - if (*++cur != ':') - return(3); - } - compress = 1; /* set compression-encountered flag */ - cur++; /* skip over the second ':' */ - continue; - } - while(IS_HEX(*cur)) cur++; - if (oct == (IPV6max-1)) - continue; - if (*cur != ':') - break; - cur++; - } - if ((!compress) && (oct != IPV6max)) - return(3); - if (*cur != ']') - return(3); - if (uri != NULL) { - if (uri->server != NULL) xmlFree(uri->server); - uri->server = (char *)xmlStrndup((xmlChar *)host+1, - (cur-host)-1); - } - cur++; - } else { + while (cur[0] != '\0') { /* - * Not IPV6, maybe IPV4 + * c) All occurrences of "./", where "." is a complete path segment, + * are removed from the buffer string. */ - for (oct = 0; oct < IPV4max; ++oct) { - if (*cur == '.') - return(3); /* e.g. http://.xml/ or http://18.29..30/ */ - while(IS_DIGIT(*cur)) cur++; - if (oct == (IPV4max-1)) - continue; - if (*cur != '.') - break; - cur++; - } - } - if ((host[0] != '[') && (oct < IPV4max || (*cur == '.' && cur++) || - IS_ALPHA(*cur))) { - /* maybe host_name */ - if (!IS_ALPHANUM(*cur)) - return(4); /* e.g. http://xml.$oft */ - do { - do ++cur; while (IS_ALPHANUM(*cur)); - if (*cur == '-') { - --cur; - if (*cur == '.') - return(5); /* e.g. http://xml.-soft */ - ++cur; - continue; - } - if (*cur == '.') { - --cur; - if (*cur == '-') - return(6); /* e.g. http://xml-.soft */ - if (*cur == '.') - return(7); /* e.g. http://xml..soft */ - ++cur; - continue; - } - break; - } while (1); - tmp = cur; - if (tmp[-1] == '.') - --tmp; /* e.g. http://xml.$Oft/ */ - do --tmp; while (tmp >= host && IS_ALPHANUM(*tmp)); - if ((++tmp == host || tmp[-1] == '.') && !IS_ALPHA(*tmp)) - return(8); /* e.g. http://xmlsOft.0rg/ */ - } - if (uri != NULL) { - if (uri->authority != NULL) xmlFree(uri->authority); - uri->authority = NULL; - if (host[0] != '[') { /* it's not an IPV6 addr */ - if (uri->server != NULL) xmlFree(uri->server); - if (uri->cleanup & 2) - uri->server = STRNDUP(host, cur - host); - else - uri->server = xmlURIUnescapeString(host, cur - host, NULL); - } - } - /* - * finish by checking for a port presence. - */ - if (*cur == ':') { - cur++; - if (IS_DIGIT(*cur)) { - if (uri != NULL) - uri->port = 0; - while (IS_DIGIT(*cur)) { - if (uri != NULL) - uri->port = uri->port * 10 + (*cur - '0'); + if ((cur[0] == '.') && (cur[1] == '/')) { + cur += 2; + /* '//' normalization should be done at this point too */ + while (cur[0] == '/') cur++; - } + continue; } - } - *str = cur; - return(0); -} -/** - * xmlParseURIRelSegment: - * @uri: pointer to an URI structure - * @str: pointer to the string to analyze - * - * Parse an URI relative segment - * - * rel_segment = 1*( unreserved | escaped | ";" | "@" | "&" | "=" | - * "+" | "$" | "," ) - * - * Returns 0 or the error code - */ -static int -xmlParseURIRelSegment(xmlURIPtr uri, const char **str) -{ - const char *cur; + /* + * d) If the buffer string ends with "." as a complete path segment, + * that "." is removed. + */ + if ((cur[0] == '.') && (cur[1] == '\0')) + break; - if (str == NULL) - return (-1); + /* Otherwise keep the segment. */ + while (cur[0] != '/') { + if (cur[0] == '\0') + goto done_cd; + (out++)[0] = (cur++)[0]; + } + /* nomalize // */ + while ((cur[0] == '/') && (cur[1] == '/')) + cur++; - cur = *str; - if (!((IS_SEGMENT(cur)) || - ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur))))) { - return (3); - } - NEXT(cur); - while ((IS_SEGMENT(cur)) || - ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur)))) - NEXT(cur); - if (uri != NULL) { - if (uri->path != NULL) - xmlFree(uri->path); - if (uri->cleanup & 2) - uri->path = STRNDUP(*str, cur - *str); - else - uri->path = xmlURIUnescapeString(*str, cur - *str, NULL); + (out++)[0] = (cur++)[0]; } - *str = cur; - return (0); -} + done_cd: + out[0] = '\0'; + + /* Reset to the beginning of the first segment for the next sequence. */ + cur = path; + while (cur[0] == '/') + ++cur; + if (cur[0] == '\0') + return(0); + + /* + * Analyze each segment in sequence for cases (e) and (f). + * + * e) All occurrences of "/../", where is a + * complete path segment not equal to "..", are removed from the + * buffer string. Removal of these path segments is performed + * iteratively, removing the leftmost matching pattern on each + * iteration, until no matching pattern remains. + * + * f) If the buffer string ends with "/..", where + * is a complete path segment not equal to "..", that + * "/.." is removed. + * + * To satisfy the "iterative" clause in (e), we need to collapse the + * string every time we find something that needs to be removed. Thus, + * we don't need to keep two pointers into the string: we only need a + * "current position" pointer. + */ + while (1) { + char *segp, *tmp; -/** - * xmlParseURIPathSegments: - * @uri: pointer to an URI structure - * @str: pointer to the string to analyze - * @slash: should we add a leading slash - * - * Parse an URI set of path segments - * - * path_segments = segment *( "/" segment ) - * segment = *pchar *( ";" param ) - * param = *pchar - * - * Returns 0 or the error code - */ -static int -xmlParseURIPathSegments(xmlURIPtr uri, const char **str, int slash) -{ - const char *cur; + /* At the beginning of each iteration of this loop, "cur" points to + * the first character of the segment we want to examine. + */ - if (str == NULL) - return (-1); + /* Find the end of the current segment. */ + segp = cur; + while ((segp[0] != '/') && (segp[0] != '\0')) + ++segp; - cur = *str; + /* If this is the last segment, we're done (we need at least two + * segments to meet the criteria for the (e) and (f) cases). + */ + if (segp[0] == '\0') + break; - do { - while ((IS_PCHAR(cur)) || - ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur)))) - NEXT(cur); - while (*cur == ';') { - cur++; - while ((IS_PCHAR(cur)) || - ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur)))) - NEXT(cur); + /* If the first segment is "..", or if the next segment _isn't_ "..", + * keep this segment and try the next one. + */ + ++segp; + if (((cur[0] == '.') && (cur[1] == '.') && (segp == cur+3)) + || ((segp[0] != '.') || (segp[1] != '.') + || ((segp[2] != '/') && (segp[2] != '\0')))) { + cur = segp; + continue; } - if (*cur != '/') - break; - cur++; - } while (1); - if (uri != NULL) { - int len, len2 = 0; - char *path; - /* - * Concat the set of path segments to the current path + /* If we get here, remove this segment and the next one and back up + * to the previous segment (if there is one), to implement the + * "iteratively" clause. It's pretty much impossible to back up + * while maintaining two pointers into the buffer, so just compact + * the whole buffer now. */ - len = cur - *str; - if (slash) - len++; - if (uri->path != NULL) { - len2 = strlen(uri->path); - len += len2; - } - path = (char *) xmlMallocAtomic(len + 1); - if (path == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlParseURIPathSegments: out of memory\n"); - *str = cur; - return (-1); - } - if (uri->path != NULL) - memcpy(path, uri->path, len2); - if (slash) { - path[len2] = '/'; - len2++; + /* If this is the end of the buffer, we're done. */ + if (segp[2] == '\0') { + cur[0] = '\0'; + break; } - path[len2] = 0; - if (cur - *str > 0) { - if (uri->cleanup & 2) { - memcpy(&path[len2], *str, cur - *str); - path[len2 + (cur - *str)] = 0; - } else - xmlURIUnescapeString(*str, cur - *str, &path[len2]); - } - if (uri->path != NULL) - xmlFree(uri->path); - uri->path = path; - } - *str = cur; - return (0); -} + /* Valgrind complained, strcpy(cur, segp + 3); */ + /* string will overlap, do not use strcpy */ + tmp = cur; + segp += 3; + while ((*tmp++ = *segp++) != 0); -/** - * xmlParseURIAuthority: - * @uri: pointer to an URI structure - * @str: pointer to the string to analyze - * - * Parse the authority part of an URI. - * - * authority = server | reg_name - * server = [ [ userinfo "@" ] hostport ] - * reg_name = 1*( unreserved | escaped | "$" | "," | ";" | ":" | - * "@" | "&" | "=" | "+" ) - * - * Note : this is completely ambiguous since reg_name is allowed to - * use the full set of chars in use by server: - * - * 3.2.1. Registry-based Naming Authority - * - * The structure of a registry-based naming authority is specific - * to the URI scheme, but constrained to the allowed characters - * for an authority component. - * - * Returns 0 or the error code - */ -static int -xmlParseURIAuthority(xmlURIPtr uri, const char **str) { - const char *cur; - int ret; + /* If there are no previous segments, then keep going from here. */ + segp = cur; + while ((segp > path) && ((--segp)[0] == '/')) + ; + if (segp == path) + continue; - if (str == NULL) - return(-1); - - cur = *str; + /* "segp" is pointing to the end of a previous segment; find it's + * start. We need to back up to the previous segment and start + * over with that to handle things like "foo/bar/../..". If we + * don't do this, then on the first pass we'll remove the "bar/..", + * but be pointing at the second ".." so we won't realize we can also + * remove the "foo/..". + */ + cur = segp; + while ((cur > path) && (cur[-1] != '/')) + --cur; + } + out[0] = '\0'; /* - * try first to parse it as a server string. + * g) If the resulting buffer string still begins with one or more + * complete path segments of "..", then the reference is + * considered to be in error. Implementations may handle this + * error by retaining these components in the resolved path (i.e., + * treating them as part of the final URI), by removing them from + * the resolved path (i.e., discarding relative levels above the + * root), or by avoiding traversal of the reference. + * + * We discard them from the final path. */ - ret = xmlParseURIServer(uri, str); - if ((ret == 0) && (*str != NULL) && - ((**str == 0) || (**str == '/') || (**str == '?'))) - return(0); - *str = cur; + if (path[0] == '/') { + cur = path; + while ((cur[0] == '/') && (cur[1] == '.') && (cur[2] == '.') + && ((cur[3] == '/') || (cur[3] == '\0'))) + cur += 3; - /* - * failed, fallback to reg_name - */ - if (!IS_REG_NAME(cur)) { - return(5); - } - NEXT(cur); - while (IS_REG_NAME(cur)) NEXT(cur); - if (uri != NULL) { - if (uri->server != NULL) xmlFree(uri->server); - uri->server = NULL; - if (uri->user != NULL) xmlFree(uri->user); - uri->user = NULL; - if (uri->authority != NULL) xmlFree(uri->authority); - if (uri->cleanup & 2) - uri->authority = STRNDUP(*str, cur - *str); - else - uri->authority = xmlURIUnescapeString(*str, cur - *str, NULL); + if (cur != path) { + out = path; + while (cur[0] != '\0') + (out++)[0] = (cur++)[0]; + out[0] = 0; + } } - *str = cur; - return(0); -} - -/** - * xmlParseURIHierPart: - * @uri: pointer to an URI structure - * @str: pointer to the string to analyze - * - * Parse an URI hierarchical part - * - * hier_part = ( net_path | abs_path ) [ "?" query ] - * abs_path = "/" path_segments - * net_path = "//" authority [ abs_path ] - * - * Returns 0 or the error code - */ -static int -xmlParseURIHierPart(xmlURIPtr uri, const char **str) { - int ret; - const char *cur; - - if (str == NULL) - return(-1); - - cur = *str; - if ((cur[0] == '/') && (cur[1] == '/')) { - cur += 2; - ret = xmlParseURIAuthority(uri, &cur); - if (ret != 0) - return(ret); - if (cur[0] == '/') { - cur++; - ret = xmlParseURIPathSegments(uri, &cur, 1); - } - } else if (cur[0] == '/') { - cur++; - ret = xmlParseURIPathSegments(uri, &cur, 1); - } else { - return(4); - } - if (ret != 0) - return(ret); - if (*cur == '?') { - cur++; - ret = xmlParseURIQuery(uri, &cur); - if (ret != 0) - return(ret); - } - *str = cur; return(0); } -/** - * xmlParseAbsoluteURI: - * @uri: pointer to an URI structure - * @str: pointer to the string to analyze - * - * Parse an URI reference string and fills in the appropriate fields - * of the @uri structure - * - * absoluteURI = scheme ":" ( hier_part | opaque_part ) - * - * Returns 0 or the error code - */ -static int -xmlParseAbsoluteURI(xmlURIPtr uri, const char **str) { - int ret; - const char *cur; - - if (str == NULL) - return(-1); - - cur = *str; - - ret = xmlParseURIScheme(uri, str); - if (ret != 0) return(ret); - if (**str != ':') { - *str = cur; +static int is_hex(char c) { + if (((c >= '0') && (c <= '9')) || + ((c >= 'a') && (c <= 'f')) || + ((c >= 'A') && (c <= 'F'))) return(1); - } - (*str)++; - if (**str == '/') - return(xmlParseURIHierPart(uri, str)); - return(xmlParseURIOpaquePart(uri, str)); + return(0); } /** - * xmlParseRelativeURI: - * @uri: pointer to an URI structure - * @str: pointer to the string to analyze + * xmlURIUnescapeString: + * @str: the string to unescape + * @len: the length in bytes to unescape (or <= 0 to indicate full string) + * @target: optional destination buffer * - * Parse an relative URI string and fills in the appropriate fields - * of the @uri structure - * - * relativeURI = ( net_path | abs_path | rel_path ) [ "?" query ] - * abs_path = "/" path_segments - * net_path = "//" authority [ abs_path ] - * rel_path = rel_segment [ abs_path ] + * Unescaping routine, but does not check that the string is an URI. The + * output is a direct unsigned char translation of %XX values (no encoding) + * Note that the length of the result can only be smaller or same size as + * the input string. * - * Returns 0 or the error code + * Returns a copy of the string, but unescaped, will return NULL only in case + * of error */ -static int -xmlParseRelativeURI(xmlURIPtr uri, const char **str) { - int ret = 0; - const char *cur; +char * +xmlURIUnescapeString(const char *str, int len, char *target) { + char *ret, *out; + const char *in; if (str == NULL) - return(-1); - - cur = *str; - if ((cur[0] == '/') && (cur[1] == '/')) { - cur += 2; - ret = xmlParseURIAuthority(uri, &cur); - if (ret != 0) - return(ret); - if (cur[0] == '/') { - cur++; - ret = xmlParseURIPathSegments(uri, &cur, 1); + return(NULL); + if (len <= 0) len = strlen(str); + if (len < 0) return(NULL); + + if (target == NULL) { + ret = (char *) xmlMallocAtomic(len + 1); + if (ret == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xmlURIUnescapeString: out of memory\n"); + return(NULL); } - } else if (cur[0] == '/') { - cur++; - ret = xmlParseURIPathSegments(uri, &cur, 1); - } else if (cur[0] != '#' && cur[0] != '?') { - ret = xmlParseURIRelSegment(uri, &cur); - if (ret != 0) - return(ret); - if (cur[0] == '/') { - cur++; - ret = xmlParseURIPathSegments(uri, &cur, 1); + } else + ret = target; + in = str; + out = ret; + while(len > 0) { + if ((len > 2) && (*in == '%') && (is_hex(in[1])) && (is_hex(in[2]))) { + in++; + if ((*in >= '0') && (*in <= '9')) + *out = (*in - '0'); + else if ((*in >= 'a') && (*in <= 'f')) + *out = (*in - 'a') + 10; + else if ((*in >= 'A') && (*in <= 'F')) + *out = (*in - 'A') + 10; + in++; + if ((*in >= '0') && (*in <= '9')) + *out = *out * 16 + (*in - '0'); + else if ((*in >= 'a') && (*in <= 'f')) + *out = *out * 16 + (*in - 'a') + 10; + else if ((*in >= 'A') && (*in <= 'F')) + *out = *out * 16 + (*in - 'A') + 10; + in++; + len -= 3; + out++; + } else { + *out++ = *in++; + len--; } } - if (ret != 0) - return(ret); - if (*cur == '?') { - cur++; - ret = xmlParseURIQuery(uri, &cur); - if (ret != 0) - return(ret); - } - *str = cur; + *out = 0; return(ret); } /** - * xmlParseURIReference: - * @uri: pointer to an URI structure - * @str: the string to analyze + * xmlURIEscapeStr: + * @str: string to escape + * @list: exception list string of chars not to escape * - * Parse an URI reference string and fills in the appropriate fields - * of the @uri structure - * - * URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ] + * This routine escapes a string to hex, ignoring reserved characters (a-z) + * and the characters in the exception list. * - * Returns 0 or the error code + * Returns a new escaped string or NULL in case of error. */ -int -xmlParseURIReference(xmlURIPtr uri, const char *str) { - int ret; - const char *tmp = str; +xmlChar * +xmlURIEscapeStr(const xmlChar *str, const xmlChar *list) { + xmlChar *ret, ch; + xmlChar *temp; + const xmlChar *in; + + unsigned int len, out; if (str == NULL) - return(-1); - xmlCleanURI(uri); + return(NULL); + if (str[0] == 0) + return(xmlStrdup(str)); + len = xmlStrlen(str); + if (!(len > 0)) return(NULL); - /* - * Try first to parse absolute refs, then fallback to relative if - * it fails. - */ - ret = xmlParseAbsoluteURI(uri, &str); - if (ret != 0) { - xmlCleanURI(uri); - str = tmp; - ret = xmlParseRelativeURI(uri, &str); - } - if (ret != 0) { - xmlCleanURI(uri); - return(ret); + len += 20; + ret = (xmlChar *) xmlMallocAtomic(len); + if (ret == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xmlURIEscapeStr: out of memory\n"); + return(NULL); } + in = (const xmlChar *) str; + out = 0; + while(*in != 0) { + if (len - out <= 3) { + len += 20; + temp = (xmlChar *) xmlRealloc(ret, len); + if (temp == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xmlURIEscapeStr: out of memory\n"); + xmlFree(ret); + return(NULL); + } + ret = temp; + } + + ch = *in; + + if ((ch != '@') && (!IS_UNRESERVED(ch)) && (!xmlStrchr(list, ch))) { + unsigned char val; + ret[out++] = '%'; + val = ch >> 4; + if (val <= 9) + ret[out++] = '0' + val; + else + ret[out++] = 'A' + val - 0xA; + val = ch & 0xF; + if (val <= 9) + ret[out++] = '0' + val; + else + ret[out++] = 'A' + val - 0xA; + in++; + } else { + ret[out++] = *in++; + } - if (*str == '#') { - str++; - ret = xmlParseURIFragment(uri, &str); - if (ret != 0) return(ret); - } - if (*str != 0) { - xmlCleanURI(uri); - return(1); } - return(0); + ret[out] = 0; + return(ret); } /** - * xmlParseURI: - * @str: the URI string to analyze + * xmlURIEscape: + * @str: the string of the URI to escape * - * Parse an URI - * - * URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ] + * Escaping routine, does not do validity checks ! + * It will try to escape the chars needing this, but this is heuristic + * based it's impossible to be sure. * - * Returns a newly built xmlURIPtr or NULL in case of error + * Returns an copy of the string, but escaped + * + * 25 May 2001 + * Uses xmlParseURI and xmlURIEscapeStr to try to escape correctly + * according to RFC2396. + * - Carl Douglas */ -xmlURIPtr -xmlParseURI(const char *str) { +xmlChar * +xmlURIEscape(const xmlChar * str) +{ + xmlChar *ret, *segment = NULL; xmlURIPtr uri; - int ret; + int ret2; + +#define NULLCHK(p) if(!p) { \ + xmlGenericError(xmlGenericErrorContext, \ + "xmlURIEscape: out of memory\n"); \ + xmlFreeURI(uri); \ + return NULL; } \ if (str == NULL) - return(NULL); + return (NULL); + uri = xmlCreateURI(); if (uri != NULL) { - ret = xmlParseURIReference(uri, str); - if (ret) { - xmlFreeURI(uri); - return(NULL); - } + /* + * Allow escaping errors in the unescaped form + */ + uri->cleanup = 1; + ret2 = xmlParseURIReference(uri, (const char *)str); + if (ret2) { + xmlFreeURI(uri); + return (NULL); + } } - return(uri); -} -/** - * xmlParseURIRaw: - * @str: the URI string to analyze - * @raw: if 1 unescaping of URI pieces are disabled - * - * Parse an URI but allows to keep intact the original fragments. - * - * URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ] - * - * Returns a newly built xmlURIPtr or NULL in case of error - */ -xmlURIPtr -xmlParseURIRaw(const char *str, int raw) { - xmlURIPtr uri; - int ret; + if (!uri) + return NULL; - if (str == NULL) - return(NULL); - uri = xmlCreateURI(); - if (uri != NULL) { - if (raw) { - uri->cleanup |= 2; - } - ret = xmlParseURIReference(uri, str); - if (ret) { - xmlFreeURI(uri); - return(NULL); - } + ret = NULL; + + if (uri->scheme) { + segment = xmlURIEscapeStr(BAD_CAST uri->scheme, BAD_CAST "+-."); + NULLCHK(segment) + ret = xmlStrcat(ret, segment); + ret = xmlStrcat(ret, BAD_CAST ":"); + xmlFree(segment); } - return(uri); + + if (uri->authority) { + segment = + xmlURIEscapeStr(BAD_CAST uri->authority, BAD_CAST "/?;:@"); + NULLCHK(segment) + ret = xmlStrcat(ret, BAD_CAST "//"); + ret = xmlStrcat(ret, segment); + xmlFree(segment); + } + + if (uri->user) { + segment = xmlURIEscapeStr(BAD_CAST uri->user, BAD_CAST ";:&=+$,"); + NULLCHK(segment) + ret = xmlStrcat(ret,BAD_CAST "//"); + ret = xmlStrcat(ret, segment); + ret = xmlStrcat(ret, BAD_CAST "@"); + xmlFree(segment); + } + + if (uri->server) { + segment = xmlURIEscapeStr(BAD_CAST uri->server, BAD_CAST "/?;:@"); + NULLCHK(segment) + if (uri->user == NULL) + ret = xmlStrcat(ret, BAD_CAST "//"); + ret = xmlStrcat(ret, segment); + xmlFree(segment); + } + + if (uri->port) { + xmlChar port[10]; + + snprintf((char *) port, 10, "%d", uri->port); + ret = xmlStrcat(ret, BAD_CAST ":"); + ret = xmlStrcat(ret, port); + } + + if (uri->path) { + segment = + xmlURIEscapeStr(BAD_CAST uri->path, BAD_CAST ":@&=+$,/?;"); + NULLCHK(segment) + ret = xmlStrcat(ret, segment); + xmlFree(segment); + } + + if (uri->query_raw) { + ret = xmlStrcat(ret, BAD_CAST "?"); + ret = xmlStrcat(ret, BAD_CAST uri->query_raw); + } + else if (uri->query) { + segment = + xmlURIEscapeStr(BAD_CAST uri->query, BAD_CAST ";/?:@&=+,$"); + NULLCHK(segment) + ret = xmlStrcat(ret, BAD_CAST "?"); + ret = xmlStrcat(ret, segment); + xmlFree(segment); + } + + if (uri->opaque) { + segment = xmlURIEscapeStr(BAD_CAST uri->opaque, BAD_CAST ""); + NULLCHK(segment) + ret = xmlStrcat(ret, segment); + xmlFree(segment); + } + + if (uri->fragment) { + segment = xmlURIEscapeStr(BAD_CAST uri->fragment, BAD_CAST "#"); + NULLCHK(segment) + ret = xmlStrcat(ret, BAD_CAST "#"); + ret = xmlStrcat(ret, segment); + xmlFree(segment); + } + + xmlFreeURI(uri); +#undef NULLCHK + + return (ret); } /************************************************************************ diff --git a/valid.c b/valid.c index 2510b8d..49fb720 100644 --- a/valid.c +++ b/valid.c @@ -36,6 +36,11 @@ static xmlElementPtr xmlGetDtdElementDesc2(xmlDtdPtr dtd, const xmlChar *name, "Unimplemented block at %s:%d\n", \ __FILE__, __LINE__); +#ifdef LIBXML_VALID_ENABLED +static int +xmlValidateAttributeValueInternal(xmlDocPtr doc, xmlAttributeType type, + const xmlChar *value); +#endif /************************************************************************ * * * Error handling routines * @@ -2024,7 +2029,7 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt, return(NULL); } if ((defaultValue != NULL) && - (!xmlValidateAttributeValue(type, defaultValue))) { + (!xmlValidateAttributeValueInternal(dtd->doc, type, defaultValue))) { xmlErrValidNode(ctxt, (xmlNodePtr) dtd, XML_DTD_ATTRIBUTE_DEFAULT, "Attribute %s of %s: invalid default value\n", elem, name, defaultValue); @@ -2042,8 +2047,10 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt, (dtd->doc->intSubset != NULL) && (dtd->doc->intSubset->attributes != NULL)) { ret = xmlHashLookup3(dtd->doc->intSubset->attributes, name, ns, elem); - if (ret != NULL) + if (ret != NULL) { + xmlFreeEnumeration(tree); return(NULL); + } } /* @@ -2057,6 +2064,7 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt, if (table == NULL) { xmlVErrMemory(ctxt, "xmlAddAttributeDecl: Table creation failed!\n"); + xmlFreeEnumeration(tree); return(NULL); } @@ -2064,6 +2072,7 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt, ret = (xmlAttributePtr) xmlMalloc(sizeof(xmlAttribute)); if (ret == NULL) { xmlVErrMemory(ctxt, "malloc failed"); + xmlFreeEnumeration(tree); return(NULL); } memset(ret, 0, sizeof(xmlAttribute)); @@ -3445,8 +3454,78 @@ xmlIsMixedElement(xmlDocPtr doc, const xmlChar *name) { } #ifdef LIBXML_VALID_ENABLED + +static int +xmlIsDocNameStartChar(xmlDocPtr doc, int c) { + if ((doc == NULL) || (doc->properties & XML_DOC_OLD10) == 0) { + /* + * Use the new checks of production [4] [4a] amd [5] of the + * Update 5 of XML-1.0 + */ + if (((c >= 'a') && (c <= 'z')) || + ((c >= 'A') && (c <= 'Z')) || + (c == '_') || (c == ':') || + ((c >= 0xC0) && (c <= 0xD6)) || + ((c >= 0xD8) && (c <= 0xF6)) || + ((c >= 0xF8) && (c <= 0x2FF)) || + ((c >= 0x370) && (c <= 0x37D)) || + ((c >= 0x37F) && (c <= 0x1FFF)) || + ((c >= 0x200C) && (c <= 0x200D)) || + ((c >= 0x2070) && (c <= 0x218F)) || + ((c >= 0x2C00) && (c <= 0x2FEF)) || + ((c >= 0x3001) && (c <= 0xD7FF)) || + ((c >= 0xF900) && (c <= 0xFDCF)) || + ((c >= 0xFDF0) && (c <= 0xFFFD)) || + ((c >= 0x10000) && (c <= 0xEFFFF))) + return(1); + } else { + if (IS_LETTER(c) || (c == '_') || (c == ':')) + return(1); + } + return(0); +} + +static int +xmlIsDocNameChar(xmlDocPtr doc, int c) { + if ((doc == NULL) || (doc->properties & XML_DOC_OLD10) == 0) { + /* + * Use the new checks of production [4] [4a] amd [5] of the + * Update 5 of XML-1.0 + */ + if (((c >= 'a') && (c <= 'z')) || + ((c >= 'A') && (c <= 'Z')) || + ((c >= '0') && (c <= '9')) || /* !start */ + (c == '_') || (c == ':') || + (c == '-') || (c == '.') || (c == 0xB7) || /* !start */ + ((c >= 0xC0) && (c <= 0xD6)) || + ((c >= 0xD8) && (c <= 0xF6)) || + ((c >= 0xF8) && (c <= 0x2FF)) || + ((c >= 0x300) && (c <= 0x36F)) || /* !start */ + ((c >= 0x370) && (c <= 0x37D)) || + ((c >= 0x37F) && (c <= 0x1FFF)) || + ((c >= 0x200C) && (c <= 0x200D)) || + ((c >= 0x203F) && (c <= 0x2040)) || /* !start */ + ((c >= 0x2070) && (c <= 0x218F)) || + ((c >= 0x2C00) && (c <= 0x2FEF)) || + ((c >= 0x3001) && (c <= 0xD7FF)) || + ((c >= 0xF900) && (c <= 0xFDCF)) || + ((c >= 0xFDF0) && (c <= 0xFFFD)) || + ((c >= 0x10000) && (c <= 0xEFFFF))) + return(1); + } else { + if ((IS_LETTER(c)) || (IS_DIGIT(c)) || + (c == '.') || (c == '-') || + (c == '_') || (c == ':') || + (IS_COMBINING(c)) || + (IS_EXTENDER(c))) + return(1); + } + return(0); +} + /** * xmlValidateNameValue: + * @doc: pointer to the document or NULL * @value: an Name value * * Validate that the given value match Name production @@ -3454,8 +3533,8 @@ xmlIsMixedElement(xmlDocPtr doc, const xmlChar *name) { * returns 1 if valid or 0 otherwise */ -int -xmlValidateNameValue(const xmlChar *value) { +static int +xmlValidateNameValueInternal(xmlDocPtr doc, const xmlChar *value) { const xmlChar *cur; int val, len; @@ -3463,18 +3542,12 @@ xmlValidateNameValue(const xmlChar *value) { cur = value; val = xmlStringCurrentChar(NULL, cur, &len); cur += len; - if (!IS_LETTER(val) && (val != '_') && - (val != ':')) { + if (!xmlIsDocNameStartChar(doc, val)) return(0); - } val = xmlStringCurrentChar(NULL, cur, &len); cur += len; - while ((IS_LETTER(val)) || (IS_DIGIT(val)) || - (val == '.') || (val == '-') || - (val == '_') || (val == ':') || - (IS_COMBINING(val)) || - (IS_EXTENDER(val))) { + while (xmlIsDocNameChar(doc, val)) { val = xmlStringCurrentChar(NULL, cur, &len); cur += len; } @@ -3485,7 +3558,22 @@ xmlValidateNameValue(const xmlChar *value) { } /** - * xmlValidateNamesValue: + * xmlValidateNameValue: + * @value: an Name value + * + * Validate that the given value match Name production + * + * returns 1 if valid or 0 otherwise + */ + +int +xmlValidateNameValue(const xmlChar *value) { + return(xmlValidateNameValueInternal(NULL, value)); +} + +/** + * xmlValidateNamesValueInternal: + * @doc: pointer to the document or NULL * @value: an Names value * * Validate that the given value match Names production @@ -3493,8 +3581,8 @@ xmlValidateNameValue(const xmlChar *value) { * returns 1 if valid or 0 otherwise */ -int -xmlValidateNamesValue(const xmlChar *value) { +static int +xmlValidateNamesValueInternal(xmlDocPtr doc, const xmlChar *value) { const xmlChar *cur; int val, len; @@ -3502,19 +3590,13 @@ xmlValidateNamesValue(const xmlChar *value) { cur = value; val = xmlStringCurrentChar(NULL, cur, &len); cur += len; - - if (!IS_LETTER(val) && (val != '_') && - (val != ':')) { + + if (!xmlIsDocNameStartChar(doc, val)) return(0); - } val = xmlStringCurrentChar(NULL, cur, &len); cur += len; - while ((IS_LETTER(val)) || (IS_DIGIT(val)) || - (val == '.') || (val == '-') || - (val == '_') || (val == ':') || - (IS_COMBINING(val)) || - (IS_EXTENDER(val))) { + while (xmlIsDocNameChar(doc, val)) { val = xmlStringCurrentChar(NULL, cur, &len); cur += len; } @@ -3526,18 +3608,13 @@ xmlValidateNamesValue(const xmlChar *value) { cur += len; } - if (!IS_LETTER(val) && (val != '_') && - (val != ':')) { + if (!xmlIsDocNameStartChar(doc, val)) return(0); - } + val = xmlStringCurrentChar(NULL, cur, &len); cur += len; - while ((IS_LETTER(val)) || (IS_DIGIT(val)) || - (val == '.') || (val == '-') || - (val == '_') || (val == ':') || - (IS_COMBINING(val)) || - (IS_EXTENDER(val))) { + while (xmlIsDocNameChar(doc, val)) { val = xmlStringCurrentChar(NULL, cur, &len); cur += len; } @@ -3549,18 +3626,33 @@ xmlValidateNamesValue(const xmlChar *value) { } /** - * xmlValidateNmtokenValue: + * xmlValidateNamesValue: + * @value: an Names value + * + * Validate that the given value match Names production + * + * returns 1 if valid or 0 otherwise + */ + +int +xmlValidateNamesValue(const xmlChar *value) { + return(xmlValidateNamesValueInternal(NULL, value)); +} + +/** + * xmlValidateNmtokenValueInternal: + * @doc: pointer to the document or NULL * @value: an Nmtoken value * * Validate that the given value match Nmtoken production * * [ VC: Name Token ] - * + * * returns 1 if valid or 0 otherwise */ -int -xmlValidateNmtokenValue(const xmlChar *value) { +static int +xmlValidateNmtokenValueInternal(xmlDocPtr doc, const xmlChar *value) { const xmlChar *cur; int val, len; @@ -3568,19 +3660,13 @@ xmlValidateNmtokenValue(const xmlChar *value) { cur = value; val = xmlStringCurrentChar(NULL, cur, &len); cur += len; - - if (!IS_LETTER(val) && !IS_DIGIT(val) && - (val != '.') && (val != '-') && - (val != '_') && (val != ':') && - (!IS_COMBINING(val)) && - (!IS_EXTENDER(val))) + + if (!xmlIsDocNameChar(doc, val)) return(0); - while ((IS_LETTER(val)) || (IS_DIGIT(val)) || - (val == '.') || (val == '-') || - (val == '_') || (val == ':') || - (IS_COMBINING(val)) || - (IS_EXTENDER(val))) { + val = xmlStringCurrentChar(NULL, cur, &len); + cur += len; + while (xmlIsDocNameChar(doc, val)) { val = xmlStringCurrentChar(NULL, cur, &len); cur += len; } @@ -3591,18 +3677,35 @@ xmlValidateNmtokenValue(const xmlChar *value) { } /** - * xmlValidateNmtokensValue: + * xmlValidateNmtokenValue: + * @value: an Nmtoken value + * + * Validate that the given value match Nmtoken production + * + * [ VC: Name Token ] + * + * returns 1 if valid or 0 otherwise + */ + +int +xmlValidateNmtokenValue(const xmlChar *value) { + return(xmlValidateNmtokenValueInternal(NULL, value)); +} + +/** + * xmlValidateNmtokensValueInternal: + * @doc: pointer to the document or NULL * @value: an Nmtokens value * * Validate that the given value match Nmtokens production * * [ VC: Name Token ] - * + * * returns 1 if valid or 0 otherwise */ -int -xmlValidateNmtokensValue(const xmlChar *value) { +static int +xmlValidateNmtokensValueInternal(xmlDocPtr doc, const xmlChar *value) { const xmlChar *cur; int val, len; @@ -3610,24 +3713,16 @@ xmlValidateNmtokensValue(const xmlChar *value) { cur = value; val = xmlStringCurrentChar(NULL, cur, &len); cur += len; - + while (IS_BLANK(val)) { val = xmlStringCurrentChar(NULL, cur, &len); cur += len; } - if (!IS_LETTER(val) && !IS_DIGIT(val) && - (val != '.') && (val != '-') && - (val != '_') && (val != ':') && - (!IS_COMBINING(val)) && - (!IS_EXTENDER(val))) + if (!xmlIsDocNameChar(doc, val)) return(0); - while ((IS_LETTER(val)) || (IS_DIGIT(val)) || - (val == '.') || (val == '-') || - (val == '_') || (val == ':') || - (IS_COMBINING(val)) || - (IS_EXTENDER(val))) { + while (xmlIsDocNameChar(doc, val)) { val = xmlStringCurrentChar(NULL, cur, &len); cur += len; } @@ -3640,18 +3735,13 @@ xmlValidateNmtokensValue(const xmlChar *value) { } if (val == 0) return(1); - if (!IS_LETTER(val) && !IS_DIGIT(val) && - (val != '.') && (val != '-') && - (val != '_') && (val != ':') && - (!IS_COMBINING(val)) && - (!IS_EXTENDER(val))) + if (!xmlIsDocNameChar(doc, val)) return(0); - while ((IS_LETTER(val)) || (IS_DIGIT(val)) || - (val == '.') || (val == '-') || - (val == '_') || (val == ':') || - (IS_COMBINING(val)) || - (IS_EXTENDER(val))) { + val = xmlStringCurrentChar(NULL, cur, &len); + cur += len; + + while (xmlIsDocNameChar(doc, val)) { val = xmlStringCurrentChar(NULL, cur, &len); cur += len; } @@ -3662,6 +3752,22 @@ xmlValidateNmtokensValue(const xmlChar *value) { return(1); } +/** + * xmlValidateNmtokensValue: + * @value: an Nmtokens value + * + * Validate that the given value match Nmtokens production + * + * [ VC: Name Token ] + * + * returns 1 if valid or 0 otherwise + */ + +int +xmlValidateNmtokensValue(const xmlChar *value) { + return(xmlValidateNmtokensValueInternal(NULL, value)); +} + /** * xmlValidateNotationDecl: * @ctxt: the validation context @@ -3710,28 +3816,34 @@ xmlValidateNotationDecl(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED, xmlDocPtr doc ATT * returns 1 if valid or 0 otherwise */ -int -xmlValidateAttributeValue(xmlAttributeType type, const xmlChar *value) { +static int +xmlValidateAttributeValueInternal(xmlDocPtr doc, xmlAttributeType type, + const xmlChar *value) { switch (type) { case XML_ATTRIBUTE_ENTITIES: case XML_ATTRIBUTE_IDREFS: - return(xmlValidateNamesValue(value)); + return(xmlValidateNamesValueInternal(doc, value)); case XML_ATTRIBUTE_ENTITY: case XML_ATTRIBUTE_IDREF: case XML_ATTRIBUTE_ID: case XML_ATTRIBUTE_NOTATION: - return(xmlValidateNameValue(value)); + return(xmlValidateNameValueInternal(doc, value)); case XML_ATTRIBUTE_NMTOKENS: case XML_ATTRIBUTE_ENUMERATION: - return(xmlValidateNmtokensValue(value)); + return(xmlValidateNmtokensValueInternal(doc, value)); case XML_ATTRIBUTE_NMTOKEN: - return(xmlValidateNmtokenValue(value)); + return(xmlValidateNmtokenValueInternal(doc, value)); case XML_ATTRIBUTE_CDATA: break; } return(1); } +int +xmlValidateAttributeValue(xmlAttributeType type, const xmlChar *value) { + return(xmlValidateAttributeValueInternal(NULL, type, value)); +} + /** * xmlValidateAttributeValue2: * @ctxt: the validation context @@ -4047,11 +4159,12 @@ xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc, int val; CHECK_DTD; if(attr == NULL) return(1); - + /* Attribute Default Legal */ /* Enumeration */ if (attr->defaultValue != NULL) { - val = xmlValidateAttributeValue(attr->atype, attr->defaultValue); + val = xmlValidateAttributeValueInternal(doc, attr->atype, + attr->defaultValue); if (val == 0) { xmlErrValidNode(ctxt, (xmlNodePtr) attr, XML_DTD_ATTRIBUTE_DEFAULT, "Syntax of default value for attribute %s of %s is not valid\n", @@ -4332,7 +4445,7 @@ xmlValidateOneAttribute(xmlValidCtxtPtr ctxt, xmlDocPtr doc, } attr->atype = attrDecl->atype; - val = xmlValidateAttributeValue(attrDecl->atype, value); + val = xmlValidateAttributeValueInternal(doc, attrDecl->atype, value); if (val == 0) { xmlErrValidNode(ctxt, elem, XML_DTD_ATTRIBUTE_VALUE, "Syntax of value for attribute %s of %s is not valid\n", @@ -4517,7 +4630,7 @@ xmlNodePtr elem, const xmlChar *prefix, xmlNsPtr ns, const xmlChar *value) { return(0); } - val = xmlValidateAttributeValue(attrDecl->atype, value); + val = xmlValidateAttributeValueInternal(doc, attrDecl->atype, value); if (val == 0) { if (ns->prefix != NULL) { xmlErrValidNode(ctxt, elem, XML_DTD_INVALID_DEFAULT, @@ -6673,7 +6786,7 @@ xmlValidateDtdFinal(xmlValidCtxtPtr ctxt, xmlDocPtr doc) { xmlAttributeTablePtr table; xmlEntitiesTablePtr entities; - if (doc == NULL) return(0); + if ((doc == NULL) || (ctxt == NULL)) return(0); if ((doc->intSubset == NULL) && (doc->extSubset == NULL)) return(0); ctxt->doc = doc; diff --git a/win32/Makefile.msvc.orig b/win32/Makefile.msvc.orig deleted file mode 100644 index ec1950c..0000000 --- a/win32/Makefile.msvc.orig +++ /dev/null @@ -1,462 +0,0 @@ -# Makefile for libxml2, specific for Windows, MSVC and NMAKE. -# -# Take a look at the beginning and modify the variables to suit your -# environment. Having done that, you can do a -# -# nmake [all] to build the libxml and the accompanying utilities. -# nmake clean to remove all compiler output files and return to a -# clean state. -# nmake rebuild to rebuild everything from scratch. This basically does -# a 'nmake clean' and then a 'nmake all'. -# nmake install to install the library and its header files. -# -# March 2002, Igor Zlatkovic - -# There should never be a need to modify anything below this line. -# ---------------------------------------------------------------- - -AUTOCONF = .\config.msvc -!include $(AUTOCONF) - -# Names of various input and output components. -XML_NAME = xml2 -XML_BASENAME = lib$(XML_NAME) -XML_SO = $(XML_BASENAME).dll -XML_IMP = $(XML_BASENAME).lib -XML_DEF = $(XML_BASENAME).def -XML_A = $(XML_BASENAME)_a.lib -XML_A_DLL = $(XML_BASENAME)_a_dll.lib - -# Place where we let the compiler put its output. -BINDIR = bin.msvc -XML_INTDIR = int.msvc -XML_INTDIR_A = int.a.msvc -XML_INTDIR_A_DLL = int.a.dll.msvc -UTILS_INTDIR = int.utils.msvc - -# The preprocessor and its options. -CPP = cl.exe /EP -CPPFLAGS = /nologo /I$(XML_SRCDIR)\include -!if "$(WITH_THREADS)" != "no" -CPPFLAGS = $(CPPFLAGS) /D "_REENTRANT" -!endif - -# The compiler and its options. -CC = cl.exe -CFLAGS = /nologo /D "WIN32" /D "_WINDOWS" /D "_MBCS" /W1 $(CRUNTIME) -CFLAGS = $(CFLAGS) /I$(XML_SRCDIR) /I$(XML_SRCDIR)\include /I$(INCPREFIX) -!if "$(WITH_THREADS)" != "no" -CFLAGS = $(CFLAGS) /D "_REENTRANT" -!endif -!if "$(WITH_THREADS)" == "yes" || "$(WITH_THREADS)" == "ctls" -CFLAGS = $(CFLAGS) /D "HAVE_WIN32_THREADS" /D "HAVE_COMPILER_TLS" -!else if "$(WITH_THREADS)" == "native" -CFLAGS = $(CFLAGS) /D "HAVE_WIN32_THREADS" -!else if "$(WITH_THREADS)" == "posix" -CFLAGS = $(CFLAGS) /D "HAVE_PTHREAD_H" -!endif -!if "$(WITH_ZLIB)" == "1" -CFLAGS = $(CFLAGS) /D "HAVE_ZLIB_H" -!endif -CFLAGS = $(CFLAGS) /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE - -# The linker and its options. -LD = link.exe -LDFLAGS = /nologo /VERSION:$(LIBXML_MAJOR_VERSION).$(LIBXML_MINOR_VERSION) -LDFLAGS = $(LDFLAGS) /LIBPATH:$(BINDIR) /LIBPATH:$(LIBPREFIX) -LIBS = -!if "$(WITH_FTP)" == "1" || "$(WITH_HTTP)" == "1" -LIBS = $(LIBS) wsock32.lib ws2_32.lib -!endif -!if "$(WITH_ICONV)" == "1" -LIBS = $(LIBS) iconv.lib -!endif -!if "$(WITH_ZLIB)" == "1" -LIBS = $(LIBS) zdll.lib -!endif -!if "$(WITH_THREADS)" == "posix" -LIBS = $(LIBS) pthreadVC.lib -!endif -!if "$(WITH_MODULES)" == "1" -LIBS = $(LIBS) kernel32.lib -!endif - -# The archiver and its options. -AR = lib.exe -ARFLAGS = /nologo - -# Optimisation and debug symbols. -!if "$(DEBUG)" == "1" -CFLAGS = $(CFLAGS) /D "_DEBUG" /Od /Z7 -LDFLAGS = $(LDFLAGS) /DEBUG -!else -CFLAGS = $(CFLAGS) /D "NDEBUG" /O2 -LDFLAGS = $(LDFLAGS) /OPT:NOWIN98 -!endif - -# Libxml object files. -XML_OBJS = $(XML_INTDIR)\c14n.obj\ - $(XML_INTDIR)\catalog.obj\ - $(XML_INTDIR)\chvalid.obj\ - $(XML_INTDIR)\debugXML.obj\ - $(XML_INTDIR)\dict.obj\ - $(XML_INTDIR)\DOCBparser.obj\ - $(XML_INTDIR)\encoding.obj\ - $(XML_INTDIR)\entities.obj\ - $(XML_INTDIR)\error.obj\ - $(XML_INTDIR)\globals.obj\ - $(XML_INTDIR)\hash.obj\ - $(XML_INTDIR)\HTMLparser.obj\ - $(XML_INTDIR)\HTMLtree.obj\ - $(XML_INTDIR)\legacy.obj\ - $(XML_INTDIR)\list.obj\ - $(XML_INTDIR)\nanoftp.obj\ - $(XML_INTDIR)\nanohttp.obj\ - $(XML_INTDIR)\parser.obj\ - $(XML_INTDIR)\parserInternals.obj\ - $(XML_INTDIR)\pattern.obj\ - $(XML_INTDIR)\relaxng.obj\ - $(XML_INTDIR)\SAX2.obj\ - $(XML_INTDIR)\SAX.obj\ - $(XML_INTDIR)\schematron.obj\ - $(XML_INTDIR)\threads.obj\ - $(XML_INTDIR)\tree.obj\ - $(XML_INTDIR)\uri.obj\ - $(XML_INTDIR)\valid.obj\ - $(XML_INTDIR)\xinclude.obj\ - $(XML_INTDIR)\xlink.obj\ - $(XML_INTDIR)\xmlIO.obj\ - $(XML_INTDIR)\xmlmemory.obj\ - $(XML_INTDIR)\xmlreader.obj\ - $(XML_INTDIR)\xmlregexp.obj\ - $(XML_INTDIR)\xmlmodule.obj\ - $(XML_INTDIR)\xmlsave.obj\ - $(XML_INTDIR)\xmlschemas.obj\ - $(XML_INTDIR)\xmlschemastypes.obj\ - $(XML_INTDIR)\xmlunicode.obj\ - $(XML_INTDIR)\xmlwriter.obj\ - $(XML_INTDIR)\xpath.obj\ - $(XML_INTDIR)\xpointer.obj\ - $(XML_INTDIR)\xmlstring.obj - -# Static libxml object files. -XML_OBJS_A = $(XML_INTDIR_A)\c14n.obj\ - $(XML_INTDIR_A)\catalog.obj\ - $(XML_INTDIR_A)\chvalid.obj\ - $(XML_INTDIR_A)\debugXML.obj\ - $(XML_INTDIR_A)\dict.obj\ - $(XML_INTDIR_A)\DOCBparser.obj\ - $(XML_INTDIR_A)\encoding.obj\ - $(XML_INTDIR_A)\entities.obj\ - $(XML_INTDIR_A)\error.obj\ - $(XML_INTDIR_A)\globals.obj\ - $(XML_INTDIR_A)\hash.obj\ - $(XML_INTDIR_A)\HTMLparser.obj\ - $(XML_INTDIR_A)\HTMLtree.obj\ - $(XML_INTDIR_A)\legacy.obj\ - $(XML_INTDIR_A)\list.obj\ - $(XML_INTDIR_A)\nanoftp.obj\ - $(XML_INTDIR_A)\nanohttp.obj\ - $(XML_INTDIR_A)\parser.obj\ - $(XML_INTDIR_A)\parserInternals.obj\ - $(XML_INTDIR_A)\pattern.obj\ - $(XML_INTDIR_A)\relaxng.obj\ - $(XML_INTDIR_A)\SAX2.obj\ - $(XML_INTDIR_A)\SAX.obj\ - $(XML_INTDIR_A)\schematron.obj\ - $(XML_INTDIR_A)\threads.obj\ - $(XML_INTDIR_A)\tree.obj\ - $(XML_INTDIR_A)\uri.obj\ - $(XML_INTDIR_A)\valid.obj\ - $(XML_INTDIR_A)\xinclude.obj\ - $(XML_INTDIR_A)\xlink.obj\ - $(XML_INTDIR_A)\xmlIO.obj\ - $(XML_INTDIR_A)\xmlmemory.obj\ - $(XML_INTDIR_A)\xmlreader.obj\ - $(XML_INTDIR_A)\xmlregexp.obj\ - $(XML_INTDIR_A)\xmlmodule.obj\ - $(XML_INTDIR_A)\xmlsave.obj\ - $(XML_INTDIR_A)\xmlschemas.obj\ - $(XML_INTDIR_A)\xmlschemastypes.obj\ - $(XML_INTDIR_A)\xmlunicode.obj\ - $(XML_INTDIR_A)\xmlwriter.obj\ - $(XML_INTDIR_A)\xpath.obj\ - $(XML_INTDIR_A)\xpointer.obj\ - $(XML_INTDIR_A)\xmlstring.obj - -# Static libxml object files. -XML_OBJS_A_DLL = $(XML_INTDIR_A_DLL)\c14n.obj\ - $(XML_INTDIR_A_DLL)\catalog.obj\ - $(XML_INTDIR_A_DLL)\chvalid.obj\ - $(XML_INTDIR_A_DLL)\debugXML.obj\ - $(XML_INTDIR_A_DLL)\dict.obj\ - $(XML_INTDIR_A_DLL)\DOCBparser.obj\ - $(XML_INTDIR_A_DLL)\encoding.obj\ - $(XML_INTDIR_A_DLL)\entities.obj\ - $(XML_INTDIR_A_DLL)\error.obj\ - $(XML_INTDIR_A_DLL)\globals.obj\ - $(XML_INTDIR_A_DLL)\hash.obj\ - $(XML_INTDIR_A_DLL)\HTMLparser.obj\ - $(XML_INTDIR_A_DLL)\HTMLtree.obj\ - $(XML_INTDIR_A_DLL)\legacy.obj\ - $(XML_INTDIR_A_DLL)\list.obj\ - $(XML_INTDIR_A_DLL)\nanoftp.obj\ - $(XML_INTDIR_A_DLL)\nanohttp.obj\ - $(XML_INTDIR_A_DLL)\parser.obj\ - $(XML_INTDIR_A_DLL)\parserInternals.obj\ - $(XML_INTDIR_A_DLL)\pattern.obj\ - $(XML_INTDIR_A_DLL)\relaxng.obj\ - $(XML_INTDIR_A_DLL)\SAX2.obj\ - $(XML_INTDIR_A_DLL)\SAX.obj\ - $(XML_INTDIR_A_DLL)\schematron.obj\ - $(XML_INTDIR_A_DLL)\threads.obj\ - $(XML_INTDIR_A_DLL)\tree.obj\ - $(XML_INTDIR_A_DLL)\uri.obj\ - $(XML_INTDIR_A_DLL)\valid.obj\ - $(XML_INTDIR_A_DLL)\xinclude.obj\ - $(XML_INTDIR_A_DLL)\xlink.obj\ - $(XML_INTDIR_A_DLL)\xmlIO.obj\ - $(XML_INTDIR_A_DLL)\xmlmemory.obj\ - $(XML_INTDIR_A_DLL)\xmlreader.obj\ - $(XML_INTDIR_A_DLL)\xmlregexp.obj\ - $(XML_INTDIR_A_DLL)\xmlmodule.obj\ - $(XML_INTDIR_A_DLL)\xmlsave.obj\ - $(XML_INTDIR_A_DLL)\xmlschemas.obj\ - $(XML_INTDIR_A_DLL)\xmlschemastypes.obj\ - $(XML_INTDIR_A_DLL)\xmlunicode.obj\ - $(XML_INTDIR_A_DLL)\xmlwriter.obj\ - $(XML_INTDIR_A_DLL)\xpath.obj\ - $(XML_INTDIR_A_DLL)\xpointer.obj\ - $(XML_INTDIR_A_DLL)\xmlstring.obj - -# Xmllint and friends executables. -UTILS = $(BINDIR)\xmllint.exe\ - $(BINDIR)\xmlcatalog.exe\ - $(BINDIR)\testAutomata.exe\ - $(BINDIR)\testC14N.exe\ - $(BINDIR)\testDocbook.exe\ - $(BINDIR)\testHTML.exe\ - $(BINDIR)\testReader.exe\ - $(BINDIR)\testRelax.exe\ - $(BINDIR)\testRegexp.exe\ - $(BINDIR)\testModule.exe\ - $(BINDIR)\testSAX.exe\ - $(BINDIR)\testSchemas.exe\ - $(BINDIR)\testURI.exe\ - $(BINDIR)\testXPath.exe\ - $(BINDIR)\runtest.exe\ - $(BINDIR)\runsuite.exe\ - $(BINDIR)\testapi.exe - -!if "$(WITH_THREADS)" == "yes" || "$(WITH_THREADS)" == "ctls" || "$(WITH_THREADS)" == "native" -UTILS = $(UTILS) $(BINDIR)\testThreadsWin32.exe -!else if "$(WITH_THREADS)" == "posix" -UTILS = $(UTILS) $(BINDIR)\testThreads.exe -!endif - -!if "$(VCMANIFEST)" == "1" -_VC_MANIFEST_EMBED_EXE= if exist $@.manifest mt.exe -nologo -manifest $@.manifest -outputresource:$@;1 -_VC_MANIFEST_EMBED_DLL= if exist $@.manifest mt.exe -nologo -manifest $@.manifest -outputresource:$@;2 -!else -_VC_MANIFEST_EMBED_EXE= -_VC_MANIFEST_EMBED_DLL= -!endif - -all : libxml libxmla libxmladll utils - -libxml : $(BINDIR)\$(XML_SO) - -libxmla : $(BINDIR)\$(XML_A) - -libxmladll : $(BINDIR)\$(XML_A_DLL) - -utils : $(UTILS) - -clean : - if exist $(XML_INTDIR) rmdir /S /Q $(XML_INTDIR) - if exist $(XML_INTDIR_A) rmdir /S /Q $(XML_INTDIR_A) - if exist $(XML_INTDIR_A_DLL) rmdir /S /Q $(XML_INTDIR_A_DLL) - if exist $(UTILS_INTDIR) rmdir /S /Q $(UTILS_INTDIR) - if exist $(BINDIR) rmdir /S /Q $(BINDIR) - -distclean : clean - if exist config.* del config.* - if exist Makefile del Makefile - -rebuild : clean all - -install-libs : all - if not exist $(INCPREFIX)\libxml mkdir $(INCPREFIX)\libxml - if not exist $(BINPREFIX) mkdir $(BINPREFIX) - if not exist $(LIBPREFIX) mkdir $(LIBPREFIX) - if not exist $(SOPREFIX) mkdir $(SOPREFIX) - copy $(XML_SRCDIR)\include\libxml\*.h $(INCPREFIX)\libxml - copy $(BINDIR)\$(XML_SO) $(SOPREFIX) - copy $(BINDIR)\$(XML_A) $(LIBPREFIX) - copy $(BINDIR)\$(XML_A_DLL) $(LIBPREFIX) - copy $(BINDIR)\$(XML_IMP) $(LIBPREFIX) - -install : install-libs - copy $(BINDIR)\*.exe $(BINPREFIX) - -copy $(BINDIR)\*.pdb $(BINPREFIX) - -install-dist : install-libs - copy $(BINDIR)\xml*.exe $(BINPREFIX) - -copy $(BINDIR)\xml*.pdb $(BINPREFIX) - -# This is a target for me, to make a binary distribution. Not for the public use, -# keep your hands off :-) -BDVERSION = $(LIBXML_MAJOR_VERSION).$(LIBXML_MINOR_VERSION).$(LIBXML_MICRO_VERSION) -BDPREFIX = $(XML_BASENAME)-$(BDVERSION).win32 -bindist : all - $(MAKE) /nologo PREFIX=$(BDPREFIX) SOPREFIX=$(BDPREFIX)\bin install-dist - cscript //NoLogo configure.js genreadme $(XML_BASENAME) $(BDVERSION) $(BDPREFIX)\readme.txt - - -# Makes the output directory. -$(BINDIR) : - if not exist $(BINDIR) mkdir $(BINDIR) - - -# Makes the libxml intermediate directory. -$(XML_INTDIR) : - if not exist $(XML_INTDIR) mkdir $(XML_INTDIR) - -# Makes the static libxml intermediate directory. -$(XML_INTDIR_A) : - if not exist $(XML_INTDIR_A) mkdir $(XML_INTDIR_A) - -# Makes the static for dll libxml intermediate directory. -$(XML_INTDIR_A_DLL) : - if not exist $(XML_INTDIR_A_DLL) mkdir $(XML_INTDIR_A_DLL) - -# An implicit rule for libxml compilation. -{$(XML_SRCDIR)}.c{$(XML_INTDIR)}.obj:: - $(CC) $(CFLAGS) /Fo$(XML_INTDIR)\ /c $< - -# An implicit rule for static libxml compilation. -{$(XML_SRCDIR)}.c{$(XML_INTDIR_A)}.obj:: - $(CC) $(CFLAGS) /D "LIBXML_STATIC" /Fo$(XML_INTDIR_A)\ /c $< - -# An implicit rule for static for dll libxml compilation. -{$(XML_SRCDIR)}.c{$(XML_INTDIR_A_DLL)}.obj:: - $(CC) $(CFLAGS) /D "LIBXML_STATIC" /D "LIBXML_STATIC_FOR_DLL" /Fo$(XML_INTDIR_A_DLL)\ /c $< - -# Compiles libxml source. Uses the implicit rule for commands. -$(XML_OBJS) : $(XML_INTDIR) - -# Compiles static libxml source. Uses the implicit rule for commands. -$(XML_OBJS_A) : $(XML_INTDIR_A) - -# Compiles static for dll libxml source. Uses the implicit rule for commands. -$(XML_OBJS_A_DLL) : $(XML_INTDIR_A_DLL) - -# Creates the export definition file (DEF) for libxml. -$(XML_INTDIR)\$(XML_DEF) : $(XML_INTDIR) $(XML_DEF).src - $(CPP) $(CPPFLAGS) $(XML_DEF).src > $(XML_INTDIR)\$(XML_DEF) - -# Creates the libxml shared object. -$(BINDIR)\$(XML_SO) : $(BINDIR) $(XML_OBJS) $(XML_INTDIR)\$(XML_DEF) - $(LD) $(LDFLAGS) /DLL \ - /IMPLIB:$(BINDIR)\$(XML_IMP) /OUT:$(BINDIR)\$(XML_SO) $(XML_OBJS) $(LIBS) - @$(_VC_MANIFEST_EMBED_DLL) - -#$(BINDIR)\$(XML_SO) : $(BINDIR) $(XML_OBJS) $(XML_INTDIR)\$(XML_DEF) -# $(LD) $(LDFLAGS) /DLL /DEF:$(XML_INTDIR)\$(XML_DEF) \ -# /IMPLIB:$(BINDIR)\$(XML_IMP) /OUT:$(BINDIR)\$(XML_SO) $(XML_OBJS) $(LIBS) - -# Creates the libxml archive. -$(BINDIR)\$(XML_A) : $(BINDIR) $(XML_OBJS_A) - $(AR) $(ARFLAGS) /OUT:$(BINDIR)\$(XML_A) $(XML_OBJS_A) - -# Creates the libxml static for dll archive. -$(BINDIR)\$(XML_A_DLL) : $(BINDIR) $(XML_OBJS_A_DLL) - $(AR) $(ARFLAGS) /OUT:$(BINDIR)\$(XML_A_DLL) $(XML_OBJS_A_DLL) - -# Makes the utils intermediate directory. -$(UTILS_INTDIR) : - if not exist $(UTILS_INTDIR) mkdir $(UTILS_INTDIR) - -# An implicit rule for xmllint and friends. -!if "$(STATIC)" == "1" -{$(UTILS_SRCDIR)}.c{$(BINDIR)}.exe: - $(CC) /D "LIBXML_STATIC" $(CFLAGS) /Fo$(UTILS_INTDIR)\ /c $< - $(LD) $(LDFLAGS) /OUT:$@ $(XML_A) $(LIBS) $(UTILS_INTDIR)\$( .memdump - @echo ## XPath regression tests - @-$(BINDIR)\testXPath.exe | find /C "support not compiled in" 1>nul - @if %ERRORLEVEL% NEQ 0 @( \ - echo Skipping debug not compiled in\ - @exit 0 \ - ) - @for %%I in ($(XML_SRCDIR)\test\XPath\expr\*.*) do @( \ - @IF NOT EXIST $(XML_SRCDIR)\result\XPath\expr\%%~nxI ( \ - @echo New test %%~nxI &&\ - @echo %%~nxI &&\ - $(BINDIR)\testXPath.exe -f --expr %%I > $(XML_SRCDIR)/result/XPath/expr/%%~nxI &&\ - findstr /C:"MEMORY ALLOCATED : 0" \ - ) ELSE ( \ - $(BINDIR)\testXPath.exe -f --expr %%I 2>&1 > result.%%~nxI &&\ - fc $(XML_SRCDIR)\result\XPath\expr\%%~nxI result.%%~nxI >nul &\ - iF ERRORLEVEL 1 exit 1 & \ - findstr "MEMORY ALLOCATED" .memdump | findstr /C:"MEMORY ALLOCATED : 0" >nul &&\ - del result.%%~nxI \ - ) \ - ) - @for %%I in ($(XML_SRCDIR)\test\XPath\docs\*.*) do @( \ - for %%J in ($(XML_SRCDIR)\test\XPath\tests\%%~nxI*.*) do @( \ - if not exist $(XML_SRCDIR)\result\XPath\tests\%%~nxJ ( \ - $(BINDIR)\testXPath.exe -f -i %%I %%J > $(XML_SRCDIR)\result\XPath\tests\%%~nxJ &&\ - findstr /C:"MEMORY ALLOCATED" .memdump | findstr /C:"MEMORY ALLOCATED : 0" > nul \ - ) ELSE ( \ - $(BINDIR)\testXPAth.exe -f -i %%I %%J 2>&1 > result.%%~nxJ &&\ - findstr /C:"MEMORY ALLOCATED" .memdump | findstr /C:"MEMORY ALLOCATED : 0">null &&\ - fc $(XML_SRCDIR)\result\XPath\tests\%%~nxJ result.%%~nxJ >null & \ - IF ERRORLEVEL 1 (echo Error: %%I %%J & exit 1) & \ - del result.%%~nxJ \ - )\ - )\ - ) - -XMLtests : $(BINDIR)\xmllint.exe - @echo. 2> .memdump - @echo ## XML regression tests - -@for %%I in ($(XML_SRCDIR)\test\*) do @( \ - if not exist $(XML_SRCDIR)\result\%%~nxI ( \ - echo New test file %%~nxI &\ - $(BINDIR)\xmllint.exe %%I > $(XML_SRCDIR)\result\%%~nxI && \ - findstr /C:"MEMORY ALLOCATED" .memdump | findstr /C:"MEMORY ALLOCATED : 0" > null \ - ) ELSE ( \ - $(BINDIR)\xmllint.exe %%I 2>&1 > result.%%~nxI && \ - findstr /C:"MEMORY ALLOC" .memdump | findstr /C:"MEMORY ALLOCATED : 0" > null && \ - fc $(XML_SRCDIR)\result\%%~nxI result.%%~nxI > null && \ - $(BINDIR)\xmllint.exe result.%%~nxI 2>&1 > result2.%%~nxI | findstr /V /C:"failed to load external entity" && \ - fc result.%%~nxI result2.%%~nxI & \ - del result.%%~nxI result2.%%~nxI\ - ) \ - ) - - - - - - diff --git a/win32/libxml2.def.src b/win32/libxml2.def.src index db05ad4..f4c2c63 100644 --- a/win32/libxml2.def.src +++ b/win32/libxml2.def.src @@ -1732,6 +1732,9 @@ xmlSchemaValPredefTypeNodeNoNorm xmlSchemaValidCtxtGetOptions #endif #ifdef LIBXML_SCHEMAS_ENABLED +xmlSchemaValidCtxtGetParserCtxt +#endif +#ifdef LIBXML_SCHEMAS_ENABLED xmlSchemaValidateDoc #endif #ifdef LIBXML_SCHEMAS_ENABLED diff --git a/xinclude.c b/xinclude.c index bb41180..ae449f8 100644 --- a/xinclude.c +++ b/xinclude.c @@ -1678,7 +1678,9 @@ loaded: /* * Do the xml:base fixup if needed */ - if ((doc != NULL) && (URL != NULL) && (xmlStrchr(URL, (xmlChar) '/'))) { + if ((doc != NULL) && (URL != NULL) && (xmlStrchr(URL, (xmlChar) '/')) && + (!(ctxt->parseFlags & XML_PARSE_NOBASEFIX)) && + (!(doc->parseFlags & XML_PARSE_NOBASEFIX))) { xmlNodePtr node; xmlChar *base; xmlChar *curBase; diff --git a/xmlIO.c b/xmlIO.c index dd4f7e7..aa97c44 100644 --- a/xmlIO.c +++ b/xmlIO.c @@ -2274,10 +2274,21 @@ xmlAllocOutputBuffer(xmlCharEncodingHandlerPtr encoder) { xmlFree(ret); return(NULL); } - ret->buffer->alloc = XML_BUFFER_ALLOC_DOUBLEIT; + + /* + * For conversion buffers we use the special IO handling + */ + ret->buffer->alloc = XML_BUFFER_ALLOC_IO; + ret->buffer->contentIO = ret->buffer->content; + ret->encoder = encoder; if (encoder != NULL) { ret->conv = xmlBufferCreateSize(4000); + if (ret->conv == NULL) { + xmlFree(ret); + return(NULL); + } + /* * This call is designed to initiate the encoder state */ @@ -3320,9 +3331,10 @@ xmlOutputBufferWriteEscape(xmlOutputBufferPtr out, const xmlChar *str, * not the case force a flush, but make sure we stay in the loop */ if (chunk < 40) { - nbchars = 0; - oldwritten = -1; - goto flush; + if (xmlBufferGrow(out->buffer, out->buffer->size + 100) < 0) + return(-1); + oldwritten = -1; + continue; } /* @@ -3370,7 +3382,6 @@ xmlOutputBufferWriteEscape(xmlOutputBufferPtr out, const xmlChar *str, if ((nbchars < MINLEN) && (len <= 0)) goto done; -flush: if (out->writecallback) { /* * second write the stuff to the I/O channel diff --git a/xmllint.c b/xmllint.c index ee41697..6955fde 100644 --- a/xmllint.c +++ b/xmllint.c @@ -202,6 +202,7 @@ static xmlStreamCtxtPtr patstream = NULL; #endif static int options = XML_PARSE_COMPACT; static int sax = 0; +static int oldxml10 = 0; /************************************************************************ * * @@ -2832,6 +2833,7 @@ static void usage(const char *name) { printf("\t--copy : used to test the internal copy implementation\n"); #endif /* LIBXML_TREE_ENABLED */ printf("\t--recover : output what was parsable on broken XML documents\n"); + printf("\t--huge : remove any internal arbitrary parser limits\n"); printf("\t--noent : substitute entity references by their value\n"); printf("\t--noout : don't output the result tree\n"); printf("\t--path 'paths': provide a set of paths for resources\n"); @@ -2890,6 +2892,7 @@ static void usage(const char *name) { #ifdef LIBXML_XINCLUDE_ENABLED printf("\t--xinclude : do XInclude processing\n"); printf("\t--noxincludenode : same but do not generate XInclude nodes\n"); + printf("\t--nofixup-base-uris : do not fixup xml:base uris\n"); #endif printf("\t--loaddtd : fetch external DTD\n"); printf("\t--dtdattr : loaddtd + populate the tree with inherited attributes \n"); @@ -2912,6 +2915,7 @@ static void usage(const char *name) { printf("\t--sax1: use the old SAX1 interfaces for processing\n"); #endif printf("\t--sax: do not build a tree but work just at the SAX level\n"); + printf("\t--oldxml10: use XML-1.0 parsing rules before the 5th edition\n"); printf("\nLibxml project home page: http://xmlsoft.org/\n"); printf("To report bugs or get some help check: http://xmlsoft.org/bugs.html\n"); @@ -2969,6 +2973,9 @@ main(int argc, char **argv) { (!strcmp(argv[i], "--recover"))) { recovery++; options |= XML_PARSE_RECOVER; + } else if ((!strcmp(argv[i], "-huge")) || + (!strcmp(argv[i], "--huge"))) { + options |= XML_PARSE_HUGE; } else if ((!strcmp(argv[i], "-noent")) || (!strcmp(argv[i], "--noent"))) { noent++; @@ -3091,6 +3098,12 @@ main(int argc, char **argv) { options |= XML_PARSE_XINCLUDE; options |= XML_PARSE_NOXINCNODE; } + else if ((!strcmp(argv[i], "-nofixup-base-uris")) || + (!strcmp(argv[i], "--nofixup-base-uris"))) { + xinclude++; + options |= XML_PARSE_XINCLUDE; + options |= XML_PARSE_NOBASEFIX; + } #endif #ifdef LIBXML_OUTPUT_ENABLED #ifdef HAVE_ZLIB_H @@ -3237,6 +3250,10 @@ main(int argc, char **argv) { i++; pattern = argv[i]; #endif + } else if ((!strcmp(argv[i], "-oldxml10")) || + (!strcmp(argv[i], "--oldxml10"))) { + oldxml10++; + options |= XML_PARSE_OLD10; } else { fprintf(stderr, "Unknown option %s\n", argv[i]); usage(argv[0]); diff --git a/xmlmemory.c b/xmlmemory.c index f9019a4..510d4ce 100644 --- a/xmlmemory.c +++ b/xmlmemory.c @@ -34,7 +34,7 @@ /** * MEM_LIST: * - * keep track of all allocated blocks for error reporting + * keep track of all allocated blocks for error reporting * Always build the memory list ! */ #ifdef DEBUG_MEMORY_LOCATION @@ -162,7 +162,7 @@ xmlMallocLoc(size_t size, const char * file, int line) { MEMHDR *p; void *ret; - + if (!xmlMemInitialized) xmlInitMemory(); #ifdef DEBUG_MEMORY xmlGenericError(xmlGenericErrorContext, @@ -170,7 +170,7 @@ xmlMallocLoc(size_t size, const char * file, int line) #endif TEST_POINT - + p = (MEMHDR *) malloc(RESERVE_SIZE+size); if (!p) { @@ -178,7 +178,7 @@ xmlMallocLoc(size_t size, const char * file, int line) "xmlMallocLoc : Out of free space\n"); xmlMemoryDump(); return(NULL); - } + } p->mh_tag = MEMTAG; p->mh_size = size; p->mh_type = MALLOC_TYPE; @@ -193,12 +193,12 @@ xmlMallocLoc(size_t size, const char * file, int line) debugmem_list_add(p); #endif xmlMutexUnlock(xmlMemMutex); - + #ifdef DEBUG_MEMORY xmlGenericError(xmlGenericErrorContext, "Malloc(%d) Ok\n",size); #endif - + if (xmlMemStopAtBlock == p->mh_number) xmlMallocBreakpoint(); ret = HDR_2_CLIENT(p); @@ -230,7 +230,7 @@ xmlMallocAtomicLoc(size_t size, const char * file, int line) { MEMHDR *p; void *ret; - + if (!xmlMemInitialized) xmlInitMemory(); #ifdef DEBUG_MEMORY xmlGenericError(xmlGenericErrorContext, @@ -238,7 +238,7 @@ xmlMallocAtomicLoc(size_t size, const char * file, int line) #endif TEST_POINT - + p = (MEMHDR *) malloc(RESERVE_SIZE+size); if (!p) { @@ -246,7 +246,7 @@ xmlMallocAtomicLoc(size_t size, const char * file, int line) "xmlMallocLoc : Out of free space\n"); xmlMemoryDump(); return(NULL); - } + } p->mh_tag = MEMTAG; p->mh_size = size; p->mh_type = MALLOC_ATOMIC_TYPE; @@ -266,7 +266,7 @@ xmlMallocAtomicLoc(size_t size, const char * file, int line) xmlGenericError(xmlGenericErrorContext, "Malloc(%d) Ok\n",size); #endif - + if (xmlMemStopAtBlock == p->mh_number) xmlMallocBreakpoint(); ret = HDR_2_CLIENT(p); @@ -341,7 +341,7 @@ xmlReallocLoc(void *ptr,size_t size, const char * file, int line) debugmem_list_delete(p); #endif xmlMutexUnlock(xmlMemMutex); - + p = (MEMHDR *) realloc(p,RESERVE_SIZE+size); if (!p) { goto error; @@ -374,8 +374,8 @@ xmlReallocLoc(void *ptr,size_t size, const char * file, int line) "Realloced(%d to %d) Ok\n", oldsize, size); #endif return(HDR_2_CLIENT(p)); - -error: + +error: return(NULL); } @@ -455,10 +455,10 @@ xmlMemFree(void *ptr) xmlGenericError(xmlGenericErrorContext, "Freed(%d) Ok\n", size); #endif - + return; - -error: + +error: xmlGenericError(xmlGenericErrorContext, "xmlMemFree(%lX) error\n", (unsigned long) ptr); xmlMallocBreakpoint(); @@ -504,16 +504,16 @@ xmlMemStrdupLoc(const char *str, const char *file, int line) debugmem_list_add(p); #endif xmlMutexUnlock(xmlMemMutex); - + s = (char *) HDR_2_CLIENT(p); - + if (xmlMemStopAtBlock == p->mh_number) xmlMallocBreakpoint(); if (s != NULL) strcpy(s,str); else goto error; - + TEST_POINT if (xmlMemTraceBlockAt == s) { @@ -617,7 +617,7 @@ xmlMemContentShow(FILE *fp, MEMHDR *p) } else if ((i == 0) && (buf[i] == 0)) { fprintf(fp," null"); } else { - if (buf[i] == 0) fprintf(fp," \"%.25s\"", buf); + if (buf[i] == 0) fprintf(fp," \"%.25s\"", buf); else { fprintf(fp," ["); for (j = 0;j < i;j++) @@ -628,6 +628,79 @@ xmlMemContentShow(FILE *fp, MEMHDR *p) } #endif +/** + * xmlMemDisplayLast: + * @fp: a FILE descriptor used as the output file, if NULL, the result is + * written to the file .memorylist + * @nbBytes: the amount of memory to dump + * + * the last nbBytes of memory allocated and not freed, useful for dumping + * the memory left allocated between two places at runtime. + */ + +void +xmlMemDisplayLast(FILE *fp, long nbBytes) +{ +#ifdef MEM_LIST + MEMHDR *p; + unsigned idx; + int nb = 0; +#endif + FILE *old_fp = fp; + + if (nbBytes <= 0) + return; + + if (fp == NULL) { + fp = fopen(".memorylist", "w"); + if (fp == NULL) + return; + } + +#ifdef MEM_LIST + fprintf(fp," Last %li MEMORY ALLOCATED : %lu, MAX was %lu\n", + nbBytes, debugMemSize, debugMaxMemSize); + fprintf(fp,"BLOCK NUMBER SIZE TYPE\n"); + idx = 0; + xmlMutexLock(xmlMemMutex); + p = memlist; + while ((p) && (nbBytes > 0)) { + fprintf(fp,"%-5u %6lu %6lu ",idx++,p->mh_number, + (unsigned long)p->mh_size); + switch (p->mh_type) { + case STRDUP_TYPE:fprintf(fp,"strdup() in ");break; + case MALLOC_TYPE:fprintf(fp,"malloc() in ");break; + case REALLOC_TYPE:fprintf(fp,"realloc() in ");break; + case MALLOC_ATOMIC_TYPE:fprintf(fp,"atomicmalloc() in ");break; + case REALLOC_ATOMIC_TYPE:fprintf(fp,"atomicrealloc() in ");break; + default: + fprintf(fp,"Unknown memory block, may be corrupted"); + xmlMutexUnlock(xmlMemMutex); + if (old_fp == NULL) + fclose(fp); + return; + } + if (p->mh_file != NULL) fprintf(fp,"%s(%u)", p->mh_file, p->mh_line); + if (p->mh_tag != MEMTAG) + fprintf(fp," INVALID"); + nb++; + if (nb < 100) + xmlMemContentShow(fp, p); + else + fprintf(fp," skip"); + + fprintf(fp,"\n"); + nbBytes -= (unsigned long)p->mh_size; + p = p->mh_next; + } + xmlMutexUnlock(xmlMemMutex); +#else + fprintf(fp,"Memory list not compiled (MEM_LIST not defined !)\n"); +#endif + if (old_fp == NULL) + fclose(fp); +} + /** * xmlMemDisplay: * @fp: a FILE descriptor used as the output file, if NULL, the result is @@ -665,7 +738,7 @@ xmlMemDisplay(FILE *fp) fprintf(fp," %s\n\n", buf); #endif - + fprintf(fp," MEMORY ALLOCATED : %lu, MAX was %lu\n", debugMemSize, debugMaxMemSize); fprintf(fp,"BLOCK NUMBER SIZE TYPE\n"); @@ -742,7 +815,7 @@ static void debugmem_list_delete(MEMHDR *p) * * internal error function. */ - + static void debugmem_tag_error(void *p) { xmlGenericError(xmlGenericErrorContext, @@ -802,7 +875,7 @@ xmlMemShow(FILE *fp, int nr ATTRIBUTE_UNUSED) } } xmlMutexUnlock(xmlMemMutex); -#endif /* MEM_LIST */ +#endif /* MEM_LIST */ } /** @@ -849,11 +922,11 @@ xmlInitMemory(void) { #ifdef HAVE_STDLIB_H char *breakpoint; -#endif +#endif #ifdef DEBUG_MEMORY xmlGenericError(xmlGenericErrorContext, "xmlInitMemory()\n"); -#endif +#endif /* This is really not good code (see Bug 130419). Suggestions for improvement will be welcome! @@ -867,18 +940,18 @@ xmlInitMemory(void) if (breakpoint != NULL) { sscanf(breakpoint, "%ud", &xmlMemStopAtBlock); } -#endif +#endif #ifdef HAVE_STDLIB_H breakpoint = getenv("XML_MEM_TRACE"); if (breakpoint != NULL) { sscanf(breakpoint, "%p", &xmlMemTraceBlockAt); } -#endif - +#endif + #ifdef DEBUG_MEMORY xmlGenericError(xmlGenericErrorContext, "xmlInitMemory() Ok\n"); -#endif +#endif return(0); } @@ -893,7 +966,7 @@ xmlCleanupMemory(void) { #ifdef DEBUG_MEMORY xmlGenericError(xmlGenericErrorContext, "xmlCleanupMemory()\n"); -#endif +#endif if (xmlMemInitialized == 0) return; @@ -903,7 +976,7 @@ xmlCleanupMemory(void) { #ifdef DEBUG_MEMORY xmlGenericError(xmlGenericErrorContext, "xmlCleanupMemory() Ok\n"); -#endif +#endif } /** @@ -927,7 +1000,7 @@ xmlMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc, #ifdef DEBUG_MEMORY xmlGenericError(xmlGenericErrorContext, "xmlMemSetup()\n"); -#endif +#endif if (freeFunc == NULL) return(-1); if (mallocFunc == NULL) @@ -944,7 +1017,7 @@ xmlMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc, #ifdef DEBUG_MEMORY xmlGenericError(xmlGenericErrorContext, "xmlMemSetup() Ok\n"); -#endif +#endif return(0); } @@ -994,7 +1067,7 @@ xmlGcMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc, #ifdef DEBUG_MEMORY xmlGenericError(xmlGenericErrorContext, "xmlGcMemSetup()\n"); -#endif +#endif if (freeFunc == NULL) return(-1); if (mallocFunc == NULL) @@ -1013,7 +1086,7 @@ xmlGcMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc, #ifdef DEBUG_MEMORY xmlGenericError(xmlGenericErrorContext, "xmlGcMemSetup() Ok\n"); -#endif +#endif return(0); } diff --git a/xmlreader.c b/xmlreader.c index 92b053e..bd47ea5 100644 --- a/xmlreader.c +++ b/xmlreader.c @@ -1847,17 +1847,22 @@ xmlTextReaderNextTree(xmlTextReaderPtr reader) } if (reader->state != XML_TEXTREADER_BACKTRACK) { - if (reader->node->children != 0) { - reader->node = reader->node->children; - reader->depth++; + /* Here removed traversal to child, because we want to skip the subtree, + replace with traversal to sibling to skip subtree */ + if (reader->node->next != 0) { + /* Move to sibling if present,skipping sub-tree */ + reader->node = reader->node->next; reader->state = XML_TEXTREADER_START; return(1); } + /* if reader->node->next is NULL mean no subtree for current node, + so need to move to sibling of parent node if present */ if ((reader->node->type == XML_ELEMENT_NODE) || (reader->node->type == XML_ATTRIBUTE_NODE)) { reader->state = XML_TEXTREADER_BACKTRACK; - return(1); + /* This will move to parent if present */ + xmlTextReaderRead(reader); } } @@ -1876,7 +1881,8 @@ xmlTextReaderNextTree(xmlTextReaderPtr reader) reader->node = reader->node->parent; reader->depth--; reader->state = XML_TEXTREADER_BACKTRACK; - return(1); + /* Repeat process to move to sibling of parent node if present */ + xmlTextReaderNextTree(reader); } reader->state = XML_TEXTREADER_END; diff --git a/xmlregexp.c b/xmlregexp.c index 389453b..73598a5 100644 --- a/xmlregexp.c +++ b/xmlregexp.c @@ -3162,7 +3162,8 @@ xmlFARegExec(xmlRegexpPtr comp, const xmlChar *content) { exec->counts = NULL; while ((exec->status == 0) && ((exec->inputString[exec->index] != 0) || - (exec->state->type != XML_REGEXP_FINAL_STATE))) { + ((exec->state != NULL) && + (exec->state->type != XML_REGEXP_FINAL_STATE)))) { xmlRegTransPtr trans; xmlRegAtomPtr atom; @@ -4905,64 +4906,6 @@ xmlFAParseCharClassEsc(xmlRegParserCtxtPtr ctxt) { } } -/** - * xmlFAParseCharRef: - * @ctxt: a regexp parser context - * - * [19] XmlCharRef ::= ( '&#' [0-9]+ ';' ) | (' &#x' [0-9a-fA-F]+ ';' ) - */ -static int -xmlFAParseCharRef(xmlRegParserCtxtPtr ctxt) { - int ret = 0, cur; - - if ((CUR != '&') || (NXT(1) != '#')) - return(-1); - NEXT; - NEXT; - cur = CUR; - if (cur == 'x') { - NEXT; - cur = CUR; - if (((cur >= '0') && (cur <= '9')) || - ((cur >= 'a') && (cur <= 'f')) || - ((cur >= 'A') && (cur <= 'F'))) { - while (((cur >= '0') && (cur <= '9')) || - ((cur >= 'a') && (cur <= 'f')) || - ((cur >= 'A') && (cur <= 'F'))) { - if ((cur >= '0') && (cur <= '9')) - ret = ret * 16 + cur - '0'; - else if ((cur >= 'a') && (cur <= 'f')) - ret = ret * 16 + 10 + (cur - 'a'); - else - ret = ret * 16 + 10 + (cur - 'A'); - NEXT; - cur = CUR; - } - } else { - ERROR("Char ref: expecting [0-9A-F]"); - return(-1); - } - } else { - if ((cur >= '0') && (cur <= '9')) { - while ((cur >= '0') && (cur <= '9')) { - ret = ret * 10 + cur - '0'; - NEXT; - cur = CUR; - } - } else { - ERROR("Char ref: expecting [0-9]"); - return(-1); - } - } - if (cur != ';') { - ERROR("Char ref: expecting ';'"); - return(-1); - } else { - NEXT; - } - return(ret); -} - /** * xmlFAParseCharRange: * @ctxt: a regexp parser context @@ -4984,12 +4927,6 @@ xmlFAParseCharRange(xmlRegParserCtxtPtr ctxt) { return; } - if ((CUR == '&') && (NXT(1) == '#')) { - end = start = xmlFAParseCharRef(ctxt); - xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg, - XML_REGEXP_CHARVAL, start, end, NULL); - return; - } cur = CUR; if (cur == '\\') { NEXT; diff --git a/xmlschemas.c b/xmlschemas.c index d57ba9f..c90b171 100644 --- a/xmlschemas.c +++ b/xmlschemas.c @@ -90,7 +90,7 @@ #ifndef DEBUG_IDC_NODE_TABLE #define DEBUG_IDC_NODE_TABLE #endif -#endif +#endif /* #define ENABLE_PARTICLE_RESTRICTION 1 */ @@ -374,7 +374,7 @@ typedef xmlSchemaBucket *xmlSchemaBucketPtr; #define XML_SCHEMA_SCHEMA_REDEFINE 3 /** - * xmlSchemaSchemaRelation: + * xmlSchemaSchemaRelation: * * Used to create a graph of schema relationships. */ @@ -402,12 +402,12 @@ struct _xmlSchemaBucket { int parsed; int imported; int preserveDoc; - xmlSchemaItemListPtr globals; /* Global components. */ + xmlSchemaItemListPtr globals; /* Global components. */ xmlSchemaItemListPtr locals; /* Local components. */ }; /** - * xmlSchemaImport: + * xmlSchemaImport: * (extends xmlSchemaBucket) * * Reflects a schema. Holds some information @@ -422,9 +422,9 @@ struct _xmlSchemaImport { const xmlChar *schemaLocation; /* The URI of the schema document. */ /* For chameleon includes, @origTargetNamespace will be NULL */ const xmlChar *origTargetNamespace; - /* + /* * For chameleon includes, @targetNamespace will be the - * targetNamespace of the including schema. + * targetNamespace of the including schema. */ const xmlChar *targetNamespace; xmlDocPtr doc; /* The schema node-tree. */ @@ -457,7 +457,7 @@ struct _xmlSchemaInclude { int parsed; int imported; int preserveDoc; - xmlSchemaItemListPtr globals; /* Global components. */ + xmlSchemaItemListPtr globals; /* Global components. */ xmlSchemaItemListPtr locals; /* Local components. */ /* The owning main or import schema bucket. */ @@ -517,7 +517,7 @@ struct _xmlSchemaAttributeUse { xmlSchemaTypeType type; xmlSchemaAnnotPtr annot; xmlSchemaAttributeUsePtr next; /* The next attr. use. */ - /* + /* * The attr. decl. OR a QName-ref. to an attr. decl. OR * a QName-ref. to an attribute group definition. */ @@ -573,7 +573,7 @@ struct _xmlSchemaConstructionCtxt { xmlDictPtr dict; xmlSchemaItemListPtr buckets; /* List of schema buckets. */ /* xmlSchemaItemListPtr relations; */ /* List of schema relations. */ - xmlSchemaBucketPtr bucket; /* The current schema bucket */ + xmlSchemaBucketPtr bucket; /* The current schema bucket */ xmlSchemaItemListPtr pending; /* All Components of all schemas that need to be fixed. */ xmlHashTablePtr substGroups; @@ -629,7 +629,7 @@ struct _xmlSchemaParserCtxt { xmlSchemaBucketPtr redefined; /* The schema to be redefined. */ xmlSchemaRedefPtr redef; /* Used for redefinitions. */ - int redefCounter; /* Used for redefinitions. */ + int redefCounter; /* Used for redefinitions. */ xmlSchemaItemListPtr attrProhibs; }; @@ -783,7 +783,7 @@ struct _xmlSchemaPSVIIDCNode { xmlNodePtr node; xmlSchemaPSVIIDCKeyPtr *keys; int nodeLine; - int nodeQNameID; + int nodeQNameID; }; @@ -879,7 +879,7 @@ struct _xmlSchemaIDCMatcher { struct _xmlSchemaNodeInfo { int nodeType; xmlNodePtr node; - int nodeLine; + int nodeLine; const xmlChar *localName; const xmlChar *nsName; const xmlChar *value; @@ -901,7 +901,7 @@ struct _xmlSchemaNodeInfo { const xmlChar **nsBindings; /* Namespace bindings on this element */ int nbNsBindings; - int sizeNsBindings; + int sizeNsBindings; int hasKeyrefs; int appliedXPath; /* Indicates that an XPath has been applied. */ @@ -938,7 +938,7 @@ typedef xmlSchemaAttrInfo *xmlSchemaAttrInfoPtr; struct _xmlSchemaAttrInfo { int nodeType; xmlNodePtr node; - int nodeLine; + int nodeLine; const xmlChar *localName; const xmlChar *nsName; const xmlChar *value; @@ -1172,7 +1172,7 @@ xmlSchemaGetComponentTypeStr(xmlSchemaBasicItemPtr item) if (WXS_IS_COMPLEX(WXS_TYPE_CAST item)) return(BAD_CAST "complex type definition"); else - return(BAD_CAST "simple type definition"); + return(BAD_CAST "simple type definition"); default: return(xmlSchemaItemTypeToStr(item->type)); } @@ -1300,11 +1300,11 @@ xmlSchemaFormatQName(xmlChar **buf, *buf = xmlStrcat(*buf, localName); } else { *buf = xmlStrcat(*buf, BAD_CAST "(NULL)"); - } + } return ((const xmlChar *) *buf); } -static const xmlChar* +static const xmlChar* xmlSchemaFormatQNameNs(xmlChar **buf, xmlNsPtr ns, const xmlChar *localName) { if (ns != NULL) @@ -1480,16 +1480,16 @@ xmlSchemaGetCanonValueWhtspExt(xmlSchemaValPtr val, int list; xmlSchemaValType valType; const xmlChar *value, *value2 = NULL; - + if ((retValue == NULL) || (val == NULL)) return (-1); list = xmlSchemaValueGetNext(val) ? 1 : 0; *retValue = NULL; do { - value = NULL; - valType = xmlSchemaGetValType(val); - switch (valType) { + value = NULL; + valType = xmlSchemaGetValType(val); + switch (valType) { case XML_SCHEMAS_STRING: case XML_SCHEMAS_NORMSTRING: case XML_SCHEMAS_ANYSIMPLETYPE: @@ -1502,7 +1502,7 @@ xmlSchemaGetCanonValueWhtspExt(xmlSchemaValPtr val, if (value2 != NULL) value = value2; } - break; + break; default: if (xmlSchemaGetCanonValue(val, &value2) == -1) { if (value2 != NULL) @@ -1540,29 +1540,29 @@ internal_error: * @buf: the string buffer * @itemDes: the designation of the item * @itemName: the name of the item - * @item: the item as an object + * @item: the item as an object * @itemNode: the node of the item * @local: the local name * @parsing: if the function is used during the parse * * Returns a representation of the given item used - * for error reports. + * for error reports. * - * The following order is used to build the resulting + * The following order is used to build the resulting * designation if the arguments are not NULL: * 1a. If itemDes not NULL -> itemDes * 1b. If (itemDes not NULL) and (itemName not NULL) * -> itemDes + itemName * 2. If the preceding was NULL and (item not NULL) -> item * 3. If the preceding was NULL and (itemNode not NULL) -> itemNode - * + * * If the itemNode is an attribute node, the name of the attribute * will be appended to the result. * * Returns the formatted string and sets @buf to the resulting value. - */ -static xmlChar* -xmlSchemaFormatItemForReport(xmlChar **buf, + */ +static xmlChar* +xmlSchemaFormatItemForReport(xmlChar **buf, const xmlChar *itemDes, xmlSchemaBasicItemPtr item, xmlNodePtr itemNode) @@ -1574,9 +1574,9 @@ xmlSchemaFormatItemForReport(xmlChar **buf, xmlFree(*buf); *buf = NULL; } - + if (itemDes != NULL) { - *buf = xmlStrdup(itemDes); + *buf = xmlStrdup(itemDes); } else if (item != NULL) { switch (item->type) { case XML_SCHEMA_TYPE_BASIC: { @@ -1634,7 +1634,7 @@ xmlSchemaFormatItemForReport(xmlChar **buf, break; case XML_SCHEMA_TYPE_ATTRIBUTE_USE: { xmlSchemaAttributeUsePtr ause; - + ause = WXS_ATTR_USE_CAST item; *buf = xmlStrdup(BAD_CAST "attribute use "); if (WXS_ATTRUSE_DECL(ause) != NULL) { @@ -1650,7 +1650,7 @@ xmlSchemaFormatItemForReport(xmlChar **buf, break; case XML_SCHEMA_TYPE_ATTRIBUTE: { xmlSchemaAttributePtr attr; - + attr = (xmlSchemaAttributePtr) item; *buf = xmlStrdup(BAD_CAST "attribute decl."); *buf = xmlStrcat(*buf, BAD_CAST " '"); @@ -1666,7 +1666,7 @@ xmlSchemaFormatItemForReport(xmlChar **buf, case XML_SCHEMA_TYPE_ELEMENT: { xmlSchemaElementPtr elem; - elem = (xmlSchemaElementPtr) item; + elem = (xmlSchemaElementPtr) item; *buf = xmlStrdup(BAD_CAST "element decl."); *buf = xmlStrcat(*buf, BAD_CAST " '"); *buf = xmlStrcat(*buf, xmlSchemaFormatQName(&str, @@ -1676,7 +1676,7 @@ xmlSchemaFormatItemForReport(xmlChar **buf, break; case XML_SCHEMA_TYPE_IDC_UNIQUE: case XML_SCHEMA_TYPE_IDC_KEY: - case XML_SCHEMA_TYPE_IDC_KEYREF: + case XML_SCHEMA_TYPE_IDC_KEYREF: if (item->type == XML_SCHEMA_TYPE_IDC_UNIQUE) *buf = xmlStrdup(BAD_CAST "unique '"); else if (item->type == XML_SCHEMA_TYPE_IDC_KEY) @@ -1732,7 +1732,7 @@ xmlSchemaFormatItemForReport(xmlChar **buf, default: named = 0; } - } else + } else named = 0; if ((named == 0) && (itemNode != NULL)) { @@ -1740,7 +1740,7 @@ xmlSchemaFormatItemForReport(xmlChar **buf, if (itemNode->type == XML_ATTRIBUTE_NODE) elem = itemNode->parent; - else + else elem = itemNode; *buf = xmlStrdup(BAD_CAST "Element '"); if (elem->ns != NULL) { @@ -1750,7 +1750,7 @@ xmlSchemaFormatItemForReport(xmlChar **buf, } else *buf = xmlStrcat(*buf, elem->name); *buf = xmlStrcat(*buf, BAD_CAST "'"); - + } if ((itemNode != NULL) && (itemNode->type == XML_ATTRIBUTE_NODE)) { *buf = xmlStrcat(*buf, BAD_CAST ", attribute '"); @@ -1763,7 +1763,7 @@ xmlSchemaFormatItemForReport(xmlChar **buf, *buf = xmlStrcat(*buf, BAD_CAST "'"); } FREE_AND_NULL(str) - + return (*buf); } @@ -1786,13 +1786,13 @@ xmlSchemaFormatFacetEnumSet(xmlSchemaAbstractCtxtPtr actxt, int res, found = 0; if (*buf != NULL) - xmlFree(*buf); + xmlFree(*buf); *buf = NULL; do { /* * Use the whitespace type of the base type. - */ + */ ws = xmlSchemaGetWhiteSpaceFacetValue(type->baseType); for (facet = type->facets; facet != NULL; facet = facet->next) { if (facet->type != XML_SCHEMA_FACET_ENUMERATION) @@ -1881,7 +1881,7 @@ xmlSchemaPErrMemory(xmlSchemaParserCtxtPtr ctxt, * @msg: the error message * @str1: extra data * @str2: extra data - * + * * Handle a parser error */ static void @@ -1914,7 +1914,7 @@ xmlSchemaPErr(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node, int error, * @msg: the error message * @str1: extra data * @str2: extra data - * + * * Handle a parser error */ static void @@ -1933,7 +1933,7 @@ xmlSchemaPErr2(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node, * xmlSchemaPErrExt: * @ctxt: the parsing context * @node: the context node - * @error: the error code + * @error: the error code * @strData1: extra data * @strData2: extra data * @strData3: extra data @@ -1943,13 +1943,13 @@ xmlSchemaPErr2(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node, * @str3: extra parameter for the message display * @str4: extra parameter for the message display * @str5: extra parameter for the message display - * + * * Handle a parser error */ static void xmlSchemaPErrExt(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node, int error, - const xmlChar * strData1, const xmlChar * strData2, - const xmlChar * strData3, const char *msg, const xmlChar * str1, + const xmlChar * strData1, const xmlChar * strData2, + const xmlChar * strData3, const char *msg, const xmlChar * str1, const xmlChar * str2, const xmlChar * str3, const xmlChar * str4, const xmlChar * str5) { @@ -1967,8 +1967,8 @@ xmlSchemaPErrExt(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node, int error, } __xmlRaiseError(schannel, channel, data, ctxt, node, XML_FROM_SCHEMASP, error, XML_ERR_ERROR, NULL, 0, - (const char *) strData1, (const char *) strData2, - (const char *) strData3, 0, 0, msg, str1, str2, + (const char *) strData1, (const char *) strData2, + (const char *) strData3, 0, 0, msg, str1, str2, str3, str4, str5); } @@ -2016,7 +2016,7 @@ xmlSchemaPSimpleInternalErr(xmlNodePtr node, * @str1: extra data * @str2: extra data * @str3: extra data - * + * * Handle a validation error */ static void @@ -2028,8 +2028,8 @@ xmlSchemaErr4Line(xmlSchemaAbstractCtxtPtr ctxt, { xmlStructuredErrorFunc schannel = NULL; xmlGenericErrorFunc channel = NULL; - void *data = NULL; - + void *data = NULL; + if (ctxt != NULL) { if (ctxt->type == XML_SCHEMA_CTXT_VALIDATOR) { xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) ctxt; @@ -2037,7 +2037,7 @@ xmlSchemaErr4Line(xmlSchemaAbstractCtxtPtr ctxt, if (errorLevel != XML_ERR_WARNING) { vctxt->nberrors++; vctxt->err = error; - channel = vctxt->error; + channel = vctxt->error; } else { channel = vctxt->warning; } @@ -2077,7 +2077,7 @@ xmlSchemaErr4Line(xmlSchemaAbstractCtxtPtr ctxt, else if ((vctxt->parserCtxt != NULL) && (vctxt->parserCtxt->input != NULL)) file = vctxt->parserCtxt->input->filename; - } + } __xmlRaiseError(schannel, channel, data, ctxt, node, XML_FROM_SCHEMASV, error, errorLevel, file, line, @@ -2089,7 +2089,7 @@ xmlSchemaErr4Line(xmlSchemaAbstractCtxtPtr ctxt, if (errorLevel != XML_ERR_WARNING) { pctxt->nberrors++; pctxt->err = error; - channel = pctxt->error; + channel = pctxt->error; } else { channel = pctxt->warning; } @@ -2115,11 +2115,11 @@ xmlSchemaErr4Line(xmlSchemaAbstractCtxtPtr ctxt, * @str1: extra data * @str2: extra data * @str3: extra data - * + * * Handle a validation error */ static void -xmlSchemaErr3(xmlSchemaAbstractCtxtPtr actxt, +xmlSchemaErr3(xmlSchemaAbstractCtxtPtr actxt, int error, xmlNodePtr node, const char *msg, const xmlChar *str1, const xmlChar *str2, const xmlChar *str3) { @@ -2128,7 +2128,7 @@ xmlSchemaErr3(xmlSchemaAbstractCtxtPtr actxt, } static void -xmlSchemaErr4(xmlSchemaAbstractCtxtPtr actxt, +xmlSchemaErr4(xmlSchemaAbstractCtxtPtr actxt, int error, xmlNodePtr node, const char *msg, const xmlChar *str1, const xmlChar *str2, const xmlChar *str3, const xmlChar *str4) @@ -2157,7 +2157,7 @@ xmlSchemaFormatNodeForError(xmlChar ** msg, (node->type != XML_ELEMENT_NODE) && (node->type != XML_ATTRIBUTE_NODE)) { - /* + /* * Don't try to format other nodes than element and * attribute nodes. * Play save and return an empty string. @@ -2171,7 +2171,7 @@ xmlSchemaFormatNodeForError(xmlChar ** msg, */ if (node->type == XML_ATTRIBUTE_NODE) { xmlNodePtr elem = node->parent; - + *msg = xmlStrdup(BAD_CAST "Element '"); if (elem->ns != NULL) *msg = xmlStrcat(*msg, xmlSchemaFormatQName(&str, @@ -2181,7 +2181,7 @@ xmlSchemaFormatNodeForError(xmlChar ** msg, NULL, elem->name)); FREE_AND_NULL(str); *msg = xmlStrcat(*msg, BAD_CAST "', "); - *msg = xmlStrcat(*msg, BAD_CAST "attribute '"); + *msg = xmlStrcat(*msg, BAD_CAST "attribute '"); } else { *msg = xmlStrdup(BAD_CAST "Element '"); } @@ -2197,7 +2197,7 @@ xmlSchemaFormatNodeForError(xmlChar ** msg, xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) actxt; /* * Work on node infos. - */ + */ if (vctxt->inode->nodeType == XML_ATTRIBUTE_NODE) { xmlSchemaNodeInfoPtr ielem = vctxt->elemInfos[vctxt->depth]; @@ -2207,7 +2207,7 @@ xmlSchemaFormatNodeForError(xmlChar ** msg, ielem->nsName, ielem->localName)); FREE_AND_NULL(str); *msg = xmlStrcat(*msg, BAD_CAST "', "); - *msg = xmlStrcat(*msg, BAD_CAST "attribute '"); + *msg = xmlStrcat(*msg, BAD_CAST "attribute '"); } else { *msg = xmlStrdup(BAD_CAST "Element '"); } @@ -2216,7 +2216,7 @@ xmlSchemaFormatNodeForError(xmlChar ** msg, FREE_AND_NULL(str); *msg = xmlStrcat(*msg, BAD_CAST "': "); } else if (actxt->type == XML_SCHEMA_CTXT_PARSER) { - /* + /* * Hmm, no node while parsing? * Return an empty string, in case NULL will break something. */ @@ -2254,7 +2254,7 @@ xmlSchemaInternalErr2(xmlSchemaAbstractCtxtPtr actxt, return; msg = xmlStrdup(BAD_CAST "Internal error: "); msg = xmlStrcat(msg, BAD_CAST funcName); - msg = xmlStrcat(msg, BAD_CAST ", "); + msg = xmlStrcat(msg, BAD_CAST ", "); msg = xmlStrcat(msg, BAD_CAST message); msg = xmlStrcat(msg, BAD_CAST ".\n"); @@ -2262,7 +2262,7 @@ xmlSchemaInternalErr2(xmlSchemaAbstractCtxtPtr actxt, xmlSchemaErr(actxt, XML_SCHEMAV_INTERNAL, NULL, (const char *) msg, str1, str2); - else if (actxt->type == XML_SCHEMA_CTXT_PARSER) + else if (actxt->type == XML_SCHEMA_CTXT_PARSER) xmlSchemaErr(actxt, XML_SCHEMAP_INTERNAL, NULL, (const char *) msg, str1, str2); @@ -2309,7 +2309,7 @@ xmlSchemaCustomErr4(xmlSchemaAbstractCtxtPtr actxt, } else xmlSchemaFormatNodeForError(&msg, actxt, node); msg = xmlStrcat(msg, (const xmlChar *) message); - msg = xmlStrcat(msg, BAD_CAST ".\n"); + msg = xmlStrcat(msg, BAD_CAST ".\n"); xmlSchemaErr4(actxt, error, node, (const char *) msg, str1, str2, str3, str4); FREE_AND_NULL(msg) @@ -2325,7 +2325,7 @@ xmlSchemaCustomErr(xmlSchemaAbstractCtxtPtr actxt, const xmlChar *str2) { xmlSchemaCustomErr4(actxt, error, node, item, - message, str1, str2, NULL, NULL); + message, str1, str2, NULL, NULL); } @@ -2344,8 +2344,8 @@ xmlSchemaCustomWarning(xmlSchemaAbstractCtxtPtr actxt, xmlSchemaFormatNodeForError(&msg, actxt, node); msg = xmlStrcat(msg, (const xmlChar *) message); - msg = xmlStrcat(msg, BAD_CAST ".\n"); - + msg = xmlStrcat(msg, BAD_CAST ".\n"); + /* URGENT TODO: Set the error code to something sane. */ xmlSchemaErr4Line(actxt, XML_ERR_WARNING, error, node, 0, (const char *) msg, str1, str2, str3, NULL); @@ -2365,15 +2365,15 @@ xmlSchemaKeyrefErr(xmlSchemaValidCtxtPtr vctxt, const xmlChar *str2) { xmlChar *msg = NULL, *qname = NULL; - - msg = xmlStrdup(BAD_CAST "Element '%s': "); + + msg = xmlStrdup(BAD_CAST "Element '%s': "); msg = xmlStrcat(msg, (const xmlChar *) message); msg = xmlStrcat(msg, BAD_CAST ".\n"); xmlSchemaErr4Line(ACTXT_CAST vctxt, XML_ERR_ERROR, error, NULL, idcNode->nodeLine, (const char *) msg, xmlSchemaFormatQName(&qname, vctxt->nodeQNames->items[idcNode->nodeQNameID +1], - vctxt->nodeQNames->items[idcNode->nodeQNameID]), + vctxt->nodeQNames->items[idcNode->nodeQNameID]), str1, str2, NULL); FREE_AND_NULL(qname); FREE_AND_NULL(msg); @@ -2456,7 +2456,7 @@ xmlSchemaSimpleTypeErr(xmlSchemaAbstractCtxtPtr actxt, if (type->builtInType != 0) { msg = xmlStrcat(msg, BAD_CAST "xs:"); msg = xmlStrcat(msg, type->name); - } else + } else msg = xmlStrcat(msg, xmlSchemaFormatQName(&str, type->targetNamespace, type->name)); @@ -2494,12 +2494,12 @@ xmlSchemaIllegalAttrErr(xmlSchemaAbstractCtxtPtr actxt, xmlNodePtr node) { xmlChar *msg = NULL, *str = NULL; - + xmlSchemaFormatNodeForError(&msg, actxt, node); msg = xmlStrcat(msg, BAD_CAST "The attribute '%s' is not allowed.\n"); xmlSchemaErr(actxt, error, node, (const char *) msg, xmlSchemaFormatErrorNodeQName(&str, (xmlSchemaNodeInfoPtr) ni, node), - NULL); + NULL); FREE_AND_NULL(str) FREE_AND_NULL(msg) } @@ -2518,7 +2518,7 @@ xmlSchemaComplexTypeErr(xmlSchemaAbstractCtxtPtr actxt, xmlChar *localName, *nsName; const xmlChar *cur, *end; int i; - + xmlSchemaFormatNodeForError(&msg, actxt, node); msg = xmlStrcat(msg, (const xmlChar *) message); msg = xmlStrcat(msg, BAD_CAST "."); @@ -2533,7 +2533,7 @@ xmlSchemaComplexTypeErr(xmlSchemaAbstractCtxtPtr actxt, } else str = xmlStrdup(BAD_CAST " Expected is ( "); nsName = NULL; - + for (i = 0; i < nbval + nbneg; i++) { cur = values[i]; if (cur == NULL) @@ -2547,7 +2547,7 @@ xmlSchemaComplexTypeErr(xmlSchemaAbstractCtxtPtr actxt, * Get the local name. */ localName = NULL; - + end = cur; if (*end == '*') { localName = xmlStrdup(BAD_CAST "*"); @@ -2556,8 +2556,8 @@ xmlSchemaComplexTypeErr(xmlSchemaAbstractCtxtPtr actxt, while ((*end != 0) && (*end != '|')) end++; localName = xmlStrncat(localName, BAD_CAST cur, end - cur); - } - if (*end != 0) { + } + if (*end != 0) { end++; /* * Skip "*|*" if they come with negated expressions, since @@ -2573,12 +2573,12 @@ xmlSchemaComplexTypeErr(xmlSchemaAbstractCtxtPtr actxt, } else { while (*end != 0) end++; - + if (i >= nbval) nsName = xmlStrdup(BAD_CAST "{##other:"); else nsName = xmlStrdup(BAD_CAST "{"); - + nsName = xmlStrncat(nsName, BAD_CAST cur, end - cur); nsName = xmlStrcat(nsName, BAD_CAST "}"); } @@ -2588,13 +2588,13 @@ xmlSchemaComplexTypeErr(xmlSchemaAbstractCtxtPtr actxt, FREE_AND_NULL(localName); continue; } - } + } str = xmlStrcat(str, BAD_CAST localName); FREE_AND_NULL(localName); - + if (i < nbval + nbneg -1) str = xmlStrcat(str, BAD_CAST ", "); - } + } str = xmlStrcat(str, BAD_CAST " ).\n"); msg = xmlStrcat(msg, BAD_CAST str); FREE_AND_NULL(str) @@ -2626,8 +2626,8 @@ xmlSchemaFacetErr(xmlSchemaAbstractCtxtPtr actxt, /* * If enumerations are validated, one must not expect the * facet to be given. - */ - } else + */ + } else facetType = facet->type; msg = xmlStrcat(msg, BAD_CAST "["); msg = xmlStrcat(msg, BAD_CAST "facet '"); @@ -2655,31 +2655,31 @@ xmlSchemaFacetErr(xmlSchemaAbstractCtxtPtr actxt, snprintf(actLen, 24, "%lu", length); if (facetType == XML_SCHEMA_FACET_LENGTH) - msg = xmlStrcat(msg, - BAD_CAST "this differs from the allowed length of '%s'.\n"); + msg = xmlStrcat(msg, + BAD_CAST "this differs from the allowed length of '%s'.\n"); else if (facetType == XML_SCHEMA_FACET_MAXLENGTH) - msg = xmlStrcat(msg, + msg = xmlStrcat(msg, BAD_CAST "this exceeds the allowed maximum length of '%s'.\n"); else if (facetType == XML_SCHEMA_FACET_MINLENGTH) - msg = xmlStrcat(msg, + msg = xmlStrcat(msg, BAD_CAST "this underruns the allowed minimum length of '%s'.\n"); - + if (nodeType == XML_ATTRIBUTE_NODE) xmlSchemaErr3(actxt, error, node, (const char *) msg, value, (const xmlChar *) actLen, (const xmlChar *) len); - else + else xmlSchemaErr(actxt, error, node, (const char *) msg, (const xmlChar *) actLen, (const xmlChar *) len); - + } else if (facetType == XML_SCHEMA_FACET_ENUMERATION) { msg = xmlStrcat(msg, BAD_CAST "The value '%s' is not an element " "of the set {%s}.\n"); - xmlSchemaErr(actxt, error, node, (const char *) msg, value, + xmlSchemaErr(actxt, error, node, (const char *) msg, value, xmlSchemaFormatFacetEnumSet(actxt, &str, type)); } else if (facetType == XML_SCHEMA_FACET_PATTERN) { msg = xmlStrcat(msg, BAD_CAST "The value '%s' is not accepted " "by the pattern '%s'.\n"); - xmlSchemaErr(actxt, error, node, (const char *) msg, value, + xmlSchemaErr(actxt, error, node, (const char *) msg, value, facet->value); } else if (facetType == XML_SCHEMA_FACET_MININCLUSIVE) { msg = xmlStrcat(msg, BAD_CAST "The value '%s' is less than the " @@ -2711,10 +2711,10 @@ xmlSchemaFacetErr(xmlSchemaAbstractCtxtPtr actxt, "digits than are allowed ('%s').\n"); xmlSchemaErr(actxt, error, node, (const char*) msg, value, facet->value); - } else if (nodeType == XML_ATTRIBUTE_NODE) { + } else if (nodeType == XML_ATTRIBUTE_NODE) { msg = xmlStrcat(msg, BAD_CAST "The value '%s' is not facet-valid.\n"); - xmlSchemaErr(actxt, error, node, (const char *) msg, value, NULL); - } else { + xmlSchemaErr(actxt, error, node, (const char *) msg, value, NULL); + } else { msg = xmlStrcat(msg, BAD_CAST "The value is not facet-valid.\n"); xmlSchemaErr(actxt, error, node, (const char *) msg, NULL, NULL); } @@ -2722,7 +2722,7 @@ xmlSchemaFacetErr(xmlSchemaAbstractCtxtPtr actxt, msg = xmlStrcat(msg, (const xmlChar *) message); msg = xmlStrcat(msg, BAD_CAST ".\n"); xmlSchemaErr(actxt, error, node, (const char *) msg, str1, str2); - } + } FREE_AND_NULL(str) xmlFree(msg); } @@ -2967,9 +2967,9 @@ xmlSchemaPAttrUseErr4(xmlSchemaParserCtxtPtr ctxt, const xmlChar *str3,const xmlChar *str4) { xmlChar *str = NULL, *msg = NULL; - + xmlSchemaFormatItemForReport(&msg, NULL, ownerItem, NULL); - msg = xmlStrcat(msg, BAD_CAST ", "); + msg = xmlStrcat(msg, BAD_CAST ", "); msg = xmlStrcat(msg, BAD_CAST xmlSchemaFormatItemForReport(&str, NULL, WXS_BASIC_CAST attruse, NULL)); @@ -2977,7 +2977,7 @@ xmlSchemaPAttrUseErr4(xmlSchemaParserCtxtPtr ctxt, msg = xmlStrcat(msg, BAD_CAST ": "); msg = xmlStrcat(msg, (const xmlChar *) message); msg = xmlStrcat(msg, BAD_CAST ".\n"); - xmlSchemaErr4(ACTXT_CAST ctxt, error, node, + xmlSchemaErr4(ACTXT_CAST ctxt, error, node, (const char *) msg, str1, str2, str3, str4); xmlFree(msg); } @@ -3071,7 +3071,7 @@ xmlSchemaPMutualExclAttrErr(xmlSchemaParserCtxtPtr ctxt, * @error: the error code * @type: the type specifier * @ownerDes: the designation of the owner - * @ownerItem: the schema object if existent + * @ownerItem: the schema object if existent * @node: the validated node * @value: the validated value * @@ -3079,7 +3079,7 @@ xmlSchemaPMutualExclAttrErr(xmlSchemaParserCtxtPtr ctxt, * TODO: Should this report the value of an element as well? */ static void -xmlSchemaPSimpleTypeErr(xmlSchemaParserCtxtPtr ctxt, +xmlSchemaPSimpleTypeErr(xmlSchemaParserCtxtPtr ctxt, xmlParserErrors error, xmlSchemaBasicItemPtr ownerItem ATTRIBUTE_UNUSED, xmlNodePtr node, @@ -3091,37 +3091,37 @@ xmlSchemaPSimpleTypeErr(xmlSchemaParserCtxtPtr ctxt, const xmlChar *str2) { xmlChar *msg = NULL; - + xmlSchemaFormatNodeForError(&msg, ACTXT_CAST ctxt, node); if (message == NULL) { /* * Use default messages. - */ + */ if (type != NULL) { if (node->type == XML_ATTRIBUTE_NODE) msg = xmlStrcat(msg, BAD_CAST "'%s' is not a valid value of "); else msg = xmlStrcat(msg, BAD_CAST "The character content is not a " - "valid value of "); + "valid value of "); if (! xmlSchemaIsGlobalItem(type)) msg = xmlStrcat(msg, BAD_CAST "the local "); else msg = xmlStrcat(msg, BAD_CAST "the "); - + if (WXS_IS_ATOMIC(type)) msg = xmlStrcat(msg, BAD_CAST "atomic type"); else if (WXS_IS_LIST(type)) msg = xmlStrcat(msg, BAD_CAST "list type"); else if (WXS_IS_UNION(type)) msg = xmlStrcat(msg, BAD_CAST "union type"); - + if (xmlSchemaIsGlobalItem(type)) { xmlChar *str = NULL; msg = xmlStrcat(msg, BAD_CAST " '"); if (type->builtInType != 0) { msg = xmlStrcat(msg, BAD_CAST "xs:"); msg = xmlStrcat(msg, type->name); - } else + } else msg = xmlStrcat(msg, xmlSchemaFormatQName(&str, type->targetNamespace, type->name)); @@ -3134,7 +3134,7 @@ xmlSchemaPSimpleTypeErr(xmlSchemaParserCtxtPtr ctxt, else msg = xmlStrcat(msg, BAD_CAST "The character content is not " "valid."); - } + } if (expected) { msg = xmlStrcat(msg, BAD_CAST " Expected is '"); msg = xmlStrcat(msg, BAD_CAST expected); @@ -3151,7 +3151,7 @@ xmlSchemaPSimpleTypeErr(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPErrExt(ctxt, node, error, NULL, NULL, NULL, (const char*) msg, str1, str2, NULL, NULL, NULL); } - /* Cleanup. */ + /* Cleanup. */ FREE_AND_NULL(msg) } @@ -3372,7 +3372,7 @@ xmlSchemaItemListAddSize(xmlSchemaItemListPtr list, static int xmlSchemaItemListInsert(xmlSchemaItemListPtr list, void *item, int idx) -{ +{ if (list->items == NULL) { list->items = (void **) xmlMalloc( 20 * sizeof(void *)); @@ -3412,7 +3412,7 @@ xmlSchemaItemListInsertSize(xmlSchemaItemListPtr list, int initialSize, void *item, int idx) -{ +{ if (list->items == NULL) { if (initialSize <= 0) initialSize = 1; @@ -3467,7 +3467,7 @@ xmlSchemaItemListRemove(xmlSchemaItemListPtr list, int idx) list->sizeItems = 0; } else if (list->nbItems -1 == idx) { list->nbItems--; - } else { + } else { for (i = idx; i < list->nbItems -1; i++) list->items[i] = list->items[i+1]; list->nbItems--; @@ -3502,19 +3502,19 @@ xmlSchemaBucketFree(xmlSchemaBucketPtr bucket) } if (bucket->locals != NULL) { xmlSchemaComponentListFree(bucket->locals); - xmlSchemaItemListFree(bucket->locals); + xmlSchemaItemListFree(bucket->locals); } if (bucket->relations != NULL) { xmlSchemaSchemaRelationPtr prev, cur = bucket->relations; do { - prev = cur; + prev = cur; cur = cur->next; xmlFree(prev); } while (cur != NULL); } if ((! bucket->preserveDoc) && (bucket->doc != NULL)) { xmlFreeDoc(bucket->doc); - } + } if (bucket->type == XML_SCHEMA_SCHEMA_IMPORT) { if (WXS_IMPBUCKET(bucket)->schema != NULL) xmlSchemaFree(WXS_IMPBUCKET(bucket)->schema); @@ -3559,7 +3559,7 @@ xmlSchemaBucketCreate(xmlSchemaParserCtxtPtr pctxt, xmlFree(ret); return(NULL); } - /* + /* * The following will assure that only the first bucket is marked as * XML_SCHEMA_SCHEMA_MAIN and it points to the *main* schema. * For each following import buckets an xmlSchema will be created. @@ -3573,7 +3573,7 @@ xmlSchemaBucketCreate(xmlSchemaParserCtxtPtr pctxt, xmlSchemaBucketFree(ret); return(NULL); } - /* Force the type to be XML_SCHEMA_SCHEMA_MAIN. */ + /* Force the type to be XML_SCHEMA_SCHEMA_MAIN. */ ret->type = XML_SCHEMA_SCHEMA_MAIN; /* Point to the *main* schema. */ WXS_CONSTRUCTOR(pctxt)->mainBucket = ret; @@ -3583,12 +3583,12 @@ xmlSchemaBucketCreate(xmlSchemaParserCtxtPtr pctxt, */ mainSchema->targetNamespace = targetNamespace; } else { - if (type == XML_SCHEMA_SCHEMA_MAIN) { + if (type == XML_SCHEMA_SCHEMA_MAIN) { PERROR_INT("xmlSchemaBucketCreate", "main bucket but it's not the first one"); xmlSchemaBucketFree(ret); return(NULL); - } else if (type == XML_SCHEMA_SCHEMA_IMPORT) { + } else if (type == XML_SCHEMA_SCHEMA_IMPORT) { /* * Create a schema for imports and assign the * targetNamespace. @@ -3600,7 +3600,7 @@ xmlSchemaBucketCreate(xmlSchemaParserCtxtPtr pctxt, } WXS_IMPBUCKET(ret)->schema->targetNamespace = targetNamespace; } - } + } if (WXS_IS_BUCKET_IMPMAIN(type)) { int res; /* @@ -3643,11 +3643,11 @@ xmlSchemaBucketCreate(xmlSchemaParserCtxtPtr pctxt, if (mainSchema->includes == NULL) { xmlSchemaBucketFree(ret); return(NULL); - } + } } xmlSchemaItemListAdd(mainSchema->includes, ret); } - /* + /* * Add to list of all buckets; this is used for lookup * during schema construction time only. */ @@ -4015,7 +4015,7 @@ xmlSchemaComponentListFree(xmlSchemaItemListPtr list) for (i = 0; i < list->nbItems; i++) { item = items[i]; if (item == NULL) - continue; + continue; switch (item->type) { case XML_SCHEMA_TYPE_SIMPLE: case XML_SCHEMA_TYPE_COMPLEX: @@ -4122,7 +4122,7 @@ xmlSchemaFree(xmlSchemaPtr schema) xmlSchemaItemListPtr list = (xmlSchemaItemListPtr) schema->includes; int i; for (i = 0; i < list->nbItems; i++) { - xmlSchemaBucketFree((xmlSchemaBucketPtr) list->items[i]); + xmlSchemaBucketFree((xmlSchemaBucketPtr) list->items[i]); } xmlSchemaItemListFree(list); } @@ -4330,7 +4330,7 @@ xmlSchemaContentModelDump(xmlSchemaParticlePtr particle, FILE * output, int dept /** * xmlSchemaAttrUsesDump: * @uses: attribute uses list - * @output: the file output + * @output: the file output * * Dumps a list of attribute use components. */ @@ -4347,7 +4347,7 @@ xmlSchemaAttrUsesDump(xmlSchemaItemListPtr uses, FILE * output) if ((uses == NULL) || (uses->nbItems == 0)) return; - fprintf(output, " attributes:\n"); + fprintf(output, " attributes:\n"); for (i = 0; i < uses->nbItems; i++) { use = uses->items[i]; if (use->type == XML_SCHEMA_EXTRA_ATTR_USE_PROHIB) { @@ -4533,7 +4533,7 @@ xmlSchemaDebugDumpIDCTable(FILE * output, return; do { fprintf(output, "IDC: BINDING '%s' (%d)\n", - xmlSchemaGetComponentQName(&str, + xmlSchemaGetComponentQName(&str, bind->definition), bind->nbNodes); FREE_AND_NULL(str) for (i = 0; i < bind->nbNodes; i++) { @@ -4634,7 +4634,7 @@ xmlSchemaGetPropNodeNs(xmlNodePtr node, const char *uri, const char *name) xmlAttrPtr prop; if ((node == NULL) || (name == NULL)) - return(NULL); + return(NULL); prop = node->properties; while (prop != NULL) { if ((prop->ns != NULL) && @@ -4729,12 +4729,12 @@ xmlSchemaGetElem(xmlSchemaPtr schema, const xmlChar * name, const xmlChar * nsName) { xmlSchemaElementPtr ret = NULL; - + if ((name == NULL) || (schema == NULL)) return(NULL); if (schema != NULL) { WXS_FIND_GLOBAL_ITEM(elemDecl) - } + } exit: #ifdef DEBUG if (ret == NULL) { @@ -4765,9 +4765,9 @@ xmlSchemaGetType(xmlSchemaPtr schema, const xmlChar * name, xmlSchemaTypePtr ret = NULL; if (name == NULL) - return (NULL); + return (NULL); /* First try the built-in types. */ - if ((nsName != NULL) && xmlStrEqual(nsName, xmlSchemaNs)) { + if ((nsName != NULL) && xmlStrEqual(nsName, xmlSchemaNs)) { ret = xmlSchemaGetPredefinedType(name, nsName); if (ret != NULL) goto exit; @@ -4780,7 +4780,7 @@ xmlSchemaGetType(xmlSchemaPtr schema, const xmlChar * name, } if (schema != NULL) { WXS_FIND_GLOBAL_ITEM(typeDecl) - } + } exit: #ifdef DEBUG @@ -4891,7 +4891,7 @@ xmlSchemaGetGroup(xmlSchemaPtr schema, const xmlChar * name, WXS_FIND_GLOBAL_ITEM(groupDecl) } exit: - + #ifdef DEBUG if (ret == NULL) { if (nsName == NULL) @@ -5000,7 +5000,7 @@ xmlSchemaIsBlank(xmlChar * str, int len) str++; len--; } - + return (1); } @@ -5061,7 +5061,7 @@ xmlSchemaFindRedefCompInGraph(xmlSchemaBucketPtr bucket, default: /* Should not be hit. */ return(NULL); - } + } } } subschemas: @@ -5209,7 +5209,7 @@ xmlSchemaAddAttributeUse(xmlSchemaParserCtxtPtr pctxt, * resolve references to the redefined components and to check constraints. */ static xmlSchemaRedefPtr -xmlSchemaAddRedef(xmlSchemaParserCtxtPtr pctxt, +xmlSchemaAddRedef(xmlSchemaParserCtxtPtr pctxt, xmlSchemaBucketPtr targetBucket, void *item, const xmlChar *refName, @@ -5272,7 +5272,7 @@ xmlSchemaAddAttributeGroupDefinition(xmlSchemaParserCtxtPtr pctxt, ret->type = XML_SCHEMA_TYPE_ATTRIBUTEGROUP; ret->name = name; ret->targetNamespace = nsName; - ret->node = node; + ret->node = node; /* TODO: Remove the flag. */ ret->flags |= XML_SCHEMAS_ATTRGROUP_GLOBAL; @@ -5282,7 +5282,7 @@ xmlSchemaAddAttributeGroupDefinition(xmlSchemaParserCtxtPtr pctxt, if (pctxt->redef == NULL) { xmlFree(ret); return(NULL); - } + } pctxt->redefCounter = 0; } WXS_ADD_GLOBAL(pctxt, ret); @@ -5371,13 +5371,13 @@ xmlSchemaAddType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, if (ctxt->redef == NULL) { xmlFree(ret); return(NULL); - } + } ctxt->redefCounter = 0; } WXS_ADD_GLOBAL(ctxt, ret); } else WXS_ADD_LOCAL(ctxt, ret); - WXS_ADD_PENDING(ctxt, ret); + WXS_ADD_PENDING(ctxt, ret); return (ret); } @@ -5509,7 +5509,7 @@ xmlSchemaAddParticle(xmlSchemaParserCtxtPtr ctxt, ret->children = NULL; WXS_ADD_LOCAL(ctxt, ret); - /* + /* * Note that addition to pending components will be done locally * to the specific parsing function, since the most particles * need not to be fixed up (i.e. the reference to be resolved). @@ -5558,7 +5558,7 @@ xmlSchemaAddModelGroupDefinition(xmlSchemaParserCtxtPtr ctxt, if (ctxt->redef == NULL) { xmlFree(ret); return(NULL); - } + } ctxt->redefCounter = 0; } WXS_ADD_GLOBAL(ctxt, ret); @@ -5595,7 +5595,7 @@ xmlSchemaAddIDC(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, const xmlChar *name, const xmlChar *nsName, int category, xmlNodePtr node) { - xmlSchemaIDCPtr ret = NULL; + xmlSchemaIDCPtr ret = NULL; if ((ctxt == NULL) || (schema == NULL) || (name == NULL)) return (NULL); @@ -5611,8 +5611,8 @@ xmlSchemaAddIDC(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, ret->targetNamespace = nsName; ret->name = name; ret->type = category; - ret->node = node; - + ret->node = node; + WXS_ADD_GLOBAL(ctxt, ret); /* * Only keyrefs need to be fixup up. @@ -5648,7 +5648,7 @@ xmlSchemaAddWildcard(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, } memset(ret, 0, sizeof(xmlSchemaWildcard)); ret->type = type; - ret->node = node; + ret->node = node; WXS_ADD_LOCAL(ctxt, ret); return (ret); } @@ -5704,7 +5704,7 @@ xmlSchemaSubstGroupAdd(xmlSchemaParserCtxtPtr pctxt, static xmlSchemaSubstGroupPtr xmlSchemaSubstGroupGet(xmlSchemaParserCtxtPtr pctxt, xmlSchemaElementPtr head) -{ +{ if (WXS_SUBST_GROUPS(pctxt) == NULL) return(NULL); return(xmlHashLookup2(WXS_SUBST_GROUPS(pctxt), @@ -6120,7 +6120,7 @@ xmlSchemaPGetBoolNodeValue(xmlSchemaParserCtxtPtr ctxt, value = xmlNodeGetContent(node); /* * 3.2.2.1 Lexical representation - * An instance of a datatype that is defined as ·boolean· + * An instance of a datatype that is defined as �boolean� * can have the following legal literals {true, false, 1, 0}. */ if (xmlStrEqual(BAD_CAST value, BAD_CAST "true")) @@ -6168,7 +6168,7 @@ xmlGetBooleanProp(xmlSchemaParserCtxtPtr ctxt, return (def); /* * 3.2.2.1 Lexical representation - * An instance of a datatype that is defined as ·boolean· + * An instance of a datatype that is defined as �boolean� * can have the following legal literals {true, false, 1, 0}. */ if (xmlStrEqual(val, BAD_CAST "true")) @@ -6288,7 +6288,7 @@ xmlSchemaPValAttrNodeValue(xmlSchemaParserCtxtPtr pctxt, ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_2; else ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1; - xmlSchemaPSimpleTypeErr(pctxt, + xmlSchemaPSimpleTypeErr(pctxt, ret, ownerItem, (xmlNodePtr) attr, type, NULL, value, NULL, NULL, NULL); } @@ -6352,7 +6352,7 @@ xmlSchemaPValAttrNode(xmlSchemaParserCtxtPtr ctxt, * number otherwise and -1 in case of an internal or API error. */ static int -xmlSchemaPValAttr(xmlSchemaParserCtxtPtr ctxt, +xmlSchemaPValAttr(xmlSchemaParserCtxtPtr ctxt, xmlSchemaBasicItemPtr ownerItem, xmlNodePtr ownerElem, const char *name, @@ -6442,7 +6442,7 @@ xmlSchemaCheckReference(xmlSchemaParserCtxtPtr pctxt, * @type: the hosting type where the attributes will be anchored * * Parses attribute uses and attribute declarations and - * attribute group references. + * attribute group references. */ static int xmlSchemaParseLocalAttributes(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, @@ -7085,7 +7085,7 @@ xmlSchemaParseLocalAttribute(xmlSchemaParserCtxtPtr pctxt, int parentType) { const xmlChar *attrValue, *name = NULL, *ns = NULL; - xmlSchemaAttributeUsePtr use = NULL; + xmlSchemaAttributeUsePtr use = NULL; xmlNodePtr child = NULL; xmlAttrPtr attr; const xmlChar *tmpNs = NULL, *tmpName = NULL, *defValue = NULL; @@ -7139,7 +7139,7 @@ xmlSchemaParseLocalAttribute(xmlSchemaParserCtxtPtr pctxt, /* * Evaluate the target namespace */ - hasForm = 1; + hasForm = 1; attrValue = xmlSchemaGetNodeContent(pctxt, (xmlNodePtr) attr); if (xmlStrEqual(attrValue, BAD_CAST "qualified")) { @@ -7210,7 +7210,7 @@ xmlSchemaParseLocalAttribute(xmlSchemaParserCtxtPtr pctxt, attr_next: attr = attr->next; - } + } /* * 3.2.3 : 2 * If default and use are both present, use must have @@ -7236,7 +7236,7 @@ attr_next: /* TODO: move XML_SCHEMAS_QUALIF_ATTR to the parser. */ if ((! hasForm) && (schema->flags & XML_SCHEMAS_QUALIF_ATTR)) - ns = pctxt->targetNamespace; + ns = pctxt->targetNamespace; /* * 3.2.6 Schema Component Constraint: xsi: Not Allowed * TODO: Move this to the component layer. @@ -7293,7 +7293,7 @@ attr_next: use->attrDecl = attrDecl; /* * Value constraint. - */ + */ if (defValue != NULL) { attrDecl->defValue = defValue; if (defValueType == WXS_ATTR_DEF_VAL_FIXED) @@ -7333,14 +7333,14 @@ attr_next: if (defValueType == WXS_ATTR_DEF_VAL_FIXED) use->flags |= XML_SCHEMA_ATTR_USE_FIXED; } - + check_children: /* * And now for the children... */ child = node->children; if (occurs == XML_SCHEMAS_ATTR_USE_PROHIBITED) { - xmlSchemaAttributeUseProhibPtr prohib; + xmlSchemaAttributeUseProhibPtr prohib; if (IS_SCHEMA(child, "annotation")) { xmlSchemaParseAnnotation(pctxt, child, 0); @@ -7355,7 +7355,7 @@ check_children: /* * Check for pointlessness of attribute prohibitions. */ - if (parentType == XML_SCHEMA_TYPE_ATTRIBUTEGROUP) { + if (parentType == XML_SCHEMA_TYPE_ATTRIBUTEGROUP) { xmlSchemaCustomWarning(ACTXT_CAST pctxt, XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH, node, NULL, @@ -7373,7 +7373,7 @@ check_children: return(NULL); } if (! isRef) { - tmpName = name; + tmpName = name; tmpNs = ns; } /* @@ -7381,7 +7381,7 @@ check_children: */ if (uses) { int i; - + for (i = 0; i < uses->nbItems; i++) { use = uses->items[i]; if ((use->type == XML_SCHEMA_EXTRA_ATTR_USE_PROHIB) && @@ -7389,16 +7389,16 @@ check_children: (tmpNs == (WXS_ATTR_PROHIB_CAST use)->targetNamespace)) { xmlChar *str = NULL; - + xmlSchemaCustomWarning(ACTXT_CAST pctxt, XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH, node, NULL, "Skipping duplicate attribute use prohibition '%s'", xmlSchemaFormatQName(&str, tmpNs, tmpName), NULL, NULL); - FREE_AND_NULL(str) + FREE_AND_NULL(str) return(NULL); - } + } } } /* @@ -7417,7 +7417,7 @@ check_children: WXS_ADD_PENDING(pctxt, prohib); } return(WXS_BASIC_CAST prohib); - } else { + } else { if (IS_SCHEMA(child, "annotation")) { /* * TODO: Should this go into the attr decl? @@ -7464,7 +7464,7 @@ check_children: NULL, node, child, NULL, "(annotation?, simpleType?)"); } - } + } return (WXS_BASIC_CAST use); } @@ -7486,7 +7486,7 @@ xmlSchemaParseGlobalAttribute(xmlSchemaParserCtxtPtr pctxt, * 3.2.3 Constraints on XML Representations of Attribute Declarations */ if ((pctxt == NULL) || (schema == NULL) || (node == NULL)) - return (NULL); + return (NULL); /* * 3.2.3 : 3.1 * One of ref or name must be present, but not both @@ -7532,7 +7532,7 @@ xmlSchemaParseGlobalAttribute(xmlSchemaParserCtxtPtr pctxt, if (ret == NULL) return (NULL); ret->flags |= XML_SCHEMAS_ATTR_GLOBAL; - + /* * Check for illegal attributes. */ @@ -7546,7 +7546,7 @@ xmlSchemaParseGlobalAttribute(xmlSchemaParserCtxtPtr pctxt, (!xmlStrEqual(attr->name, BAD_CAST "type"))) { xmlSchemaPIllegalAttrErr(pctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { xmlSchemaPIllegalAttrErr(pctxt, @@ -7556,7 +7556,7 @@ xmlSchemaParseGlobalAttribute(xmlSchemaParserCtxtPtr pctxt, } xmlSchemaPValAttrQName(pctxt, schema, NULL, node, "type", &ret->typeNs, &ret->typeName); - + xmlSchemaPValAttrID(pctxt, node, BAD_CAST "id"); /* * Attribute "fixed". @@ -7641,12 +7641,12 @@ xmlSchemaParseAttributeGroupRef(xmlSchemaParserCtxtPtr pctxt, XML_SCHEMAP_S4S_ATTR_MISSING, NULL, node, "ref", NULL); return (NULL); - } + } xmlSchemaPValAttrNodeQName(pctxt, schema, NULL, attr, &refNs, &ref); if (xmlSchemaCheckReference(pctxt, schema, node, attr, refNs) != 0) return(NULL); - + /* * Check for illegal attributes. */ @@ -7698,13 +7698,13 @@ xmlSchemaParseAttributeGroupRef(xmlSchemaParserCtxtPtr pctxt, /* * SPEC src-redefine: * (7.1) "If it has an among its contents - * the ·actual value· of whose ref [attribute] is the same - * as the ·actual value· of its own name attribute plus + * the �actual value� of whose ref [attribute] is the same + * as the �actual value� of its own name attribute plus * target namespace, then it must have exactly one such group." */ if (pctxt->redefCounter != 0) { xmlChar *str = NULL; - + xmlSchemaCustomErr(ACTXT_CAST pctxt, XML_SCHEMAP_SRC_REDEFINE, node, NULL, "The redefining attribute group definition " @@ -7738,7 +7738,7 @@ xmlSchemaParseAttributeGroupRef(xmlSchemaParserCtxtPtr pctxt, ret->node = node; /* Add to pending items, to be able to resolve the reference. */ WXS_ADD_PENDING(pctxt, ret); - } + } return (ret); } @@ -7785,7 +7785,7 @@ xmlSchemaParseAttributeGroupDefinition(xmlSchemaParserCtxtPtr pctxt, ret = xmlSchemaAddAttributeGroupDefinition(pctxt, schema, name, pctxt->targetNamespace, node); if (ret == NULL) - return (NULL); + return (NULL); /* * Check for illegal attributes. */ @@ -8185,7 +8185,7 @@ xmlSchemaAddAnnotation(xmlSchemaAnnotItemPtr annItem, * Returns the parsed identity-constraint definition. */ static xmlSchemaIDCSelectPtr -xmlSchemaParseIDCSelectorAndField(xmlSchemaParserCtxtPtr ctxt, +xmlSchemaParseIDCSelectorAndField(xmlSchemaParserCtxtPtr ctxt, xmlSchemaIDCPtr idc, xmlNodePtr node, int isField) @@ -8848,7 +8848,7 @@ xmlSchemaParseUnion(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, type->flags |= XML_SCHEMAS_TYPE_VARIETY_UNION; /* * SPEC (Base type) (2) "If the or alternative is chosen, - * then the ·simple ur-type definition·." + * then the �simple ur-type definition�." */ type->baseType = xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYSIMPLETYPE); /* @@ -9016,7 +9016,7 @@ xmlSchemaParseList(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, type->flags |= XML_SCHEMAS_TYPE_VARIETY_LIST; /* * SPEC (Base type) (2) "If the or alternative is chosen, - * then the ·simple ur-type definition·." + * then the �simple ur-type definition�." */ type->baseType = xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYSIMPLETYPE); /* @@ -9161,9 +9161,9 @@ xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, } /* * TargetNamespace: - * SPEC "The ·actual value· of the targetNamespace [attribute] + * SPEC "The �actual value� of the targetNamespace [attribute] * of the ancestor element information item if present, - * otherwise ·absent·. + * otherwise �absent�. */ if (topLevel == 0) { #ifdef ENABLE_NAMED_LOCALS @@ -9195,7 +9195,7 @@ xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, if (attr->ns == NULL) { if (!xmlStrEqual(attr->name, BAD_CAST "id")) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { xmlSchemaPIllegalAttrErr(ctxt, @@ -9266,9 +9266,9 @@ xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, * And now for the children... */ oldCtxtType = ctxt->ctxtType; - + ctxt->ctxtType = type; - + child = node->children; if (IS_SCHEMA(child, "annotation")) { type->annot = xmlSchemaParseAnnotation(ctxt, child, 1); @@ -9278,10 +9278,10 @@ xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_MISSING, NULL, node, child, NULL, "(annotation?, (restriction | list | union))"); - } else if (IS_SCHEMA(child, "restriction")) { + } else if (IS_SCHEMA(child, "restriction")) { xmlSchemaParseRestriction(ctxt, schema, child, - XML_SCHEMA_TYPE_SIMPLE); - hasRestriction = 1; + XML_SCHEMA_TYPE_SIMPLE); + hasRestriction = 1; child = child->next; } else if (IS_SCHEMA(child, "list")) { xmlSchemaParseList(ctxt, schema, child); @@ -9298,8 +9298,8 @@ xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, /* * REDEFINE: SPEC src-redefine (5) * "Within the [children], each must have a - * among its [children] ... the ·actual value· of whose - * base [attribute] must be the same as the ·actual value· of its own + * among its [children] ... the �actual value� of whose + * base [attribute] must be the same as the �actual value� of its own * name attribute plus target namespace;" */ if (topLevel && ctxt->isRedefine && (! hasRestriction)) { @@ -9307,7 +9307,7 @@ xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, NULL, node, "This is a redefinition, thus the " " must have a child", NULL); } - + ctxt->ctxtType = oldCtxtType; return (type); } @@ -9373,13 +9373,13 @@ xmlSchemaParseModelGroupDefRef(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPValAttrID(ctxt, node, BAD_CAST "id"); item = xmlSchemaAddParticle(ctxt, node, min, max); if (item == NULL) - return (NULL); + return (NULL); /* * Create a qname-reference and set as the term; it will be substituted * for the model group after the reference has been resolved. */ item->children = (xmlSchemaTreeItemPtr) - xmlSchemaNewQNameRef(ctxt, XML_SCHEMA_TYPE_GROUP, ref, refNs); + xmlSchemaNewQNameRef(ctxt, XML_SCHEMA_TYPE_GROUP, ref, refNs); xmlSchemaPCheckParticleCorrect_2(ctxt, item, node, min, max); /* * And now for the children... @@ -9419,7 +9419,7 @@ xmlSchemaParseModelGroupDefRef(xmlSchemaParserCtxtPtr ctxt, * Note that the contraint src-redefine (6.2) can't be applied until * references have been resolved. So we will do this at the * component fixup level. - * + * * *WARNING* this interface is highly subject to change * * Returns -1 in case of error, 0 if the declaration is improper and @@ -9493,7 +9493,7 @@ xmlSchemaParseModelGroupDefinition(xmlSchemaParserCtxtPtr ctxt, child = child->next; } - + if (child != NULL) { xmlSchemaPContentErr(ctxt, @@ -9631,7 +9631,7 @@ xmlSchemaParseSchemaElement(xmlSchemaParserCtxtPtr ctxt, attr = xmlSchemaGetPropNode(node, "version"); if (attr != NULL) { res = xmlSchemaPValAttrNode(ctxt, NULL, NULL, attr, - xmlSchemaGetBuiltInType(XML_SCHEMAS_TOKEN), &val); + xmlSchemaGetBuiltInType(XML_SCHEMAS_TOKEN), &val); HFAILURE; } */ @@ -9691,7 +9691,7 @@ xmlSchemaParseSchemaElement(xmlSchemaParserCtxtPtr ctxt, } attr = xmlSchemaGetPropNode(node, "blockDefault"); if (attr != NULL) { - val = xmlSchemaGetNodeContent(ctxt, (xmlNodePtr) attr); + val = xmlSchemaGetNodeContent(ctxt, (xmlNodePtr) attr); res = xmlSchemaPValAttrBlockFinal(val, &(schema->flags), -1, XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION, XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION, @@ -9752,14 +9752,14 @@ xmlSchemaParseSchemaTopLevel(xmlSchemaParserCtxtPtr ctxt, HFAILURE; HSTOP(ctxt); if (tmpOldErrs != ctxt->nberrors) - goto exit; + goto exit; } else if (IS_SCHEMA(child, "include")) { tmpOldErrs = ctxt->nberrors; res = xmlSchemaParseInclude(ctxt, schema, child); HFAILURE; HSTOP(ctxt); if (tmpOldErrs != ctxt->nberrors) - goto exit; + goto exit; } else if (IS_SCHEMA(child, "redefine")) { tmpOldErrs = ctxt->nberrors; res = xmlSchemaParseRedefine(ctxt, schema, child); @@ -9884,7 +9884,7 @@ xmlSchemaConstructionCtxtFree(xmlSchemaConstructionCtxtPtr con) xmlFree(con); } -static xmlSchemaConstructionCtxtPtr +static xmlSchemaConstructionCtxtPtr xmlSchemaConstructionCtxtCreate(xmlDictPtr dict) { xmlSchemaConstructionCtxtPtr ret; @@ -9954,10 +9954,10 @@ xmlSchemaNewParserCtxtUseDict(const char *URL, xmlDictPtr dict) xmlSchemaParserCtxtPtr ret; ret = xmlSchemaParserCtxtCreate(); - if (ret == NULL) + if (ret == NULL) return (NULL); ret->dict = dict; - xmlDictReference(dict); + xmlDictReference(dict); if (URL != NULL) ret->URL = xmlDictLookup(dict, (const xmlChar *) URL, -1); return (ret); @@ -10082,8 +10082,8 @@ xmlSchemaParseNewDocWithContext(xmlSchemaParserCtxtPtr pctxt, xmlNodePtr node; int ret, oldErrs; xmlSchemaBucketPtr oldbucket = pctxt->constructor->bucket; - - /* + + /* * Save old values; reset the *main* schema. * URGENT TODO: This is not good; move the per-document information * to the parser. Get rid of passing the main schema to the @@ -10093,9 +10093,9 @@ xmlSchemaParseNewDocWithContext(xmlSchemaParserCtxtPtr pctxt, oldDoc = schema->doc; if (schema->flags != 0) xmlSchemaClearSchemaDefaults(schema); - schema->doc = bucket->doc; + schema->doc = bucket->doc; pctxt->schema = schema; - /* + /* * Keep the current target namespace on the parser *not* on the * main schema. */ @@ -10108,7 +10108,7 @@ xmlSchemaParseNewDocWithContext(xmlSchemaParserCtxtPtr pctxt, * We are parsing the schema for schemas! */ pctxt->isS4S = 1; - } + } /* Mark it as parsed, even if parsing fails. */ bucket->parsed++; /* Compile the schema doc. */ @@ -10132,7 +10132,7 @@ xmlSchemaParseNewDocWithContext(xmlSchemaParserCtxtPtr pctxt, ret = pctxt->err; goto exit; } - + exit: WXS_CONSTRUCTOR(pctxt)->bucket = oldbucket; /* Restore schema values. */ @@ -10165,7 +10165,7 @@ xmlSchemaParseNewDoc(xmlSchemaParserCtxtPtr pctxt, PERROR_INT("xmlSchemaParseNewDoc", "no constructor"); return(-1); - } + } /* Create and init the temporary parser context. */ newpctxt = xmlSchemaNewParserCtxtUseDict( (const char *) bucket->schemaLocation, pctxt->dict); @@ -10173,7 +10173,7 @@ xmlSchemaParseNewDoc(xmlSchemaParserCtxtPtr pctxt, return(-1); newpctxt->constructor = pctxt->constructor; /* - * TODO: Can we avoid that the parser knows about the main schema? + * TODO: Can we avoid that the parser knows about the main schema? * It would be better if he knows about the current schema bucket * only. */ @@ -10183,16 +10183,16 @@ xmlSchemaParseNewDoc(xmlSchemaParserCtxtPtr pctxt, xmlSchemaSetParserStructuredErrors(newpctxt, pctxt->serror, pctxt->errCtxt); newpctxt->counter = pctxt->counter; - + res = xmlSchemaParseNewDocWithContext(newpctxt, schema, bucket); - + /* Channel back errors and cleanup the temporary parser context. */ if (res != 0) pctxt->err = res; pctxt->nberrors += newpctxt->nberrors; pctxt->counter = newpctxt->counter; - newpctxt->constructor = NULL; + newpctxt->constructor = NULL; /* Free the parser context. */ xmlSchemaFreeParserCtxt(newpctxt); return(res); @@ -10217,11 +10217,11 @@ xmlSchemaSchemaRelationAddChild(xmlSchemaBucketPtr bucket, static const xmlChar * xmlSchemaBuildAbsoluteURI(xmlDictPtr dict, const xmlChar* location, xmlNodePtr ctxtNode) -{ +{ /* * Build an absolue location URI. */ - if (location != NULL) { + if (location != NULL) { if (ctxtNode == NULL) return(location); else { @@ -10244,7 +10244,7 @@ xmlSchemaBuildAbsoluteURI(xmlDictPtr dict, const xmlChar* location, } return(NULL); } - + /** @@ -10267,8 +10267,8 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt, const char *schemaBuffer, int schemaBufferLen, xmlNodePtr invokingNode, - const xmlChar *sourceTargetNamespace, - const xmlChar *importNamespace, + const xmlChar *sourceTargetNamespace, + const xmlChar *importNamespace, xmlSchemaBucketPtr *bucket) { const xmlChar *targetNamespace = NULL; @@ -10279,7 +10279,7 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt, if (bucket != NULL) *bucket = NULL; - + switch (type) { case XML_SCHEMA_SCHEMA_IMPORT: case XML_SCHEMA_SCHEMA_MAIN: @@ -10291,23 +10291,23 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt, case XML_SCHEMA_SCHEMA_REDEFINE: err = XML_SCHEMAP_SRC_REDEFINE; break; - } - + } + /* Special handling for the main schema: * skip the location and relation logic and just parse the doc. * We need just a bucket to be returned in this case. - */ + */ if ((type == XML_SCHEMA_SCHEMA_MAIN) || (! WXS_HAS_BUCKETS(pctxt))) - goto doc_load; + goto doc_load; - /* Note that we expect the location to be an absulute URI. */ + /* Note that we expect the location to be an absulute URI. */ if (schemaLocation != NULL) { bkt = xmlSchemaGetSchemaBucket(pctxt, schemaLocation); if ((bkt != NULL) && (pctxt->constructor->bucket == bkt)) { /* Report self-imports/inclusions/redefinitions. */ - + xmlSchemaCustomErr(ACTXT_CAST pctxt, err, invokingNode, NULL, "The schema must not import/include/redefine itself", @@ -10320,7 +10320,7 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt, */ relation = xmlSchemaSchemaRelationCreate(); if (relation == NULL) - return(-1); + return(-1); xmlSchemaSchemaRelationAddChild(pctxt->constructor->bucket, relation); relation->type = type; @@ -10329,7 +10329,7 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt, * Save the namespace import information. */ if (WXS_IS_BUCKET_IMPMAIN(type)) { - relation->importNamespace = importNamespace; + relation->importNamespace = importNamespace; if (schemaLocation == NULL) { /* * No location; this is just an import of the namespace. @@ -10342,7 +10342,7 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt, } /* Did we already fetch the doc? */ - if (bkt != NULL) { + if (bkt != NULL) { /* TODO: The following nasty cases will produce an error. */ if ((WXS_IS_BUCKET_IMPMAIN(type)) && (! bkt->imported)) { /* We included/redefined and then try to import a schema. */ @@ -10364,14 +10364,14 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt, "redefined, since it was already imported", schemaLocation, NULL); goto exit; - } + } } - + if (WXS_IS_BUCKET_IMPMAIN(type)) { /* * Given that the schemaLocation [attribute] is only a hint, it is open * to applications to ignore all but the first for a given - * namespace, regardless of the ·actual value· of schemaLocation, but + * namespace, regardless of the �actual value� of schemaLocation, but * such a strategy risks missing useful information when new * schemaLocations are offered. * @@ -10387,7 +10387,7 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt, * 5 Attempt to resolve the namespace name to locate such a resource. * * NOTE: (3) and (5) are not supported. - */ + */ if (bkt != NULL) { relation->bucket = bkt; goto exit; @@ -10395,7 +10395,7 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt, bkt = xmlSchemaGetSchemaBucketByTNS(pctxt, importNamespace, 1); - if (bkt != NULL) { + if (bkt != NULL) { relation->bucket = bkt; if (bkt->schemaLocation == NULL) { /* First given location of the schema; load the doc. */ @@ -10421,19 +10421,19 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt, } goto exit; } - } - /* + } + /* * No bucket + first location: load the doc and create a * bucket. */ } else { /* and */ if (bkt != NULL) { - + if ((bkt->origTargetNamespace == NULL) && (bkt->targetNamespace != sourceTargetNamespace)) { xmlSchemaBucketPtr chamel; - + /* * Chameleon include/redefine: skip loading only if it was * aleady build for the targetNamespace of the including @@ -10458,7 +10458,7 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt, relation->bucket = chamel; goto exit; } - /* + /* * We need to parse the chameleon again for a different * targetNamespace. * CHAMELEON TODO: Optimize this by only parsing the @@ -10469,7 +10469,7 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt, } else { relation->bucket = bkt; goto exit; - } + } } } if ((bkt != NULL) && (bkt->doc != NULL)) { @@ -10521,7 +10521,7 @@ doc_load: NULL, NULL, SCHEMAS_PARSE_OPTIONS); schemaLocation = xmlStrdup(BAD_CAST "in_memory_buffer"); if (doc != NULL) - doc->URL = schemaLocation; + doc->URL = schemaLocation; } /* * For : @@ -10575,11 +10575,11 @@ doc_load: if (doc != NULL) { xmlNodePtr docElem = NULL; - located = 1; + located = 1; docElem = xmlDocGetRootElement(doc); if (docElem == NULL) { xmlSchemaCustomErr(ACTXT_CAST pctxt, XML_SCHEMAP_NOROOT, - invokingNode, NULL, + invokingNode, NULL, "The document '%s' has no document element", schemaLocation, NULL); goto exit_error; @@ -10598,14 +10598,14 @@ doc_load: schemaLocation, NULL); goto exit_error; } - /* + /* * Note that we don't apply a type check for the * targetNamespace value here. */ targetNamespace = xmlSchemaGetProp(pctxt, docElem, "targetNamespace"); } - + /* after_doc_loading: */ if ((bkt == NULL) && located) { /* Only create a bucket if the schema was located. */ @@ -10632,14 +10632,14 @@ doc_load: if (relation != NULL) relation->bucket = bkt; } - + exit: /* * Return the bucket explicitely; this is needed for the * main schema. */ if (bucket != NULL) - *bucket = bkt; + *bucket = bkt; return (0); exit_error: @@ -10655,7 +10655,7 @@ exit_failure: xmlFreeDoc(doc); if (bkt != NULL) bkt->doc = NULL; - } + } return (-1); } @@ -10755,8 +10755,8 @@ xmlSchemaParseImport(xmlSchemaParserCtxtPtr pctxt, xmlSchemaPtr schema, thisTargetNamespace = WXS_BUCKET(pctxt)->origTargetNamespace; if (namespaceName != NULL) { /* - * 1.1 If the namespace [attribute] is present, then its ·actual value· - * must not match the ·actual value· of the enclosing 's + * 1.1 If the namespace [attribute] is present, then its �actual value� + * must not match the �actual value� of the enclosing 's * targetNamespace [attribute]. */ if (xmlStrEqual(thisTargetNamespace, namespaceName)) { @@ -10810,11 +10810,11 @@ xmlSchemaParseImport(xmlSchemaParserCtxtPtr pctxt, xmlSchemaPtr schema, "Failed to locate a schema at location '%s'. " "Skipping the import", schemaLocation, NULL, NULL); } - - if ((bucket != NULL) && CAN_PARSE_SCHEMA(bucket)) { + + if ((bucket != NULL) && CAN_PARSE_SCHEMA(bucket)) { ret = xmlSchemaParseNewDoc(pctxt, schema, bucket); } - + return (ret); } @@ -10896,7 +10896,7 @@ xmlSchemaParseIncludeOrRedefineAttrs(xmlSchemaParserCtxtPtr pctxt, XML_SCHEMAP_SRC_REDEFINE, NULL, node, "The schema document '%s' cannot redefine itself.", - *schemaLocation); + *schemaLocation); } else { xmlSchemaPCustomErr(pctxt, XML_SCHEMAP_SRC_INCLUDE, @@ -10906,7 +10906,7 @@ xmlSchemaParseIncludeOrRedefineAttrs(xmlSchemaParserCtxtPtr pctxt, } goto exit_error; } - + return(0); exit_error: return(pctxt->err); @@ -10936,19 +10936,19 @@ xmlSchemaParseIncludeOrRedefine(xmlSchemaParserCtxtPtr pctxt, res = xmlSchemaParseIncludeOrRedefineAttrs(pctxt, schema, node, (xmlChar **) (&schemaLocation), type); if (res != 0) - return(res); + return(res); /* * Load and add the schema document. */ res = xmlSchemaAddSchemaDoc(pctxt, type, schemaLocation, NULL, NULL, 0, node, pctxt->targetNamespace, NULL, &bucket); if (res != 0) - return(res); + return(res); /* * If we get no schema bucket back, then this means that the schema * document could not be located or was broken XML or was not * a schema document. - */ + */ if ((bucket == NULL) || (bucket->doc == NULL)) { if (type == XML_SCHEMA_SCHEMA_INCLUDE) { /* @@ -10957,7 +10957,7 @@ xmlSchemaParseIncludeOrRedefine(xmlSchemaParserCtxtPtr pctxt, * for inclusions, since the that was the feedback from the * schema people. I.e. the following spec piece will *not* be * satisfied: - * SPEC src-include: "It is not an error for the ·actual value· of the + * SPEC src-include: "It is not an error for the �actual value� of the * schemaLocation [attribute] to fail to resolve it all, in which * case no corresponding inclusion is performed. * So do we need a warning report here?" @@ -10974,7 +10974,7 @@ xmlSchemaParseIncludeOrRedefine(xmlSchemaParserCtxtPtr pctxt, * * SPEC src-redefine (1) * "If there are any element information items among the [children] - * other than then the ·actual value· of the + * other than then the �actual value� of the * schemaLocation [attribute] must successfully resolve." * TODO: Ask the WG if a the location has always to resolve * here as well! @@ -10990,13 +10990,13 @@ xmlSchemaParseIncludeOrRedefine(xmlSchemaParserCtxtPtr pctxt, * Check targetNamespace sanity before parsing the new schema. * TODO: Note that we won't check further content if the * targetNamespace was bad. - */ - if (bucket->origTargetNamespace != NULL) { + */ + if (bucket->origTargetNamespace != NULL) { /* * SPEC src-include (2.1) - * "SII has a targetNamespace [attribute], and its ·actual - * value· is identical to the ·actual value· of the targetNamespace - * [attribute] of SII’ (which must have such an [attribute])." + * "SII has a targetNamespace [attribute], and its �actual + * value� is identical to the �actual value� of the targetNamespace + * [attribute] of SII� (which must have such an [attribute])." */ if (pctxt->targetNamespace == NULL) { xmlSchemaCustomErr(ACTXT_CAST pctxt, @@ -11020,7 +11020,7 @@ xmlSchemaParseIncludeOrRedefine(xmlSchemaParserCtxtPtr pctxt, pctxt->targetNamespace); goto exit_error; } - } else if (pctxt->targetNamespace != NULL) { + } else if (pctxt->targetNamespace != NULL) { /* * Chameleons: the original target namespace will * differ from the resulting namespace. @@ -11038,10 +11038,10 @@ xmlSchemaParseIncludeOrRedefine(xmlSchemaParserCtxtPtr pctxt, } bucket->targetNamespace = pctxt->targetNamespace; } - } + } /* * Parse the schema. - */ + */ if (bucket && (!bucket->parsed) && (bucket->doc != NULL)) { if (isChameleon) { /* TODO: Get rid of this flag on the schema itself. */ @@ -11058,8 +11058,8 @@ xmlSchemaParseIncludeOrRedefine(xmlSchemaParserCtxtPtr pctxt, /* * And now for the children... */ - child = node->children; - if (type == XML_SCHEMA_SCHEMA_REDEFINE) { + child = node->children; + if (type == XML_SCHEMA_SCHEMA_REDEFINE) { /* * Parse (simpleType | complexType | group | attributeGroup))* */ @@ -11082,7 +11082,7 @@ xmlSchemaParseIncludeOrRedefine(xmlSchemaParserCtxtPtr pctxt, } else if (IS_SCHEMA(child, "complexType")) { xmlSchemaParseComplexType(pctxt, schema, child, 1); /* hasRedefinitions = 1; */ - } else if (IS_SCHEMA(child, "group")) { + } else if (IS_SCHEMA(child, "group")) { /* hasRedefinitions = 1; */ xmlSchemaParseModelGroupDefinition(pctxt, schema, child); @@ -11102,7 +11102,7 @@ xmlSchemaParseIncludeOrRedefine(xmlSchemaParserCtxtPtr pctxt, */ child = child->next; } - } + } if (child != NULL) { res = XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED; if (type == XML_SCHEMA_SCHEMA_REDEFINE) { @@ -11113,8 +11113,8 @@ xmlSchemaParseIncludeOrRedefine(xmlSchemaParserCtxtPtr pctxt, xmlSchemaPContentErr(pctxt, res, NULL, node, child, NULL, "(annotation?)"); - } - } + } + } return(res); exit_error: @@ -11164,7 +11164,7 @@ xmlSchemaParseInclude(xmlSchemaParserCtxtPtr pctxt, xmlSchemaPtr schema, * Redefinition Constraints and Semantics (src-redefine) * (6.1), (6.1.1), (6.1.2) * - * Schema Component Constraint: + * Schema Component Constraint: * All Group Limited (cos-all-limited) (2) * TODO: Actually this should go to component-level checks, * but is done here due to performance. Move it to an other layer @@ -11343,8 +11343,8 @@ xmlSchemaParseModelGroup(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, /* * SPEC src-redefine: * (6.1) "If it has a among its contents at - * some level the ·actual value· of whose ref - * [attribute] is the same as the ·actual value· of + * some level the �actual value� of whose ref + * [attribute] is the same as the �actual value� of * its own name attribute plus target namespace, then * all of the following must be true:" * (6.1.1) "It must have exactly one such group." @@ -11369,9 +11369,9 @@ xmlSchemaParseModelGroup(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, xmlChar *str = NULL; /* * SPEC src-redefine: - * (6.1.2) "The ·actual value· of both that + * (6.1.2) "The �actual value� of both that * group's minOccurs and maxOccurs [attribute] - * must be 1 (or ·absent·). + * must be 1 (or �absent�). */ xmlSchemaCustomErr(ACTXT_CAST ctxt, XML_SCHEMAP_SRC_REDEFINE, child, NULL, @@ -11388,7 +11388,7 @@ xmlSchemaParseModelGroup(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, } ctxt->redef->reference = WXS_BASIC_CAST part; ctxt->redefCounter++; - } + } } } else if (IS_SCHEMA(child, "any")) { part = (xmlSchemaTreeItemPtr) @@ -11425,7 +11425,7 @@ xmlSchemaParseModelGroup(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, WXS_ADD_PENDING(ctxt, item); } if (withParticle) - return ((xmlSchemaTreeItemPtr) particle); + return ((xmlSchemaTreeItemPtr) particle); else return ((xmlSchemaTreeItemPtr) item); } @@ -11477,7 +11477,7 @@ xmlSchemaParseRestriction(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, */ xmlSchemaPValAttrID(ctxt, node, BAD_CAST "id"); /* - * Attribute + * Attribute */ /* * Extract the base type. The "base" attribute is mandatory if inside @@ -11485,8 +11485,8 @@ xmlSchemaParseRestriction(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, * * SPEC (1.2) "...otherwise ( has no " * among its [children]), the simple type definition which is - * the {content type} of the type definition ·resolved· to by - * the ·actual value· of the base [attribute]" + * the {content type} of the type definition �resolved� to by + * the �actual value� of the base [attribute]" */ if (xmlSchemaPValAttrQName(ctxt, schema, NULL, node, "base", &(type->baseNs), &(type->base)) == 0) @@ -11509,8 +11509,8 @@ xmlSchemaParseRestriction(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, /* * REDEFINE: SPEC src-redefine (5) * "Within the [children], each must have a - * among its [children] ... the ·actual value· of - * whose base [attribute] must be the same as the ·actual value· + * among its [children] ... the �actual value� of + * whose base [attribute] must be the same as the �actual value� * of its own name attribute plus target namespace;" */ xmlSchemaPCustomErrExt(ctxt, XML_SCHEMAP_SRC_REDEFINE, @@ -11526,7 +11526,7 @@ xmlSchemaParseRestriction(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, type->base = NULL; type->baseNs = NULL; } - } + } } /* * And now for the children... @@ -11593,7 +11593,7 @@ xmlSchemaParseRestriction(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, /* * Model group reference . */ - } else if (IS_SCHEMA(child, "group")) { + } else if (IS_SCHEMA(child, "group")) { type->subtypes = (xmlSchemaTypePtr) xmlSchemaParseModelGroupDefRef(ctxt, schema, child); /* @@ -11931,13 +11931,13 @@ xmlSchemaParseSimpleContent(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_MISSING, NULL, node, NULL, NULL, - "(annotation?, (restriction | extension))"); + "(annotation?, (restriction | extension))"); } if (child == NULL) { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_MISSING, NULL, node, NULL, NULL, - "(annotation?, (restriction | extension))"); + "(annotation?, (restriction | extension))"); } if (IS_SCHEMA(child, "restriction")) { xmlSchemaParseRestriction(ctxt, schema, child, @@ -12094,7 +12094,7 @@ xmlSchemaParseComplexType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, } else if (xmlSchemaPValAttrNode(ctxt, NULL, attr, xmlSchemaGetBuiltInType(XML_SCHEMAS_NCNAME), &name) != 0) { return (NULL); - } + } } if (topLevel == 0) { @@ -12183,7 +12183,7 @@ xmlSchemaParseComplexType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, NULL, (xmlNodePtr) attr, NULL, "(#all | List of (extension | restriction))", attrValue, NULL, NULL, NULL); - } else + } else final = 1; } else if (xmlStrEqual(attr->name, BAD_CAST "block")) { /* @@ -12201,7 +12201,7 @@ xmlSchemaParseComplexType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, NULL, (xmlNodePtr) attr, NULL, "(#all | List of (extension | restriction)) ", attrValue, NULL, NULL, NULL); - } else + } else block = 1; } else { xmlSchemaPIllegalAttrErr(ctxt, @@ -12212,7 +12212,7 @@ xmlSchemaParseComplexType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { - xmlSchemaPIllegalAttrErr(ctxt, + xmlSchemaPIllegalAttrErr(ctxt, XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } attr = attr->next; @@ -12271,7 +12271,7 @@ xmlSchemaParseComplexType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, * SPEC * "...the third alternative (neither nor * ) is chosen. This case is understood as shorthand - * for complex content restricting the ·ur-type definition·, and the + * for complex content restricting the �ur-type definition�, and the * details of the mappings should be modified as necessary. */ type->baseType = xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYTYPE); @@ -12448,7 +12448,7 @@ xmlSchemaNewMemParserCtxt(const char *buffer, int size) return(NULL); ret->buffer = buffer; ret->size = size; - ret->dict = xmlDictCreate(); + ret->dict = xmlDictCreate(); return (ret); } @@ -12491,7 +12491,7 @@ xmlSchemaFreeParserCtxt(xmlSchemaParserCtxtPtr ctxt) if (ctxt == NULL) return; if (ctxt->doc != NULL && !ctxt->preserve) - xmlFreeDoc(ctxt->doc); + xmlFreeDoc(ctxt->doc); if (ctxt->vctxt != NULL) { xmlSchemaFreeValidCtxt(ctxt->vctxt); } @@ -12573,7 +12573,7 @@ xmlSchemaBuildContentModelForSubstGroup(xmlSchemaParserCtxtPtr pctxt, * was incorrectly used instead of xmlAutomataNewTransition2() * (seems like a copy&paste bug from the XML_SCHEMA_TYPE_ALL * section in xmlSchemaBuildAContentModel() ). - * TODO: Check if xmlAutomataNewOnceTrans2() was instead + * TODO: Check if xmlAutomataNewOnceTrans2() was instead * intended for the above "counter" section originally. I.e., * check xs:all with subst-groups. * @@ -12582,7 +12582,7 @@ xmlSchemaBuildContentModelForSubstGroup(xmlSchemaParserCtxtPtr pctxt, * 1, 1, member); */ tmp = xmlAutomataNewTransition2(pctxt->am, start, NULL, - member->name, member->targetNamespace, member); + member->name, member->targetNamespace, member); xmlAutomataNewEpsilon(pctxt->am, tmp, end); } } else { @@ -12645,11 +12645,11 @@ xmlSchemaBuildContentModelForElement(xmlSchemaParserCtxtPtr ctxt, } else if ((particle->maxOccurs >= UNBOUNDED) && (particle->minOccurs < 2)) { /* Special case. */ - start = ctxt->state; + start = ctxt->state; ctxt->state = xmlAutomataNewTransition2(ctxt->am, start, NULL, - elemDecl->name, elemDecl->targetNamespace, elemDecl); + elemDecl->name, elemDecl->targetNamespace, elemDecl); ctxt->state = xmlAutomataNewTransition2(ctxt->am, ctxt->state, ctxt->state, - elemDecl->name, elemDecl->targetNamespace, elemDecl); + elemDecl->name, elemDecl->targetNamespace, elemDecl); } else { int counter; int maxOccurs = particle->maxOccurs == UNBOUNDED ? @@ -12684,7 +12684,7 @@ xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr pctxt, xmlSchemaParticlePtr particle) { if (particle == NULL) { - PERROR_INT("xmlSchemaBuildAContentModel", "particle is NULL"); + PERROR_INT("xmlSchemaBuildAContentModel", "particle is NULL"); return; } if (particle->children == NULL) { @@ -13115,8 +13115,8 @@ xmlSchemaResolveElementReferences(xmlSchemaElementPtr elemDecl, if ((elemDecl->subtypes == NULL) && (elemDecl->namedType != NULL)) { xmlSchemaTypePtr type; - /* (type definition) ... otherwise the type definition ·resolved· - * to by the ·actual value· of the type [attribute] ... + /* (type definition) ... otherwise the type definition �resolved� + * to by the �actual value� of the type [attribute] ... */ type = xmlSchemaGetType(ctxt->schema, elemDecl->namedType, elemDecl->namedTypeNs); @@ -13154,7 +13154,7 @@ xmlSchemaResolveElementReferences(xmlSchemaElementPtr elemDecl, /* * The type definitions is set to: * SPEC "...the {type definition} of the element - * declaration ·resolved· to by the ·actual value· + * declaration �resolved� to by the �actual value� * of the substitutionGroup [attribute], if present" */ if (elemDecl->subtypes == NULL) @@ -13192,8 +13192,8 @@ xmlSchemaResolveUnionMemberTypes(xmlSchemaParserCtxtPtr ctxt, /* * SPEC (1) "If the alternative is chosen, then [Definition:] - * define the explicit members as the type definitions ·resolved· - * to by the items in the ·actual value· of the memberTypes [attribute], + * define the explicit members as the type definitions �resolved� + * to by the items in the �actual value� of the memberTypes [attribute], * if any, followed by the type definitions corresponding to the * s among the [children] of , if any." */ @@ -13306,7 +13306,6 @@ xmlSchemaIsUserDerivedFromBuiltInType(xmlSchemaTypePtr type, int valType) return (0); } -#endif static xmlSchemaTypePtr xmlSchemaQueryBuiltInType(xmlSchemaTypePtr type) @@ -13319,6 +13318,7 @@ xmlSchemaQueryBuiltInType(xmlSchemaTypePtr type) return(type); return(xmlSchemaQueryBuiltInType(type->subtypes)); } +#endif /** * xmlSchemaGetPrimitiveType: @@ -13488,7 +13488,7 @@ xmlSchemaUnionWildcards(xmlSchemaParserCtxtPtr ctxt, return (0); } /* - * 3 If both O1 and O2 are sets of (namespace names or ·absent·), + * 3 If both O1 and O2 are sets of (namespace names or �absent�), * then the union of those sets must be the value. */ if ((completeWild->nsSet != NULL) && (curWild->nsSet != NULL)) { @@ -13522,7 +13522,7 @@ xmlSchemaUnionWildcards(xmlSchemaParserCtxtPtr ctxt, } /* * 4 If the two are negations of different values (namespace names - * or ·absent·), then a pair of not and ·absent· must be the value. + * or �absent�), then a pair of not and �absent� must be the value. */ if ((completeWild->negNsSet != NULL) && (curWild->negNsSet != NULL) && @@ -13564,7 +13564,7 @@ xmlSchemaUnionWildcards(xmlSchemaParserCtxtPtr ctxt, if (nsFound && absentFound) { /* * 5.1 If the set S includes both the negated namespace - * name and ·absent·, then any must be the value. + * name and �absent�, then any must be the value. */ completeWild->any = 1; if (completeWild->nsSet != NULL) { @@ -13578,7 +13578,7 @@ xmlSchemaUnionWildcards(xmlSchemaParserCtxtPtr ctxt, } else if (nsFound && (!absentFound)) { /* * 5.2 If the set S includes the negated namespace name - * but not ·absent·, then a pair of not and ·absent· must + * but not �absent�, then a pair of not and �absent� must * be the value. */ if (completeWild->nsSet != NULL) { @@ -13593,7 +13593,7 @@ xmlSchemaUnionWildcards(xmlSchemaParserCtxtPtr ctxt, completeWild->negNsSet->value = NULL; } else if ((!nsFound) && absentFound) { /* - * 5.3 If the set S includes ·absent· but not the negated + * 5.3 If the set S includes �absent� but not the negated * namespace name, then the union is not expressible. */ xmlSchemaPErr(ctxt, completeWild->node, @@ -13604,7 +13604,7 @@ xmlSchemaUnionWildcards(xmlSchemaParserCtxtPtr ctxt, } else if ((!nsFound) && (!absentFound)) { /* * 5.4 If the set S does not include either the negated namespace - * name or ·absent·, then whichever of O1 or O2 is a pair of not + * name or �absent�, then whichever of O1 or O2 is a pair of not * and a namespace name must be the value. */ if (completeWild->negNsSet == NULL) { @@ -13638,7 +13638,7 @@ xmlSchemaUnionWildcards(xmlSchemaParserCtxtPtr ctxt, while (cur != NULL) { if (cur->value == NULL) { /* - * 6.1 If the set S includes ·absent·, then any must be the + * 6.1 If the set S includes �absent�, then any must be the * value. */ completeWild->any = 1; @@ -13656,8 +13656,8 @@ xmlSchemaUnionWildcards(xmlSchemaParserCtxtPtr ctxt, } if (completeWild->negNsSet == NULL) { /* - * 6.2 If the set S does not include ·absent·, then a pair of not - * and ·absent· must be the value. + * 6.2 If the set S does not include �absent�, then a pair of not + * and �absent� must be the value. */ if (completeWild->nsSet != NULL) { xmlSchemaFreeWildcardNsSet(completeWild->nsSet); @@ -13740,9 +13740,9 @@ xmlSchemaIntersectWildcards(xmlSchemaParserCtxtPtr ctxt, } /* * 3 If either O1 or O2 is a pair of not and a value (a namespace - * name or ·absent·) and the other is a set of (namespace names or - * ·absent·), then that set, minus the negated value if it was in - * the set, minus ·absent· if it was in the set, must be the value. + * name or �absent�) and the other is a set of (namespace names or + * �absent�), then that set, minus the negated value if it was in + * the set, minus �absent� if it was in the set, must be the value. */ if (((completeWild->negNsSet != NULL) && (curWild->nsSet != NULL)) || ((curWild->negNsSet != NULL) && (completeWild->nsSet != NULL))) { @@ -13791,7 +13791,7 @@ xmlSchemaIntersectWildcards(xmlSchemaParserCtxtPtr ctxt, return(0); } /* - * 4 If both O1 and O2 are sets of (namespace names or ·absent·), + * 4 If both O1 and O2 are sets of (namespace names or �absent�), * then the intersection of those sets must be the value. */ if ((completeWild->nsSet != NULL) && (curWild->nsSet != NULL)) { @@ -13841,7 +13841,7 @@ xmlSchemaIntersectWildcards(xmlSchemaParserCtxtPtr ctxt, } /* * 6 If the one is a negation of a namespace name and the other - * is a negation of ·absent·, then the one which is the negation + * is a negation of �absent�, then the one which is the negation * of a namespace name must be the value. */ if ((completeWild->negNsSet != NULL) && (curWild->negNsSet != NULL) && @@ -13873,7 +13873,7 @@ xmlSchemaCheckCOSNSSubset(xmlSchemaWildcardPtr sub, if (super->any) return (0); /* - * 2.1 sub must be a pair of not and a namespace name or ·absent·. + * 2.1 sub must be a pair of not and a namespace name or �absent�. * 2.2 super must be a pair of not and the same value. */ if ((sub->negNsSet != NULL) && @@ -13881,7 +13881,7 @@ xmlSchemaCheckCOSNSSubset(xmlSchemaWildcardPtr sub, (sub->negNsSet->value == sub->negNsSet->value)) return (0); /* - * 3.1 sub must be a set whose members are either namespace names or ·absent·. + * 3.1 sub must be a set whose members are either namespace names or �absent�. */ if (sub->nsSet != NULL) { /* @@ -13912,7 +13912,7 @@ xmlSchemaCheckCOSNSSubset(xmlSchemaWildcardPtr sub, xmlSchemaWildcardNsPtr cur; /* * 3.2.2 super must be a pair of not and a namespace name or - * ·absent· and that value must not be in sub's set. + * �absent� and that value must not be in sub's set. */ cur = sub->nsSet; while (cur != NULL) { @@ -13937,7 +13937,7 @@ xmlSchemaGetEffectiveValueConstraint(xmlSchemaAttributeUsePtr attruse, if (val != 0) *val = NULL; - if (attruse->defValue != NULL) { + if (attruse->defValue != NULL) { *value = attruse->defValue; if (val != NULL) *val = attruse->defVal; @@ -14017,12 +14017,12 @@ xmlSchemaCheckDerivationOKRestriction2to4(xmlSchemaParserCtxtPtr pctxt, xmlSchemaItemListPtr baseUses, xmlSchemaWildcardPtr wild, xmlSchemaWildcardPtr baseWild) -{ +{ xmlSchemaAttributeUsePtr cur = NULL, bcur; int i, j, found; /* err = 0; */ const xmlChar *bEffValue; int effFixed; - + if (uses != NULL) { for (i = 0; i < uses->nbItems; i++) { cur = uses->items[i]; @@ -14030,7 +14030,7 @@ xmlSchemaCheckDerivationOKRestriction2to4(xmlSchemaParserCtxtPtr pctxt, if (baseUses == NULL) goto not_found; for (j = 0; j < baseUses->nbItems; j++) { - bcur = baseUses->items[j]; + bcur = baseUses->items[j]; if ((WXS_ATTRUSE_DECL_NAME(cur) == WXS_ATTRUSE_DECL_NAME(bcur)) && (WXS_ATTRUSE_DECL_TNS(cur) == @@ -14043,7 +14043,7 @@ xmlSchemaCheckDerivationOKRestriction2to4(xmlSchemaParserCtxtPtr pctxt, * namespace}, then all of the following must be true:" */ found = 1; - + if ((cur->occurs == XML_SCHEMAS_ATTR_USE_OPTIONAL) && (bcur->occurs == XML_SCHEMAS_ATTR_USE_REQUIRED)) { @@ -14069,12 +14069,12 @@ xmlSchemaCheckDerivationOKRestriction2to4(xmlSchemaParserCtxtPtr pctxt, WXS_ATTRUSE_TYPEDEF(bcur), 0) != 0) { xmlChar *strA = NULL, *strB = NULL, *strC = NULL; - + /* * SPEC (2.1.2) "R's {attribute declaration}'s * {type definition} must be validly derived from * B's {type definition} given the empty set as - * defined in Type Derivation OK (Simple) (§3.14.6)." + * defined in Type Derivation OK (Simple) (�3.14.6)." */ xmlSchemaPAttrUseErr4(pctxt, XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_2, @@ -14106,17 +14106,17 @@ xmlSchemaCheckDerivationOKRestriction2to4(xmlSchemaParserCtxtPtr pctxt, /* * 2.1.3 ... one of the following must be true * - * 2.1.3.1 B's ·effective value constraint· is - * ·absent· or default. + * 2.1.3.1 B's �effective value constraint� is + * �absent� or default. */ if ((bEffValue != NULL) && (effFixed == 1)) { const xmlChar *rEffValue = NULL; - + xmlSchemaGetEffectiveValueConstraint(bcur, &effFixed, &rEffValue, NULL); /* - * 2.1.3.2 R's ·effective value constraint· is + * 2.1.3.2 R's �effective value constraint� is * fixed with the same string as B's. * MAYBE TODO: Compare the computed values. * Hmm, it says "same string" so @@ -14126,7 +14126,7 @@ xmlSchemaCheckDerivationOKRestriction2to4(xmlSchemaParserCtxtPtr pctxt, (! WXS_ARE_DEFAULT_STR_EQUAL(rEffValue, bEffValue))) { xmlChar *str = NULL; - + xmlSchemaPAttrUseErr4(pctxt, XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_3, WXS_ITEM_NODE(item), item, cur, @@ -14145,21 +14145,21 @@ xmlSchemaCheckDerivationOKRestriction2to4(xmlSchemaParserCtxtPtr pctxt, break; } } -not_found: +not_found: if (!found) { /* * (2.2) "otherwise the {base type definition} must have an * {attribute wildcard} and the {target namespace} of the - * R's {attribute declaration} must be ·valid· with respect + * R's {attribute declaration} must be �valid� with respect * to that wildcard, as defined in Wildcard allows Namespace - * Name (§3.10.4)." + * Name (�3.10.4)." */ if ((baseWild == NULL) || (xmlSchemaCheckCVCWildcardNamespace(baseWild, (WXS_ATTRUSE_DECL(cur))->targetNamespace) != 0)) { xmlChar *str = NULL; - + xmlSchemaPAttrUseErr4(pctxt, XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_2, WXS_ITEM_NODE(item), item, cur, @@ -14175,7 +14175,7 @@ not_found: } } /* - * SPEC derivation-ok-restriction (3): + * SPEC derivation-ok-restriction (3): * (3) "For each attribute use in the {attribute uses} of the {base type * definition} whose {required} is true, there must be an attribute * use with an {attribute declaration} with the same {name} and @@ -14190,7 +14190,7 @@ not_found: found = 0; if (uses != NULL) { for (i = 0; i < uses->nbItems; i++) { - cur = uses->items[i]; + cur = uses->items[i]; if ((WXS_ATTRUSE_DECL_NAME(cur) == WXS_ATTRUSE_DECL_NAME(bcur)) && (WXS_ATTRUSE_DECL_TNS(cur) == @@ -14202,7 +14202,7 @@ not_found: } if (!found) { xmlChar *strA = NULL, *strB = NULL; - + xmlSchemaCustomErr4(ACTXT_CAST pctxt, XML_SCHEMAP_DERIVATION_OK_RESTRICTION_3, NULL, item, @@ -14224,19 +14224,19 @@ not_found: /* * (4) "If there is an {attribute wildcard}, all of the * following must be true:" - */ + */ if (baseWild == NULL) { xmlChar *str = NULL; /* * (4.1) "The {base type definition} must also have one." - */ + */ xmlSchemaCustomErr4(ACTXT_CAST pctxt, XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_1, NULL, item, "The %s has an attribute wildcard, " "but the %s %s '%s' does not have one", - WXS_ITEM_TYPE_NAME(item), + WXS_ITEM_TYPE_NAME(item), WXS_ACTION_STR(action), WXS_ITEM_TYPE_NAME(baseItem), xmlSchemaGetComponentQName(&str, baseItem)); @@ -14250,7 +14250,7 @@ not_found: * (4.2) "The complex type definition's {attribute wildcard}'s * {namespace constraint} must be a subset of the {base type * definition}'s {attribute wildcard}'s {namespace constraint}, - * as defined by Wildcard Subset (§3.10.6)." + * as defined by Wildcard Subset (�3.10.6)." */ xmlSchemaCustomErr4(ACTXT_CAST pctxt, XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_2, @@ -14264,8 +14264,8 @@ not_found: FREE_AND_NULL(str); return(pctxt->err); } - /* 4.3 Unless the {base type definition} is the ·ur-type - * definition·, the complex type definition's {attribute + /* 4.3 Unless the {base type definition} is the �ur-type + * definition�, the complex type definition's {attribute * wildcard}'s {process contents} must be identical to or * stronger than the {base type definition}'s {attribute * wildcard}'s {process contents}, where strict is stronger @@ -14316,7 +14316,7 @@ xmlSchemaFixupTypeAttributeUses(xmlSchemaParserCtxtPtr pctxt, xmlSchemaTypePtr type) { xmlSchemaTypePtr baseType = NULL; - xmlSchemaAttributeUsePtr use; + xmlSchemaAttributeUsePtr use; xmlSchemaItemListPtr uses, baseUses, prohibs = NULL; if (type->baseType == NULL) { @@ -14324,7 +14324,7 @@ xmlSchemaFixupTypeAttributeUses(xmlSchemaParserCtxtPtr pctxt, "no base type"); return (-1); } - baseType = type->baseType; + baseType = type->baseType; if (WXS_IS_TYPE_NOT_FIXED(baseType)) if (xmlSchemaTypeFixup(baseType, ACTXT_CAST pctxt) == -1) return(-1); @@ -14336,7 +14336,7 @@ xmlSchemaFixupTypeAttributeUses(xmlSchemaParserCtxtPtr pctxt, * wildcard, i.e. intersect multiple wildcards. * Move attribute prohibitions into a separate list. */ - if (uses != NULL) { + if (uses != NULL) { if (WXS_IS_RESTRICTION(type)) { /* * This one will transfer all attr. prohibitions @@ -14370,7 +14370,7 @@ xmlSchemaFixupTypeAttributeUses(xmlSchemaParserCtxtPtr pctxt, if (WXS_IS_RESTRICTION(type)) { int usesCount; - xmlSchemaAttributeUsePtr tmp; + xmlSchemaAttributeUsePtr tmp; if (uses != NULL) usesCount = uses->nbItems; @@ -14420,15 +14420,15 @@ inherit_next: {} } } else { /* Extension. */ - for (i = 0; i < baseUses->nbItems; i++) { - use = baseUses->items[i]; + for (i = 0; i < baseUses->nbItems; i++) { + use = baseUses->items[i]; if (uses == NULL) { type->attrUses = xmlSchemaItemListCreate(); if (type->attrUses == NULL) goto exit_failure; uses = type->attrUses; } - xmlSchemaItemListAddSize(uses, baseUses->nbItems, use); + xmlSchemaItemListAddSize(uses, baseUses->nbItems, use); } } } @@ -14448,10 +14448,10 @@ inherit_next: {} /* * Compute the complete wildcard. */ - if (WXS_IS_EXTENSION(type)) { + if (WXS_IS_EXTENSION(type)) { if (baseType->attributeWildcard != NULL) { /* - * (3.2.2.1) "If the ·base wildcard· is non-·absent·, then + * (3.2.2.1) "If the �base wildcard� is non-�absent�, then * the appropriate case among the following:" */ if (type->attributeWildcard != NULL) { @@ -14459,26 +14459,26 @@ inherit_next: {} * Union the complete wildcard with the base wildcard. * SPEC {attribute wildcard} * (3.2.2.1.2) "otherwise a wildcard whose {process contents} - * and {annotation} are those of the ·complete wildcard·, + * and {annotation} are those of the �complete wildcard�, * and whose {namespace constraint} is the intensional union - * of the {namespace constraint} of the ·complete wildcard· - * and of the ·base wildcard·, as defined in Attribute - * Wildcard Union (§3.10.6)." + * of the {namespace constraint} of the �complete wildcard� + * and of the �base wildcard�, as defined in Attribute + * Wildcard Union (�3.10.6)." */ if (xmlSchemaUnionWildcards(pctxt, type->attributeWildcard, baseType->attributeWildcard) == -1) - goto exit_failure; + goto exit_failure; } else { /* - * (3.2.2.1.1) "If the ·complete wildcard· is ·absent·, - * then the ·base wildcard·." + * (3.2.2.1.1) "If the �complete wildcard� is �absent�, + * then the �base wildcard�." */ type->attributeWildcard = baseType->attributeWildcard; - } + } } else { /* - * (3.2.2.2) "otherwise (the ·base wildcard· is ·absent·) the - * ·complete wildcard" + * (3.2.2.2) "otherwise (the �base wildcard� is �absent�) the + * �complete wildcard" * NOOP */ } @@ -14486,11 +14486,11 @@ inherit_next: {} /* * SPEC {attribute wildcard} * (3.1) "If the alternative is chosen, then the - * ·complete wildcard·;" + * �complete wildcard�;" * NOOP */ } - + return (0); exit_failure: @@ -14594,6 +14594,7 @@ xmlSchemaGetParticleTotalRangeMin(xmlSchemaParticlePtr particle) } } +#if 0 /** * xmlSchemaGetParticleTotalRangeMax: * @particle: the particle @@ -14653,6 +14654,7 @@ xmlSchemaGetParticleTotalRangeMax(xmlSchemaParticlePtr particle) return (particle->maxOccurs * sum); } } +#endif /** * xmlSchemaIsParticleEmptiable: @@ -14733,12 +14735,12 @@ xmlSchemaCheckCOSSTDerivedOK(xmlSchemaAbstractCtxtPtr actxt, /* 2.2 */ if (type->baseType == baseType) { /* - * 2.2.1 D's ·base type definition· is B. + * 2.2.1 D's �base type definition� is B. */ return (0); } /* - * 2.2.2 D's ·base type definition· is not the ·ur-type definition· + * 2.2.2 D's �base type definition� is not the �ur-type definition� * and is validly derived from B given the subset, as defined by this * constraint. */ @@ -14748,8 +14750,8 @@ xmlSchemaCheckCOSSTDerivedOK(xmlSchemaAbstractCtxtPtr actxt, return (0); } /* - * 2.2.3 D's {variety} is list or union and B is the ·simple ur-type - * definition·. + * 2.2.3 D's {variety} is list or union and B is the �simple ur-type + * definition�. */ if (WXS_IS_ANY_SIMPLE_TYPE(baseType) && (WXS_IS_LIST(type) || WXS_IS_UNION(type))) { @@ -14865,10 +14867,10 @@ static int xmlSchemaCheckUnionTypeDefCircularRecur(xmlSchemaParserCtxtPtr pctxt, xmlSchemaTypePtr ctxType, xmlSchemaTypeLinkPtr members) -{ +{ xmlSchemaTypeLinkPtr member; xmlSchemaTypePtr memberType; - + member = members; while (member != NULL) { memberType = member->type; @@ -14969,7 +14971,7 @@ xmlSchemaResolveTypeReferences(xmlSchemaTypePtr typeDef, } return; } - } + } /* * The ball of letters below means, that if we have a particle * which has a QName-helper component as its {term}, we want @@ -15012,7 +15014,7 @@ xmlSchemaResolveTypeReferences(xmlSchemaTypePtr typeDef, * particle's {term}. */ WXS_TYPE_PARTICLE_TERM(typeDef) = WXS_MODELGROUPDEF_MODEL(groupDef); - + if (WXS_MODELGROUPDEF_MODEL(groupDef)->type == XML_SCHEMA_TYPE_ALL) { /* * SPEC cos-all-limited (1.2) @@ -15061,14 +15063,14 @@ xmlSchemaCheckSTPropsCorrect(xmlSchemaParserCtxtPtr ctxt, * NOTE: This is somehow redundant, since we actually built a simple type * to have all the needed information; this acts as an self test. */ - /* Base type: If the datatype has been ·derived· by ·restriction· - * then the Simple Type Definition component from which it is ·derived·, - * otherwise the Simple Type Definition for anySimpleType (§4.1.6). + /* Base type: If the datatype has been �derived� by �restriction� + * then the Simple Type Definition component from which it is �derived�, + * otherwise the Simple Type Definition for anySimpleType (�4.1.6). */ if (baseType == NULL) { /* * TODO: Think about: "modulo the impact of Missing - * Sub-components (§5.3)." + * Sub-components (�5.3)." */ xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_ST_PROPS_CORRECT_1, @@ -15092,7 +15094,7 @@ xmlSchemaCheckSTPropsCorrect(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_ST_PROPS_CORRECT_1, WXS_BASIC_CAST type, NULL, - "A type, derived by list or union, must have" + "A type, derived by list or union, must have " "the simple ur-type definition as base type, not '%s'", xmlSchemaGetComponentQName(&str, baseType)); FREE_AND_NULL(str) @@ -15127,10 +15129,10 @@ xmlSchemaCheckSTPropsCorrect(xmlSchemaParserCtxtPtr ctxt, } /* - * 2 All simple type definitions must be derived ultimately from the ·simple - * ur-type definition (so· circular definitions are disallowed). That is, it - * must be possible to reach a built-in primitive datatype or the ·simple - * ur-type definition· by repeatedly following the {base type definition}. + * 2 All simple type definitions must be derived ultimately from the �simple + * ur-type definition (so� circular definitions are disallowed). That is, it + * must be possible to reach a built-in primitive datatype or the �simple + * ur-type definition� by repeatedly following the {base type definition}. * * NOTE: this is done in xmlSchemaCheckTypeDefCircular(). */ @@ -15314,10 +15316,10 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr pctxt, } /* * MAYBE TODO: (Hmm, not really) Datatypes states: - * A ·list· datatype can be ·derived· from an ·atomic· datatype - * whose ·lexical space· allows space (such as string or anyURI)or - * a ·union· datatype any of whose {member type definitions}'s - * ·lexical space· allows space. + * A �list� datatype can be �derived� from an �atomic� datatype + * whose �lexical space� allows space (such as string or anyURI)or + * a �union� datatype any of whose {member type definitions}'s + * �lexical space� allows space. */ } else { /* @@ -15354,7 +15356,7 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr pctxt, /* * 2.3.2.3 The {item type definition} must be validly derived * from the {base type definition}'s {item type definition} given - * the empty set, as defined in Type Derivation OK (Simple) (§3.14.6). + * the empty set, as defined in Type Derivation OK (Simple) (�3.14.6). */ { xmlSchemaTypePtr baseItemType; @@ -15401,7 +15403,7 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr pctxt, case XML_SCHEMA_FACET_WHITESPACE: /* * TODO: 2.5.1.2 List datatypes - * The value of ·whiteSpace· is fixed to the value collapse. + * The value of �whiteSpace� is fixed to the value collapse. */ case XML_SCHEMA_FACET_PATTERN: case XML_SCHEMA_FACET_ENUMERATION: @@ -15454,8 +15456,8 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr pctxt, member = member->next; } /* - * 3.3.1 If the {base type definition} is the ·simple ur-type - * definition· + * 3.3.1 If the {base type definition} is the �simple ur-type + * definition� */ if (type->baseType->builtInType == XML_SCHEMAS_ANYSIMPLETYPE) { /* @@ -15517,7 +15519,7 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr pctxt, * 3.3.2.3 The {member type definitions}, in order, must be validly * derived from the corresponding type definitions in the {base * type definition}'s {member type definitions} given the empty set, - * as defined in Type Derivation OK (Simple) (§3.14.6). + * as defined in Type Derivation OK (Simple) (�3.14.6). */ { xmlSchemaTypeLinkPtr baseMember; @@ -15609,7 +15611,7 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr pctxt, * @ctxt: the schema parser context * @type: the simple type definition * - * Checks crc-simple-type constraints. + * Checks crc-simple-type constraints. * * Returns 0 if the constraints are satisfied, * if not a positive error code and -1 on internal @@ -15623,8 +15625,8 @@ xmlSchemaCheckSRCSimpleType(xmlSchemaParserCtxtPtr ctxt, /* * src-simple-type.1 The corresponding simple type definition, if any, * must satisfy the conditions set out in Constraints on Simple Type - * Definition Schema Components (§3.14.6). - */ + * Definition Schema Components (�3.14.6). + */ if (WXS_IS_RESTRICTION(type)) { /* * src-simple-type.2 "If the alternative is chosen, @@ -15633,7 +15635,7 @@ xmlSchemaCheckSRCSimpleType(xmlSchemaParserCtxtPtr ctxt, * NOTE: This is checked in the parse function of . */ /* - * + * */ } else if (WXS_IS_LIST(type)) { /* src-simple-type.3 "If the alternative is chosen, either it must have @@ -15642,8 +15644,8 @@ xmlSchemaCheckSRCSimpleType(xmlSchemaParserCtxtPtr ctxt, * * NOTE: This is checked in the parse function of . */ - } else if (WXS_IS_UNION(type)) { - /* + } else if (WXS_IS_UNION(type)) { + /* * src-simple-type.4 is checked in xmlSchemaCheckUnionTypeDefCircular(). */ } @@ -15721,8 +15723,8 @@ xmlSchemaParseCheckCOSValidDefault(xmlSchemaParserCtxtPtr pctxt, * SPEC (2.1) "its {content type} must be a simple type definition * or mixed." * SPEC (2.2.2) "If the {content type} is mixed, then the {content - * type}'s particle must be ·emptiable· as defined by - * Particle Emptiable (§3.9.6)." + * type}'s particle must be �emptiable� as defined by + * Particle Emptiable (�3.9.6)." */ if ((! WXS_HAS_SIMPLE_CONTENT(type)) && ((! WXS_HAS_MIXED_CONTENT(type)) || (! WXS_EMPTIABLE(type)))) { @@ -15738,14 +15740,14 @@ xmlSchemaParseCheckCOSValidDefault(xmlSchemaParserCtxtPtr pctxt, } /* * 1 If the type definition is a simple type definition, then the string - * must be ·valid· with respect to that definition as defined by String - * Valid (§3.14.4). + * must be �valid� with respect to that definition as defined by String + * Valid (�3.14.4). * * AND * * 2.2.1 If the {content type} is a simple type definition, then the - * string must be ·valid· with respect to that simple type definition - * as defined by String Valid (§3.14.4). + * string must be �valid� with respect to that simple type definition + * as defined by String Valid (�3.14.4). */ if (WXS_IS_SIMPLE(type)) ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST pctxt, node, @@ -15786,8 +15788,8 @@ xmlSchemaCheckCTPropsCorrect(xmlSchemaParserCtxtPtr pctxt, * * SPEC (1) "The values of the properties of a complex type definition must * be as described in the property tableau in The Complex Type Definition - * Schema Component (§3.4.1), modulo the impact of Missing - * Sub-components (§5.3)." + * Schema Component (�3.4.1), modulo the impact of Missing + * Sub-components (�5.3)." */ if ((type->baseType != NULL) && (WXS_IS_SIMPLE(type->baseType)) && @@ -15798,14 +15800,14 @@ xmlSchemaCheckCTPropsCorrect(xmlSchemaParserCtxtPtr pctxt, */ xmlSchemaCustomErr(ACTXT_CAST pctxt, XML_SCHEMAP_SRC_CT_1, - NULL, WXS_BASIC_CAST type, + NULL, WXS_BASIC_CAST type, "If the base type is a simple type, the derivation method must be " "'extension'", NULL, NULL); return (XML_SCHEMAP_SRC_CT_1); } /* - * SPEC (3) "Circular definitions are disallowed, except for the ·ur-type - * definition·. That is, it must be possible to reach the ·ur-type + * SPEC (3) "Circular definitions are disallowed, except for the �ur-type + * definition�. That is, it must be possible to reach the �ur-type * definition by repeatedly following the {base type definition}." * * NOTE (3) is done in xmlSchemaCheckTypeDefCircular(). @@ -15815,7 +15817,7 @@ xmlSchemaCheckCTPropsCorrect(xmlSchemaParserCtxtPtr pctxt, * - attribute uses need to be already inherited (apply attr. prohibitions) * - attribute group references need to be expanded already * - simple types need to be typefixed already - */ + */ if (type->attrUses && (((xmlSchemaItemListPtr) type->attrUses)->nbItems > 1)) { @@ -15825,8 +15827,8 @@ xmlSchemaCheckCTPropsCorrect(xmlSchemaParserCtxtPtr pctxt, for (i = uses->nbItems -1; i >= 0; i--) { use = uses->items[i]; - - /* + + /* * SPEC ct-props-correct * (4) "Two distinct attribute declarations in the * {attribute uses} must not have identical {name}s and @@ -15867,10 +15869,10 @@ xmlSchemaCheckCTPropsCorrect(xmlSchemaParserCtxtPtr pctxt, if (WXS_ATTRUSE_TYPEDEF(use) != NULL) { if (xmlSchemaIsDerivedFromBuiltInType( WXS_ATTRUSE_TYPEDEF(use), XML_SCHEMAS_ID)) - { + { if (hasId) { xmlChar *str = NULL; - + xmlSchemaCustomErr(ACTXT_CAST pctxt, XML_SCHEMAP_AG_PROPS_CORRECT, NULL, WXS_BASIC_CAST type, @@ -15884,7 +15886,7 @@ xmlSchemaCheckCTPropsCorrect(xmlSchemaParserCtxtPtr pctxt, if (xmlSchemaItemListRemove(uses, i) == -1) goto exit_failure; } - + hasId = 1; } } @@ -15958,8 +15960,8 @@ xmlSchemaCheckCOSCTDerivedOK(xmlSchemaAbstractCtxtPtr actxt, if (type->baseType == baseType) return (0); /* - * SPEC (2.3.1) "D's {base type definition} must not be the ·ur-type - * definition·." + * SPEC (2.3.1) "D's {base type definition} must not be the �ur-type + * definition�." */ if (WXS_IS_ANYTYPE(type->baseType)) return (1); @@ -15976,7 +15978,7 @@ xmlSchemaCheckCOSCTDerivedOK(xmlSchemaAbstractCtxtPtr actxt, /* * SPEC (2.3.2.2) "If D's {base type definition} is simple, then it * must be validly derived from B given the subset as defined in Type - * Derivation OK (Simple) (§3.14.6). + * Derivation OK (Simple) (�3.14.6). */ return (xmlSchemaCheckCOSSTDerivedOK(actxt, type->baseType, baseType, set)); @@ -16037,7 +16039,7 @@ xmlSchemaCheckCOSCTExtends(xmlSchemaParserCtxtPtr ctxt, * SPEC (1) "If the {base type definition} is a complex type definition, * then all of the following must be true:" */ - if (WXS_IS_COMPLEX(base)) { + if (WXS_IS_COMPLEX(base)) { /* * SPEC (1.1) "The {final} of the {base type definition} must not * contain extension." @@ -16050,7 +16052,7 @@ xmlSchemaCheckCOSCTExtends(xmlSchemaParserCtxtPtr ctxt, "contains 'extension'", NULL); return (XML_SCHEMAP_COS_CT_EXTENDS_1_1); } - + /* * ATTENTION: The constrains (1.2) and (1.3) are not applied, * since they are automatically satisfied through the @@ -16094,11 +16096,11 @@ xmlSchemaCheckCOSCTExtends(xmlSchemaParserCtxtPtr ctxt, } if (! found) { xmlChar *str = NULL; - + xmlSchemaCustomErr(ACTXT_CAST ctxt, XML_SCHEMAP_COS_CT_EXTENDS_1_2, NULL, WXS_BASIC_CAST type, - /* + /* * TODO: The report does not indicate that also the * type needs to be the same. */ @@ -16116,9 +16118,9 @@ xmlSchemaCheckCOSCTExtends(xmlSchemaParserCtxtPtr ctxt, * definition must also have one, and the base type definition's * {attribute wildcard}'s {namespace constraint} must be a subset * of the complex type definition's {attribute wildcard}'s {namespace - * constraint}, as defined by Wildcard Subset (§3.10.6)." + * constraint}, as defined by Wildcard Subset (�3.10.6)." */ - + /* * MAYBE TODO: Enable if ever needed. But this will be needed only * if created the type via a schema construction API. @@ -16126,7 +16128,7 @@ xmlSchemaCheckCOSCTExtends(xmlSchemaParserCtxtPtr ctxt, if (base->attributeWildcard != NULL) { if (type->attributeWilcard == NULL) { xmlChar *str = NULL; - + xmlSchemaCustomErr(ACTXT_CAST pctxt, XML_SCHEMAP_COS_CT_EXTENDS_1_3, NULL, type, @@ -16139,7 +16141,7 @@ xmlSchemaCheckCOSCTExtends(xmlSchemaParserCtxtPtr ctxt, base->attributeWildcard, type->attributeWildcard)) { xmlChar *str = NULL; - + xmlSchemaCustomErr(ACTXT_CAST pctxt, XML_SCHEMAP_COS_CT_EXTENDS_1_3, NULL, type, @@ -16213,9 +16215,9 @@ xmlSchemaCheckCOSCTExtends(xmlSchemaParserCtxtPtr ctxt, } /* * URGENT TODO SPEC (1.4.3.2.2.2) "The particle of the - * complex type definition must be a ·valid extension· + * complex type definition must be a �valid extension� * of the {base type definition}'s particle, as defined - * in Particle Valid (Extension) (§3.9.6)." + * in Particle Valid (Extension) (�3.9.6)." * * NOTE that we won't check "Particle Valid (Extension)", * since it is ensured by the derivation process in @@ -16293,7 +16295,7 @@ xmlSchemaCheckDerivationOKRestriction(xmlSchemaParserCtxtPtr ctxt, */ base = type->baseType; if (! WXS_IS_COMPLEX(base)) { - xmlSchemaCustomErr(ACTXT_CAST ctxt, + xmlSchemaCustomErr(ACTXT_CAST ctxt, XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1, type->node, WXS_BASIC_CAST type, "The base type must be a complex type", NULL, NULL); @@ -16304,7 +16306,7 @@ xmlSchemaCheckDerivationOKRestriction(xmlSchemaParserCtxtPtr ctxt, * SPEC (1) "The {base type definition} must be a complex type * definition whose {final} does not contain restriction." */ - xmlSchemaCustomErr(ACTXT_CAST ctxt, + xmlSchemaCustomErr(ACTXT_CAST ctxt, XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1, type->node, WXS_BASIC_CAST type, "The 'final' of the base type definition " @@ -16332,7 +16334,7 @@ xmlSchemaCheckDerivationOKRestriction(xmlSchemaParserCtxtPtr ctxt, if (base->builtInType == XML_SCHEMAS_ANYTYPE) { /* * SPEC (5.1) "The {base type definition} must be the - * ·ur-type definition·." + * �ur-type definition�." * PASS */ } else if ((type->contentType == XML_SCHEMA_CONTENT_SIMPLE) || @@ -16351,11 +16353,11 @@ xmlSchemaCheckDerivationOKRestriction(xmlSchemaParserCtxtPtr ctxt, * SPEC (5.2.2.1) "The {content type} of the {base type * definition} must be a simple type definition from which * the {content type} is validly derived given the empty - * set as defined in Type Derivation OK (Simple) (§3.14.6)." + * set as defined in Type Derivation OK (Simple) (�3.14.6)." * * ATTENTION TODO: This seems not needed if the type implicitely * derived from the base type. - * + * */ err = xmlSchemaCheckCOSSTDerivedOK(ACTXT_CAST ctxt, type->contentTypeDef, base->contentTypeDef, 0); @@ -16382,8 +16384,8 @@ xmlSchemaCheckDerivationOKRestriction(xmlSchemaParserCtxtPtr ctxt, (xmlSchemaParticlePtr) base->subtypes))) { /* * SPEC (5.2.2.2) "The {base type definition} must be mixed - * and have a particle which is ·emptiable· as defined in - * Particle Emptiable (§3.9.6)." + * and have a particle which is �emptiable� as defined in + * Particle Emptiable (�3.9.6)." * PASS */ } else { @@ -16412,7 +16414,7 @@ xmlSchemaCheckDerivationOKRestriction(xmlSchemaParserCtxtPtr ctxt, /* * SPEC (5.3.2.2) "The {content type} of the {base type * definition} must be elementOnly or mixed and have a particle - * which is ·emptiable· as defined in Particle Emptiable (§3.9.6)." + * which is �emptiable� as defined in Particle Emptiable (�3.9.6)." * PASS */ } else { @@ -16429,7 +16431,7 @@ xmlSchemaCheckDerivationOKRestriction(xmlSchemaParserCtxtPtr ctxt, /* * SPEC (5.4.1.1) "The {content type} of the complex type definition * itself must be element-only" - */ + */ if (WXS_HAS_MIXED_CONTENT(type) && (! WXS_HAS_MIXED_CONTENT(base))) { /* * SPEC (5.4.1.2) "The {content type} of the complex type @@ -16445,9 +16447,9 @@ xmlSchemaCheckDerivationOKRestriction(xmlSchemaParserCtxtPtr ctxt, } /* * SPEC (5.4.2) "The particle of the complex type definition itself - * must be a ·valid restriction· of the particle of the {content + * must be a �valid restriction� of the particle of the {content * type} of the {base type definition} as defined in Particle Valid - * (Restriction) (§3.9.6). + * (Restriction) (�3.9.6). * * URGENT TODO: (5.4.2) */ @@ -16516,7 +16518,7 @@ xmlSchemaCheckSRCCT(xmlSchemaParserCtxtPtr ctxt, if (! WXS_HAS_SIMPLE_CONTENT(type)) { /* * 1 If the alternative is chosen, the type definition - * ·resolved· to by the ·actual value· of the base [attribute] + * �resolved� to by the �actual value� of the base [attribute] * must be a complex type definition; */ if (! WXS_IS_COMPLEX(base)) { @@ -16536,7 +16538,7 @@ xmlSchemaCheckSRCCT(xmlSchemaParserCtxtPtr ctxt, * SPEC * 2 If the alternative is chosen, all of the * following must be true: - * 2.1 The type definition ·resolved· to by the ·actual value· of the + * 2.1 The type definition �resolved� to by the �actual value� of the * base [attribute] must be one of the following: */ if (WXS_IS_SIMPLE(base)) { @@ -16586,11 +16588,11 @@ xmlSchemaCheckSRCCT(xmlSchemaParserCtxtPtr ctxt, if (! xmlSchemaIsParticleEmptiable( (xmlSchemaParticlePtr) base->subtypes)) { ret = XML_SCHEMAP_SRC_CT_1; - } else + } else /* * Attention: at this point the child is in * ->contentTypeDef (put there during parsing). - */ + */ if (type->contentTypeDef == NULL) { xmlChar *str = NULL; /* @@ -16642,14 +16644,14 @@ xmlSchemaCheckSRCCT(xmlSchemaParserCtxtPtr ctxt, /* * SPEC (3) "The corresponding complex type definition component must * satisfy the conditions set out in Constraints on Complex Type - * Definition Schema Components (§3.4.6);" + * Definition Schema Components (�3.4.6);" * NOTE (3) will be done in xmlSchemaTypeFixup(). */ /* * SPEC (4) If clause 2.2.1 or clause 2.2.2 in the correspondence specification * above for {attribute wildcard} is satisfied, the intensional * intersection must be expressible, as defined in Attribute Wildcard - * Intersection (§3.10.6). + * Intersection (�3.10.6). * NOTE (4) is done in xmlSchemaFixupTypeAttributeUses(). */ return (ret); @@ -16720,7 +16722,7 @@ xmlSchemaCheckRCaseNameAndTypeOK(xmlSchemaParserCtxtPtr ctxt, return (1); /* * SPEC (2) "R's occurrence range is a valid restriction of B's - * occurrence range as defined by Occurrence Range OK (§3.9.6)." + * occurrence range as defined by Occurrence Range OK (�3.9.6)." */ if (xmlSchemaCheckParticleRangeOK(r->minOccurs, r->maxOccurs, b->minOccurs, b->maxOccurs) != 0) @@ -16812,19 +16814,19 @@ xmlSchemaCheckRCaseNSCompat(xmlSchemaParserCtxtPtr ctxt, { /* TODO:Error codes (rcase-NSCompat). */ /* - * SPEC "For an element declaration particle to be a ·valid restriction· + * SPEC "For an element declaration particle to be a �valid restriction� * of a wildcard particle all of the following must be true:" * - * SPEC (1) "The element declaration's {target namespace} is ·valid· + * SPEC (1) "The element declaration's {target namespace} is �valid� * with respect to the wildcard's {namespace constraint} as defined by - * Wildcard allows Namespace Name (§3.10.4)." + * Wildcard allows Namespace Name (�3.10.4)." */ if (xmlSchemaCheckCVCWildcardNamespace((xmlSchemaWildcardPtr) b->children, ((xmlSchemaElementPtr) r->children)->targetNamespace) != 0) return (1); /* * SPEC (2) "R's occurrence range is a valid restriction of B's - * occurrence range as defined by Occurrence Range OK (§3.9.6)." + * occurrence range as defined by Occurrence Range OK (�3.9.6)." */ if (xmlSchemaCheckParticleRangeOK(r->minOccurs, r->maxOccurs, b->minOccurs, b->maxOccurs) != 0) @@ -16884,21 +16886,21 @@ xmlSchemaCheckRCaseNSSubset(xmlSchemaParserCtxtPtr ctxt, /* TODO: Error codes (rcase-NSSubset). */ /* * SPEC (1) "R's occurrence range is a valid restriction of B's - * occurrence range as defined by Occurrence Range OK (§3.9.6)." + * occurrence range as defined by Occurrence Range OK (�3.9.6)." */ if (xmlSchemaCheckParticleRangeOK(r->minOccurs, r->maxOccurs, b->minOccurs, b->maxOccurs)) return (1); /* * SPEC (2) "R's {namespace constraint} must be an intensional subset - * of B's {namespace constraint} as defined by Wildcard Subset (§3.10.6)." + * of B's {namespace constraint} as defined by Wildcard Subset (�3.10.6)." */ if (xmlSchemaCheckCOSNSSubset((xmlSchemaWildcardPtr) r->children, (xmlSchemaWildcardPtr) b->children)) return (1); /* - * SPEC (3) "Unless B is the content model wildcard of the ·ur-type - * definition·, R's {process contents} must be identical to or stronger + * SPEC (3) "Unless B is the content model wildcard of the �ur-type + * definition�, R's {process contents} must be identical to or stronger * than B's {process contents}, where strict is stronger than lax is * stronger than skip." */ @@ -16948,6 +16950,7 @@ xmlSchemaCheckCOSParticleRestrict(xmlSchemaParserCtxtPtr ctxt, return (0); } +#if 0 /** * xmlSchemaCheckRCaseNSRecurseCheckCardinality: * @ctxt: the schema parser context @@ -16975,12 +16978,12 @@ xmlSchemaCheckRCaseNSRecurseCheckCardinality(xmlSchemaParserCtxtPtr ctxt, if ((r->children == NULL) || (r->children->children == NULL)) return (-1); /* - * SPEC "For a group particle to be a ·valid restriction· of a + * SPEC "For a group particle to be a �valid restriction� of a * wildcard particle..." * - * SPEC (1) "Every member of the {particles} of the group is a ·valid - * restriction· of the wildcard as defined by - * Particle Valid (Restriction) (§3.9.6)." + * SPEC (1) "Every member of the {particles} of the group is a �valid + * restriction� of the wildcard as defined by + * Particle Valid (Restriction) (�3.9.6)." */ part = (xmlSchemaParticlePtr) r->children->children; do { @@ -16991,7 +16994,7 @@ xmlSchemaCheckRCaseNSRecurseCheckCardinality(xmlSchemaParserCtxtPtr ctxt, /* * SPEC (2) "The effective total range of the group [...] is a * valid restriction of B's occurrence range as defined by - * Occurrence Range OK (§3.9.6)." + * Occurrence Range OK (�3.9.6)." */ if (xmlSchemaCheckParticleRangeOK( xmlSchemaGetParticleTotalRangeMin(r), @@ -17000,6 +17003,7 @@ xmlSchemaCheckRCaseNSRecurseCheckCardinality(xmlSchemaParserCtxtPtr ctxt, return (1); return (0); } +#endif /** * xmlSchemaCheckRCaseRecurse: @@ -17030,11 +17034,11 @@ xmlSchemaCheckRCaseRecurse(xmlSchemaParserCtxtPtr ctxt, (r->children->type != b->children->type)) return (-1); /* - * SPEC "For an all or sequence group particle to be a ·valid - * restriction· of another group particle with the same {compositor}..." + * SPEC "For an all or sequence group particle to be a �valid + * restriction� of another group particle with the same {compositor}..." * * SPEC (1) "R's occurrence range is a valid restriction of B's - * occurrence range as defined by Occurrence Range OK (§3.9.6)." + * occurrence range as defined by Occurrence Range OK (�3.9.6)." */ if (xmlSchemaCheckParticleRangeOK(r->minOccurs, r->maxOccurs, b->minOccurs, b->maxOccurs)) @@ -17131,7 +17135,7 @@ xmlSchemaDeriveAndValidateFacets(xmlSchemaParserCtxtPtr pctxt, /* * SPEC st-restrict-facets 1: - * "The {variety} of R is the same as that of B." + * "The {variety} of R is the same as that of B." */ /* * SPEC st-restrict-facets 2: @@ -17603,7 +17607,7 @@ xmlSchemaDeriveAndValidateFacets(xmlSchemaParserCtxtPtr pctxt, * The whitespace must be stronger. */ if (facet->whitespace < bfacet->whitespace) { - FACET_RESTR_ERR(flength, + FACET_RESTR_ERR(facet, "The 'whitespace' value has to be equal to " "or stronger than the 'whitespace' value of " "the base type") @@ -17658,7 +17662,7 @@ xmlSchemaFinishMemberTypeDefinitionsProperty(xmlSchemaParserCtxtPtr pctxt, xmlSchemaTypeLinkPtr link, lastLink, prevLink, subLink, newLink; /* * The actual value is then formed by replacing any union type - * definition in the ·explicit members· with the members of their + * definition in the �explicit members� with the members of their * {member type definitions}, in order. * * TODO: There's a bug entry at @@ -17704,7 +17708,7 @@ xmlSchemaFinishMemberTypeDefinitionsProperty(xmlSchemaParserCtxtPtr pctxt, static void xmlSchemaTypeFixupOptimFacets(xmlSchemaTypePtr type) -{ +{ int has = 0, needVal = 0, normVal = 0; has = (type->baseType->flags & XML_SCHEMAS_TYPE_HAS_FACETS) ? 1 : 0; @@ -17716,7 +17720,7 @@ xmlSchemaTypeFixupOptimFacets(xmlSchemaTypePtr type) } if (type->facets != NULL) { xmlSchemaFacetPtr fac; - + for (fac = type->facets; fac != NULL; fac = fac->next) { switch (fac->type) { case XML_SCHEMA_FACET_WHITESPACE: @@ -17734,7 +17738,7 @@ xmlSchemaTypeFixupOptimFacets(xmlSchemaTypePtr type) has = 1; break; } - } + } } if (normVal) type->flags |= XML_SCHEMAS_TYPE_NORMVALUENEEDED; @@ -17751,24 +17755,24 @@ xmlSchemaTypeFixupOptimFacets(xmlSchemaTypePtr type) if ((prim->builtInType != XML_SCHEMAS_ANYSIMPLETYPE) && (prim->builtInType != XML_SCHEMAS_STRING)) { type->flags |= XML_SCHEMAS_TYPE_FACETSNEEDVALUE; - } - } + } + } } static int xmlSchemaTypeFixupWhitespace(xmlSchemaTypePtr type) { - - + + /* * Evaluate the whitespace-facet value. - */ + */ if (WXS_IS_LIST(type)) { type->flags |= XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE; return (0); } else if (WXS_IS_UNION(type)) return (0); - + if (type->facetSet != NULL) { xmlSchemaFacetLinkPtr lin; @@ -17792,23 +17796,23 @@ xmlSchemaTypeFixupWhitespace(xmlSchemaTypePtr type) } } /* - * For all ·atomic· datatypes other than string (and types ·derived· - * by ·restriction· from it) the value of whiteSpace is fixed to + * For all �atomic� datatypes other than string (and types �derived� + * by �restriction� from it) the value of whiteSpace is fixed to * collapse */ { xmlSchemaTypePtr anc; - for (anc = type->baseType; anc != NULL && + for (anc = type->baseType; anc != NULL && anc->builtInType != XML_SCHEMAS_ANYTYPE; anc = anc->baseType) { if (anc->type == XML_SCHEMA_TYPE_BASIC) { - if (anc->builtInType == XML_SCHEMAS_NORMSTRING) { + if (anc->builtInType == XML_SCHEMAS_NORMSTRING) { type->flags |= XML_SCHEMAS_TYPE_WHITESPACE_REPLACE; } else if ((anc->builtInType == XML_SCHEMAS_STRING) || - (anc->builtInType == XML_SCHEMAS_ANYSIMPLETYPE)) { + (anc->builtInType == XML_SCHEMAS_ANYSIMPLETYPE)) { type->flags |= XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE; } else @@ -17845,7 +17849,7 @@ xmlSchemaFixupSimpleTypeStageOne(xmlSchemaParserCtxtPtr pctxt, } else if (WXS_IS_UNION(type)) { /* * Corresponds to ... - */ + */ if (type->memberTypes == NULL) { /* * This one is really needed, so get out. @@ -17853,8 +17857,8 @@ xmlSchemaFixupSimpleTypeStageOne(xmlSchemaParserCtxtPtr pctxt, PERROR_INT("xmlSchemaFixupSimpleTypeStageOne", "union type has no member-types assigned"); return(-1); - } - } else { + } + } else { /* * Corresponds to ... */ @@ -17969,7 +17973,7 @@ xmlSchemaFixupSimpleTypeStageTwo(xmlSchemaParserCtxtPtr pctxt, } if (WXS_IS_TYPE_NOT_FIXED(type->baseType)) xmlSchemaTypeFixup(type->baseType, ACTXT_CAST pctxt); - /* + /* * If a member type of a union is a union itself, we need to substitute * that member type for its member types. * NOTE that this might change in WXS 1.1; i.e. we will keep the union @@ -17977,12 +17981,12 @@ xmlSchemaFixupSimpleTypeStageTwo(xmlSchemaParserCtxtPtr pctxt, */ if ((type->memberTypes != NULL) && (xmlSchemaFinishMemberTypeDefinitionsProperty(pctxt, type) == -1)) - return(-1); + return(-1); /* - * SPEC src-simple-type 1 + * SPEC src-simple-type 1 * "The corresponding simple type definition, if any, must satisfy * the conditions set out in Constraints on Simple Type Definition - * Schema Components (§3.14.6)." + * Schema Components (�3.14.6)." */ /* * Schema Component Constraint: Simple Type Definition Properties Correct @@ -17990,7 +17994,7 @@ xmlSchemaFixupSimpleTypeStageTwo(xmlSchemaParserCtxtPtr pctxt, */ res = xmlSchemaCheckSTPropsCorrect(pctxt, type); HFAILURE HERROR - /* + /* * Schema Component Constraint: Derivation Valid (Restriction, Simple) * (cos-st-restricts) */ @@ -18023,7 +18027,7 @@ xmlSchemaFixupSimpleTypeStageTwo(xmlSchemaParserCtxtPtr pctxt, */ res = xmlSchemaTypeFixupWhitespace(type); HFAILURE HERROR - xmlSchemaTypeFixupOptimFacets(type); + xmlSchemaTypeFixupOptimFacets(type); exit_error: #ifdef DEBUG_TYPE @@ -18054,7 +18058,7 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, PERROR_INT("xmlSchemaFixupComplexType", "missing baseType"); goto exit_failure; - } + } /* * Fixup the base type. */ @@ -18066,12 +18070,12 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, * TODO: Generate a warning! */ return(0); - } + } /* * This basically checks if the base type can be derived. */ res = xmlSchemaCheckSRCCT(pctxt, type); - HFAILURE HERROR + HFAILURE HERROR /* * Fixup the content type. */ @@ -18145,7 +18149,7 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, type->facets = NULL; content->facetSet = type->facetSet; type->facetSet = NULL; - + type->contentTypeDef = content; if (WXS_IS_TYPE_NOT_FIXED(contentBase)) xmlSchemaTypeFixup(contentBase, ACTXT_CAST pctxt); @@ -18154,10 +18158,10 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, * for circularity here. */ res = xmlSchemaFixupSimpleTypeStageOne(pctxt, content); - HFAILURE HERROR + HFAILURE HERROR res = xmlSchemaFixupSimpleTypeStageTwo(pctxt, content); - HFAILURE HERROR - + HFAILURE HERROR + } else if ((WXS_IS_COMPLEX(baseType)) && (baseType->contentType == XML_SCHEMA_CONTENT_MIXED) && (WXS_IS_RESTRICTION(type))) { @@ -18242,7 +18246,7 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, ( ((xmlSchemaTreeItemPtr) particle->children)->children == NULL))) { if (type->flags & XML_SCHEMAS_TYPE_MIXED) { /* - * SPEC (2.1.4) "If the ·effective mixed· is true, then + * SPEC (2.1.4) "If the �effective mixed� is true, then * a particle whose properties are as follows:..." * * Empty sequence model group with @@ -18267,7 +18271,7 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, XML_SCHEMA_TYPE_SEQUENCE, type->node); if (particle->children == NULL) goto exit_failure; - + type->subtypes = (xmlSchemaTypePtr) particle; } dummySequence = 1; @@ -18304,7 +18308,7 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, if (type->contentType == XML_SCHEMA_CONTENT_EMPTY) { /* * SPEC (3.2.1) - * "If the ·effective content· is empty, then the + * "If the �effective content� is empty, then the * {content type} of the [...] base ..." */ type->contentType = baseType->contentType; @@ -18411,7 +18415,7 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, particle->children = ((xmlSchemaParticlePtr) baseType->subtypes)->children; /* - * SPEC "followed by the ·effective content·." + * SPEC "followed by the �effective content�." */ particle->next = effectiveContent; /* @@ -18555,12 +18559,12 @@ xmlSchemaCheckFacet(xmlSchemaFacetPtr facet, /* 4.3.5.5 Constraints on enumeration Schema Components * Schema Component Constraint: enumeration valid restriction - * It is an ·error· if any member of {value} is not in the - * ·value space· of {base type definition}. + * It is an �error� if any member of {value} is not in the + * �value space� of {base type definition}. * * minInclusive, maxInclusive, minExclusive, maxExclusive: - * The value ·must· be in the - * ·value space· of the ·base type·. + * The value �must� be in the + * �value space� of the �base type�. */ /* * This function is intended to deliver a compiled value @@ -18580,11 +18584,11 @@ xmlSchemaCheckFacet(xmlSchemaFacetPtr facet, } } else base = typeDecl; - + if (! ctxtGiven) { /* * A context is needed if called from RelaxNG. - */ + */ pctxt = xmlSchemaNewParserCtxt("*"); if (pctxt == NULL) return (-1); @@ -18595,17 +18599,17 @@ xmlSchemaCheckFacet(xmlSchemaFacetPtr facet, * facet->node is just the node holding the facet * definition, *not* the attribute holding the *value* * of the facet. - */ + */ ret = xmlSchemaVCheckCVCSimpleType( ACTXT_CAST pctxt, facet->node, base, facet->value, &(facet->val), 1, 1, 0); if (ret != 0) { if (ret < 0) { /* No error message for RelaxNG. */ - if (ctxtGiven) { + if (ctxtGiven) { xmlSchemaCustomErr(ACTXT_CAST pctxt, XML_SCHEMAP_INTERNAL, facet->node, NULL, - "Internal error: xmlSchemaCheckFacet, " + "Internal error: xmlSchemaCheckFacet, " "failed to validate the value '%s' of the " "facet '%s' against the base type", facet->value, xmlSchemaFacetTypeToString(facet->type)); @@ -18680,17 +18684,17 @@ xmlSchemaCheckFacet(xmlSchemaFacetPtr facet, /* error code */ xmlSchemaCustomErr4(ACTXT_CAST pctxt, ret, facet->node, WXS_BASIC_CAST typeDecl, - "The value '%s' of the facet '%s' is not a valid '%s'", + "The value '%s' of the facet '%s' is not a valid '%s'", facet->value, xmlSchemaFacetTypeToString(facet->type), - (facet->type != XML_SCHEMA_FACET_TOTALDIGITS) ? + (facet->type != XML_SCHEMA_FACET_TOTALDIGITS) ? BAD_CAST "nonNegativeInteger" : BAD_CAST "positiveInteger", NULL); } } break; - + case XML_SCHEMA_FACET_WHITESPACE:{ if (xmlStrEqual(facet->value, BAD_CAST "preserve")) { facet->whitespace = XML_SCHEMAS_FACET_PRESERVE; @@ -18903,7 +18907,7 @@ xmlSchemaModelGroupToModelGroupDefFixup( { particle = WXS_PTC_CAST particle->next; continue; - } + } if (WXS_MODELGROUPDEF_MODEL(WXS_PARTICLE_TERM(particle)) == NULL) { /* * TODO: Remove the particle. @@ -18953,7 +18957,7 @@ xmlSchemaCheckAttrGroupCircularRecur(xmlSchemaAttributeGroupPtr ctxtGr, if (gr == ctxtGr) return(ref); if (gr->flags & XML_SCHEMAS_ATTRGROUP_MARKED) - continue; + continue; /* * Mark as visited to avoid infinite recursion on * circular references not yet examined. @@ -18963,12 +18967,12 @@ xmlSchemaCheckAttrGroupCircularRecur(xmlSchemaAttributeGroupPtr ctxtGr, { gr->flags |= XML_SCHEMAS_ATTRGROUP_MARKED; circ = xmlSchemaCheckAttrGroupCircularRecur(ctxtGr, - (xmlSchemaItemListPtr) gr->attrUses); + (xmlSchemaItemListPtr) gr->attrUses); gr->flags ^= XML_SCHEMAS_ATTRGROUP_MARKED; if (circ != NULL) return (circ); } - + } } return (NULL); @@ -18995,9 +18999,9 @@ xmlSchemaCheckAttrGroupCircular(xmlSchemaAttributeGroupPtr attrGr, * not be an with ref [attribute] which resolves * to the component corresponding to this . Indirect * circularity is also ruled out. That is, when QName resolution - * (Schema Document) (§3.15.3) is applied to a ·QName· arising from + * (Schema Document) (�3.15.3) is applied to a �QName� arising from * any s with a ref [attribute] among the [children], - * it must not be the case that a ·QName· is encountered at any depth + * it must not be the case that a �QName� is encountered at any depth * which resolves to the component corresponding to this . */ if (attrGr->attrUses == NULL) @@ -19006,9 +19010,9 @@ xmlSchemaCheckAttrGroupCircular(xmlSchemaAttributeGroupPtr attrGr, return(0); else { xmlSchemaQNameRefPtr circ; - + circ = xmlSchemaCheckAttrGroupCircularRecur(attrGr, - (xmlSchemaItemListPtr) attrGr->attrUses); + (xmlSchemaItemListPtr) attrGr->attrUses); if (circ != NULL) { xmlChar *str = NULL; /* @@ -19040,7 +19044,7 @@ xmlSchemaAttributeGroupExpandRefs(xmlSchemaParserCtxtPtr pctxt, * xmlSchemaExpandAttributeGroupRefs: * @pctxt: the parser context * @node: the node of the component holding the attribute uses - * @completeWild: the intersected wildcard to be returned + * @completeWild: the intersected wildcard to be returned * @list: the attribute uses * * Substitutes contained attribute group references @@ -19069,7 +19073,7 @@ xmlSchemaExpandAttributeGroupRefs(xmlSchemaParserCtxtPtr pctxt, for (i = 0; i < list->nbItems; i++) { use = list->items[i]; - if (use->type == XML_SCHEMA_EXTRA_ATTR_USE_PROHIB) { + if (use->type == XML_SCHEMA_EXTRA_ATTR_USE_PROHIB) { if (prohibs == NULL) { PERROR_INT("xmlSchemaExpandAttributeGroupRefs", "unexpected attr prohibition found"); @@ -19084,7 +19088,7 @@ xmlSchemaExpandAttributeGroupRefs(xmlSchemaParserCtxtPtr pctxt, /* * Note that duplicate prohibitions were already * handled at parsing time. - */ + */ /* * Add to list of prohibitions. */ @@ -19137,7 +19141,7 @@ xmlSchemaExpandAttributeGroupRefs(xmlSchemaParserCtxtPtr pctxt, *completeWild = tmpWild; created = 1; } - + if (xmlSchemaIntersectWildcards(pctxt, *completeWild, gr->attributeWildcard) == -1) return(-1); @@ -19211,7 +19215,7 @@ xmlSchemaExpandAttributeGroupRefs(xmlSchemaParserCtxtPtr pctxt, /** * xmlSchemaAttributeGroupExpandRefs: * @pctxt: the parser context - * @attrGr: the attribute group definition + * @attrGr: the attribute group definition * * Computation of: * {attribute uses} property @@ -19223,7 +19227,7 @@ xmlSchemaExpandAttributeGroupRefs(xmlSchemaParserCtxtPtr pctxt, static int xmlSchemaAttributeGroupExpandRefs(xmlSchemaParserCtxtPtr pctxt, xmlSchemaAttributeGroupPtr attrGr) -{ +{ if ((attrGr->attrUses == NULL) || (attrGr->flags & XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED)) return(0); @@ -19231,33 +19235,33 @@ xmlSchemaAttributeGroupExpandRefs(xmlSchemaParserCtxtPtr pctxt, attrGr->flags |= XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED; if (xmlSchemaExpandAttributeGroupRefs(pctxt, WXS_BASIC_CAST attrGr, &(attrGr->attributeWildcard), attrGr->attrUses, NULL) == -1) - return(-1); + return(-1); return(0); } /** * xmlSchemaAttributeGroupExpandRefs: * @pctxt: the parser context - * @attrGr: the attribute group definition + * @attrGr: the attribute group definition * * Substitutes contained attribute group references * for their attribute uses. Wilcards are intersected. - * + * * Schema Component Constraint: - * Attribute Group Definition Properties Correct (ag-props-correct) + * Attribute Group Definition Properties Correct (ag-props-correct) */ static int xmlSchemaCheckAGPropsCorrect(xmlSchemaParserCtxtPtr pctxt, xmlSchemaAttributeGroupPtr attrGr) -{ +{ /* * SPEC ag-props-correct * (1) "The values of the properties of an attribute group definition * must be as described in the property tableau in The Attribute - * Group Definition Schema Component (§3.6.1), modulo the impact of - * Missing Sub-components (§5.3);" + * Group Definition Schema Component (�3.6.1), modulo the impact of + * Missing Sub-components (�5.3);" */ - + if ((attrGr->attrUses != NULL) && (WXS_LIST_CAST attrGr->attrUses)->nbItems > 1) { @@ -19266,7 +19270,7 @@ xmlSchemaCheckAGPropsCorrect(xmlSchemaParserCtxtPtr pctxt, int i, j, hasId = 0; for (i = uses->nbItems -1; i >= 0; i--) { - use = uses->items[i]; + use = uses->items[i]; /* * SPEC ag-props-correct * (2) "Two distinct members of the {attribute uses} must not have @@ -19282,7 +19286,7 @@ xmlSchemaCheckAGPropsCorrect(xmlSchemaParserCtxtPtr pctxt, WXS_ATTRUSE_DECL_TNS(tmp))) { xmlChar *str = NULL; - + xmlSchemaCustomErr(ACTXT_CAST pctxt, XML_SCHEMAP_AG_PROPS_CORRECT, attrGr->node, WXS_BASIC_CAST attrGr, @@ -19306,13 +19310,13 @@ xmlSchemaCheckAGPropsCorrect(xmlSchemaParserCtxtPtr pctxt, * are derived from ID." * TODO: Does 'derived' include member-types of unions? */ - if (WXS_ATTRUSE_TYPEDEF(use) != NULL) { + if (WXS_ATTRUSE_TYPEDEF(use) != NULL) { if (xmlSchemaIsDerivedFromBuiltInType( WXS_ATTRUSE_TYPEDEF(use), XML_SCHEMAS_ID)) - { + { if (hasId) { xmlChar *str = NULL; - + xmlSchemaCustomErr(ACTXT_CAST pctxt, XML_SCHEMAP_AG_PROPS_CORRECT, attrGr->node, WXS_BASIC_CAST attrGr, @@ -19325,7 +19329,7 @@ xmlSchemaCheckAGPropsCorrect(xmlSchemaParserCtxtPtr pctxt, FREE_AND_NULL(str); if (xmlSchemaItemListRemove(uses, i) == -1) return(-1); - } + } hasId = 1; } } @@ -19389,10 +19393,10 @@ xmlSchemaCheckAttrPropsCorrect(xmlSchemaParserCtxtPtr pctxt, * SPEC a-props-correct (1) * "The values of the properties of an attribute declaration must * be as described in the property tableau in The Attribute - * Declaration Schema Component (§3.2.1), modulo the impact of - * Missing Sub-components (§5.3)." + * Declaration Schema Component (�3.2.1), modulo the impact of + * Missing Sub-components (�5.3)." */ - + if (WXS_ATTR_TYPEDEF(attr) == NULL) return(0); @@ -19418,8 +19422,8 @@ xmlSchemaCheckAttrPropsCorrect(xmlSchemaParserCtxtPtr pctxt, /* * SPEC a-props-correct (2) * "if there is a {value constraint}, the canonical lexical - * representation of its value must be ·valid· with respect - * to the {type definition} as defined in String Valid (§3.14.4)." + * representation of its value must be �valid� with respect + * to the {type definition} as defined in String Valid (�3.14.4)." * TODO: Don't care about the *cononical* stuff here, this requirement * will be removed in WXS 1.1 anyway. */ @@ -19441,7 +19445,7 @@ xmlSchemaCheckAttrPropsCorrect(xmlSchemaParserCtxtPtr pctxt, return(pctxt->err); } } - + return(0); } @@ -19487,15 +19491,15 @@ xmlSchemaCheckElemPropsCorrect(xmlSchemaParserCtxtPtr pctxt, /* * SPEC (1) "The values of the properties of an element declaration * must be as described in the property tableau in The Element - * Declaration Schema Component (§3.3.1), modulo the impact of Missing - * Sub-components (§5.3)." + * Declaration Schema Component (�3.3.1), modulo the impact of Missing + * Sub-components (�5.3)." */ if (WXS_SUBST_HEAD(elemDecl) != NULL) { xmlSchemaElementPtr head = WXS_SUBST_HEAD(elemDecl), circ; xmlSchemaCheckElementDeclComponent(head, pctxt); /* - * SPEC (3) "If there is a non-·absent· {substitution group + * SPEC (3) "If there is a non-�absent� {substitution group * affiliation}, then {scope} must be global." */ if ((elemDecl->flags & XML_SCHEMAS_ELEM_GLOBAL) == 0) { @@ -19539,9 +19543,9 @@ xmlSchemaCheckElemPropsCorrect(xmlSchemaParserCtxtPtr pctxt, * of the element declaration must be validly derived from the {type * definition} of the {substitution group affiliation}, given the value * of the {substitution group exclusions} of the {substitution group - * affiliation}, as defined in Type Derivation OK (Complex) (§3.4.6) + * affiliation}, as defined in Type Derivation OK (Complex) (�3.4.6) * (if the {type definition} is complex) or as defined in - * Type Derivation OK (Simple) (§3.14.6) (if the {type definition} is + * Type Derivation OK (Simple) (�3.14.6) (if the {type definition} is * simple)." * * NOTE: {substitution group exclusions} means the values of the @@ -19605,9 +19609,9 @@ xmlSchemaCheckElemPropsCorrect(xmlSchemaParserCtxtPtr pctxt, /* * SPEC (2) "If there is a {value constraint}, the canonical lexical - * representation of its value must be ·valid· with respect to the + * representation of its value must be �valid� with respect to the * {type definition} as defined in Element Default Valid (Immediate) - * (§3.3.6)." + * (�3.3.6)." */ if (typeDef == NULL) { xmlSchemaPErr(pctxt, elemDecl->node, @@ -19675,7 +19679,7 @@ xmlSchemaCheckElemSubstGroup(xmlSchemaParserCtxtPtr ctxt, /* * SPEC (2) "It is validly substitutable for HEAD subject to HEAD's * {disallowed substitutions} as the blocking constraint, as defined in - * Substitution Group OK (Transitive) (§3.3.6)." + * Substitution Group OK (Transitive) (�3.3.6)." */ for (head = WXS_SUBST_HEAD(elemDecl); head != NULL; head = WXS_SUBST_HEAD(head)) { @@ -19767,12 +19771,12 @@ add_member: * @ctxtParticle: the first particle of the context component * @searchParticle: the element declaration particle to be analysed * - * Schema Component Constraint: Element Declarations Consistent + * Schema Component Constraint: Element Declarations Consistent */ static int xmlSchemaCheckElementDeclConsistent(xmlSchemaParserCtxtPtr pctxt, xmlSchemaBasicItemPtr ctxtComponent, - xmlSchemaParticlePtr ctxtParticle, + xmlSchemaParticlePtr ctxtParticle, xmlSchemaParticlePtr searchParticle, xmlSchemaParticlePtr curParticle, int search) @@ -19781,7 +19785,7 @@ xmlSchemaCheckElementDeclConsistent(xmlSchemaParserCtxtPtr pctxt, int ret = 0; xmlSchemaParticlePtr cur = curParticle; - if (curParticle == NULL) { + if (curParticle == NULL) { return(0); } if (WXS_PARTICLE_TERM(curParticle) == NULL) { @@ -19790,7 +19794,7 @@ xmlSchemaCheckElementDeclConsistent(xmlSchemaParserCtxtPtr pctxt, * might arise due to an invalid "term" component. */ return(0); - } + } while (cur != NULL) { switch (WXS_PARTICLE_TERM(cur)->type) { case XML_SCHEMA_TYPE_ANY: @@ -19800,7 +19804,7 @@ xmlSchemaCheckElementDeclConsistent(xmlSchemaParserCtxtPtr pctxt, ret = xmlSchemaCheckElementDeclConsistent(pctxt, ctxtComponent, ctxtParticle, cur, ctxtParticle, 1); if (ret != 0) - return(ret); + return(ret); } else { xmlSchemaElementPtr elem = WXS_ELEM_CAST(WXS_PARTICLE_TERM(cur)); @@ -19808,7 +19812,7 @@ xmlSchemaCheckElementDeclConsistent(xmlSchemaParserCtxtPtr pctxt, * SPEC Element Declarations Consistent: * "If the {particles} contains, either directly, * indirectly (that is, within the {particles} of a - * contained model group, recursively) or ·implicitly· + * contained model group, recursively) or �implicitly� * two or more element declaration particles with * the same {name} and {target namespace}, then * all their type definitions must be the same @@ -19820,7 +19824,7 @@ xmlSchemaCheckElementDeclConsistent(xmlSchemaParserCtxtPtr pctxt, WXS_PARTICLE_TERM_AS_ELEM(searchParticle)->targetNamespace)) { xmlChar *strA = NULL, *strB = NULL; - + xmlSchemaCustomErr(ACTXT_CAST pctxt, /* TODO: error code */ XML_SCHEMAP_COS_NONAMBIG, @@ -19837,16 +19841,16 @@ xmlSchemaCheckElementDeclConsistent(xmlSchemaParserCtxtPtr pctxt, FREE_AND_NULL(strB); return(XML_SCHEMAP_COS_NONAMBIG); } - } + } break; - case XML_SCHEMA_TYPE_SEQUENCE: { + case XML_SCHEMA_TYPE_SEQUENCE: { break; } case XML_SCHEMA_TYPE_CHOICE:{ /* xmlSchemaTreeItemPtr sub; - - sub = WXS_PARTICLE_TERM(particle)->children; (xmlSchemaParticlePtr) + + sub = WXS_PARTICLE_TERM(particle)->children; (xmlSchemaParticlePtr) while (sub != NULL) { ret = xmlSchemaCheckElementDeclConsistent(pctxt, ctxtComponent, ctxtParticle, ctxtElem); @@ -19883,7 +19887,7 @@ exit: * @name: the name of the attribute * * Validates the value constraints of an element declaration. - * Adds substitution group members. + * Adds substitution group members. */ static void xmlSchemaCheckElementDeclComponent(xmlSchemaElementPtr elemDecl, @@ -19898,7 +19902,7 @@ xmlSchemaCheckElementDeclComponent(xmlSchemaElementPtr elemDecl, /* * Adds substitution group members. */ - xmlSchemaCheckElemSubstGroup(ctxt, elemDecl); + xmlSchemaCheckElemSubstGroup(ctxt, elemDecl); } } @@ -19928,7 +19932,7 @@ xmlSchemaResolveModelGroupParticleReferences( XML_SCHEMA_EXTRA_QNAMEREF)) { goto next_particle; - } + } ref = WXS_QNAME_CAST WXS_PARTICLE_TERM(particle); /* * Resolve the reference. @@ -19944,7 +19948,7 @@ xmlSchemaResolveModelGroupParticleReferences( ref->targetNamespace, ref->itemType, NULL); /* TODO: remove the particle. */ goto next_particle; - } + } if (refItem->type == XML_SCHEMA_TYPE_GROUP) { if (WXS_MODELGROUPDEF_MODEL(refItem) == NULL) /* TODO: remove the particle. */ @@ -19994,9 +19998,9 @@ next_particle: static int xmlSchemaAreValuesEqual(xmlSchemaValPtr x, - xmlSchemaValPtr y) -{ - xmlSchemaTypePtr tx, ty, ptx, pty; + xmlSchemaValPtr y) +{ + xmlSchemaTypePtr tx, ty, ptx, pty; int ret; while (x != NULL) { @@ -20006,12 +20010,12 @@ xmlSchemaAreValuesEqual(xmlSchemaValPtr x, ptx = xmlSchemaGetPrimitiveType(tx); pty = xmlSchemaGetPrimitiveType(ty); /* - * (1) if a datatype T' is ·derived· by ·restriction· from an - * atomic datatype T then the ·value space· of T' is a subset of - * the ·value space· of T. */ + * (1) if a datatype T' is �derived� by �restriction� from an + * atomic datatype T then the �value space� of T' is a subset of + * the �value space� of T. */ /* - * (2) if datatypes T' and T'' are ·derived· by ·restriction· - * from a common atomic ancestor T then the ·value space·s of T' + * (2) if datatypes T' and T'' are �derived� by �restriction� + * from a common atomic ancestor T then the �value space�s of T' * and T'' may overlap. */ if (ptx != pty) @@ -20042,7 +20046,7 @@ xmlSchemaAreValuesEqual(xmlSchemaValPtr x, if (x != NULL) { y = xmlSchemaValueGetNext(y); if (y == NULL) - return (0); + return (0); } else if (xmlSchemaValueGetNext(y) != NULL) return (0); else @@ -20092,11 +20096,11 @@ xmlSchemaResolveAttrUseReferences(xmlSchemaAttributeUsePtr ause, /** * xmlSchemaCheckAttrUsePropsCorrect: * @ctxt: a parser context - * @use: an attribute use + * @use: an attribute use * * Schema Component Constraint: * Attribute Use Correct (au-props-correct) - * + * */ static int xmlSchemaCheckAttrUsePropsCorrect(xmlSchemaParserCtxtPtr ctxt, @@ -20106,16 +20110,16 @@ xmlSchemaCheckAttrUsePropsCorrect(xmlSchemaParserCtxtPtr ctxt, return(-1); if ((use->defValue == NULL) || (WXS_ATTRUSE_DECL(use) == NULL) || ((WXS_ATTRUSE_DECL(use))->type != XML_SCHEMA_TYPE_ATTRIBUTE)) - return(0); + return(0); /* * SPEC au-props-correct (1) * "The values of the properties of an attribute use must be as * described in the property tableau in The Attribute Use Schema - * Component (§3.5.1), modulo the impact of Missing - * Sub-components (§5.3)." + * Component (�3.5.1), modulo the impact of Missing + * Sub-components (�5.3)." */ - + if (((WXS_ATTRUSE_DECL(use))->defValue != NULL) && ((WXS_ATTRUSE_DECL(use))->flags & XML_SCHEMAS_ATTR_FIXED) && ((use->flags & XML_SCHEMA_ATTR_USE_FIXED) == 0)) @@ -20135,7 +20139,7 @@ xmlSchemaCheckAttrUsePropsCorrect(xmlSchemaParserCtxtPtr ctxt, if ((use->defVal != NULL) && (WXS_ATTRUSE_TYPEDEF(use) != NULL)) { int ret; /* - * TODO: The spec seems to be missing a check of the + * TODO: The spec seems to be missing a check of the * value constraint of the attribute use. We will do it here. */ /* @@ -20152,7 +20156,7 @@ xmlSchemaCheckAttrUsePropsCorrect(xmlSchemaParserCtxtPtr ctxt, NULL, NULL); return(ctxt->err); } - + ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST ctxt, use->node, WXS_ATTRUSE_TYPEDEF(use), use->defValue, &(use->defVal), @@ -20203,7 +20207,7 @@ xmlSchemaCheckAttrUsePropsCorrect(xmlSchemaParserCtxtPtr ctxt, /** * xmlSchemaResolveAttrTypeReferences: * @item: an attribute declaration - * @ctxt: a parser context + * @ctxt: a parser context * * Resolves the referenced type definition component. */ @@ -20214,8 +20218,8 @@ xmlSchemaResolveAttrTypeReferences(xmlSchemaAttributePtr item, /* * The simple type definition corresponding to the element * information item in the [children], if present, otherwise the simple - * type definition ·resolved· to by the ·actual value· of the type - * [attribute], if present, otherwise the ·simple ur-type definition·. + * type definition �resolved� to by the �actual value� of the type + * [attribute], if present, otherwise the �simple ur-type definition�. */ if (item->flags & XML_SCHEMAS_ATTR_INTERNAL_RESOLVED) return(0); @@ -20294,7 +20298,7 @@ xmlSchemaResolveIDCKeyReferences(xmlSchemaIDCPtr idc, ((xmlSchemaIDCPtr) idc->ref->item)->nbFields) { xmlChar *str = NULL; xmlSchemaIDCPtr refer; - + refer = (xmlSchemaIDCPtr) idc->ref->item; /* * SPEC c-props-correct(2) @@ -20353,7 +20357,7 @@ xmlSchemaCheckSRCRedefineFirst(xmlSchemaParserCtxtPtr pctxt) int wasRedefined; if (redef == NULL) - return(0); + return(0); do { item = redef->item; @@ -20368,7 +20372,7 @@ xmlSchemaCheckSRCRedefineFirst(xmlSchemaParserCtxtPtr pctxt) * d schema. Currenlty we latter approach is used. * SUPPLEMENT: It seems that the WG moves towards the latter * approach, so we are doing it right. - * + * */ prev = xmlSchemaFindRedefCompInGraph( redef->targetBucket, item->type, @@ -20379,11 +20383,11 @@ xmlSchemaCheckSRCRedefineFirst(xmlSchemaParserCtxtPtr pctxt) /* * SPEC src-redefine: - * (6.2.1) "The ·actual value· of its own name attribute plus - * target namespace must successfully ·resolve· to a model + * (6.2.1) "The �actual value� of its own name attribute plus + * target namespace must successfully �resolve� to a model * group definition in I." - * (7.2.1) "The ·actual value· of its own name attribute plus - * target namespace must successfully ·resolve· to an attribute + * (7.2.1) "The �actual value� of its own name attribute plus + * target namespace must successfully �resolve� to an attribute * group definition in I." * @@ -20400,7 +20404,7 @@ xmlSchemaCheckSRCRedefineFirst(xmlSchemaParserCtxtPtr pctxt) /* * TODO: error code. * Probably XML_SCHEMAP_SRC_RESOLVE, if this is using the - * reference kind. + * reference kind. */ XML_SCHEMAP_SRC_REDEFINE, node, NULL, "The %s '%s' to be redefined could not be found in " @@ -20408,7 +20412,7 @@ xmlSchemaCheckSRCRedefineFirst(xmlSchemaParserCtxtPtr pctxt) WXS_ITEM_TYPE_NAME(item), xmlSchemaFormatQName(&str, redef->refTargetNs, redef->refName)); - FREE_AND_NULL(str); + FREE_AND_NULL(str); err = pctxt->err; redef = redef->next; continue; @@ -20434,7 +20438,7 @@ xmlSchemaCheckSRCRedefineFirst(xmlSchemaParserCtxtPtr pctxt) * base type of the redefining type. * TODO: How */ - ((xmlSchemaTypePtr) item)->baseType = + ((xmlSchemaTypePtr) item)->baseType = (xmlSchemaTypePtr) prev; break; case XML_SCHEMA_TYPE_GROUP: @@ -20489,7 +20493,7 @@ xmlSchemaCheckSRCRedefineFirst(xmlSchemaParserCtxtPtr pctxt) default: PERROR_INT("xmlSchemaResolveRedefReferences", "Unexpected redefined component type"); - return(-1); + return(-1); } if (wasRedefined) { xmlChar *str = NULL; @@ -20499,7 +20503,7 @@ xmlSchemaCheckSRCRedefineFirst(xmlSchemaParserCtxtPtr pctxt) node = WXS_ITEM_NODE(redef->reference); else node = WXS_ITEM_NODE(redef->item); - + xmlSchemaCustomErr(ACTXT_CAST pctxt, /* TODO: error code. */ XML_SCHEMAP_SRC_REDEFINE, @@ -20508,12 +20512,12 @@ xmlSchemaCheckSRCRedefineFirst(xmlSchemaParserCtxtPtr pctxt) "redefinition of the same component is not supported", xmlSchemaGetComponentDesignation(&str, prev), NULL); - FREE_AND_NULL(str) + FREE_AND_NULL(str) err = pctxt->err; redef = redef->next; continue; } - redef = redef->next; + redef = redef->next; } while (redef != NULL); return(err); @@ -20527,7 +20531,7 @@ xmlSchemaCheckSRCRedefineSecond(xmlSchemaParserCtxtPtr pctxt) xmlSchemaBasicItemPtr item; if (redef == NULL) - return(0); + return(0); do { if (redef->target == NULL) { @@ -20535,7 +20539,7 @@ xmlSchemaCheckSRCRedefineSecond(xmlSchemaParserCtxtPtr pctxt) continue; } item = redef->item; - + switch (item->type) { case XML_SCHEMA_TYPE_SIMPLE: case XML_SCHEMA_TYPE_COMPLEX: @@ -20544,7 +20548,7 @@ xmlSchemaCheckSRCRedefineSecond(xmlSchemaParserCtxtPtr pctxt) * type to be 'absent', we'll NULL it. */ (WXS_TYPE_CAST redef->target)->name = NULL; - + /* * TODO: Seems like there's nothing more to do. The normal * inheritance mechanism is used. But not 100% sure. @@ -20556,10 +20560,10 @@ xmlSchemaCheckSRCRedefineSecond(xmlSchemaParserCtxtPtr pctxt) * SPEC src-redefine: * (6.2.2) "The {model group} of the model group definition * which corresponds to it per XML Representation of Model - * Group Definition Schema Components (§3.7.2) must be a - * ·valid restriction· of the {model group} of that model + * Group Definition Schema Components (�3.7.2) must be a + * �valid restriction� of the {model group} of that model * group definition in I, as defined in Particle Valid - * (Restriction) (§3.9.6)." + * (Restriction) (�3.9.6)." */ break; case XML_SCHEMA_TYPE_ATTRIBUTEGROUP: @@ -20568,11 +20572,11 @@ xmlSchemaCheckSRCRedefineSecond(xmlSchemaParserCtxtPtr pctxt) * (7.2.2) "The {attribute uses} and {attribute wildcard} of * the attribute group definition which corresponds to it * per XML Representation of Attribute Group Definition Schema - * Components (§3.6.2) must be ·valid restrictions· of the + * Components (�3.6.2) must be �valid restrictions� of the * {attribute uses} and {attribute wildcard} of that attribute * group definition in I, as defined in clause 2, clause 3 and * clause 4 of Derivation Valid (Restriction, Complex) - * (§3.4.6) (where references to the base type definition are + * (�3.4.6) (where references to the base type definition are * understood as references to the attribute group definition * in I)." */ @@ -20593,7 +20597,7 @@ xmlSchemaCheckSRCRedefineSecond(xmlSchemaParserCtxtPtr pctxt) } while (redef != NULL); return(0); } - + static int xmlSchemaAddComponents(xmlSchemaParserCtxtPtr pctxt, @@ -20627,8 +20631,8 @@ xmlSchemaAddComponents(xmlSchemaParserCtxtPtr pctxt, return(-1); if (bucket->flags & XML_SCHEMA_BUCKET_COMPS_ADDED) return(0); - bucket->flags |= XML_SCHEMA_BUCKET_COMPS_ADDED; - + bucket->flags |= XML_SCHEMA_BUCKET_COMPS_ADDED; + for (i = 0; i < bucket->globals->nbItems; i++) { item = bucket->globals->items[i]; table = NULL; @@ -20669,12 +20673,12 @@ xmlSchemaAddComponents(xmlSchemaParserCtxtPtr pctxt, case XML_SCHEMA_TYPE_NOTATION: name = ((xmlSchemaNotationPtr) item)->name; WXS_GET_GLOBAL_HASH(bucket, notaDecl) - break; + break; default: PERROR_INT("xmlSchemaAddComponents", "Unexpected global component type"); - continue; - } + continue; + } if (*table == NULL) { *table = xmlHashCreateDict(10, pctxt->dict); if (*table == NULL) { @@ -20682,11 +20686,11 @@ xmlSchemaAddComponents(xmlSchemaParserCtxtPtr pctxt, "failed to create a component hash table"); return(-1); } - } + } err = xmlHashAddEntry(*table, name, item); - if (err != 0) { + if (err != 0) { xmlChar *str = NULL; - + xmlSchemaCustomErr(ACTXT_CAST pctxt, XML_SCHEMAP_REDEFINED_TYPE, WXS_ITEM_NODE(item), @@ -20694,7 +20698,7 @@ xmlSchemaAddComponents(xmlSchemaParserCtxtPtr pctxt, "A global %s '%s' does already exist", WXS_ITEM_TYPE_NAME(item), xmlSchemaGetComponentQName(&str, item)); - FREE_AND_NULL(str); + FREE_AND_NULL(str); } } /* @@ -20728,34 +20732,34 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, if ((con->pending == NULL) || (con->pending->nbItems == 0)) - return(0); + return(0); /* * Since xmlSchemaFixupComplexType() will create new particles * (local components), and those particle components need a bucket * on the constructor, we'll assure here that the constructor has * a bucket. - * TODO: Think about storing locals _only_ on the main bucket. - */ + * TODO: Think about storing locals _only_ on the main bucket. + */ if (con->bucket == NULL) - con->bucket = rootBucket; + con->bucket = rootBucket; /* TODO: * SPEC (src-redefine): * (6.2) "If it has no such self-reference, then all of the * following must be true:" - + * (6.2.2) The {model group} of the model group definition which * corresponds to it per XML Representation of Model Group - * Definition Schema Components (§3.7.2) must be a ·valid - * restriction· of the {model group} of that model group definition - * in I, as defined in Particle Valid (Restriction) (§3.9.6)." + * Definition Schema Components (�3.7.2) must be a �valid + * restriction� of the {model group} of that model group definition + * in I, as defined in Particle Valid (Restriction) (�3.9.6)." */ xmlSchemaCheckSRCRedefineFirst(pctxt); /* * Add global components to the schemata's hash tables. - */ + */ xmlSchemaAddComponents(pctxt, rootBucket); pctxt->ctxtType = NULL; @@ -20765,7 +20769,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, * Now that we have parsed *all* the schema document(s) and converted * them to schema components, we can resolve references, apply component * constraints, create the FSA from the content model, etc. - */ + */ /* * Resolve references of.. * @@ -20786,7 +20790,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, * 6. IDC key-references: * - the referenced IDC 'key' or 'unique' definition * 7. Attribute prohibitions which had a "ref" attribute. - */ + */ for (i = 0; i < nbItems; i++) { item = items[i]; switch (item->type) { @@ -20812,7 +20816,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, FIXHFAILURE; break; case XML_SCHEMA_EXTRA_QNAMEREF: - if ((WXS_QNAME_CAST item)->itemType == + if ((WXS_QNAME_CAST item)->itemType == XML_SCHEMA_TYPE_ATTRIBUTEGROUP) { xmlSchemaResolveAttrGroupReferences( @@ -20849,11 +20853,11 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, } if (pctxt->nberrors != 0) goto exit_error; - + /* * Now that all references are resolved we * can check for circularity of... - * 1. the base axis of type definitions + * 1. the base axis of type definitions * 2. nested model group definitions * 3. nested attribute group definitions * TODO: check for circual substitution groups. @@ -20888,7 +20892,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, break; default: break; - } + } } if (pctxt->nberrors != 0) goto exit_error; @@ -20904,7 +20908,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, item = items[i]; switch (item->type) { case XML_SCHEMA_TYPE_SEQUENCE: - case XML_SCHEMA_TYPE_CHOICE: + case XML_SCHEMA_TYPE_CHOICE: xmlSchemaModelGroupToModelGroupDefFixup(pctxt, WXS_MODEL_GROUP_CAST item); break; @@ -20935,7 +20939,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, } if (pctxt->nberrors != 0) goto exit_error; - /* + /* * First compute the variety of simple types. This is needed as * a seperate step, since otherwise we won't be able to detect * circular union types in all cases. @@ -20965,7 +20969,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, switch (item->type) { case XML_SCHEMA_TYPE_SIMPLE: if (((xmlSchemaTypePtr) item)->memberTypes != NULL) { - xmlSchemaCheckUnionTypeDefCircular(pctxt, + xmlSchemaCheckUnionTypeDefCircular(pctxt, (xmlSchemaTypePtr) item); FIXHFAILURE; } @@ -20976,7 +20980,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, } if (pctxt->nberrors != 0) goto exit_error; - + /* * Do the complete type fixup for simple types. */ @@ -21004,10 +21008,10 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, for (i = 0; i < nbItems; i++) { item = items[i]; switch (item->type) { - case XML_SCHEMA_TYPE_ATTRIBUTE: + case XML_SCHEMA_TYPE_ATTRIBUTE: xmlSchemaCheckAttrPropsCorrect(pctxt, WXS_ATTR_CAST item); FIXHFAILURE; - break; + break; default: break; } @@ -21016,7 +21020,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, goto exit_error; /* * Apply constraints for attribute uses. - */ + */ for (i = 0; i < nbItems; i++) { item = items[i]; switch (item->type) { @@ -21063,7 +21067,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, if (pctxt->nberrors != 0) goto exit_error; - /* + /* * Complex types are builded and checked. */ for (i = 0; i < nbItems; i++) { @@ -21087,8 +21091,8 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, * will create particles and model groups in some cases. */ items = (xmlSchemaTreeItemPtr *) con->pending->items; - nbItems = con->pending->nbItems; - + nbItems = con->pending->nbItems; + /* * Apply some constraints for element declarations. */ @@ -21097,7 +21101,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, switch (item->type) { case XML_SCHEMA_TYPE_ELEMENT: elemDecl = (xmlSchemaElementPtr) item; - + if ((elemDecl->flags & XML_SCHEMAS_ELEM_INTERNAL_CHECKED) == 0) { xmlSchemaCheckElementDeclComponent( @@ -21127,7 +21131,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, } if (pctxt->nberrors != 0) goto exit_error; - + /* * Finally we can build the automaton from the content model of * complex types. @@ -21148,10 +21152,10 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, goto exit_error; /* * URGENT TODO: cos-element-consistent - */ - goto exit; + */ + goto exit; -exit_error: +exit_error: ret = pctxt->err; goto exit; @@ -21165,12 +21169,12 @@ exit: * if not cleared here. */ con->bucket = oldbucket; - con->pending->nbItems = 0; + con->pending->nbItems = 0; if (con->substGroups != NULL) { xmlHashFree(con->substGroups, (xmlHashDeallocator) xmlSchemaSubstGroupFree); con->substGroups = NULL; - } + } if (con->redefs != NULL) { xmlSchemaRedefListFree(con->redefs); con->redefs = NULL; @@ -21233,11 +21237,11 @@ xmlSchemaParse(xmlSchemaParserCtxtPtr ctxt) if (res == -1) goto exit_failure; if (res != 0) - goto exit; + goto exit; if (bucket == NULL) { /* TODO: Error code, actually we failed to *locate* the schema. */ - if (ctxt->URL) + if (ctxt->URL) xmlSchemaCustomErr(ACTXT_CAST ctxt, XML_SCHEMAP_FAILED_LOAD, NULL, NULL, "Failed to locate the main schema resource at '%s'", @@ -21248,16 +21252,16 @@ xmlSchemaParse(xmlSchemaParserCtxtPtr ctxt) "Failed to locate the main schema resource", NULL, NULL); goto exit; - } + } /* Then do the parsing for good. */ if (xmlSchemaParseNewDocWithContext(ctxt, mainSchema, bucket) == -1) goto exit_failure; if (ctxt->nberrors != 0) goto exit; - + mainSchema->doc = bucket->doc; mainSchema->preserve = ctxt->preserve; - + ctxt->schema = mainSchema; if (xmlSchemaFixupComponents(ctxt, WXS_CONSTRUCTOR(ctxt)->mainBucket) == -1) @@ -21267,8 +21271,8 @@ xmlSchemaParse(xmlSchemaParserCtxtPtr ctxt) * TODO: This is not nice, since we cannot distinguish from the * result if there was an internal error or not. */ -exit: - if (ctxt->nberrors != 0) { +exit: + if (ctxt->nberrors != 0) { if (mainSchema) { xmlSchemaFree(mainSchema); mainSchema = NULL; @@ -21282,7 +21286,7 @@ exit: ctxt->schema = NULL; return(mainSchema); exit_failure: - /* + /* * Quite verbose, but should catch internal errors, which were * not communitated. */ @@ -21296,7 +21300,7 @@ exit_failure: ctxt->ownsConstructor = 0; } PERROR_INT2("xmlSchemaParse", - "An internal error occured"); + "An internal error occured"); ctxt->schema = NULL; return(NULL); } @@ -21433,8 +21437,8 @@ xmlSchemaGetWhiteSpaceFacetValue(xmlSchemaTypePtr type) return(XML_SCHEMA_WHITESPACE_REPLACE); else { /* - * For all ·atomic· datatypes other than string (and types ·derived· - * by ·restriction· from it) the value of whiteSpace is fixed to + * For all �atomic� datatypes other than string (and types �derived� + * by �restriction� from it) the value of whiteSpace is fixed to * collapse * Note that this includes built-in list datatypes. */ @@ -21521,11 +21525,11 @@ xmlSchemaAssembleByLocation(xmlSchemaValidCtxtPtr vctxt, * XML_SCHEMA_SCHEMA_MAIN if it is the first schema document. */ ret = xmlSchemaAddSchemaDoc(pctxt, XML_SCHEMA_SCHEMA_IMPORT, - location, NULL, NULL, 0, node, NULL, nsName, + location, NULL, NULL, 0, node, NULL, nsName, &bucket); if (ret != 0) - return(ret); - if (bucket == NULL) { + return(ret); + if (bucket == NULL) { /* * Generate a warning that the document could not be located. */ @@ -21555,17 +21559,17 @@ xmlSchemaAssembleByLocation(xmlSchemaValidCtxtPtr vctxt, pctxt->nberrors = 0; pctxt->err = 0; pctxt->doc = bucket->doc; - - ret = xmlSchemaParseNewDocWithContext(pctxt, schema, bucket); + + ret = xmlSchemaParseNewDocWithContext(pctxt, schema, bucket); if (ret == -1) { pctxt->doc = NULL; goto exit_failure; } /* Paranoid error channelling. */ if ((ret == 0) && (pctxt->nberrors != 0)) - ret = pctxt->err; - if (pctxt->nberrors == 0) { - /* + ret = pctxt->err; + if (pctxt->nberrors == 0) { + /* * Only bother to fixup pending components, if there was * no error yet. * For every XSI acquired schema (and its sub-schemata) we will @@ -21581,7 +21585,7 @@ xmlSchemaAssembleByLocation(xmlSchemaValidCtxtPtr vctxt, vctxt->err = ret; vctxt->nberrors += pctxt->nberrors; } else { - /* Add to validation error sum. */ + /* Add to validation error sum. */ vctxt->nberrors += pctxt->nberrors; } pctxt->doc = NULL; @@ -21592,7 +21596,7 @@ exit_failure: } static xmlSchemaAttrInfoPtr -xmlSchemaGetMetaAttrInfo(xmlSchemaValidCtxtPtr vctxt, +xmlSchemaGetMetaAttrInfo(xmlSchemaValidCtxtPtr vctxt, int metaType) { if (vctxt->nbAttrInfos == 0) @@ -21682,7 +21686,7 @@ xmlSchemaAssembleByXSI(xmlSchemaValidCtxtPtr vctxt) /* * If using @schemaLocation then tuples are expected. * I.e. the namespace name *and* the document's URI. - */ + */ xmlSchemaCustomWarning(ACTXT_CAST vctxt, XML_SCHEMAV_MISC, iattr->node, NULL, "The value must consist of tuples: the target namespace " @@ -21711,7 +21715,7 @@ xmlSchemaLookupNamespace(xmlSchemaValidCtxtPtr vctxt, if (vctxt->sax != NULL) { int i, j; xmlSchemaNodeInfoPtr inode; - + for (i = vctxt->depth; i >= 0; i--) { if (vctxt->elemInfos[i]->nbNsBindings != 0) { inode = vctxt->elemInfos[i]; @@ -21725,16 +21729,16 @@ xmlSchemaLookupNamespace(xmlSchemaValidCtxtPtr vctxt, * Note that the namespace bindings are already * in a string dict. */ - return (inode->nsBindings[j+1]); + return (inode->nsBindings[j+1]); } } } } return (NULL); -#ifdef LIBXML_WRITER_ENABLED +#ifdef LIBXML_READER_ENABLED } else if (vctxt->reader != NULL) { xmlChar *nsName; - + nsName = xmlTextReaderLookupNamespace(vctxt->reader, prefix); if (nsName != NULL) { const xmlChar *ret; @@ -21766,7 +21770,7 @@ xmlSchemaLookupNamespace(xmlSchemaValidCtxtPtr vctxt, * This one works on the schema of the validation context. */ static int -xmlSchemaValidateNotation(xmlSchemaValidCtxtPtr vctxt, +xmlSchemaValidateNotation(xmlSchemaValidCtxtPtr vctxt, xmlSchemaPtr schema, xmlNodePtr node, const xmlChar *value, @@ -21791,7 +21795,7 @@ xmlSchemaValidateNotation(xmlSchemaValidCtxtPtr vctxt, if (prefix != NULL) { const xmlChar *nsName = NULL; - if (vctxt != NULL) + if (vctxt != NULL) nsName = xmlSchemaLookupNamespace(vctxt, BAD_CAST prefix); else if (node != NULL) { xmlNsPtr ns = xmlSearchNs(node->doc, node, prefix); @@ -22143,7 +22147,7 @@ xmlSchemaIDCFreeBinding(xmlSchemaPSVIIDCBindingPtr bind) if (bind->nodeTable != NULL) xmlFree(bind->nodeTable); if (bind->dupls != NULL) - xmlSchemaItemListFree(bind->dupls); + xmlSchemaItemListFree(bind->dupls); xmlFree(bind); } @@ -22178,12 +22182,12 @@ xmlSchemaIDCFreeMatcherList(xmlSchemaIDCMatcherPtr matcher) while (matcher != NULL) { next = matcher->next; - if (matcher->keySeqs != NULL) { + if (matcher->keySeqs != NULL) { int i; for (i = 0; i < matcher->sizeKeySeqs; i++) if (matcher->keySeqs[i] != NULL) xmlFree(matcher->keySeqs[i]); - xmlFree(matcher->keySeqs); + xmlFree(matcher->keySeqs); } if (matcher->targets != NULL) { if (matcher->idcType == XML_SCHEMA_TYPE_IDC_KEYREF) { @@ -22223,7 +22227,7 @@ xmlSchemaIDCReleaseMatcherList(xmlSchemaValidCtxtPtr vctxt, while (matcher != NULL) { next = matcher->next; - if (matcher->keySeqs != NULL) { + if (matcher->keySeqs != NULL) { int i; /* * Don't free the array, but only the content. @@ -22252,7 +22256,7 @@ xmlSchemaIDCReleaseMatcherList(xmlSchemaValidCtxtPtr vctxt, } xmlSchemaItemListFree(matcher->targets); matcher->targets = NULL; - } + } matcher->next = NULL; /* * Cache the matcher. @@ -22294,7 +22298,7 @@ xmlSchemaIDCAddStateObject(xmlSchemaValidCtxtPtr vctxt, sto = vctxt->xpathStatePool; vctxt->xpathStatePool = sto->next; sto->next = NULL; - } else { + } else { /* * Create a new state object. */ @@ -22305,10 +22309,10 @@ xmlSchemaIDCAddStateObject(xmlSchemaValidCtxtPtr vctxt, return (-1); } memset(sto, 0, sizeof(xmlSchemaIDCStateObj)); - } + } /* - * Add to global list. - */ + * Add to global list. + */ if (vctxt->xpathStates != NULL) sto->next = vctxt->xpathStates; vctxt->xpathStates = sto; @@ -22328,13 +22332,13 @@ xmlSchemaIDCAddStateObject(xmlSchemaValidCtxtPtr vctxt, VERROR_INT("xmlSchemaIDCAddStateObject", "failed to create an XPath validation context"); return (-1); - } + } sto->type = type; sto->depth = vctxt->depth; sto->matcher = matcher; sto->sel = sel; sto->nbHistory = 0; - + #ifdef DEBUG_IDC xmlGenericError(xmlGenericErrorContext, "IDC: STO push '%s'\n", sto->sel->xpath); @@ -22358,7 +22362,7 @@ xmlSchemaXPathEvaluate(xmlSchemaValidCtxtPtr vctxt, { xmlSchemaIDCStateObjPtr sto, head = NULL, first; int res, resolved = 0, depth = vctxt->depth; - + if (vctxt->xpathStates == NULL) return (0); @@ -22367,8 +22371,8 @@ xmlSchemaXPathEvaluate(xmlSchemaValidCtxtPtr vctxt, #ifdef DEBUG_IDC { xmlChar *str = NULL; - xmlGenericError(xmlGenericErrorContext, - "IDC: EVAL on %s, depth %d, type %d\n", + xmlGenericError(xmlGenericErrorContext, + "IDC: EVAL on %s, depth %d, type %d\n", xmlSchemaFormatQName(&str, vctxt->inode->nsName, vctxt->inode->localName), depth, nodeType); FREE_AND_NULL(str) @@ -22382,10 +22386,10 @@ xmlSchemaXPathEvaluate(xmlSchemaValidCtxtPtr vctxt, while (sto != head) { #ifdef DEBUG_IDC if (sto->type == XPATH_STATE_OBJ_TYPE_IDC_SELECTOR) - xmlGenericError(xmlGenericErrorContext, "IDC: ['%s'] selector '%s'\n", + xmlGenericError(xmlGenericErrorContext, "IDC: ['%s'] selector '%s'\n", sto->matcher->aidc->def->name, sto->sel->xpath); else - xmlGenericError(xmlGenericErrorContext, "IDC: ['%s'] field '%s'\n", + xmlGenericError(xmlGenericErrorContext, "IDC: ['%s'] field '%s'\n", sto->matcher->aidc->def->name, sto->sel->xpath); #endif if (nodeType == XML_ELEMENT_NODE) @@ -22415,7 +22419,7 @@ xmlSchemaXPathEvaluate(xmlSchemaValidCtxtPtr vctxt, if (sto->history == NULL) { sto->history = (int *) xmlMalloc(5 * sizeof(int)); if (sto->history == NULL) { - xmlSchemaVErrMemory(NULL, + xmlSchemaVErrMemory(NULL, "allocating the state object history", NULL); return(-1); } @@ -22425,11 +22429,11 @@ xmlSchemaXPathEvaluate(xmlSchemaValidCtxtPtr vctxt, sto->history = (int *) xmlRealloc(sto->history, sto->sizeHistory * sizeof(int)); if (sto->history == NULL) { - xmlSchemaVErrMemory(NULL, + xmlSchemaVErrMemory(NULL, "re-allocating the state object history", NULL); return(-1); } - } + } sto->history[sto->nbHistory++] = depth; #ifdef DEBUG_IDC @@ -22498,7 +22502,7 @@ xmlSchemaFormatIDCKeySequence(xmlSchemaValidCtxtPtr vctxt, *buf = xmlStrdup(BAD_CAST "["); for (i = 0; i < count; i++) { *buf = xmlStrcat(*buf, BAD_CAST "'"); - res = xmlSchemaGetCanonValueWhtspExt(seq[i]->val, + res = xmlSchemaGetCanonValueWhtspExt(seq[i]->val, xmlSchemaGetWhiteSpaceFacetValue(seq[i]->type), &value); if (res == 0) @@ -22556,7 +22560,7 @@ xmlSchemaXPathPop(xmlSchemaValidCtxtPtr vctxt) * * Processes and pops the history items of the IDC state objects. * IDC key-sequences are validated/created on IDC bindings. - * + * * Returns 0 on success and -1 on internal errors. */ static int @@ -22575,13 +22579,13 @@ xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt, #ifdef DEBUG_IDC { xmlChar *str = NULL; - xmlGenericError(xmlGenericErrorContext, + xmlGenericError(xmlGenericErrorContext, "IDC: BACK on %s, depth %d\n", xmlSchemaFormatQName(&str, vctxt->inode->nsName, vctxt->inode->localName), vctxt->depth); FREE_AND_NULL(str) } -#endif +#endif /* * Evaluate the state objects. */ @@ -22607,14 +22611,14 @@ xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt, if (matchDepth != depth) { sto = sto->next; continue; - } + } if (sto->type == XPATH_STATE_OBJ_TYPE_IDC_FIELD) { /* * NOTE: According to * http://www.w3.org/Bugs/Public/show_bug.cgi?id=2198 * ... the simple-content of complex types is also allowed. */ - + if (WXS_IS_COMPLEX(type)) { if (WXS_HAS_SIMPLE_CONTENT(type)) { /* @@ -22629,17 +22633,17 @@ xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt, } } else simpleType = NULL; - } else + } else simpleType = type; if (simpleType == NULL) { xmlChar *str = NULL; - + /* * Not qualified if the field resolves to a node of non * simple type. - */ + */ xmlSchemaCustomErr(ACTXT_CAST vctxt, - XML_SCHEMAV_CVC_IDC, NULL, + XML_SCHEMAV_CVC_IDC, NULL, WXS_BASIC_CAST sto->matcher->aidc->def, "The XPath '%s' of a field of %s does evaluate to a node of " "non-simple type", @@ -22649,7 +22653,7 @@ xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt, sto->nbHistory--; goto deregister_check; } - + if ((key == NULL) && (vctxt->inode->val == NULL)) { /* * Failed to provide the normalized value; maybe @@ -22665,13 +22669,13 @@ xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt, xmlSchemaIDCMatcherPtr matcher = sto->matcher; xmlSchemaPSVIIDCKeyPtr *keySeq; int pos, idx; - + /* * The key will be anchored on the matcher's list of * key-sequences. The position in this list is determined * by the target node's depth relative to the matcher's * depth of creation (i.e. the depth of the scope element). - * + * * Element Depth Pos List-entries * 0 NULL * 1 NULL @@ -22682,23 +22686,23 @@ xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt, * The size of the list is only dependant on the depth of * the tree. * An entry will be NULLed in selector_leave, i.e. when - * we hit the target's - */ + * we hit the target's + */ pos = sto->depth - matcher->depth; idx = sto->sel->index; - + /* * Create/grow the array of key-sequences. */ if (matcher->keySeqs == NULL) { - if (pos > 9) + if (pos > 9) matcher->sizeKeySeqs = pos * 2; else matcher->sizeKeySeqs = 10; - matcher->keySeqs = (xmlSchemaPSVIIDCKeyPtr **) + matcher->keySeqs = (xmlSchemaPSVIIDCKeyPtr **) xmlMalloc(matcher->sizeKeySeqs * - sizeof(xmlSchemaPSVIIDCKeyPtr *)); - if (matcher->keySeqs == NULL) { + sizeof(xmlSchemaPSVIIDCKeyPtr *)); + if (matcher->keySeqs == NULL) { xmlSchemaVErrMemory(NULL, "allocating an array of key-sequences", NULL); @@ -22707,9 +22711,9 @@ xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt, memset(matcher->keySeqs, 0, matcher->sizeKeySeqs * sizeof(xmlSchemaPSVIIDCKeyPtr *)); - } else if (pos >= matcher->sizeKeySeqs) { + } else if (pos >= matcher->sizeKeySeqs) { int i = matcher->sizeKeySeqs; - + matcher->sizeKeySeqs *= 2; matcher->keySeqs = (xmlSchemaPSVIIDCKeyPtr **) xmlRealloc(matcher->keySeqs, @@ -22725,29 +22729,29 @@ xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt, * The array needs to be NULLed. * TODO: Use memset? */ - for (; i < matcher->sizeKeySeqs; i++) - matcher->keySeqs[i] = NULL; + for (; i < matcher->sizeKeySeqs; i++) + matcher->keySeqs[i] = NULL; } - + /* * Get/create the key-sequence. */ - keySeq = matcher->keySeqs[pos]; - if (keySeq == NULL) { + keySeq = matcher->keySeqs[pos]; + if (keySeq == NULL) { goto create_sequence; } else if (keySeq[idx] != NULL) { xmlChar *str = NULL; /* * cvc-identity-constraint: - * 3 For each node in the ·target node set· all + * 3 For each node in the �target node set� all * of the {fields}, with that node as the context * node, evaluate to either an empty node-set or * a node-set with exactly one member, which must * have a simple type. - * + * * The key was already set; report an error. */ - xmlSchemaCustomErr(ACTXT_CAST vctxt, + xmlSchemaCustomErr(ACTXT_CAST vctxt, XML_SCHEMAV_CVC_IDC, NULL, WXS_BASIC_CAST matcher->aidc->def, "The XPath '%s' of a field of %s evaluates to a " @@ -22758,27 +22762,27 @@ xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt, sto->nbHistory--; goto deregister_check; } else - goto create_key; - + goto create_key; + create_sequence: /* * Create a key-sequence. */ keySeq = (xmlSchemaPSVIIDCKeyPtr *) xmlMalloc( - matcher->aidc->def->nbFields * + matcher->aidc->def->nbFields * sizeof(xmlSchemaPSVIIDCKeyPtr)); if (keySeq == NULL) { - xmlSchemaVErrMemory(NULL, + xmlSchemaVErrMemory(NULL, "allocating an IDC key-sequence", NULL); - return(-1); - } - memset(keySeq, 0, matcher->aidc->def->nbFields * + return(-1); + } + memset(keySeq, 0, matcher->aidc->def->nbFields * sizeof(xmlSchemaPSVIIDCKeyPtr)); matcher->keySeqs[pos] = keySeq; create_key: /* * Create a key once per node only. - */ + */ if (key == NULL) { key = (xmlSchemaPSVIIDCKeyPtr) xmlMalloc( sizeof(xmlSchemaPSVIIDCKey)); @@ -22787,7 +22791,7 @@ create_key: "allocating a IDC key", NULL); xmlFree(keySeq); matcher->keySeqs[pos] = NULL; - return(-1); + return(-1); } /* * Consume the compiled value. @@ -22803,10 +22807,10 @@ create_key: return (-1); } } - keySeq[idx] = key; + keySeq[idx] = key; } } else if (sto->type == XPATH_STATE_OBJ_TYPE_IDC_SELECTOR) { - + xmlSchemaPSVIIDCKeyPtr **keySeq = NULL; /* xmlSchemaPSVIIDCBindingPtr bind; */ xmlSchemaPSVIIDCNodePtr ntItem; @@ -22817,22 +22821,22 @@ create_key: /* * Here we have the following scenario: * An IDC 'selector' state object resolved to a target node, - * during the time this target node was in the - * ancestor-or-self axis, the 'field' state object(s) looked - * out for matching nodes to create a key-sequence for this + * during the time this target node was in the + * ancestor-or-self axis, the 'field' state object(s) looked + * out for matching nodes to create a key-sequence for this * target node. Now we are back to this target node and need - * to put the key-sequence, together with the target node - * itself, into the node-table of the corresponding IDC + * to put the key-sequence, together with the target node + * itself, into the node-table of the corresponding IDC * binding. */ matcher = sto->matcher; idc = matcher->aidc->def; nbKeys = idc->nbFields; - pos = depth - matcher->depth; + pos = depth - matcher->depth; /* * Check if the matcher has any key-sequences at all, plus * if it has a key-sequence for the current target node. - */ + */ if ((matcher->keySeqs == NULL) || (matcher->sizeKeySeqs <= pos)) { if (idc->type == XML_SCHEMA_TYPE_IDC_KEY) @@ -22840,15 +22844,15 @@ create_key: else goto selector_leave; } - - keySeq = &(matcher->keySeqs[pos]); + + keySeq = &(matcher->keySeqs[pos]); if (*keySeq == NULL) { if (idc->type == XML_SCHEMA_TYPE_IDC_KEY) goto selector_key_error; else goto selector_leave; } - + for (i = 0; i < nbKeys; i++) { if ((*keySeq)[i] == NULL) { /* @@ -22859,18 +22863,18 @@ create_key: * All fields of a "key" IDC must resolve. */ goto selector_key_error; - } + } goto selector_leave; } } /* * All fields did resolve. */ - + /* * 4.1 If the {identity-constraint category} is unique(/key), - * then no two members of the ·qualified node set· have - * ·key-sequences· whose members are pairwise equal, as + * then no two members of the �qualified node set� have + * �key-sequences� whose members are pairwise equal, as * defined by Equal in [XML Schemas: Datatypes]. * * Get the IDC binding from the matcher and check for @@ -22880,10 +22884,10 @@ create_key: bind = xmlSchemaIDCAcquireBinding(vctxt, matcher); #endif targets = xmlSchemaIDCAcquireTargetList(vctxt, matcher); - if ((idc->type != XML_SCHEMA_TYPE_IDC_KEYREF) && + if ((idc->type != XML_SCHEMA_TYPE_IDC_KEYREF) && (targets->nbItems != 0)) { xmlSchemaPSVIIDCKeyPtr ckey, bkey, *bkeySeq; - + i = 0; res = 0; /* @@ -22894,7 +22898,7 @@ create_key: ((xmlSchemaPSVIIDCNodePtr) targets->items[i])->keys; for (j = 0; j < nbKeys; j++) { ckey = (*keySeq)[j]; - bkey = bkeySeq[j]; + bkey = bkeySeq[j]; res = xmlSchemaAreValuesEqual(ckey->val, bkey->val); if (res == -1) { return (-1); @@ -22916,10 +22920,10 @@ create_key: } while (i < targets->nbItems); if (i != targets->nbItems) { xmlChar *str = NULL, *strB = NULL; - /* + /* * TODO: Try to report the key-sequence. */ - xmlSchemaCustomErr(ACTXT_CAST vctxt, + xmlSchemaCustomErr(ACTXT_CAST vctxt, XML_SCHEMAV_CVC_IDC, NULL, WXS_BASIC_CAST idc, "Duplicate key-sequence %s in %s", @@ -22937,15 +22941,15 @@ create_key: ntItem = (xmlSchemaPSVIIDCNodePtr) xmlMalloc( sizeof(xmlSchemaPSVIIDCNode)); if (ntItem == NULL) { - xmlSchemaVErrMemory(NULL, + xmlSchemaVErrMemory(NULL, "allocating an IDC node-table item", NULL); xmlFree(*keySeq); *keySeq = NULL; return(-1); - } + } memset(ntItem, 0, sizeof(xmlSchemaPSVIIDCNode)); - - /* + + /* * Store the node-table item in a global list. */ if (idc->type != XML_SCHEMA_TYPE_IDC_KEYREF) { @@ -22967,7 +22971,7 @@ create_key: xmlFree(ntItem); xmlFree(*keySeq); *keySeq = NULL; - return (-1); + return (-1); } } /* @@ -22979,11 +22983,11 @@ create_key: ntItem->keys = *keySeq; *keySeq = NULL; #if 0 - if (xmlSchemaIDCAppendNodeTableItem(bind, ntItem) == -1) { + if (xmlSchemaIDCAppendNodeTableItem(bind, ntItem) == -1) #endif if (xmlSchemaItemListAdd(targets, ntItem) == -1) { if (idc->type == XML_SCHEMA_TYPE_IDC_KEYREF) { - /* + /* * Free the item, since keyref items won't be * put on a global list. */ @@ -22992,18 +22996,18 @@ create_key: } return (-1); } - + goto selector_leave; selector_key_error: { xmlChar *str = NULL; /* - * 4.2.1 (KEY) The ·target node set· and the - * ·qualified node set· are equal, that is, every - * member of the ·target node set· is also a member - * of the ·qualified node set· and vice versa. + * 4.2.1 (KEY) The �target node set� and the + * �qualified node set� are equal, that is, every + * member of the �target node set� is also a member + * of the �qualified node set� and vice versa. */ - xmlSchemaCustomErr(ACTXT_CAST vctxt, + xmlSchemaCustomErr(ACTXT_CAST vctxt, XML_SCHEMAV_CVC_IDC, NULL, WXS_BASIC_CAST idc, "Not all fields of %s evaluate to a node", @@ -23019,7 +23023,7 @@ selector_leave: *keySeq = NULL; } } /* if selector */ - + sto->nbHistory--; deregister_check: @@ -23070,15 +23074,15 @@ xmlSchemaIDCRegisterMatchers(xmlSchemaValidCtxtPtr vctxt, xmlSchemaIDCMatcherPtr matcher, last = NULL; xmlSchemaIDCPtr idc, refIdc; xmlSchemaIDCAugPtr aidc; - + idc = (xmlSchemaIDCPtr) elemDecl->idcs; if (idc == NULL) return (0); - + #ifdef DEBUG_IDC { xmlChar *str = NULL; - xmlGenericError(xmlGenericErrorContext, + xmlGenericError(xmlGenericErrorContext, "IDC: REGISTER on %s, depth %d\n", (char *) xmlSchemaFormatQName(&str, vctxt->inode->nsName, vctxt->inode->localName), vctxt->depth); @@ -23119,7 +23123,7 @@ xmlSchemaIDCRegisterMatchers(xmlSchemaValidCtxtPtr vctxt, "Could not find an augmented IDC item for an IDC " "definition"); return (-1); - } + } if ((aidc->keyrefDepth == -1) || (vctxt->depth < aidc->keyrefDepth)) aidc->keyrefDepth = vctxt->depth; @@ -23150,10 +23154,10 @@ xmlSchemaIDCRegisterMatchers(xmlSchemaValidCtxtPtr vctxt, vctxt->idcMatcherCache = matcher->nextCached; matcher->nextCached = NULL; } else { - matcher = (xmlSchemaIDCMatcherPtr) + matcher = (xmlSchemaIDCMatcherPtr) xmlMalloc(sizeof(xmlSchemaIDCMatcher)); if (matcher == NULL) { - xmlSchemaVErrMemory(vctxt, + xmlSchemaVErrMemory(vctxt, "allocating an IDC matcher", NULL); return (-1); } @@ -23166,16 +23170,16 @@ xmlSchemaIDCRegisterMatchers(xmlSchemaValidCtxtPtr vctxt, last = matcher; matcher->type = IDC_MATCHER; - matcher->depth = vctxt->depth; + matcher->depth = vctxt->depth; matcher->aidc = aidc; matcher->idcType = aidc->def->type; -#ifdef DEBUG_IDC +#ifdef DEBUG_IDC xmlGenericError(xmlGenericErrorContext, "IDC: register matcher\n"); -#endif +#endif /* - * Init the automaton state object. + * Init the automaton state object. */ - if (xmlSchemaIDCAddStateObject(vctxt, matcher, + if (xmlSchemaIDCAddStateObject(vctxt, matcher, idc->selector, XPATH_STATE_OBJ_TYPE_IDC_SELECTOR) == -1) return (-1); @@ -23192,7 +23196,7 @@ xmlSchemaIDCFillNodeTables(xmlSchemaValidCtxtPtr vctxt, int res, i, j, k, nbTargets, nbFields, nbDupls, nbNodeTable; xmlSchemaPSVIIDCKeyPtr *keys, *ntkeys; xmlSchemaPSVIIDCNodePtr *targets, *dupls; - + xmlSchemaIDCMatcherPtr matcher = ielem->idcMatchers; /* vctxt->createIDCNodeTables */ while (matcher != NULL) { @@ -23226,7 +23230,7 @@ xmlSchemaIDCFillNodeTables(xmlSchemaValidCtxtPtr vctxt, nbDupls = bind->dupls->nbItems; } else { dupls = NULL; - nbDupls = 0; + nbDupls = 0; } if (bind->nodeTable != NULL) { nbNodeTable = bind->nbNodes; @@ -23239,29 +23243,29 @@ xmlSchemaIDCFillNodeTables(xmlSchemaValidCtxtPtr vctxt, * Transfer all IDC target-nodes to the IDC node-table. */ bind->nodeTable = - (xmlSchemaPSVIIDCNodePtr *) matcher->targets->items; + (xmlSchemaPSVIIDCNodePtr *) matcher->targets->items; bind->sizeNodes = matcher->targets->sizeItems; bind->nbNodes = matcher->targets->nbItems; matcher->targets->items = NULL; matcher->targets->sizeItems = 0; - matcher->targets->nbItems = 0; + matcher->targets->nbItems = 0; } else { /* * Compare the key-sequences and add to the IDC node-table. */ nbTargets = matcher->targets->nbItems; - targets = (xmlSchemaPSVIIDCNodePtr *) matcher->targets->items; + targets = (xmlSchemaPSVIIDCNodePtr *) matcher->targets->items; nbFields = matcher->aidc->def->nbFields; i = 0; do { keys = targets[i]->keys; - if (nbDupls) { + if (nbDupls) { /* * Search in already found duplicates first. */ j = 0; - do { + do { if (nbFields == 1) { res = xmlSchemaAreValuesEqual(keys[0]->val, dupls[j]->keys[0]->val); @@ -23296,11 +23300,11 @@ xmlSchemaIDCFillNodeTables(xmlSchemaValidCtxtPtr vctxt, } } j++; - } while (j < nbDupls); + } while (j < nbDupls); } if (nbNodeTable) { j = 0; - do { + do { if (nbFields == 1) { res = xmlSchemaAreValuesEqual(keys[0]->val, bind->nodeTable[j]->keys[0]->val); @@ -23327,7 +23331,7 @@ xmlSchemaIDCFillNodeTables(xmlSchemaValidCtxtPtr vctxt, goto next_node_table_entry; } } - } + } /* * Add the duplicate to the list of duplicates. */ @@ -23335,7 +23339,7 @@ xmlSchemaIDCFillNodeTables(xmlSchemaValidCtxtPtr vctxt, bind->dupls = xmlSchemaItemListCreate(); if (bind->dupls == NULL) goto internal_error; - } + } if (xmlSchemaItemListAdd(bind->dupls, bind->nodeTable[j]) == -1) goto internal_error; /* @@ -23370,12 +23374,12 @@ internal_error: } /** - * xmlSchemaBubbleIDCNodeTables: + * xmlSchemaBubbleIDCNodeTables: * @depth: the current tree depth * - * Merges IDC bindings of an element at @depth into the corresponding IDC - * bindings of its parent element. If a duplicate note-table entry is found, - * both, the parent node-table entry and child entry are discarded from the + * Merges IDC bindings of an element at @depth into the corresponding IDC + * bindings of its parent element. If a duplicate note-table entry is found, + * both, the parent node-table entry and child entry are discarded from the * node-table of the parent. * * Returns 0 if OK and -1 on internal errors. @@ -23389,19 +23393,19 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt) xmlSchemaIDCAugPtr aidc; int i, j, k, ret = 0, nbFields, oldNum, oldDupls; - bind = vctxt->inode->idcTable; + bind = vctxt->inode->idcTable; if (bind == NULL) { /* Fine, no table, no bubbles. */ return (0); } - + parTable = &(vctxt->elemInfos[vctxt->depth -1]->idcTable); /* * Walk all bindings; create new or add to existing bindings. * Remove duplicate key-sequences. */ while (bind != NULL) { - + if ((bind->nbNodes == 0) && WXS_ILIST_IS_EMPTY(bind->dupls)) goto next_binding; /* @@ -23411,7 +23415,7 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt) aidc = vctxt->aidcs; do { if (aidc->def == bind->definition) { - if ((aidc->keyrefDepth == -1) || + if ((aidc->keyrefDepth == -1) || (aidc->keyrefDepth >= vctxt->depth)) { goto next_binding; } @@ -23427,7 +23431,7 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt) * Search a matching parent binding for the * IDC definition. */ - while (parBind != NULL) { + while (parBind != NULL) { if (parBind->definition == bind->definition) break; parBind = parBind->next; @@ -23435,7 +23439,7 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt) if (parBind != NULL) { /* - * Compare every node-table entry of the child node, + * Compare every node-table entry of the child node, * i.e. the key-sequence within, ... */ oldNum = parBind->nbNodes; /* Skip newly added items. */ @@ -23445,12 +23449,12 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt) dupls = (xmlSchemaPSVIIDCNodePtr *) parBind->dupls->items; } else { dupls = NULL; - oldDupls = 0; + oldDupls = 0; } - + parNodes = parBind->nodeTable; nbFields = bind->definition->nbFields; - + for (i = 0; i < bind->nbNodes; i++) { node = bind->nodeTable[i]; if (node == NULL) @@ -23460,7 +23464,7 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt) * evaluated to be a duplicate key-sequence. */ if (oldDupls) { - j = 0; + j = 0; while (j < oldDupls) { if (nbFields == 1) { ret = xmlSchemaAreValuesEqual( @@ -23493,12 +23497,12 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt) /* Duplicate found. Skip this entry. */ continue; } - } + } /* * ... and with every key-sequence of the parent node. */ if (oldNum) { - j = 0; + j = 0; while (j < oldNum) { parNode = parNodes[j]; if (nbFields == 1) { @@ -23511,7 +23515,7 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt) j++; continue; } - } else { + } else { for (k = 0; k < nbFields; k++) { ret = xmlSchemaAreValuesEqual( node->keys[k]->val, @@ -23532,20 +23536,20 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt) * Handle duplicates. Move the duplicate in * the parent's node-table to the list of * duplicates. - */ + */ oldNum--; parBind->nbNodes--; /* * Move last old item to pos of duplicate. */ parNodes[j] = parNodes[oldNum]; - + if (parBind->nbNodes != oldNum) { /* - * If new items exist, move last new item to + * If new items exist, move last new item to * last of old items. */ - parNodes[oldNum] = + parNodes[oldNum] = parNodes[parBind->nbNodes]; } if (parBind->dupls == NULL) { @@ -23553,31 +23557,31 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt) if (parBind->dupls == NULL) goto internal_error; } - xmlSchemaItemListAdd(parBind->dupls, parNode); + xmlSchemaItemListAdd(parBind->dupls, parNode); } else { /* - * Add the node-table entry (node and key-sequence) of + * Add the node-table entry (node and key-sequence) of * the child node to the node table of the parent node. */ - if (parBind->nodeTable == NULL) { - parBind->nodeTable = (xmlSchemaPSVIIDCNodePtr *) + if (parBind->nodeTable == NULL) { + parBind->nodeTable = (xmlSchemaPSVIIDCNodePtr *) xmlMalloc(10 * sizeof(xmlSchemaPSVIIDCNodePtr)); if (parBind->nodeTable == NULL) { - xmlSchemaVErrMemory(NULL, + xmlSchemaVErrMemory(NULL, "allocating IDC list of node-table items", NULL); goto internal_error; } parBind->sizeNodes = 1; } else if (parBind->nbNodes >= parBind->sizeNodes) { parBind->sizeNodes *= 2; - parBind->nodeTable = (xmlSchemaPSVIIDCNodePtr *) - xmlRealloc(parBind->nodeTable, parBind->sizeNodes * + parBind->nodeTable = (xmlSchemaPSVIIDCNodePtr *) + xmlRealloc(parBind->nodeTable, parBind->sizeNodes * sizeof(xmlSchemaPSVIIDCNodePtr)); if (parBind->nodeTable == NULL) { - xmlSchemaVErrMemory(NULL, + xmlSchemaVErrMemory(NULL, "re-allocating IDC list of node-table items", NULL); goto internal_error; - } + } } parNodes = parBind->nodeTable; /* @@ -23587,9 +23591,9 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt) parNodes[parBind->nbNodes++] = node; } - } - - } + } + + } } else { /* * No binding for the IDC was found: create a new one and @@ -23598,7 +23602,7 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt) parBind = xmlSchemaIDCNewBinding(bind->definition); if (parBind == NULL) goto internal_error; - + /* * TODO: Hmm, how to optimize the initial number of * allocated entries? @@ -23624,11 +23628,11 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt) /* * Copy the entries. */ - parBind->nodeTable = (xmlSchemaPSVIIDCNodePtr *) + parBind->nodeTable = (xmlSchemaPSVIIDCNodePtr *) xmlMalloc(bind->nbNodes * sizeof(xmlSchemaPSVIIDCNodePtr)); if (parBind->nodeTable == NULL) { - xmlSchemaVErrMemory(NULL, + xmlSchemaVErrMemory(NULL, "allocating an array of IDC node-table " "items", NULL); xmlSchemaIDCFreeBinding(parBind); @@ -23647,15 +23651,15 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt) if (parBind->dupls != NULL) xmlSchemaItemListFree(parBind->dupls); parBind->dupls = bind->dupls; - bind->dupls = NULL; + bind->dupls = NULL; } if (*parTable == NULL) *parTable = parBind; else { parBind->next = *parTable; *parTable = parBind; - } - } + } + } next_binding: bind = bind->next; @@ -23678,7 +23682,7 @@ xmlSchemaCheckCVCIDCKeyRef(xmlSchemaValidCtxtPtr vctxt) { xmlSchemaIDCMatcherPtr matcher; xmlSchemaPSVIIDCBindingPtr bind; - + matcher = vctxt->inode->idcMatchers; /* * Find a keyref. @@ -23699,7 +23703,7 @@ xmlSchemaCheckCVCIDCKeyRef(xmlSchemaValidCtxtPtr vctxt) */ bind = vctxt->inode->idcTable; while (bind != NULL) { - if ((xmlSchemaIDCPtr) matcher->aidc->def->ref->item == + if ((xmlSchemaIDCPtr) matcher->aidc->def->ref->item == bind->definition) break; bind = bind->next; @@ -23768,7 +23772,7 @@ xmlSchemaCheckCVCIDCKeyRef(xmlSchemaValidCtxtPtr vctxt) } } } - + if (res == 0) { xmlChar *str = NULL, *strB = NULL; xmlSchemaKeyrefErr(vctxt, @@ -23852,7 +23856,7 @@ xmlSchemaValidatorPushAttribute(xmlSchemaValidCtxtPtr vctxt, xmlNodePtr attrNode, int nodeLine, const xmlChar *localName, - const xmlChar *nsName, + const xmlChar *nsName, int ownedNames, xmlChar *value, int ownedValue) @@ -23878,7 +23882,7 @@ xmlSchemaValidatorPushAttribute(xmlSchemaValidCtxtPtr vctxt, if (nsName != NULL) { if (xmlStrEqual(localName, BAD_CAST "nil")) { if (xmlStrEqual(attr->nsName, xmlSchemaInstanceNs)) { - attr->metaType = XML_SCHEMA_ATTR_INFO_META_XSI_NIL; + attr->metaType = XML_SCHEMA_ATTR_INFO_META_XSI_NIL; } } else if (xmlStrEqual(localName, BAD_CAST "type")) { if (xmlStrEqual(attr->nsName, xmlSchemaInstanceNs)) { @@ -24099,7 +24103,7 @@ xmlSchemaValidateFacets(xmlSchemaAbstractCtxtPtr actxt, valType = valType; else valType = xmlSchemaGetValType(val); - + ret = 0; for (facetLink = type->facetSet; facetLink != NULL; facetLink = facetLink->next) { @@ -24148,11 +24152,11 @@ WXS_IS_LIST: ret = 0; for (facetLink = type->facetSet; facetLink != NULL; facetLink = facetLink->next) { - + switch (facetLink->facet->type) { case XML_SCHEMA_FACET_LENGTH: case XML_SCHEMA_FACET_MINLENGTH: - case XML_SCHEMA_FACET_MAXLENGTH: + case XML_SCHEMA_FACET_MAXLENGTH: ret = xmlSchemaValidateListSimpleTypeFacet(facetLink->facet, value, length, NULL); break; @@ -24164,7 +24168,7 @@ WXS_IS_LIST: "validating against a list type facet"); return (-1); } else if (ret > 0) { - if (fireErrors) + if (fireErrors) xmlSchemaFacetErr(actxt, ret, node, value, length, type, facetLink->facet, NULL, NULL, NULL); else @@ -24241,7 +24245,7 @@ pattern_and_enum: if (facetLink->facet->type != XML_SCHEMA_FACET_PATTERN) continue; found = 1; - /* + /* * NOTE that for patterns, @value needs to be the * normalized vaule. */ @@ -24253,7 +24257,7 @@ pattern_and_enum: "validating against a pattern facet"); return (-1); } else { - /* + /* * Save the last non-validating facet. */ facet = facetLink->facet; @@ -24276,12 +24280,12 @@ pattern_and_enum: return (error); } - + static xmlChar * xmlSchemaNormalizeValue(xmlSchemaTypePtr type, const xmlChar *value) { - switch (xmlSchemaGetWhiteSpaceFacetValue(type)) { + switch (xmlSchemaGetWhiteSpaceFacetValue(type)) { case XML_SCHEMA_WHITESPACE_COLLAPSE: return (xmlSchemaCollapseString(value)); case XML_SCHEMA_WHITESPACE_REPLACE: @@ -24300,7 +24304,7 @@ xmlSchemaValidateQName(xmlSchemaValidCtxtPtr vctxt, int ret; const xmlChar *nsName; xmlChar *local, *prefix = NULL; - + ret = xmlValidateQName(value, 1); if (ret != 0) { if (ret == -1) { @@ -24323,7 +24327,7 @@ xmlSchemaValidateQName(xmlSchemaValidCtxtPtr vctxt, * - is there a default namespace? */ nsName = xmlSchemaLookupNamespace(vctxt, prefix); - + if (prefix != NULL) { xmlFree(prefix); /* @@ -24380,7 +24384,7 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, value = normValue; \ isNormalized = 1; \ } - + if ((retVal != NULL) && (*retVal != NULL)) { xmlSchemaFreeValue(*retVal); *retVal = NULL; @@ -24395,14 +24399,14 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, */ /* * 2.1 If The definition is ENTITY or is validly derived from ENTITY given - * the empty set, as defined in Type Derivation OK (Simple) (§3.14.6), then - * the string must be a ·declared entity name·. + * the empty set, as defined in Type Derivation OK (Simple) (�3.14.6), then + * the string must be a �declared entity name�. */ /* * 2.2 If The definition is ENTITIES or is validly derived from ENTITIES - * given the empty set, as defined in Type Derivation OK (Simple) (§3.14.6), - * then every whitespace-delimited substring of the string must be a ·declared - * entity name·. + * given the empty set, as defined in Type Derivation OK (Simple) (�3.14.6), + * then every whitespace-delimited substring of the string must be a �declared + * entity name�. */ /* * 2.3 otherwise no further condition applies. @@ -24414,8 +24418,8 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, if (WXS_IS_ANY_SIMPLE_TYPE(type) || WXS_IS_ATOMIC(type)) { xmlSchemaTypePtr biType; /* The built-in type. */ /* - * SPEC (1.2.1) "if {variety} is ·atomic· then the string must ·match· - * a literal in the ·lexical space· of {base type definition}" + * SPEC (1.2.1) "if {variety} is �atomic� then the string must �match� + * a literal in the �lexical space� of {base type definition}" */ /* * Whitespace-normalize. @@ -24441,9 +24445,9 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, * NOTATIONs need to be processed here, since they need * to lookup in the hashtable of NOTATION declarations of the schema. */ - if (actxt->type == XML_SCHEMA_CTXT_VALIDATOR) { - switch (biType->builtInType) { - case XML_SCHEMAS_NOTATION: + if (actxt->type == XML_SCHEMA_CTXT_VALIDATOR) { + switch (biType->builtInType) { + case XML_SCHEMAS_NOTATION: ret = xmlSchemaValidateNotation( (xmlSchemaValidCtxtPtr) actxt, ((xmlSchemaValidCtxtPtr) actxt)->schema, @@ -24463,8 +24467,8 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, value, NULL, NULL); break; } - } else if (actxt->type == XML_SCHEMA_CTXT_PARSER) { - switch (biType->builtInType) { + } else if (actxt->type == XML_SCHEMA_CTXT_PARSER) { + switch (biType->builtInType) { case XML_SCHEMAS_NOTATION: ret = xmlSchemaValidateNotation(NULL, ((xmlSchemaParserCtxtPtr) actxt)->schema, node, @@ -24479,7 +24483,7 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, ret = xmlSchemaValPredefTypeNodeNoNorm(biType, value, NULL, node); break; - } + } } else { /* * Validation via a public API is not implemented yet. @@ -24496,7 +24500,7 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, if (WXS_IS_LIST(type)) ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_2; else - ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1; + ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1; } if ((ret == 0) && (type->flags & XML_SCHEMAS_TYPE_HAS_FACETS)) { /* @@ -24511,10 +24515,10 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, "validating facets of atomic simple type"); goto internal_error; } - if (WXS_IS_LIST(type)) + if (WXS_IS_LIST(type)) ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_2; else - ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1; + ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1; } } if (fireErrors && (ret > 0)) @@ -24526,9 +24530,9 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, xmlChar *tmpValue = NULL; unsigned long len = 0; xmlSchemaValPtr prevVal = NULL, curVal = NULL; - /* 1.2.2 if {variety} is ·list· then the string must be a sequence - * of white space separated tokens, each of which ·match·es a literal - * in the ·lexical space· of {item type definition} + /* 1.2.2 if {variety} is �list� then the string must be a sequence + * of white space separated tokens, each of which �match�es a literal + * in the �lexical space� of {item type definition} */ /* * Note that XML_SCHEMAS_TYPE_NORMVALUENEEDED will be set if @@ -24539,7 +24543,7 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, * VAL TODO: Optimize validation of empty values. * VAL TODO: We do not have computed values for lists. */ - itemType = WXS_LIST_ITEMTYPE(type); + itemType = WXS_LIST_ITEMTYPE(type); cur = value; do { while (IS_BLANK_CH(*cur)) @@ -24578,7 +24582,7 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, } ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_2; break; - } + } cur = end; } while (*cur != 0); FREE_AND_NULL(tmpValue); @@ -24599,7 +24603,7 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, } } if (fireErrors && (ret > 0)) { - /* + /* * Report the normalized value. */ normalize = 1; @@ -24609,10 +24613,10 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, } else if (WXS_IS_UNION(type)) { xmlSchemaTypeLinkPtr memberLink; /* - * TODO: For all datatypes ·derived· by ·union· whiteSpace does - * not apply directly; however, the normalization behavior of ·union· + * TODO: For all datatypes �derived� by �union� whiteSpace does + * not apply directly; however, the normalization behavior of �union� * types is controlled by the value of whiteSpace on that one of the - * ·memberTypes· against which the ·union· is successfully validated. + * �memberTypes� against which the �union� is successfully validated. * * This means that the value is normalized by the first validating * member type, then the facets of the union type are applied. This @@ -24620,8 +24624,8 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, */ /* - * 1.2.3 if {variety} is ·union· then the string must ·match· a - * literal in the ·lexical space· of at least one member of + * 1.2.3 if {variety} is �union� then the string must �match� a + * literal in the �lexical space� of at least one member of * {member type definitions} */ memberLink = xmlSchemaGetUnionSimpleTypeMemberTypes(type); @@ -24629,7 +24633,7 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, AERROR_INT("xmlSchemaVCheckCVCSimpleType", "union simple type has no member types"); goto internal_error; - } + } /* * Always normalize union type values, since we currently * cannot store the whitespace information with the value @@ -24637,7 +24641,7 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, * not possible. */ while (memberLink != NULL) { - if (valNeeded) + if (valNeeded) ret = xmlSchemaVCheckCVCSimpleType(actxt, node, memberLink->type, value, &val, 0, 1, 0); else @@ -24660,9 +24664,9 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, */ if ((ret == 0) && (type->flags & XML_SCHEMAS_TYPE_HAS_FACETS)) { /* - * The normalization behavior of ·union· types is controlled by - * the value of whiteSpace on that one of the ·memberTypes· - * against which the ·union· is successfully validated. + * The normalization behavior of �union� types is controlled by + * the value of whiteSpace on that one of the �memberTypes� + * against which the �union� is successfully validated. */ NORMALIZE(memberLink->type); ret = xmlSchemaValidateFacets(actxt, node, type, @@ -24674,7 +24678,7 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, "validating facets of union simple type"); goto internal_error; } - ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_3; + ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_3; } } if (fireErrors && (ret > 0)) @@ -24822,14 +24826,14 @@ xmlSchemaProcessXSIType(xmlSchemaValidCtxtPtr vctxt, /* * SPEC cvc-elt (3.3.4) : (4.3) (Type Derivation OK) - * "The ·local type definition· must be validly + * "The �local type definition� must be validly * derived from the {type definition} given the union of * the {disallowed substitutions} and the {type definition}'s * {prohibited substitutions}, as defined in - * Type Derivation OK (Complex) (§3.4.6) + * Type Derivation OK (Complex) (�3.4.6) * (if it is a complex type definition), * or given {disallowed substitutions} as defined in Type - * Derivation OK (Simple) (§3.14.6) (if it is a simple type + * Derivation OK (Simple) (�3.14.6) (if it is a simple type * definition)." * * {disallowed substitutions}: the "block" on the element decl. @@ -25089,19 +25093,19 @@ xmlSchemaClearAttrInfos(xmlSchemaValidCtxtPtr vctxt) static int xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) { - xmlSchemaTypePtr type = vctxt->inode->typeDef; + xmlSchemaTypePtr type = vctxt->inode->typeDef; xmlSchemaItemListPtr attrUseList; xmlSchemaAttributeUsePtr attrUse = NULL; xmlSchemaAttributePtr attrDecl = NULL; - xmlSchemaAttrInfoPtr iattr, tmpiattr; + xmlSchemaAttrInfoPtr iattr, tmpiattr; int i, j, found, nbAttrs, nbUses; int xpathRes = 0, res, wildIDs = 0, fixed; xmlNodePtr defAttrOwnerElem = NULL; /* * SPEC (cvc-attribute) - * (1) "The declaration must not be ·absent· (see Missing - * Sub-components (§5.3) for how this can fail to be + * (1) "The declaration must not be �absent� (see Missing + * Sub-components (�5.3) for how this can fail to be * the case)." * (2) "Its {type definition} must not be absent." * @@ -25151,15 +25155,15 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) * use with an {attribute declaration} whose {name} matches * the attribute information item's [local name] and whose * {target namespace} is identical to the attribute information - * item's [namespace name] (where an ·absent· {target namespace} + * item's [namespace name] (where an �absent� {target namespace} * is taken to be identical to a [namespace name] with no value), - * then the attribute information must be ·valid· with respect + * then the attribute information must be �valid� with respect * to that attribute use as per Attribute Locally Valid (Use) - * (§3.5.4). In this case the {attribute declaration} of that - * attribute use is the ·context-determined declaration· for the + * (�3.5.4). In this case the {attribute declaration} of that + * attribute use is the �context-determined declaration� for the * attribute information item with respect to Schema-Validity - * Assessment (Attribute) (§3.2.4) and - * Assessment Outcome (Attribute) (§3.2.5). + * Assessment (Attribute) (�3.2.4) and + * Assessment Outcome (Attribute) (�3.2.5). */ iattr->state = XML_SCHEMAS_ATTR_ASSESSED; iattr->use = attrUse; @@ -25193,7 +25197,7 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) } tmpiattr->state = XML_SCHEMAS_ATTR_ERR_MISSING; tmpiattr->use = attrUse; - tmpiattr->decl = attrDecl; + tmpiattr->decl = attrDecl; } else if ((attrUse->occurs == XML_SCHEMAS_ATTR_USE_OPTIONAL) && ((attrUse->defValue != NULL) || (attrDecl->defValue != NULL))) { @@ -25237,13 +25241,13 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) continue; /* * SPEC (cvc-complex-type) - * (3.2.2) "The attribute information item must be ·valid· with - * respect to it as defined in Item Valid (Wildcard) (§3.10.4)." + * (3.2.2) "The attribute information item must be �valid� with + * respect to it as defined in Item Valid (Wildcard) (�3.10.4)." * * SPEC Item Valid (Wildcard) (cvc-wildcard) - * "... its [namespace name] must be ·valid· with respect to + * "... its [namespace name] must be �valid� with respect to * the wildcard constraint, as defined in Wildcard allows - * Namespace Name (§3.10.4)." + * Namespace Name (�3.10.4)." */ if (xmlSchemaCheckCVCWildcardNamespace(type->attributeWildcard, iattr->nsName) == 0) { @@ -25279,11 +25283,11 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) * SPEC (cvc-complex-type) * (5) "Let [Definition:] the wild IDs be the set of * all attribute information item to which clause 3.2 - * applied and whose ·validation· resulted in a - * ·context-determined declaration· of mustFind or no - * ·context-determined declaration· at all, and whose + * applied and whose �validation� resulted in a + * �context-determined declaration� of mustFind or no + * �context-determined declaration� at all, and whose * [local name] and [namespace name] resolve (as - * defined by QName resolution (Instance) (§3.15.4)) to + * defined by QName resolution (Instance) (�3.15.4)) to * an attribute declaration whose {type definition} is * or is derived from ID. Then all of the following * must be true:" @@ -25293,7 +25297,7 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) iattr->typeDef, XML_SCHEMAS_ID)) { /* * SPEC (5.1) "There must be no more than one - * item in ·wild IDs·." + * item in �wild IDs�." */ if (wildIDs != 0) { /* VAL TODO */ @@ -25304,7 +25308,7 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) wildIDs++; /* * SPEC (cvc-complex-type) - * (5.2) "If ·wild IDs· is non-empty, there must not + * (5.2) "If �wild IDs� is non-empty, there must not * be any attribute uses among the {attribute uses} * whose {attribute declaration}'s {type definition} * is or is derived from ID." @@ -25421,7 +25425,7 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) * VAL TODO: Should we use the *normalized* value? This currently * uses the *initial* value. */ - + if (defAttrOwnerElem) { xmlChar *normValue; const xmlChar *value; @@ -25512,9 +25516,9 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) fixed = 0; /* * SPEC (cvc-attribute) - * (3) "The item's ·normalized value· must be locally ·valid· - * with respect to that {type definition} as per - * String Valid (§3.14.4)." + * (3) "The item's �normalized value� must be locally �valid� + * with respect to that {type definition} as per + * String Valid (�3.14.4)." * * VAL TODO: Do we already have the * "normalized attribute value" here? @@ -25534,7 +25538,7 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) iattr->node, iattr->typeDef, iattr->value, NULL, 1, 0, 0); } - + if (res != 0) { if (res == -1) { VERROR_INT("xmlSchemaVAttributesComplex", @@ -25549,12 +25553,12 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) goto eval_idcs; } - if (fixed) { + if (fixed) { /* * SPEC Attribute Locally Valid (Use) (cvc-au) - * "For an attribute information item to be·valid· + * "For an attribute information item to be�valid� * with respect to an attribute use its *normalized* - * value· must match the *canonical* lexical + * value� must match the *canonical* lexical * representation of the attribute use's {value * constraint}value, if it is present and fixed." * @@ -25563,7 +25567,7 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) */ /* * SPEC Attribute Locally Valid (cvc-attribute) - * (4) "The item's *actual* value· must match the *value* of + * (4) "The item's *actual* value� must match the *value* of * the {value constraint}, if it is present and fixed." */ if (iattr->val == NULL) { @@ -25655,8 +25659,8 @@ eval_idcs: xmlSchemaCustomErr(ACTXT_CAST vctxt, XML_SCHEMAV_CVC_AU, NULL, NULL, "The value '%s' does not match the fixed " - "value constraint '%s'", - iattr->value, iattr->vcValue); + "value constraint '%s'", + iattr->value, iattr->vcValue); break; case XML_SCHEMAS_ATTR_ERR_WILD_STRICT_NO_DECL: VERROR(XML_SCHEMAV_CVC_WILDCARD, NULL, @@ -25718,7 +25722,7 @@ xmlSchemaValidateElemWildcard(xmlSchemaValidCtxtPtr vctxt, xmlSchemaElementPtr decl = NULL; decl = xmlSchemaGetElem(vctxt->schema, - vctxt->inode->localName, vctxt->inode->nsName); + vctxt->inode->localName, vctxt->inode->nsName); if (decl != NULL) { vctxt->inode->decl = decl; return (0); @@ -25776,16 +25780,16 @@ static int xmlSchemaCheckCOSValidDefault(xmlSchemaValidCtxtPtr vctxt, const xmlChar *value, xmlSchemaValPtr *val) -{ +{ int ret = 0; xmlSchemaNodeInfoPtr inode = vctxt->inode; /* * cos-valid-default: * Schema Component Constraint: Element Default Valid (Immediate) - * For a string to be a valid default with respect to a type + * For a string to be a valid default with respect to a type * definition the appropriate case among the following must be true: - */ + */ if WXS_IS_COMPLEX(inode->typeDef) { /* * Complex type. @@ -25793,8 +25797,8 @@ xmlSchemaCheckCOSValidDefault(xmlSchemaValidCtxtPtr vctxt, * SPEC (2.1) "its {content type} must be a simple type definition * or mixed." * SPEC (2.2.2) "If the {content type} is mixed, then the {content - * type}'s particle must be ·emptiable· as defined by - * Particle Emptiable (§3.9.6)." + * type}'s particle must be �emptiable� as defined by + * Particle Emptiable (�3.9.6)." */ if ((! WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) && ((! WXS_HAS_MIXED_CONTENT(inode->typeDef)) || @@ -25807,18 +25811,18 @@ xmlSchemaCheckCOSValidDefault(xmlSchemaValidCtxtPtr vctxt, "or mixed content and a particle emptiable"); return(ret); } - } + } /* - * 1 If the type definition is a simple type definition, then the string - * must be ·valid· with respect to that definition as defined by String - * Valid (§3.14.4). + * 1 If the type definition is a simple type definition, then the string + * must be �valid� with respect to that definition as defined by String + * Valid (�3.14.4). * * AND * - * 2.2.1 If the {content type} is a simple type definition, then the - * string must be ·valid· with respect to that simple type definition - * as defined by String Valid (§3.14.4). - */ + * 2.2.1 If the {content type} is a simple type definition, then the + * string must be �valid� with respect to that simple type definition + * as defined by String Valid (�3.14.4). + */ if (WXS_IS_SIMPLE(inode->typeDef)) { ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST vctxt, @@ -25832,7 +25836,7 @@ xmlSchemaCheckCOSValidDefault(xmlSchemaValidCtxtPtr vctxt, if (ret < 0) { VERROR_INT("xmlSchemaCheckCOSValidDefault", "calling xmlSchemaVCheckCVCSimpleType()"); - } + } return (ret); } @@ -25866,13 +25870,13 @@ xmlSchemaVContentModelCallback(xmlSchemaValidCtxtPtr vctxt ATTRIBUTE_UNUSED, static int xmlSchemaValidatorPushElem(xmlSchemaValidCtxtPtr vctxt) -{ +{ vctxt->inode = xmlSchemaGetFreshElemInfo(vctxt); if (vctxt->inode == NULL) { VERROR_INT("xmlSchemaValidatorPushElem", "calling xmlSchemaGetFreshElemInfo()"); return (-1); - } + } vctxt->nbAttrInfos = 0; return (0); } @@ -25895,7 +25899,7 @@ xmlSchemaVCheckINodeDataType(xmlSchemaValidCtxtPtr vctxt, -/* +/* * Process END of element. */ static int @@ -25914,7 +25918,7 @@ xmlSchemaValidatorPopElem(xmlSchemaValidCtxtPtr vctxt) */ vctxt->skipDepth = vctxt->depth -1; goto end_elem; - } + } if ((inode->typeDef == NULL) || (inode->flags & XML_SCHEMA_NODE_INFO_ERR_BAD_TYPE)) { /* @@ -25934,8 +25938,8 @@ xmlSchemaValidatorPopElem(xmlSchemaValidCtxtPtr vctxt) * Workaround for "anyType". */ if (inode->typeDef->builtInType == XML_SCHEMAS_ANYTYPE) - goto character_content; - + goto character_content; + if ((inode->flags & XML_SCHEMA_ELEM_INFO_ERR_BAD_CONTENT) == 0) { xmlChar *values[10]; int terminal, nbval = 10, nbneg; @@ -25956,12 +25960,12 @@ xmlSchemaValidatorPopElem(xmlSchemaValidCtxtPtr vctxt) #ifdef DEBUG_AUTOMATA xmlGenericError(xmlGenericErrorContext, "AUTOMATON create on '%s'\n", inode->localName); -#endif +#endif } /* * Get hold of the still expected content, since a further * call to xmlRegExecPushString() will loose this information. - */ + */ xmlRegExecNextValues(inode->regexCtxt, &nbval, &nbneg, &values[0], &terminal); ret = xmlRegExecPushString(inode->regexCtxt, NULL, NULL); @@ -26011,14 +26015,14 @@ character_content: /* * Speedup if no declaration exists. */ - if (WXS_IS_SIMPLE(inode->typeDef)) { + if (WXS_IS_SIMPLE(inode->typeDef)) { ret = xmlSchemaVCheckINodeDataType(vctxt, inode, inode->typeDef, inode->value); } else if (WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) { ret = xmlSchemaVCheckINodeDataType(vctxt, inode, inode->typeDef->contentTypeDef, inode->value); - } + } if (ret < 0) { VERROR_INT("xmlSchemaValidatorPopElem", "calling xmlSchemaVCheckCVCSimpleType()"); @@ -26027,26 +26031,26 @@ character_content: goto end_elem; } /* - * cvc-elt (3.3.4) : 5 + * cvc-elt (3.3.4) : 5 * The appropriate case among the following must be true: */ /* - * cvc-elt (3.3.4) : 5.1 - * If the declaration has a {value constraint}, - * the item has neither element nor character [children] and + * cvc-elt (3.3.4) : 5.1 + * If the declaration has a {value constraint}, + * the item has neither element nor character [children] and * clause 3.2 has not applied, then all of the following must be true: */ if ((inode->decl->value != NULL) && - (inode->flags & XML_SCHEMA_ELEM_INFO_EMPTY) && + (inode->flags & XML_SCHEMA_ELEM_INFO_EMPTY) && (! INODE_NILLED(inode))) { /* - * cvc-elt (3.3.4) : 5.1.1 - * If the ·actual type definition· is a ·local type definition· + * cvc-elt (3.3.4) : 5.1.1 + * If the �actual type definition� is a �local type definition� * then the canonical lexical representation of the {value constraint} - * value must be a valid default for the ·actual type definition· as - * defined in Element Default Valid (Immediate) (§3.3.6). + * value must be a valid default for the �actual type definition� as + * defined in Element Default Valid (Immediate) (�3.3.6). */ - /* + /* * NOTE: 'local' above means types acquired by xsi:type. * NOTE: Although the *canonical* value is stated, it is not * relevant if canonical or not. Additionally XML Schema 1.1 @@ -26069,22 +26073,22 @@ character_content: * (see following). */ goto default_psvi; - } - /* - * cvc-elt (3.3.4) : 5.1.2 - * The element information item with the canonical lexical - * representation of the {value constraint} value used as its - * ·normalized value· must be ·valid· with respect to the - * ·actual type definition· as defined by Element Locally Valid (Type) - * (§3.3.4). - */ + } + /* + * cvc-elt (3.3.4) : 5.1.2 + * The element information item with the canonical lexical + * representation of the {value constraint} value used as its + * �normalized value� must be �valid� with respect to the + * �actual type definition� as defined by Element Locally Valid (Type) + * (�3.3.4). + */ if (WXS_IS_SIMPLE(inode->typeDef)) { ret = xmlSchemaVCheckINodeDataType(vctxt, inode, inode->typeDef, inode->decl->value); } else if (WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) { ret = xmlSchemaVCheckINodeDataType(vctxt, inode, inode->typeDef->contentTypeDef, - inode->decl->value); + inode->decl->value); } if (ret != 0) { if (ret < 0) { @@ -26105,7 +26109,7 @@ default_psvi: xmlChar *normValue; /* * VAL TODO: Normalize the value. - */ + */ normValue = xmlSchemaNormalizeValue(inode->typeDef, inode->decl->value); if (normValue != NULL) { @@ -26118,42 +26122,42 @@ default_psvi: "calling xmlNewText()"); goto internal_error; } else - xmlAddChild(inode->node, textChild); + xmlAddChild(inode->node, textChild); } - - } else if (! INODE_NILLED(inode)) { + + } else if (! INODE_NILLED(inode)) { /* - * 5.2.1 The element information item must be ·valid· with respect - * to the ·actual type definition· as defined by Element Locally - * Valid (Type) (§3.3.4). - */ + * 5.2.1 The element information item must be �valid� with respect + * to the �actual type definition� as defined by Element Locally + * Valid (Type) (�3.3.4). + */ if (WXS_IS_SIMPLE(inode->typeDef)) { /* * SPEC (cvc-type) (3.1) * "If the type definition is a simple type definition, ..." * (3.1.3) "If clause 3.2 of Element Locally Valid - * (Element) (§3.3.4) did not apply, then the ·normalized value· - * must be ·valid· with respect to the type definition as defined - * by String Valid (§3.14.4). - */ + * (Element) (�3.3.4) did not apply, then the �normalized value� + * must be �valid� with respect to the type definition as defined + * by String Valid (�3.14.4). + */ ret = xmlSchemaVCheckINodeDataType(vctxt, inode, inode->typeDef, inode->value); } else if (WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) { /* * SPEC (cvc-type) (3.2) "If the type definition is a complex type * definition, then the element information item must be - * ·valid· with respect to the type definition as per - * Element Locally Valid (Complex Type) (§3.4.4);" + * �valid� with respect to the type definition as per + * Element Locally Valid (Complex Type) (�3.4.4);" * * SPEC (cvc-complex-type) (2.2) - * "If the {content type} is a simple type definition, ... - * the ·normalized value· of the element information item is - * ·valid· with respect to that simple type definition as - * defined by String Valid (§3.14.4)." + * "If the {content type} is a simple type definition, ... + * the �normalized value� of the element information item is + * �valid� with respect to that simple type definition as + * defined by String Valid (�3.14.4)." */ ret = xmlSchemaVCheckINodeDataType(vctxt, inode, inode->typeDef->contentTypeDef, inode->value); - } + } if (ret != 0) { if (ret < 0) { VERROR_INT("xmlSchemaValidatorPopElem", @@ -26163,7 +26167,7 @@ default_psvi: goto end_elem; } /* - * 5.2.2 If there is a fixed {value constraint} and clause 3.2 has + * 5.2.2 If there is a fixed {value constraint} and clause 3.2 has * not applied, all of the following must be true: */ if ((inode->decl->value != NULL) && @@ -26174,7 +26178,7 @@ default_psvi: * done on computed values. */ /* - * 5.2.2.1 The element information item must have no element + * 5.2.2.1 The element information item must have no element * information item [children]. */ if (inode->flags & @@ -26186,28 +26190,28 @@ default_psvi: goto end_elem; } else { /* - * 5.2.2.2 The appropriate case among the following must + * 5.2.2.2 The appropriate case among the following must * be true: - */ + */ if (WXS_HAS_MIXED_CONTENT(inode->typeDef)) { /* - * 5.2.2.2.1 If the {content type} of the ·actual type - * definition· is mixed, then the *initial value* of the - * item must match the canonical lexical representation + * 5.2.2.2.1 If the {content type} of the �actual type + * definition� is mixed, then the *initial value* of the + * item must match the canonical lexical representation * of the {value constraint} value. * - * ... the *initial value* of an element information - * item is the string composed of, in order, the - * [character code] of each character information item in + * ... the *initial value* of an element information + * item is the string composed of, in order, the + * [character code] of each character information item in * the [children] of that element information item. - */ + */ if (! xmlStrEqual(inode->value, inode->decl->value)){ - /* + /* * VAL TODO: Report invalid & expected values as well. * VAL TODO: Implement the canonical stuff. */ ret = XML_SCHEMAV_CVC_ELT_5_2_2_2_1; - xmlSchemaCustomErr(ACTXT_CAST vctxt, + xmlSchemaCustomErr(ACTXT_CAST vctxt, ret, NULL, NULL, "The initial value '%s' does not match the fixed " "value constraint '%s'", @@ -26216,9 +26220,9 @@ default_psvi: } } else if (WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) { /* - * 5.2.2.2.2 If the {content type} of the ·actual type - * definition· is a simple type definition, then the - * *actual value* of the item must match the canonical + * 5.2.2.2.2 If the {content type} of the �actual type + * definition� is a simple type definition, then the + * *actual value* of the item must match the canonical * lexical representation of the {value constraint} value. */ /* @@ -26233,16 +26237,16 @@ default_psvi: xmlSchemaCustomErr(ACTXT_CAST vctxt, ret, NULL, NULL, "The actual value '%s' does not match the fixed " - "value constraint '%s'", + "value constraint '%s'", inode->value, inode->decl->value); goto end_elem; - } + } } - } + } } } - + end_elem: if (vctxt->depth < 0) { /* TODO: raise error? */ @@ -26252,15 +26256,15 @@ end_elem: vctxt->skipDepth = -1; /* * Evaluate the history of XPath state objects. - */ + */ if (inode->appliedXPath && (xmlSchemaXPathProcessHistory(vctxt, vctxt->depth) == -1)) goto internal_error; /* * MAYBE TODO: - * SPEC (6) "The element information item must be ·valid· with + * SPEC (6) "The element information item must be �valid� with * respect to each of the {identity-constraint definitions} as per - * Identity-constraint Satisfied (§3.11.4)." + * Identity-constraint Satisfied (�3.11.4)." */ /* * PSVI TODO: If we expose IDC node-tables via PSVI then the tables @@ -26268,7 +26272,7 @@ end_elem: * We will currently build IDC node-tables and bubble them only if * keyrefs do exist. */ - + /* * Add the current IDC target-nodes to the IDC node-tables. */ @@ -26302,7 +26306,7 @@ end_elem: */ if (xmlSchemaBubbleIDCNodeTables(vctxt) == -1) goto internal_error; - } + } } /* * Clear the current ielem. @@ -26335,11 +26339,11 @@ end_elem: aidc = aidc->next; } while (aidc != NULL); } - vctxt->depth--; + vctxt->depth--; vctxt->inode = vctxt->elemInfos[vctxt->depth]; /* - * VAL TODO: 7 If the element information item is the ·validation root·, it must be - * ·valid· per Validation Root Valid (ID/IDREF) (§3.3.4). + * VAL TODO: 7 If the element information item is the �validation root�, it must be + * �valid� per Validation Root Valid (ID/IDREF) (�3.3.4). */ return (ret); @@ -26420,11 +26424,11 @@ xmlSchemaValidateChildElem(xmlSchemaValidCtxtPtr vctxt) * Fallback to "anyType". * * SPEC (cvc-assess-elt) - * "If the item cannot be ·strictly assessed·, [...] + * "If the item cannot be �strictly assessed�, [...] * an element information item's schema validity may be laxly - * assessed if its ·context-determined declaration· is not - * skip by ·validating· with respect to the ·ur-type - * definition· as per Element Locally Valid (Type) (§3.3.4)." + * assessed if its �context-determined declaration� is not + * skip by �validating� with respect to the �ur-type + * definition� as per Element Locally Valid (Type) (�3.3.4)." */ vctxt->inode->typeDef = xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYTYPE); @@ -26496,9 +26500,9 @@ xmlSchemaValidateChildElem(xmlSchemaValidCtxtPtr vctxt) * SPEC (2.4) "If the {content type} is element-only or mixed, * then the sequence of the element information item's * element information item [children], if any, taken in - * order, is ·valid· with respect to the {content type}'s + * order, is �valid� with respect to the {content type}'s * particle, as defined in Element Sequence Locally Valid - * (Particle) (§3.9.4)." + * (Particle) (�3.9.4)." */ ret = xmlRegExecPushString2(regexCtxt, vctxt->inode->localName, @@ -26595,7 +26599,7 @@ xmlSchemaVPushText(xmlSchemaValidCtxtPtr vctxt, if (consumed != NULL) *consumed = 0; if (INODE_NILLED(vctxt->inode)) { - /* + /* * SPEC cvc-elt (3.3.4 - 3.2.1) * "The element information item must have no character or * element information item [children]." @@ -26611,7 +26615,7 @@ xmlSchemaVPushText(xmlSchemaValidCtxtPtr vctxt, * information item [children]." */ if (vctxt->inode->typeDef->contentType == - XML_SCHEMA_CONTENT_EMPTY) { + XML_SCHEMA_CONTENT_EMPTY) { VERROR(XML_SCHEMAV_CVC_COMPLEX_TYPE_2_1, NULL, "Character content is not allowed, " "because the content type is empty"); @@ -26622,12 +26626,12 @@ xmlSchemaVPushText(xmlSchemaValidCtxtPtr vctxt, XML_SCHEMA_CONTENT_ELEMENTS) { if ((nodeType != XML_TEXT_NODE) || (! xmlSchemaIsBlank((xmlChar *) value, len))) { - /* - * SPEC cvc-complex-type (2.3) - * "If the {content type} is element-only, then the - * element information item has no character information - * item [children] other than those whose [character - * code] is defined as a white space in [XML 1.0 (Second + /* + * SPEC cvc-complex-type (2.3) + * "If the {content type} is element-only, then the + * element information item has no character information + * item [children] other than those whose [character + * code] is defined as a white space in [XML 1.0 (Second * Edition)]." */ VERROR(XML_SCHEMAV_CVC_COMPLEX_TYPE_2_3, NULL, @@ -26637,7 +26641,7 @@ xmlSchemaVPushText(xmlSchemaValidCtxtPtr vctxt, } return (0); } - + if ((value == NULL) || (value[0] == 0)) return (0); /* @@ -26649,7 +26653,7 @@ xmlSchemaVPushText(xmlSchemaValidCtxtPtr vctxt, ((vctxt->inode->decl == NULL) || (vctxt->inode->decl->value == NULL))) return (0); - + if (vctxt->inode->value == NULL) { /* * Set the value. @@ -26692,7 +26696,7 @@ xmlSchemaVPushText(xmlSchemaValidCtxtPtr vctxt, len = xmlStrlen(value); /* * Concat the value. - */ + */ if (vctxt->inode->flags & XML_SCHEMA_NODE_INFO_FLAG_OWNED_VALUES) { vctxt->inode->value = BAD_CAST xmlStrncat( (xmlChar *) vctxt->inode->value, value, len); @@ -26701,7 +26705,7 @@ xmlSchemaVPushText(xmlSchemaValidCtxtPtr vctxt, BAD_CAST xmlStrncatNew(vctxt->inode->value, value, len); vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_FLAG_OWNED_VALUES; } - } + } return (0); } @@ -26718,7 +26722,7 @@ xmlSchemaValidateElem(xmlSchemaValidCtxtPtr vctxt) goto internal_error; } if (vctxt->xsiAssemble) { - /* + /* * We will stop validation if there was an error during * dynamic schema construction. * Note that we simply set @skipDepth to 0, this could @@ -26831,12 +26835,12 @@ type_validation: VERROR(ret, NULL, "The type definition is absent"); goto exit; - } + } if (vctxt->inode->typeDef->flags & XML_SCHEMAS_TYPE_ABSTRACT) { vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_ERR_BAD_TYPE; ret = XML_SCHEMAV_CVC_TYPE_2; VERROR(ret, NULL, - "The type definition is abstract"); + "The type definition is abstract"); goto exit; } /* @@ -26917,7 +26921,7 @@ root_found: nodeType = xmlTextReaderNodeType(vctxt->reader); if (nodeType == XML_ELEMENT_NODE) { - + vctxt->depth++; if (xmlSchemaValidatorPushElem(vctxt) == -1) { VERROR_INT("xmlSchemaVReaderWalk", @@ -27092,8 +27096,8 @@ internal_error: * Process text content. */ static void -xmlSchemaSAXHandleText(void *ctx, - const xmlChar * ch, +xmlSchemaSAXHandleText(void *ctx, + const xmlChar * ch, int len) { xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) ctx; @@ -27117,10 +27121,10 @@ xmlSchemaSAXHandleText(void *ctx, * Process CDATA content. */ static void -xmlSchemaSAXHandleCDataSection(void *ctx, - const xmlChar * ch, +xmlSchemaSAXHandleCDataSection(void *ctx, + const xmlChar * ch, int len) -{ +{ xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) ctx; if (vctxt->depth < 0) @@ -27154,20 +27158,20 @@ xmlSchemaSAXHandleReference(void *ctx ATTRIBUTE_UNUSED, static void xmlSchemaSAXHandleStartElementNs(void *ctx, - const xmlChar * localname, - const xmlChar * prefix ATTRIBUTE_UNUSED, - const xmlChar * URI, - int nb_namespaces, - const xmlChar ** namespaces, - int nb_attributes, - int nb_defaulted ATTRIBUTE_UNUSED, + const xmlChar * localname, + const xmlChar * prefix ATTRIBUTE_UNUSED, + const xmlChar * URI, + int nb_namespaces, + const xmlChar ** namespaces, + int nb_attributes, + int nb_defaulted ATTRIBUTE_UNUSED, const xmlChar ** attributes) -{ +{ xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) ctx; int ret; xmlSchemaNodeInfoPtr ielem; int i, j; - + /* * SAX VAL TODO: What to do with nb_defaulted? */ @@ -27195,16 +27199,16 @@ xmlSchemaSAXHandleStartElementNs(void *ctx, ielem->flags |= XML_SCHEMA_ELEM_INFO_EMPTY; /* * Register namespaces on the elem info. - */ + */ if (nb_namespaces != 0) { /* * Although the parser builds its own namespace list, * we have no access to it, so we'll use an own one. */ - for (i = 0, j = 0; i < nb_namespaces; i++, j += 2) { + for (i = 0, j = 0; i < nb_namespaces; i++, j += 2) { /* * Store prefix and namespace name. - */ + */ if (ielem->nsBindings == NULL) { ielem->nsBindings = (const xmlChar **) xmlMalloc(10 * @@ -27240,7 +27244,7 @@ xmlSchemaSAXHandleStartElementNs(void *ctx, } else ielem->nsBindings[ielem->nbNsBindings * 2 + 1] = namespaces[j+1]; - ielem->nbNsBindings++; + ielem->nbNsBindings++; } } /* @@ -27254,7 +27258,7 @@ xmlSchemaSAXHandleStartElementNs(void *ctx, for (j = 0, i = 0; i < nb_attributes; i++, j += 5) { /* * Duplicate the value. - */ + */ value = xmlStrndup(attributes[j+3], attributes[j+4] - attributes[j+3]); /* @@ -27281,7 +27285,7 @@ xmlSchemaSAXHandleStartElementNs(void *ctx, goto internal_error; } goto exit; - } + } exit: return; @@ -27391,7 +27395,7 @@ xmlSchemaClearValidCtxt(xmlSchemaValidCtxtPtr vctxt) #ifdef LIBXML_READER_ENABLED vctxt->reader = NULL; #endif - vctxt->hasKeyrefs = 0; + vctxt->hasKeyrefs = 0; if (vctxt->value != NULL) { xmlSchemaFreeValue(vctxt->value); @@ -27461,7 +27465,7 @@ xmlSchemaClearValidCtxt(xmlSchemaValidCtxtPtr vctxt) break; xmlSchemaClearElemInfo(vctxt, ei); } - } + } xmlSchemaItemListClear(vctxt->nodeQNames); /* Recreate the dict. */ xmlDictFree(vctxt->dict); @@ -27563,7 +27567,7 @@ xmlSchemaFreeValidCtxt(xmlSchemaValidCtxtPtr ctxt) * @ctxt: the schema validation context * * Check if any error was detected during validation. - * + * * Returns 1 if valid so far, 0 if errors were detected, and -1 in case * of internal error. */ @@ -27622,7 +27626,7 @@ xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt, /** * xmlSchemaGetValidErrors: - * @ctxt: a XML-Schema validation context + * @ctxt: a XML-Schema validation context * @err: the error function result * @warn: the warning function result * @ctx: the functions context result @@ -27683,7 +27687,7 @@ xmlSchemaSetValidOptions(xmlSchemaValidCtxtPtr ctxt, /** * xmlSchemaValidCtxtGetOptions: - * @ctxt: a schema validation context + * @ctxt: a schema validation context * * Get the validation context options. * @@ -27751,7 +27755,7 @@ xmlSchemaVDocWalk(xmlSchemaValidCtxtPtr vctxt) nsName = NULL; ret = xmlSchemaValidatorPushAttribute(vctxt, (xmlNodePtr) attr, - /* + /* * Note that we give it the line number of the * parent element. */ @@ -27807,7 +27811,7 @@ xmlSchemaVDocWalk(xmlSchemaValidCtxtPtr vctxt) (node->type == XML_ENTITY_REF_NODE)) { /* * DOC VAL TODO: What to do with entities? - */ + */ VERROR_INT("xmlSchemaVDocWalk", "there is at least one entity reference in the node-tree " "currently being validated. Processing of entities with " @@ -27867,7 +27871,7 @@ static int xmlSchemaPreRun(xmlSchemaValidCtxtPtr vctxt) { /* * Some initialization. - */ + */ vctxt->err = 0; vctxt->nberrors = 0; vctxt->depth = -1; @@ -27884,9 +27888,9 @@ xmlSchemaPreRun(xmlSchemaValidCtxtPtr vctxt) { */ if (vctxt->schema == NULL) { xmlSchemaParserCtxtPtr pctxt; - + vctxt->xsiAssemble = 1; - /* + /* * If not schema was given then we will create a schema * dynamically using XSI schema locations. * @@ -27902,8 +27906,8 @@ xmlSchemaPreRun(xmlSchemaValidCtxtPtr vctxt) { */ vctxt->schema = xmlSchemaNewSchema(pctxt); if (vctxt->schema == NULL) - return (-1); - /* + return (-1); + /* * Create the schema construction context. */ pctxt->constructor = xmlSchemaConstructionCtxtCreate(pctxt->dict); @@ -27914,13 +27918,13 @@ xmlSchemaPreRun(xmlSchemaValidCtxtPtr vctxt) { * Take ownership of the constructor to be able to free it. */ pctxt->ownsConstructor = 1; - } - /* - * Augment the IDC definitions for the main schema and all imported ones + } + /* + * Augment the IDC definitions for the main schema and all imported ones * NOTE: main schema if the first in the imported list */ xmlHashScan(vctxt->schema->schemasImports,(xmlHashScanner)xmlSchemaAugmentImportedIDC, vctxt); - + return(0); } @@ -28335,10 +28339,10 @@ referenceSplit(void *ctx, const xmlChar *name) } static void -startElementNsSplit(void *ctx, const xmlChar * localname, - const xmlChar * prefix, const xmlChar * URI, - int nb_namespaces, const xmlChar ** namespaces, - int nb_attributes, int nb_defaulted, +startElementNsSplit(void *ctx, const xmlChar * localname, + const xmlChar * prefix, const xmlChar * URI, + int nb_namespaces, const xmlChar ** namespaces, + int nb_attributes, int nb_defaulted, const xmlChar ** attributes) { xmlSchemaSAXPlugPtr ctxt = (xmlSchemaSAXPlugPtr) ctx; if (ctxt == NULL) @@ -28357,7 +28361,7 @@ startElementNsSplit(void *ctx, const xmlChar * localname, } static void -endElementNsSplit(void *ctx, const xmlChar * localname, +endElementNsSplit(void *ctx, const xmlChar * localname, const xmlChar * prefix, const xmlChar * URI) { xmlSchemaSAXPlugPtr ctxt = (xmlSchemaSAXPlugPtr) ctx; if (ctxt == NULL) @@ -28398,7 +28402,7 @@ xmlSchemaSAXPlug(xmlSchemaValidCtxtPtr ctxt, old_sax = *sax; if ((old_sax != NULL) && (old_sax->initialized != XML_SAX2_MAGIC)) return(NULL); - if ((old_sax != NULL) && + if ((old_sax != NULL) && (old_sax->startElementNs == NULL) && (old_sax->endElementNs == NULL) && ((old_sax->startElement != NULL) || (old_sax->endElement != NULL))) return(NULL); @@ -28416,7 +28420,7 @@ xmlSchemaSAXPlug(xmlSchemaValidCtxtPtr ctxt, ret->ctxt = ctxt; ret->user_sax_ptr = sax; ret->user_sax = old_sax; - if (old_sax == NULL) { + if (old_sax == NULL) { /* * go direct, no need for the split block and functions. */ @@ -28437,7 +28441,7 @@ xmlSchemaSAXPlug(xmlSchemaValidCtxtPtr ctxt, } else { /* * for each callback unused by Schemas initialize it to the Split - * routine only if non NULL in the user block, this can speed up + * routine only if non NULL in the user block, this can speed up * things at the SAX level. */ if (old_sax->internalSubset != NULL) @@ -28590,7 +28594,7 @@ xmlSchemaValidateStream(xmlSchemaValidCtxtPtr ctxt, if (options) xmlCtxtUseOptions(pctxt, options); #endif - pctxt->linenumbers = 1; + pctxt->linenumbers = 1; inputStream = xmlNewIOInputStream(pctxt, input, enc);; if (inputStream == NULL) { @@ -28619,7 +28623,7 @@ xmlSchemaValidateStream(xmlSchemaValidCtxtPtr ctxt, ret = ctxt->parserCtxt->errNo; if (ret == 0) ret = 1; - } + } done: ctxt->parserCtxt = NULL; @@ -28658,16 +28662,33 @@ xmlSchemaValidateFile(xmlSchemaValidCtxtPtr ctxt, if ((ctxt == NULL) || (filename == NULL)) return (-1); - + input = xmlParserInputBufferCreateFilename(filename, XML_CHAR_ENCODING_NONE); if (input == NULL) return (-1); ret = xmlSchemaValidateStream(ctxt, input, XML_CHAR_ENCODING_NONE, - NULL, NULL); + NULL, NULL); return (ret); } +/** + * xmlSchemaValidCtxtGetParserCtxt: + * @ctxt: a schema validation context + * + * allow access to the parser context of the schema validation context + * + * Returns the parser context of the schema validation context or NULL + * in case of error. + */ +xmlParserCtxtPtr +xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxtPtr ctxt) +{ + if (ctxt == NULL) + return(NULL); + return (ctxt->parserCtxt); +} + #define bottom_xmlschemas #include "elfgcchack.h" #endif /* LIBXML_SCHEMAS_ENABLED */ diff --git a/xpath.c b/xpath.c index a52c44a..cfa3f69 100644 --- a/xpath.c +++ b/xpath.c @@ -59,7 +59,7 @@ #define XPATH_STREAMING #endif -#define TODO \ +#define TODO \ xmlGenericError(xmlGenericErrorContext, \ "Unimplemented block at %s:%d\n", \ __FILE__, __LINE__); @@ -79,7 +79,7 @@ * XP_OPTIMIZED_FILTER_FIRST: * If defined, this will optimize expressions like "key('foo', 'val')[b][1]" * in a way, that it stop evaluation at the first node. -*/ +*/ #define XP_OPTIMIZED_FILTER_FIRST /* @@ -99,9 +99,9 @@ #if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) /************************************************************************ - * * - * Floating point stuff * - * * + * * + * Floating point stuff * + * * ************************************************************************/ #ifndef TRIO_REPLACE_STDIO @@ -142,7 +142,7 @@ xmlXPathInit(void) { * Provides a portable isnan() function to detect whether a double * is a NotaNumber. Based on trio code * http://sourceforge.net/projects/ctrio/ - * + * * Returns 1 if the value is a NaN, 0 otherwise */ int @@ -157,7 +157,7 @@ xmlXPathIsNaN(double val) { * Provides a portable isinf() function to detect whether a double * is a +Infinite or -Infinite. Based on trio code * http://sourceforge.net/projects/ctrio/ - * + * * Returns 1 vi the value is +Infinite, -1 if -Infinite, 0 otherwise */ int @@ -174,7 +174,7 @@ xmlXPathIsInf(double val) { * Provides a portable function to detect the sign of a double * Modified from trio code * http://sourceforge.net/projects/ctrio/ - * + * * Returns 1 if the value is Negative, 0 if positive */ static int @@ -203,7 +203,7 @@ static xmlNs xmlXPathXMLNamespaceStruct = { }; static xmlNsPtr xmlXPathXMLNamespace = &xmlXPathXMLNamespaceStruct; #ifndef LIBXML_THREAD_ENABLED -/* +/* * Optimizer is disabled only when threaded apps are detected while * the library ain't compiled for thread safety. */ @@ -350,7 +350,7 @@ xmlXPathErr(xmlXPathParserContextPtr ctxt, int error) } /* cleanup current last error */ - xmlResetError(&ctxt->context->lastError); + xmlResetError(&ctxt->context->lastError); ctxt->context->lastError.domain = XML_FROM_XPATH; ctxt->context->lastError.code = error + XML_XPATH_EXPRESSION_OK - @@ -390,9 +390,9 @@ xmlXPatherror(xmlXPathParserContextPtr ctxt, const char *file ATTRIBUTE_UNUSED, } /************************************************************************ - * * - * Utilities * - * * + * * + * Utilities * + * * ************************************************************************/ /** @@ -412,7 +412,7 @@ struct _xmlPointerList { * and here, we should make the functions public. */ static int -xmlPointerListAddSize(xmlPointerListPtr list, +xmlPointerListAddSize(xmlPointerListPtr list, void *item, int initialSize) { @@ -486,9 +486,9 @@ xmlPointerListFree(xmlPointerListPtr list) } /************************************************************************ - * * - * Parser Types * - * * + * * + * Parser Types * + * * ************************************************************************/ /* @@ -533,7 +533,7 @@ typedef enum { AXIS_PARENT, AXIS_PRECEDING, AXIS_PRECEDING_SIBLING, - AXIS_SELF + AXIS_SELF } xmlXPathAxisVal; typedef enum { @@ -549,7 +549,7 @@ typedef enum { NODE_TYPE_NODE = 0, NODE_TYPE_COMMENT = XML_COMMENT_NODE, NODE_TYPE_TEXT = XML_TEXT_NODE, - NODE_TYPE_PI = XML_PI_NODE + NODE_TYPE_PI = XML_PI_NODE } xmlXPathTypeVal; #define XP_REWRITE_DOS_CHILD_ELEM 1 @@ -587,9 +587,9 @@ struct _xmlXPathCompExpr { }; /************************************************************************ - * * - * Forward declarations * - * * + * * + * Forward declarations * + * * ************************************************************************/ static void xmlXPathFreeValueTree(xmlNodeSetPtr obj); @@ -604,9 +604,9 @@ xmlXPathCompOpEvalToBoolean(xmlXPathParserContextPtr ctxt, int isPredicate); /************************************************************************ - * * - * Parser Type functions * - * * + * * + * Parser Type functions * + * * ************************************************************************/ /** @@ -796,19 +796,19 @@ xmlXPathCompSwap(xmlXPathStepOpPtr op) { xmlXPathCompExprAdd(ctxt->comp, ctxt->comp->last, -1, \ (op), (val), (val2), (val3), (val4), (val5)) -#define PUSH_LEAVE_EXPR(op, val, val2) \ +#define PUSH_LEAVE_EXPR(op, val, val2) \ xmlXPathCompExprAdd(ctxt->comp, -1, -1, (op), (val), (val2), 0 ,NULL ,NULL) -#define PUSH_UNARY_EXPR(op, ch, val, val2) \ +#define PUSH_UNARY_EXPR(op, ch, val, val2) \ xmlXPathCompExprAdd(ctxt->comp, (ch), -1, (op), (val), (val2), 0 ,NULL ,NULL) -#define PUSH_BINARY_EXPR(op, ch1, ch2, val, val2) \ +#define PUSH_BINARY_EXPR(op, ch1, ch2, val, val2) \ xmlXPathCompExprAdd(ctxt->comp, (ch1), (ch2), (op), \ (val), (val2), 0 ,NULL ,NULL) /************************************************************************ * * - * XPath object cache structures * + * XPath object cache structures * * * ************************************************************************/ @@ -840,8 +840,8 @@ struct _xmlXPathContextCache { int dbgCachedLocset; int dbgCachedUsers; int dbgCachedXSLTTree; - int dbgCachedUndefined; - + int dbgCachedUndefined; + int dbgReusedAll; int dbgReusedNodeset; @@ -860,11 +860,11 @@ struct _xmlXPathContextCache { /************************************************************************ * * - * Debugging related functions * + * Debugging related functions * * * ************************************************************************/ -#define STRANGE \ +#define STRANGE \ xmlGenericError(xmlGenericErrorContext, \ "Internal error at %s:%d\n", \ __FILE__, __LINE__); @@ -882,7 +882,7 @@ xmlXPathDebugDumpNode(FILE *output, xmlNodePtr cur, int depth) { fprintf(output, shift); fprintf(output, "Node is NULL !\n"); return; - + } if ((cur->type == XML_DOCUMENT_NODE) || @@ -907,7 +907,7 @@ xmlXPathDebugDumpNodeList(FILE *output, xmlNodePtr cur, int depth) { fprintf(output, shift); fprintf(output, "Node is NULL !\n"); return; - + } while (cur != NULL) { @@ -930,7 +930,7 @@ xmlXPathDebugDumpNodeSet(FILE *output, xmlNodeSetPtr cur, int depth) { fprintf(output, shift); fprintf(output, "NodeSet is NULL !\n"); return; - + } if (cur != NULL) { @@ -956,7 +956,7 @@ xmlXPathDebugDumpValueTree(FILE *output, xmlNodeSetPtr cur, int depth) { fprintf(output, shift); fprintf(output, "Value Tree is NULL !\n"); return; - + } fprintf(output, shift); @@ -977,7 +977,7 @@ xmlXPathDebugDumpLocationSet(FILE *output, xmlLocationSetPtr cur, int depth) { fprintf(output, shift); fprintf(output, "LocationSet is NULL !\n"); return; - + } for (i = 0;i < cur->locNr;i++) { @@ -1008,7 +1008,7 @@ xmlXPathDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth) { shift[2 * i] = shift[2 * i + 1] = 0; - fprintf(output, shift); + fprintf(output, shift); if (cur == NULL) { fprintf(output, "Object is empty (NULL)\n"); @@ -1333,7 +1333,7 @@ static int xmlXPathDebugObjTotalRange = 0; static int xmlXPathDebugObjTotalLocset = 0; static int xmlXPathDebugObjTotalUsers = 0; static int xmlXPathDebugObjTotalXSLTTree = 0; -static int xmlXPathDebugObjTotalAll = 0; +static int xmlXPathDebugObjTotalAll = 0; static int xmlXPathDebugObjMaxUndefined = 0; static int xmlXPathDebugObjMaxNodeset = 0; @@ -1366,7 +1366,7 @@ xmlXPathDebugObjUsageReset(xmlXPathContextPtr ctxt) cache->dbgCachedLocset = 0; cache->dbgCachedUsers = 0; cache->dbgCachedXSLTTree = 0; - cache->dbgCachedUndefined = 0; + cache->dbgCachedUndefined = 0; cache->dbgReusedAll = 0; cache->dbgReusedNodeset = 0; @@ -1380,7 +1380,7 @@ xmlXPathDebugObjUsageReset(xmlXPathContextPtr ctxt) cache->dbgReusedXSLTTree = 0; cache->dbgReusedUndefined = 0; } - } + } xmlXPathDebugObjCounterUndefined = 0; xmlXPathDebugObjCounterNodeset = 0; @@ -1393,7 +1393,7 @@ xmlXPathDebugObjUsageReset(xmlXPathContextPtr ctxt) xmlXPathDebugObjCounterUsers = 0; xmlXPathDebugObjCounterXSLTTree = 0; xmlXPathDebugObjCounterAll = 0; - + xmlXPathDebugObjTotalUndefined = 0; xmlXPathDebugObjTotalNodeset = 0; xmlXPathDebugObjTotalBool = 0; @@ -1404,7 +1404,7 @@ xmlXPathDebugObjUsageReset(xmlXPathContextPtr ctxt) xmlXPathDebugObjTotalLocset = 0; xmlXPathDebugObjTotalUsers = 0; xmlXPathDebugObjTotalXSLTTree = 0; - xmlXPathDebugObjTotalAll = 0; + xmlXPathDebugObjTotalAll = 0; xmlXPathDebugObjMaxUndefined = 0; xmlXPathDebugObjMaxNodeset = 0; @@ -1430,10 +1430,10 @@ xmlXPathDebugObjUsageRequested(xmlXPathContextPtr ctxt, if (ctxt->cache != NULL) { xmlXPathContextCachePtr cache = (xmlXPathContextCachePtr) ctxt->cache; - + isCached = 1; - - cache->dbgReusedAll++; + + cache->dbgReusedAll++; switch (objType) { case XPATH_UNDEFINED: cache->dbgReusedUndefined++; @@ -1467,7 +1467,7 @@ xmlXPathDebugObjUsageRequested(xmlXPathContextPtr ctxt, break; default: break; - } + } } } @@ -1475,7 +1475,7 @@ xmlXPathDebugObjUsageRequested(xmlXPathContextPtr ctxt, case XPATH_UNDEFINED: if (! isCached) xmlXPathDebugObjTotalUndefined++; - xmlXPathDebugObjCounterUndefined++; + xmlXPathDebugObjCounterUndefined++; if (xmlXPathDebugObjCounterUndefined > xmlXPathDebugObjMaxUndefined) xmlXPathDebugObjMaxUndefined = @@ -1484,7 +1484,7 @@ xmlXPathDebugObjUsageRequested(xmlXPathContextPtr ctxt, case XPATH_NODESET: if (! isCached) xmlXPathDebugObjTotalNodeset++; - xmlXPathDebugObjCounterNodeset++; + xmlXPathDebugObjCounterNodeset++; if (xmlXPathDebugObjCounterNodeset > xmlXPathDebugObjMaxNodeset) xmlXPathDebugObjMaxNodeset = @@ -1493,7 +1493,7 @@ xmlXPathDebugObjUsageRequested(xmlXPathContextPtr ctxt, case XPATH_BOOLEAN: if (! isCached) xmlXPathDebugObjTotalBool++; - xmlXPathDebugObjCounterBool++; + xmlXPathDebugObjCounterBool++; if (xmlXPathDebugObjCounterBool > xmlXPathDebugObjMaxBool) xmlXPathDebugObjMaxBool = @@ -1502,7 +1502,7 @@ xmlXPathDebugObjUsageRequested(xmlXPathContextPtr ctxt, case XPATH_NUMBER: if (! isCached) xmlXPathDebugObjTotalNumber++; - xmlXPathDebugObjCounterNumber++; + xmlXPathDebugObjCounterNumber++; if (xmlXPathDebugObjCounterNumber > xmlXPathDebugObjMaxNumber) xmlXPathDebugObjMaxNumber = @@ -1511,7 +1511,7 @@ xmlXPathDebugObjUsageRequested(xmlXPathContextPtr ctxt, case XPATH_STRING: if (! isCached) xmlXPathDebugObjTotalString++; - xmlXPathDebugObjCounterString++; + xmlXPathDebugObjCounterString++; if (xmlXPathDebugObjCounterString > xmlXPathDebugObjMaxString) xmlXPathDebugObjMaxString = @@ -1520,7 +1520,7 @@ xmlXPathDebugObjUsageRequested(xmlXPathContextPtr ctxt, case XPATH_POINT: if (! isCached) xmlXPathDebugObjTotalPoint++; - xmlXPathDebugObjCounterPoint++; + xmlXPathDebugObjCounterPoint++; if (xmlXPathDebugObjCounterPoint > xmlXPathDebugObjMaxPoint) xmlXPathDebugObjMaxPoint = @@ -1547,7 +1547,7 @@ xmlXPathDebugObjUsageRequested(xmlXPathContextPtr ctxt, case XPATH_USERS: if (! isCached) xmlXPathDebugObjTotalUsers++; - xmlXPathDebugObjCounterUsers++; + xmlXPathDebugObjCounterUsers++; if (xmlXPathDebugObjCounterUsers > xmlXPathDebugObjMaxUsers) xmlXPathDebugObjMaxUsers = @@ -1556,7 +1556,7 @@ xmlXPathDebugObjUsageRequested(xmlXPathContextPtr ctxt, case XPATH_XSLT_TREE: if (! isCached) xmlXPathDebugObjTotalXSLTTree++; - xmlXPathDebugObjCounterXSLTTree++; + xmlXPathDebugObjCounterXSLTTree++; if (xmlXPathDebugObjCounterXSLTTree > xmlXPathDebugObjMaxXSLTTree) xmlXPathDebugObjMaxXSLTTree = @@ -1585,8 +1585,8 @@ xmlXPathDebugObjUsageReleased(xmlXPathContextPtr ctxt, xmlXPathContextCachePtr cache = (xmlXPathContextCachePtr) ctxt->cache; - isCached = 1; - + isCached = 1; + cache->dbgCachedAll++; switch (objType) { case XPATH_UNDEFINED: @@ -1622,7 +1622,7 @@ xmlXPathDebugObjUsageReleased(xmlXPathContextPtr ctxt, default: break; } - + } } switch (objType) { @@ -1658,7 +1658,7 @@ xmlXPathDebugObjUsageReleased(xmlXPathContextPtr ctxt, break; default: break; - } + } xmlXPathDebugObjCounterAll--; } @@ -1681,7 +1681,7 @@ xmlXPathDebugObjUsageDisplay(xmlXPathContextPtr ctxt) reqNumber = xmlXPathDebugObjTotalNumber; reqXSLTTree = xmlXPathDebugObjTotalXSLTTree; reqUndefined = xmlXPathDebugObjTotalUndefined; - + printf("# XPath object usage:\n"); if (ctxt != NULL) { @@ -1703,7 +1703,7 @@ xmlXPathDebugObjUsageDisplay(xmlXPathContextPtr ctxt) reqXSLTTree += reXSLTTree; reUndefined = cache->dbgReusedUndefined; reqUndefined += reUndefined; - + caAll = cache->dbgCachedAll; caBool = cache->dbgCachedBool; caNodeset = cache->dbgCachedNodeset; @@ -1711,7 +1711,7 @@ xmlXPathDebugObjUsageDisplay(xmlXPathContextPtr ctxt) caNumber = cache->dbgCachedNumber; caXSLTTree = cache->dbgCachedXSLTTree; caUndefined = cache->dbgCachedUndefined; - + if (cache->nodesetObjs) leftObjs -= cache->nodesetObjs->number; if (cache->stringObjs) @@ -1724,8 +1724,8 @@ xmlXPathDebugObjUsageDisplay(xmlXPathContextPtr ctxt) leftObjs -= cache->miscObjs->number; } } - - printf("# all\n"); + + printf("# all\n"); printf("# total : %d\n", reqAll); printf("# left : %d\n", leftObjs); printf("# created: %d\n", xmlXPathDebugObjTotalAll); @@ -1848,7 +1848,7 @@ xmlXPathFreeCache(xmlXPathContextCachePtr cache) if (cache->numberObjs) xmlXPathCacheFreeObjectList(cache->numberObjs); if (cache->miscObjs) - xmlXPathCacheFreeObjectList(cache->miscObjs); + xmlXPathCacheFreeObjectList(cache->miscObjs); xmlFree(cache); } @@ -1857,7 +1857,7 @@ xmlXPathFreeCache(xmlXPathContextCachePtr cache) * * @ctxt: the XPath context * @active: enables/disables (creates/frees) the cache - * @value: a value with semantics dependant on @options + * @value: a value with semantics dependant on @options * @options: options (currently only the value 0 is used) * * Creates/frees an object cache on the XPath context. @@ -1884,7 +1884,7 @@ xmlXPathContextSetCache(xmlXPathContextPtr ctxt, return(-1); if (active) { xmlXPathContextCachePtr cache; - + if (ctxt->cache == NULL) { ctxt->cache = xmlXPathNewCache(); if (ctxt->cache == NULL) @@ -1919,7 +1919,7 @@ xmlXPathContextSetCache(xmlXPathContextPtr ctxt, */ static xmlXPathObjectPtr xmlXPathCacheWrapNodeSet(xmlXPathContextPtr ctxt, xmlNodeSetPtr val) -{ +{ if ((ctxt != NULL) && (ctxt->cache != NULL)) { xmlXPathContextCachePtr cache = (xmlXPathContextCachePtr) ctxt->cache; @@ -1928,7 +1928,7 @@ xmlXPathCacheWrapNodeSet(xmlXPathContextPtr ctxt, xmlNodeSetPtr val) (cache->miscObjs->number != 0)) { xmlXPathObjectPtr ret; - + ret = (xmlXPathObjectPtr) cache->miscObjs->items[--cache->miscObjs->number]; ret->type = XPATH_NODESET; @@ -1936,12 +1936,12 @@ xmlXPathCacheWrapNodeSet(xmlXPathContextPtr ctxt, xmlNodeSetPtr val) #ifdef XP_DEBUG_OBJ_USAGE xmlXPathDebugObjUsageRequested(ctxt, XPATH_NODESET); #endif - return(ret); + return(ret); } } - + return(xmlXPathWrapNodeSet(val)); - + } /** @@ -1956,16 +1956,16 @@ xmlXPathCacheWrapNodeSet(xmlXPathContextPtr ctxt, xmlNodeSetPtr val) */ static xmlXPathObjectPtr xmlXPathCacheWrapString(xmlXPathContextPtr ctxt, xmlChar *val) -{ +{ if ((ctxt != NULL) && (ctxt->cache != NULL)) { xmlXPathContextCachePtr cache = (xmlXPathContextCachePtr) ctxt->cache; if ((cache->stringObjs != NULL) && (cache->stringObjs->number != 0)) { - + xmlXPathObjectPtr ret; - + ret = (xmlXPathObjectPtr) cache->stringObjs->items[--cache->stringObjs->number]; ret->type = XPATH_STRING; @@ -2014,20 +2014,20 @@ xmlXPathCacheNewNodeSet(xmlXPathContextPtr ctxt, xmlNodePtr val) if ((cache->nodesetObjs != NULL) && (cache->nodesetObjs->number != 0)) - { + { xmlXPathObjectPtr ret; /* * Use the nodset-cache. - */ + */ ret = (xmlXPathObjectPtr) cache->nodesetObjs->items[--cache->nodesetObjs->number]; ret->type = XPATH_NODESET; ret->boolval = 0; - if (val) { + if (val) { if ((ret->nodesetval->nodeMax == 0) || (val->type == XML_NAMESPACE_DECL)) { - xmlXPathNodeSetAddUnique(ret->nodesetval, val); + xmlXPathNodeSetAddUnique(ret->nodesetval, val); } else { ret->nodesetval->nodeTab[0] = val; ret->nodesetval->nodeNr = 1; @@ -2072,15 +2072,15 @@ xmlXPathCacheNewNodeSet(xmlXPathContextPtr ctxt, xmlNodePtr val) */ static xmlXPathObjectPtr xmlXPathCacheNewCString(xmlXPathContextPtr ctxt, const char *val) -{ +{ if ((ctxt != NULL) && (ctxt->cache)) { xmlXPathContextCachePtr cache = (xmlXPathContextCachePtr) ctxt->cache; if ((cache->stringObjs != NULL) && (cache->stringObjs->number != 0)) - { + { xmlXPathObjectPtr ret; - + ret = (xmlXPathObjectPtr) cache->stringObjs->items[--cache->stringObjs->number]; @@ -2121,15 +2121,15 @@ xmlXPathCacheNewCString(xmlXPathContextPtr ctxt, const char *val) */ static xmlXPathObjectPtr xmlXPathCacheNewString(xmlXPathContextPtr ctxt, const xmlChar *val) -{ +{ if ((ctxt != NULL) && (ctxt->cache)) { xmlXPathContextCachePtr cache = (xmlXPathContextCachePtr) ctxt->cache; if ((cache->stringObjs != NULL) && (cache->stringObjs->number != 0)) - { + { xmlXPathObjectPtr ret; - + ret = (xmlXPathObjectPtr) cache->stringObjs->items[--cache->stringObjs->number]; ret->type = XPATH_STRING; @@ -2175,15 +2175,15 @@ xmlXPathCacheNewString(xmlXPathContextPtr ctxt, const xmlChar *val) */ static xmlXPathObjectPtr xmlXPathCacheNewBoolean(xmlXPathContextPtr ctxt, int val) -{ +{ if ((ctxt != NULL) && (ctxt->cache)) { xmlXPathContextCachePtr cache = (xmlXPathContextCachePtr) ctxt->cache; if ((cache->booleanObjs != NULL) && (cache->booleanObjs->number != 0)) - { + { xmlXPathObjectPtr ret; - + ret = (xmlXPathObjectPtr) cache->booleanObjs->items[--cache->booleanObjs->number]; ret->type = XPATH_BOOLEAN; @@ -2229,9 +2229,9 @@ xmlXPathCacheNewFloat(xmlXPathContextPtr ctxt, double val) if ((cache->numberObjs != NULL) && (cache->numberObjs->number != 0)) - { + { xmlXPathObjectPtr ret; - + ret = (xmlXPathObjectPtr) cache->numberObjs->items[--cache->numberObjs->number]; ret->type = XPATH_NUMBER; @@ -2273,7 +2273,7 @@ xmlXPathCacheNewFloat(xmlXPathContextPtr ctxt, double val) static xmlXPathObjectPtr xmlXPathCacheConvertString(xmlXPathContextPtr ctxt, xmlXPathObjectPtr val) { - xmlChar *res = NULL; + xmlChar *res = NULL; if (val == NULL) return(xmlXPathCacheNewCString(ctxt, "")); @@ -2357,7 +2357,7 @@ xmlXPathCacheObjectCopy(xmlXPathContextPtr ctxt, xmlXPathObjectPtr val) static xmlXPathObjectPtr xmlXPathCacheConvertBoolean(xmlXPathContextPtr ctxt, xmlXPathObjectPtr val) { xmlXPathObjectPtr ret; - + if (val == NULL) return(xmlXPathCacheNewBoolean(ctxt, 0)); if (val->type == XPATH_BOOLEAN) @@ -2381,7 +2381,7 @@ xmlXPathCacheConvertBoolean(xmlXPathContextPtr ctxt, xmlXPathObjectPtr val) { static xmlXPathObjectPtr xmlXPathCacheConvertNumber(xmlXPathContextPtr ctxt, xmlXPathObjectPtr val) { xmlXPathObjectPtr ret; - + if (val == NULL) return(xmlXPathCacheNewFloat(ctxt, 0.0)); if (val->type == XPATH_NUMBER) @@ -2393,7 +2393,7 @@ xmlXPathCacheConvertNumber(xmlXPathContextPtr ctxt, xmlXPathObjectPtr val) { /************************************************************************ * * - * Parser stacks related functions and macros * + * Parser stacks related functions and macros * * * ************************************************************************/ @@ -2632,7 +2632,7 @@ xmlXPathPopExternal (xmlXPathParserContextPtr ctxt) { #define NEXTL(l) ctxt->cur += l -#define SKIP_BLANKS \ +#define SKIP_BLANKS \ while (IS_BLANK_CH(*(ctxt->cur))) NEXT #define CURRENT (*ctxt->cur) @@ -3001,17 +3001,17 @@ xmlXPathCmpNodesExt(xmlNodePtr node1, xmlNodePtr node2) { if (node1 == node2) return(0); - + /* * a couple of optimizations which will avoid computations in most cases - */ + */ switch (node1->type) { case XML_ELEMENT_NODE: if (node2->type == XML_ELEMENT_NODE) { if ((0 > (long) node1->content) && /* TODO: Would a != 0 suffice here? */ (0 > (long) node2->content) && (node1->doc == node2->doc)) - { + { l1 = -((long) node1->content); l2 = -((long) node2->content); if (l1 < l2) @@ -3019,7 +3019,7 @@ xmlXPathCmpNodesExt(xmlNodePtr node1, xmlNodePtr node2) { if (l1 > l2) return(-1); } else - goto turtle_comparison; + goto turtle_comparison; } break; case XML_ATTRIBUTE_NODE: @@ -3035,7 +3035,7 @@ xmlXPathCmpNodesExt(xmlNodePtr node1, xmlNodePtr node2) { miscNode1 = node1; /* * Find nearest element node. - */ + */ if (node1->prev != NULL) { do { node1 = node1->prev; @@ -3075,9 +3075,9 @@ xmlXPathCmpNodesExt(xmlNodePtr node1, xmlNodePtr node2) { return(1); default: break; - } + } switch (node2->type) { - case XML_ELEMENT_NODE: + case XML_ELEMENT_NODE: break; case XML_ATTRIBUTE_NODE: precedence2 = 1; /* element is owner */ @@ -3106,7 +3106,7 @@ xmlXPathCmpNodesExt(xmlNodePtr node1, xmlNodePtr node2) { } else { precedence2 = 2; /* element is parent */ node2 = node2->parent; - } + } if ((node2 == NULL) || (node2->type != XML_ELEMENT_NODE) || (0 <= (long) node1->content)) { @@ -3144,11 +3144,11 @@ xmlXPathCmpNodesExt(xmlNodePtr node1, xmlNodePtr node2) { * Is this 100% correct? */ if (precedence1 < precedence2) - return(1); + return(1); else - return(-1); + return(-1); } - } + } /* * Special case: One of the helper-elements is contained by the other. * @@ -3157,7 +3157,7 @@ xmlXPathCmpNodesExt(xmlNodePtr node1, xmlNodePtr node2) { * * Text-6(precedence2 == 3) * - */ + */ if ((precedence2 == 3) && (precedence1 > 1)) { cur = node1->parent; while (cur) { @@ -3166,7 +3166,7 @@ xmlXPathCmpNodesExt(xmlNodePtr node1, xmlNodePtr node2) { cur = cur->parent; } } - if ((precedence1 == 3) && (precedence2 > 1)) { + if ((precedence1 == 3) && (precedence2 > 1)) { cur = node2->parent; while (cur) { if (cur == node1) @@ -3174,16 +3174,16 @@ xmlXPathCmpNodesExt(xmlNodePtr node1, xmlNodePtr node2) { cur = cur->parent; } } - } + } /* * Speedup using document order if availble. */ - if ((node1->type == XML_ELEMENT_NODE) && + if ((node1->type == XML_ELEMENT_NODE) && (node2->type == XML_ELEMENT_NODE) && (0 > (long) node1->content) && (0 > (long) node2->content) && - (node1->doc == node2->doc)) { + (node1->doc == node2->doc)) { l1 = -((long) node1->content); l2 = -((long) node2->content); @@ -3251,7 +3251,7 @@ turtle_comparison: (node2->type == XML_ELEMENT_NODE) && (0 > (long) node1->content) && (0 > (long) node2->content) && - (node1->doc == node2->doc)) { + (node1->doc == node2->doc)) { l1 = -((long) node1->content); l2 = -((long) node2->content); @@ -3339,9 +3339,9 @@ xmlXPathNodeSetDupNs(xmlNodePtr node, xmlNsPtr ns) { memset(cur, 0, sizeof(xmlNs)); cur->type = XML_NAMESPACE_DECL; if (ns->href != NULL) - cur->href = xmlStrdup(ns->href); + cur->href = xmlStrdup(ns->href); if (ns->prefix != NULL) - cur->prefix = xmlStrdup(ns->prefix); + cur->prefix = xmlStrdup(ns->prefix); cur->next = (xmlNsPtr) node; return((xmlNodePtr) cur); } @@ -3435,7 +3435,7 @@ xmlXPathNodeSetCreateSize(int size) { return(NULL); } memset(ret->nodeTab, 0 , size * (size_t) sizeof(xmlNodePtr)); - ret->nodeMax = size; + ret->nodeMax = size; return(ret); } @@ -3488,7 +3488,7 @@ void xmlXPathNodeSetAddNs(xmlNodeSetPtr cur, xmlNodePtr node, xmlNsPtr ns) { int i; - + if ((cur == NULL) || (ns == NULL) || (node == NULL) || (ns->type != XML_NAMESPACE_DECL) || (node->type != XML_ELEMENT_NODE)) @@ -3587,7 +3587,7 @@ xmlXPathNodeSetAdd(xmlNodeSetPtr cur, xmlNodePtr val) { if (val->type == XML_NAMESPACE_DECL) { xmlNsPtr ns = (xmlNsPtr) val; - cur->nodeTab[cur->nodeNr++] = + cur->nodeTab[cur->nodeNr++] = xmlXPathNodeSetDupNs((xmlNodePtr) ns->next, ns); } else cur->nodeTab[cur->nodeNr++] = val; @@ -3639,7 +3639,7 @@ xmlXPathNodeSetAddUnique(xmlNodeSetPtr cur, xmlNodePtr val) { if (val->type == XML_NAMESPACE_DECL) { xmlNsPtr ns = (xmlNsPtr) val; - cur->nodeTab[cur->nodeNr++] = + cur->nodeTab[cur->nodeNr++] = xmlXPathNodeSetDupNs((xmlNodePtr) ns->next, ns); } else cur->nodeTab[cur->nodeNr++] = val; @@ -3674,7 +3674,7 @@ xmlXPathNodeSetMerge(xmlNodeSetPtr val1, xmlNodeSetPtr val2) { * If there was a flag on the nodesetval, indicating that * some temporary nodes are in, that would be helpfull. */ - /* + /* * Optimization: Create an equally sized node-set * and memcpy the content. */ @@ -3698,7 +3698,7 @@ xmlXPathNodeSetMerge(xmlNodeSetPtr val1, xmlNodeSetPtr val2) { initNr = val1->nodeNr; for (i = 0;i < val2->nodeNr;i++) { - n2 = val2->nodeTab[i]; + n2 = val2->nodeTab[i]; /* * check against duplicates */ @@ -3709,7 +3709,7 @@ xmlXPathNodeSetMerge(xmlNodeSetPtr val1, xmlNodeSetPtr val2) { skip = 1; break; } else if ((n1->type == XML_NAMESPACE_DECL) && - (n2->type == XML_NAMESPACE_DECL)) { + (n2->type == XML_NAMESPACE_DECL)) { if ((((xmlNsPtr) n1)->next == ((xmlNsPtr) n2)->next) && (xmlStrEqual(((xmlNsPtr) n1)->prefix, ((xmlNsPtr) n2)->prefix))) @@ -3860,7 +3860,7 @@ xmlXPathNodeSetMergeAndClear(xmlNodeSetPtr set1, xmlNodeSetPtr set2, if (set1 == NULL) return (NULL); - initNbSet1 = set1->nodeNr; + initNbSet1 = set1->nodeNr; for (i = 0;i < set2->nodeNr;i++) { n2 = set2->nodeTab[i]; /* @@ -3873,11 +3873,11 @@ xmlXPathNodeSetMergeAndClear(xmlNodeSetPtr set1, xmlNodeSetPtr set2, */ for (j = 0; j < initNbSet1; j++) { n1 = set1->nodeTab[j]; - if (n1 == n2) { + if (n1 == n2) { goto skip_node; } else if ((n1->type == XML_NAMESPACE_DECL) && (n2->type == XML_NAMESPACE_DECL)) - { + { if ((((xmlNsPtr) n1)->next == ((xmlNsPtr) n2)->next) && (xmlStrEqual(((xmlNsPtr) n1)->prefix, ((xmlNsPtr) n2)->prefix))) @@ -3906,7 +3906,7 @@ xmlXPathNodeSetMergeAndClear(xmlNodeSetPtr set1, xmlNodeSetPtr set2, set1->nodeMax = XML_NODESET_DEFAULT; } else if (set1->nodeNr >= set1->nodeMax) { xmlNodePtr *temp; - + set1->nodeMax *= 2; temp = (xmlNodePtr *) xmlRealloc( set1->nodeTab, set1->nodeMax * sizeof(xmlNodePtr)); @@ -3918,7 +3918,7 @@ xmlXPathNodeSetMergeAndClear(xmlNodeSetPtr set1, xmlNodeSetPtr set2, } if (n2->type == XML_NAMESPACE_DECL) { xmlNsPtr ns = (xmlNsPtr) n2; - + set1->nodeTab[set1->nodeNr++] = xmlXPathNodeSetDupNs((xmlNodePtr) ns->next, ns); } else @@ -3946,7 +3946,7 @@ skip_node: static xmlNodeSetPtr xmlXPathNodeSetMergeAndClearNoDupls(xmlNodeSetPtr set1, xmlNodeSetPtr set2, int hasNullEntries) -{ +{ if (set2 == NULL) return(set1); if ((set1 == NULL) && (hasNullEntries == 0)) { @@ -3970,14 +3970,14 @@ xmlXPathNodeSetMergeAndClearNoDupls(xmlNodeSetPtr set1, xmlNodeSetPtr set2, set1 = xmlXPathNodeSetCreate(NULL); if (set1 == NULL) return (NULL); - + for (i = 0;i < set2->nodeNr;i++) { n2 = set2->nodeTab[i]; /* * Skip NULLed entries. */ if (n2 == NULL) - continue; + continue; if (set1->nodeMax == 0) { set1->nodeTab = (xmlNodePtr *) xmlMalloc( XML_NODESET_DEFAULT * sizeof(xmlNodePtr)); @@ -3990,7 +3990,7 @@ xmlXPathNodeSetMergeAndClearNoDupls(xmlNodeSetPtr set1, xmlNodeSetPtr set2, set1->nodeMax = XML_NODESET_DEFAULT; } else if (set1->nodeNr >= set1->nodeMax) { xmlNodePtr *temp; - + set1->nodeMax *= 2; temp = (xmlNodePtr *) xmlRealloc( set1->nodeTab, set1->nodeMax * sizeof(xmlNodePtr)); @@ -4029,7 +4029,7 @@ xmlXPathNodeSetDel(xmlNodeSetPtr cur, xmlNodePtr val) { if (i >= cur->nodeNr) { /* not found */ #ifdef DEBUG - xmlGenericError(xmlGenericErrorContext, + xmlGenericError(xmlGenericErrorContext, "xmlXPathNodeSetDel: Node %s wasn't found in NodeList\n", val->name); #endif @@ -4089,7 +4089,7 @@ xmlXPathFreeNodeSet(xmlNodeSetPtr obj) { /** * xmlXPathNodeSetClear: * @set: the node set to clear - * + * * Clears the list from all temporary XPath objects (e.g. namespace nodes * are feed), but does *not* free the list itself. Sets the length of the * list to 0. @@ -4102,13 +4102,13 @@ xmlXPathNodeSetClear(xmlNodeSetPtr set, int hasNsNodes) else if (hasNsNodes) { int i; xmlNodePtr node; - + for (i = 0; i < set->nodeNr; i++) { node = set->nodeTab[i]; if ((node != NULL) && (node->type == XML_NAMESPACE_DECL)) xmlXPathNodeSetFreeNs((xmlNsPtr) node); - } + } } set->nodeNr = 0; } @@ -4117,7 +4117,7 @@ xmlXPathNodeSetClear(xmlNodeSetPtr set, int hasNsNodes) * xmlXPathNodeSetClearFromPos: * @set: the node set to be cleared * @pos: the start position to clear from - * + * * Clears the list from temporary XPath objects (e.g. namespace nodes * are feed) starting with the entry at @pos, but does *not* free the list * itself. Sets the length of the list to @pos. @@ -4130,13 +4130,13 @@ xmlXPathNodeSetClearFromPos(xmlNodeSetPtr set, int pos, int hasNsNodes) else if ((hasNsNodes)) { int i; xmlNodePtr node; - + for (i = pos; i < set->nodeNr; i++) { node = set->nodeTab[i]; if ((node != NULL) && (node->type == XML_NAMESPACE_DECL)) xmlXPathNodeSetFreeNs((xmlNsPtr) node); - } + } } set->nodeNr = pos; } @@ -4413,7 +4413,7 @@ xmlXPathIntersection (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) { * * Implements the EXSLT - Sets distinct() function: * node-set set:distinct (node-set) - * + * * Returns a subset of the nodes contained in @nodes, or @nodes if * it is empty */ @@ -4722,7 +4722,7 @@ xmlXPathTrailing (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) { * * Returns 0 in case of success, -1 in case of error */ -int +int xmlXPathRegisterFunc(xmlXPathContextPtr ctxt, const xmlChar *name, xmlXPathFunction f) { return(xmlXPathRegisterFuncNS(ctxt, name, NULL, f)); @@ -4816,7 +4816,7 @@ xmlXPathFunction xmlXPathFunctionLookupNS(xmlXPathContextPtr ctxt, const xmlChar *name, const xmlChar *ns_uri) { xmlXPathFunction ret; - + if (ctxt == NULL) return(NULL); if (name == NULL) @@ -4870,7 +4870,7 @@ xmlXPathRegisteredFuncsCleanup(xmlXPathContextPtr ctxt) { * * Returns 0 in case of success, -1 in case of error */ -int +int xmlXPathRegisterVariable(xmlXPathContextPtr ctxt, const xmlChar *name, xmlXPathObjectPtr value) { return(xmlXPathRegisterVariableNS(ctxt, name, NULL, value)); @@ -4902,7 +4902,7 @@ xmlXPathRegisterVariableNS(xmlXPathContextPtr ctxt, const xmlChar *name, if (ctxt->varHash == NULL) return(-1); if (value == NULL) - return(xmlHashRemoveEntry2(ctxt->varHash, name, ns_uri, + return(xmlHashRemoveEntry2(ctxt->varHash, name, ns_uri, (xmlHashDeallocator)xmlXPathFreeObject)); return(xmlHashUpdateEntry2(ctxt->varHash, name, ns_uri, (void *) value, @@ -4958,7 +4958,7 @@ xmlXPathVariableLookup(xmlXPathContextPtr ctxt, const xmlChar *name) { * @ns_uri: the variable namespace URI * * Search in the Variable array of the context for the given - * variable value. + * variable value. * * Returns the a copy of the value or NULL if not found */ @@ -5341,7 +5341,7 @@ xmlXPathObjectCopy(xmlXPathObjectPtr val) { #endif case XPATH_USERS: ret->user = val->user; - break; + break; case XPATH_UNDEFINED: xmlGenericError(xmlGenericErrorContext, "xmlXPathObjectCopy: unsupported type %d\n", @@ -5370,7 +5370,7 @@ xmlXPathFreeObject(xmlXPathObjectPtr obj) { #endif obj->type = XPATH_XSLT_TREE; /* TODO: Just for debugging. */ if (obj->nodesetval != NULL) - xmlXPathFreeValueTree(obj->nodesetval); + xmlXPathFreeValueTree(obj->nodesetval); } else { if (obj->nodesetval != NULL) xmlXPathFreeNodeSet(obj->nodesetval); @@ -5387,7 +5387,7 @@ xmlXPathFreeObject(xmlXPathObjectPtr obj) { #ifdef XP_DEBUG_OBJ_USAGE xmlXPathDebugObjUsageReleased(NULL, obj->type); #endif - xmlFree(obj); + xmlFree(obj); } /** @@ -5410,7 +5410,7 @@ xmlXPathReleaseObject(xmlXPathContextPtr ctxt, xmlXPathObjectPtr obj) return; if ((ctxt == NULL) || (ctxt->cache == NULL)) { xmlXPathFreeObject(obj); - } else { + } else { xmlXPathContextCachePtr cache = (xmlXPathContextCachePtr) ctxt->cache; @@ -5419,7 +5419,7 @@ xmlXPathReleaseObject(xmlXPathContextPtr ctxt, xmlXPathObjectPtr obj) case XPATH_XSLT_TREE: if (obj->nodesetval != NULL) { if (obj->boolval) { - /* + /* * It looks like the @boolval is used for * evaluation if this an XSLT Result Tree Fragment. * TODO: Check if this assumption is correct. @@ -5466,7 +5466,7 @@ xmlXPathReleaseObject(xmlXPathContextPtr ctxt, xmlXPathObjectPtr obj) xmlXPtrFreeLocationSet(obj->user); } goto free_obj; -#endif +#endif default: goto free_obj; } @@ -5487,7 +5487,7 @@ obj_cached: if (obj->nodesetval != NULL) { xmlNodeSetPtr tmpset = obj->nodesetval; - + /* * TODO: Due to those nasty ns-nodes, we need to traverse * the list and free the ns-nodes. @@ -5510,7 +5510,7 @@ obj_cached: if ((tmpset->nodeTab[0] != NULL) && (tmpset->nodeTab[0]->type == XML_NAMESPACE_DECL)) xmlXPathNodeSetFreeNs((xmlNsPtr) tmpset->nodeTab[0]); - } + } tmpset->nodeNr = 0; memset(obj, 0, sizeof(xmlXPathObject)); obj->nodesetval = tmpset; @@ -5522,7 +5522,7 @@ obj_cached: free_obj: /* * Cache is full; free the object. - */ + */ if (obj->nodesetval != NULL) xmlXPathFreeNodeSet(obj->nodesetval); #ifdef XP_DEBUG_OBJ_USAGE @@ -5633,7 +5633,7 @@ xmlXPathCastNodeSetToString (xmlNodeSetPtr ns) { * Converts an existing object to its string() equivalent * * Returns the allocated string value of the object, NULL in case of error. - * It's up to the caller to free the string memory with xmlFree(). + * It's up to the caller to free the string memory with xmlFree(). */ xmlChar * xmlXPathCastToString(xmlXPathObjectPtr val) { @@ -6024,7 +6024,7 @@ xmlXPathNewContext(xmlDocPtr doc) { } #endif - xmlXPathRegisterAllFunctions(ret); + xmlXPathRegisterAllFunctions(ret); return(ret); } @@ -6055,7 +6055,7 @@ xmlXPathFreeContext(xmlXPathContextPtr ctxt) { ************************************************************************/ #define CHECK_CTXT(ctxt) \ - if (ctxt == NULL) { \ + if (ctxt == NULL) { \ __xmlRaiseError(NULL, NULL, NULL, \ NULL, NULL, XML_FROM_XPATH, \ XML_ERR_INTERNAL_ERROR, XML_ERR_FATAL, \ @@ -6066,7 +6066,7 @@ xmlXPathFreeContext(xmlXPathContextPtr ctxt) { } \ #define CHECK_CTXT_NEG(ctxt) \ - if (ctxt == NULL) { \ + if (ctxt == NULL) { \ __xmlRaiseError(NULL, NULL, NULL, \ NULL, NULL, XML_FROM_XPATH, \ XML_ERR_INTERNAL_ERROR, XML_ERR_FATAL, \ @@ -6079,7 +6079,7 @@ xmlXPathFreeContext(xmlXPathContextPtr ctxt) { #define CHECK_CONTEXT(ctxt) \ if ((ctxt == NULL) || (ctxt->doc == NULL) || \ - (ctxt->doc->children == NULL)) { \ + (ctxt->doc->children == NULL)) { \ xmlXPatherror(ctxt, __FILE__, __LINE__, XPATH_INVALID_CTXT); \ return(NULL); \ } @@ -6142,7 +6142,7 @@ xmlXPathCompParserContext(xmlXPathCompExprPtr comp, xmlXPathContextPtr ctxt) { memset(ret, 0 , (size_t) sizeof(xmlXPathParserContext)); /* Allocate the value stack */ - ret->valueTab = (xmlXPathObjectPtr *) + ret->valueTab = (xmlXPathObjectPtr *) xmlMalloc(10 * sizeof(xmlXPathObjectPtr)); if (ret->valueTab == NULL) { xmlFree(ret); @@ -6289,7 +6289,7 @@ xmlXPathNodeValHash(xmlNodePtr node) { tmp = tmp->next; continue; } - + do { tmp = tmp->parent; if (tmp == NULL) @@ -6448,7 +6448,7 @@ xmlXPathCompareNodeSetString(xmlXPathParserContextPtr ctxt, int inf, int strict, * If both objects to be compared are node-sets, then the comparison * will be true if and only if there is a node in the first node-set * and a node in the second node-set such that the result of performing - * the comparison on the string-values of the two nodes is true. + * the comparison on the string-values of the two nodes is true. * .... * When neither object to be compared is a node-set and the operator * is <=, <, >= or >, then the objects are compared by converting both @@ -6462,7 +6462,7 @@ xmlXPathCompareNodeSetString(xmlXPathParserContextPtr ctxt, int inf, int strict, * represented by the string; any other string is converted to NaN * * Conclusion all nodes need to be converted first to their string value - * and then the comparison must be done when possible + * and then the comparison must be done when possible */ static int xmlXPathCompareNodeSets(int inf, int strict, @@ -6517,7 +6517,7 @@ xmlXPathCompareNodeSets(int inf, int strict, } if (xmlXPathIsNaN(values2[j])) continue; - if (inf && strict) + if (inf && strict) ret = (val1 < values2[j]); else if (inf && !strict) ret = (val1 <= values2[j]); @@ -6857,7 +6857,7 @@ xmlXPathEqualValuesCommon(xmlXPathParserContextPtr ctxt, case XPATH_STRING: if ((arg2->stringval == NULL) || (arg2->stringval[0] == 0)) ret = 0; - else + else ret = 1; ret = (arg1->boolval == ret); break; @@ -6892,7 +6892,7 @@ xmlXPathEqualValuesCommon(xmlXPathParserContextPtr ctxt, case XPATH_NUMBER: /* Hand check NaN and Infinity equalities */ if (xmlXPathIsNaN(arg1->floatval) || - xmlXPathIsNaN(arg2->floatval)) { + xmlXPathIsNaN(arg2->floatval)) { ret = 0; } else if (xmlXPathIsInf(arg1->floatval) == 1) { if (xmlXPathIsInf(arg2->floatval) == 1) @@ -6940,7 +6940,7 @@ xmlXPathEqualValuesCommon(xmlXPathParserContextPtr ctxt, case XPATH_BOOLEAN: if ((arg1->stringval == NULL) || (arg1->stringval[0] == 0)) ret = 0; - else + else ret = 1; ret = (arg2->boolval == ret); break; @@ -6953,7 +6953,7 @@ xmlXPathEqualValuesCommon(xmlXPathParserContextPtr ctxt, arg1 = valuePop(ctxt); /* Hand check NaN and Infinity equalities */ if (xmlXPathIsNaN(arg1->floatval) || - xmlXPathIsNaN(arg2->floatval)) { + xmlXPathIsNaN(arg2->floatval)) { ret = 0; } else if (xmlXPathIsInf(arg1->floatval) == 1) { if (xmlXPathIsInf(arg2->floatval) == 1) @@ -7019,7 +7019,7 @@ xmlXPathEqualValues(xmlXPathParserContextPtr ctxt) { int ret = 0; if ((ctxt == NULL) || (ctxt->context == NULL)) return(0); - arg2 = valuePop(ctxt); + arg2 = valuePop(ctxt); arg1 = valuePop(ctxt); if ((arg1 == NULL) || (arg2 == NULL)) { if (arg1 != NULL) @@ -7065,7 +7065,7 @@ xmlXPathEqualValues(xmlXPathParserContextPtr ctxt) { case XPATH_BOOLEAN: if ((arg1->nodesetval == NULL) || (arg1->nodesetval->nodeNr == 0)) ret = 0; - else + else ret = 1; ret = (ret == arg2->boolval); break; @@ -7104,7 +7104,7 @@ xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt) { int ret = 0; if ((ctxt == NULL) || (ctxt->context == NULL)) return(0); - arg2 = valuePop(ctxt); + arg2 = valuePop(ctxt); arg1 = valuePop(ctxt); if ((arg1 == NULL) || (arg2 == NULL)) { if (arg1 != NULL) @@ -7150,7 +7150,7 @@ xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt) { case XPATH_BOOLEAN: if ((arg1->nodesetval == NULL) || (arg1->nodesetval->nodeNr == 0)) ret = 0; - else + else ret = 1; ret = (ret != arg2->boolval); break; @@ -7181,7 +7181,7 @@ xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt) { * @inf: less than (1) or greater than (0) * @strict: is the comparison strict * - * Implement the compare operation on XPath objects: + * Implement the compare operation on XPath objects: * @arg1 < @arg2 (1, 1, ... * @arg1 <= @arg2 (1, 0, ... * @arg1 > @arg2 (0, 1, ... @@ -7205,7 +7205,7 @@ xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict) { xmlXPathObjectPtr arg1, arg2; if ((ctxt == NULL) || (ctxt->context == NULL)) return(0); - arg2 = valuePop(ctxt); + arg2 = valuePop(ctxt); arg1 = valuePop(ctxt); if ((arg1 == NULL) || (arg2 == NULL)) { if (arg1 != NULL) @@ -7446,7 +7446,7 @@ xmlXPathDivValues(xmlXPathParserContextPtr ctxt) { ctxt->value->floatval = xmlXPathPINF; else if (ctxt->value->floatval < 0) ctxt->value->floatval = xmlXPathNINF; - } else + } else ctxt->value->floatval /= val; } @@ -7681,10 +7681,10 @@ xmlXPathNextDescendantOrSelfElemParent(xmlNodePtr cur, #ifdef LIBXML_DOCB_ENABLED case XML_DOCB_DOCUMENT_NODE: #endif - case XML_HTML_DOCUMENT_NODE: + case XML_HTML_DOCUMENT_NODE: return(contextNode); default: - return(NULL); + return(NULL); } return(NULL); } else { @@ -7695,7 +7695,7 @@ xmlXPathNextDescendantOrSelfElemParent(xmlNodePtr cur, case XML_ELEMENT_NODE: /* TODO: OK to have XInclude here? */ case XML_XINCLUDE_START: - case XML_DOCUMENT_FRAG_NODE: + case XML_DOCUMENT_FRAG_NODE: if (cur != start) return(cur); if (cur->children != NULL) { @@ -7714,13 +7714,13 @@ xmlXPathNextDescendantOrSelfElemParent(xmlNodePtr cur, return(xmlDocGetRootElement((xmlDocPtr) cur)); default: break; - } - + } + next_sibling: if ((cur == NULL) || (cur == contextNode)) - return(NULL); + return(NULL); if (cur->next != NULL) { - cur = cur->next; + cur = cur->next; } else { cur = cur->parent; goto next_sibling; @@ -7728,7 +7728,7 @@ next_sibling: } } return(NULL); -} +} /** * xmlXPathNextDescendant: @@ -7760,7 +7760,7 @@ xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { /* * Do not descend on entities declarations */ - if (cur->children->type != XML_ENTITY_DECL) { + if (cur->children->type != XML_ENTITY_DECL) { cur = cur->children; /* * Skip DTDs @@ -7778,7 +7778,7 @@ xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { (cur->type != XML_DTD_NODE)) return(cur); } - + do { cur = cur->parent; if (cur == NULL) break; @@ -7877,7 +7877,7 @@ xmlXPathNextParent(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { return(NULL); case XML_NAMESPACE_DECL: { xmlNsPtr ns = (xmlNsPtr) ctxt->context->node; - + if ((ns->next != NULL) && (ns->next->type != XML_NAMESPACE_DECL)) return((xmlNodePtr) ns->next); @@ -7950,7 +7950,7 @@ xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { return(NULL); case XML_NAMESPACE_DECL: { xmlNsPtr ns = (xmlNsPtr) ctxt->context->node; - + if ((ns->next != NULL) && (ns->next->type != XML_NAMESPACE_DECL)) return((xmlNodePtr) ns->next); @@ -7994,7 +7994,7 @@ xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { } case XML_NAMESPACE_DECL: { xmlNsPtr ns = (xmlNsPtr) ctxt->context->node; - + if ((ns->next != NULL) && (ns->next->type != XML_NAMESPACE_DECL)) return((xmlNodePtr) ns->next); @@ -8191,7 +8191,7 @@ xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) * node that are before the context node in document order, excluding any * ancestors and excluding attribute nodes and namespace nodes; the nodes are * ordered in reverse document order - * This is a faster implementation but internal only since it requires a + * This is a faster implementation but internal only since it requires a * state kept in the parser context: ctxt->ancestor. * * Returns the next element following that axis @@ -8248,7 +8248,7 @@ xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { if (ctxt->context->tmpNsList == NULL && cur != (xmlNodePtr) xmlXPathXMLNamespace) { if (ctxt->context->tmpNsList != NULL) xmlFree(ctxt->context->tmpNsList); - ctxt->context->tmpNsList = + ctxt->context->tmpNsList = xmlGetNsList(ctxt->context->doc, ctxt->context->node); ctxt->context->tmpNsNr = 0; if (ctxt->context->tmpNsList != NULL) { @@ -8396,7 +8396,7 @@ xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlXPathObjectPtr cur; CHECK_ARITY(1); - if ((ctxt->value == NULL) || + if ((ctxt->value == NULL) || ((ctxt->value->type != XPATH_NODESET) && (ctxt->value->type != XPATH_XSLT_TREE))) XP_ERROR(XPATH_INVALID_TYPE); @@ -8541,7 +8541,7 @@ xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, int nargs) { } obj = xmlXPathCacheConvertString(ctxt->context, obj); ret = xmlXPathGetElementsByIds(ctxt->context->doc, obj->stringval); - valuePush(ctxt, xmlXPathCacheWrapNodeSet(ctxt->context, ret)); + valuePush(ctxt, xmlXPathCacheWrapNodeSet(ctxt->context, ret)); xmlXPathReleaseObject(ctxt->context, obj); return; } @@ -8572,7 +8572,7 @@ xmlXPathLocalNameFunction(xmlXPathParserContextPtr ctxt, int nargs) { } CHECK_ARITY(1); - if ((ctxt->value == NULL) || + if ((ctxt->value == NULL) || ((ctxt->value->type != XPATH_NODESET) && (ctxt->value->type != XPATH_XSLT_TREE))) XP_ERROR(XPATH_INVALID_TYPE); @@ -8630,7 +8630,7 @@ xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs) { nargs = 1; } CHECK_ARITY(1); - if ((ctxt->value == NULL) || + if ((ctxt->value == NULL) || ((ctxt->value->type != XPATH_NODESET) && (ctxt->value->type != XPATH_XSLT_TREE))) XP_ERROR(XPATH_INVALID_TYPE); @@ -8714,7 +8714,7 @@ xmlXPathNameFunction(xmlXPathParserContextPtr ctxt, int nargs) cur->nodesetval->nodeTab[i]->name)); } else { xmlChar *fullname; - + fullname = xmlBuildQName(cur->nodesetval->nodeTab[i]->name, cur->nodesetval->nodeTab[i]->ns->prefix, NULL, 0); @@ -8749,11 +8749,11 @@ xmlXPathNameFunction(xmlXPathParserContextPtr ctxt, int nargs) * the node in the node-set that is first in document order. * If the node-set is empty, an empty string is returned. * - A number is converted to a string as follows - * + NaN is converted to the string NaN - * + positive zero is converted to the string 0 - * + negative zero is converted to the string 0 - * + positive infinity is converted to the string Infinity - * + negative infinity is converted to the string -Infinity + * + NaN is converted to the string NaN + * + positive zero is converted to the string 0 + * + negative zero is converted to the string 0 + * + positive infinity is converted to the string Infinity + * + negative infinity is converted to the string -Infinity * + if the number is an integer, the number is represented in * decimal form as a Number with no decimal point and no leading * zeros, preceded by a minus sign (-) if the number is negative @@ -8827,7 +8827,7 @@ xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs) { CHECK_TYPE(XPATH_STRING); cur = valuePop(ctxt); valuePush(ctxt, xmlXPathCacheNewFloat(ctxt->context, - xmlUTF8Strlen(cur->stringval))); + xmlUTF8Strlen(cur->stringval))); xmlXPathReleaseObject(ctxt->context, cur); } @@ -8966,12 +8966,12 @@ xmlXPathStartsWithFunction(xmlXPathParserContextPtr ctxt, int nargs) { * or equal to the second argument and, if the third argument is specified, * less than the sum of the second and third arguments; the comparisons * and addition used for the above follow the standard IEEE 754 rules. Thus: - * - substring("12345", 1.5, 2.6) returns "234" - * - substring("12345", 0, 3) returns "12" - * - substring("12345", 0 div 0, 3) returns "" - * - substring("12345", 1, 0 div 0) returns "" - * - substring("12345", -42, 1 div 0) returns "12345" - * - substring("12345", -1 div 0, 1 div 0) returns "" + * - substring("12345", 1.5, 2.6) returns "234" + * - substring("12345", 0, 3) returns "12" + * - substring("12345", 0 div 0, 3) returns "" + * - substring("12345", 1, 0 div 0) returns "" + * - substring("12345", -42, 1 div 0) returns "12345" + * - substring("12345", -1 div 0, 1 div 0) returns "" */ void xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs) { @@ -9012,18 +9012,18 @@ xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs) { */ if (nargs != 3) { le = (double)m; - if (in < 1.0) + if (in < 1.0) in = 1.0; } - /* Need to check for the special cases where either + /* Need to check for the special cases where either * the index is NaN, the length is NaN, or both * arguments are infinity (relying on Inf + -Inf = NaN) */ if (!xmlXPathIsNaN(in + le) && !xmlXPathIsInf(in)) { /* * To meet the requirements of the spec, the arguments - * must be converted to integer format before + * must be converted to integer format before * initial index calculations are done * * First we go to integer form, rounding up @@ -9089,13 +9089,13 @@ xmlXPathSubstringBeforeFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlBufferPtr target; const xmlChar *point; int offset; - + CHECK_ARITY(2); CAST_TO_STRING; find = valuePop(ctxt); CAST_TO_STRING; str = valuePop(ctxt); - + target = xmlBufferCreate(); if (target) { point = xmlStrstr(str->stringval, find->stringval); @@ -9132,13 +9132,13 @@ xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlBufferPtr target; const xmlChar *point; int offset; - + CHECK_ARITY(2); CAST_TO_STRING; find = valuePop(ctxt); CAST_TO_STRING; str = valuePop(ctxt); - + target = xmlBufferCreate(); if (target) { point = xmlStrstr(str->stringval, find->stringval); @@ -9148,7 +9148,7 @@ xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlStrlen(str->stringval) - offset); } valuePush(ctxt, xmlXPathCacheNewString(ctxt->context, - xmlBufferContent(target))); + xmlBufferContent(target))); xmlBufferFree(target); } xmlXPathReleaseObject(ctxt->context, str); @@ -9175,7 +9175,7 @@ xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlChar *source = NULL; xmlBufferPtr target; xmlChar blank; - + if (ctxt == NULL) return; if (nargs == 0) { /* Use current context node */ @@ -9193,11 +9193,11 @@ xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs) { target = xmlBufferCreate(); if (target && source) { - + /* Skip leading whitespaces */ while (IS_BLANK_CH(*source)) source++; - + /* Collapse intermediate whitespaces, and skip trailing whitespaces */ blank = 0; while (*source) { @@ -9472,7 +9472,7 @@ xmlXPathSumFunction(xmlXPathParserContextPtr ctxt, int nargs) { double res = 0.0; CHECK_ARITY(1); - if ((ctxt->value == NULL) || + if ((ctxt->value == NULL) || ((ctxt->value->type != XPATH_NODESET) && (ctxt->value->type != XPATH_XSLT_TREE))) XP_ERROR(XPATH_INVALID_TYPE); @@ -9591,14 +9591,14 @@ xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs) { if (ctxt->value->floatval < 0) { if (ctxt->value->floatval < f - 0.5) ctxt->value->floatval = f - 1; - else + else ctxt->value->floatval = f; if (ctxt->value->floatval == 0) ctxt->value->floatval = xmlXPathNZERO; } else { if (ctxt->value->floatval < f + 0.5) ctxt->value->floatval = f; - else + else ctxt->value->floatval = f + 1; } } @@ -9649,7 +9649,7 @@ xmlXPathCurrentChar(xmlXPathParserContextPtr ctxt, int *len) { * UCS-4 range (hex.) UTF-8 octet sequence (binary) * 0000 0000-0000 007F 0xxxxxxx * 0000 0080-0000 07FF 110xxxxx 10xxxxxx - * 0000 0800-0000 FFFF 1110xxxx 10xxxxxx 10xxxxxx + * 0000 0800-0000 FFFF 1110xxxx 10xxxxxx 10xxxxxx * * Check for the 0x110000 limit too */ @@ -9686,7 +9686,7 @@ xmlXPathCurrentChar(xmlXPathParserContextPtr ctxt, int *len) { } if (!IS_CHAR(val)) { XP_ERROR0(XPATH_INVALID_CHAR_ERROR); - } + } return(val); } else { /* 1-byte code */ @@ -9758,7 +9758,7 @@ xmlXPathParseNCName(xmlXPathParserContextPtr ctxt) { /** * xmlXPathParseQName: * @ctxt: the XPath Parser context - * @prefix: a xmlChar ** + * @prefix: a xmlChar ** * * parse an XML qualified name * @@ -9852,7 +9852,7 @@ xmlXPathParseNameComplex(xmlXPathParserContextPtr ctxt, int qualified) { while ((c != ' ') && (c != '>') && (c != '/') && /* test bigname.xml */ ((IS_LETTER(c)) || (IS_DIGIT(c)) || (c == '.') || (c == '-') || - (c == '_') || ((qualified) && (c == ':')) || + (c == '_') || ((qualified) && (c == ':')) || (IS_COMBINING(c)) || (IS_EXTENDER(c)))) { COPY_BUF(l,buf,len,c); @@ -9865,7 +9865,7 @@ xmlXPathParseNameComplex(xmlXPathParserContextPtr ctxt, int qualified) { */ xmlChar *buffer; int max = len * 2; - + buffer = (xmlChar *) xmlMallocAtomic(max * sizeof(xmlChar)); if (buffer == NULL) { XP_ERRORNULL(XPATH_MEMORY_ERROR); @@ -9873,7 +9873,7 @@ xmlXPathParseNameComplex(xmlXPathParserContextPtr ctxt, int qualified) { memcpy(buffer, buf, len); while ((IS_LETTER(c)) || (IS_DIGIT(c)) || /* test bigname.xml */ (c == '.') || (c == '-') || - (c == '_') || ((qualified) && (c == ':')) || + (c == '_') || ((qualified) && (c == ':')) || (IS_COMBINING(c)) || (IS_EXTENDER(c))) { if (len + 10 > max) { @@ -9920,7 +9920,7 @@ static double my_pow10[MAX_FRAC+1] = { * [30a] Float ::= Number ('e' Digits?)? * * [30] Number ::= Digits ('.' Digits?)? - * | '.' Digits + * | '.' Digits * [31] Digits ::= [0-9]+ * * Compile a Number in the string @@ -10019,7 +10019,7 @@ xmlXPathStringEvalNumber(const xmlChar *str) { * @ctxt: the XPath Parser context * * [30] Number ::= Digits ('.' Digits?)? - * | '.' Digits + * | '.' Digits * [31] Digits ::= [0-9]+ * * Compile a Number, then push it on the stack @@ -10199,9 +10199,9 @@ xmlXPathCompLiteral(xmlXPathParserContextPtr ctxt) { * * Early evaluation is possible since: * The variable bindings [...] used to evaluate a subexpression are - * always the same as those used to evaluate the containing expression. + * always the same as those used to evaluate the containing expression. * - * [36] VariableReference ::= '$' QName + * [36] VariableReference ::= '$' QName */ static void xmlXPathCompVariableReference(xmlXPathParserContextPtr ctxt) { @@ -10260,7 +10260,7 @@ xmlXPathIsNodeType(const xmlChar *name) { * @ctxt: the XPath Parser context * * [16] FunctionCall ::= FunctionName '(' ( Argument ( ',' Argument)*)? ')' - * [17] Argument ::= Expr + * [17] Argument ::= Expr * * Compile a function call, the evaluation of all arguments are * pushed on the stack @@ -10327,11 +10327,11 @@ xmlXPathCompFunctionCall(xmlXPathParserContextPtr ctxt) { * xmlXPathCompPrimaryExpr: * @ctxt: the XPath Parser context * - * [15] PrimaryExpr ::= VariableReference + * [15] PrimaryExpr ::= VariableReference * | '(' Expr ')' - * | Literal - * | Number - * | FunctionCall + * | Literal + * | Number + * | FunctionCall * * Compile a primary expression. */ @@ -10363,8 +10363,8 @@ xmlXPathCompPrimaryExpr(xmlXPathParserContextPtr ctxt) { * xmlXPathCompFilterExpr: * @ctxt: the XPath Parser context * - * [20] FilterExpr ::= PrimaryExpr - * | FilterExpr Predicate + * [20] FilterExpr ::= PrimaryExpr + * | FilterExpr Predicate * * Compile a filter expression. * Square brackets are used to filter expressions in the same way that @@ -10379,13 +10379,13 @@ xmlXPathCompFilterExpr(xmlXPathParserContextPtr ctxt) { xmlXPathCompPrimaryExpr(ctxt); CHECK_ERROR; SKIP_BLANKS; - + while (CUR == '[') { xmlXPathCompPredicate(ctxt, 1); SKIP_BLANKS; } - + } /** @@ -10424,7 +10424,7 @@ xmlXPathScanName(xmlXPathParserContextPtr ctxt) { while ((c != ' ') && (c != '>') && (c != '/') && /* test bigname.xml */ ((IS_LETTER(c)) || (IS_DIGIT(c)) || (c == '.') || (c == '-') || - (c == '_') || (c == ':') || + (c == '_') || (c == ':') || (IS_COMBINING(c)) || (IS_EXTENDER(c)))) { len += l; @@ -10440,10 +10440,10 @@ xmlXPathScanName(xmlXPathParserContextPtr ctxt) { * xmlXPathCompPathExpr: * @ctxt: the XPath Parser context * - * [19] PathExpr ::= LocationPath - * | FilterExpr - * | FilterExpr '/' RelativeLocationPath - * | FilterExpr '//' RelativeLocationPath + * [19] PathExpr ::= LocationPath + * | FilterExpr + * | FilterExpr '/' RelativeLocationPath + * | FilterExpr '//' RelativeLocationPath * * Compile a path expression. * The / operator and // operators combine an arbitrary expression @@ -10460,8 +10460,8 @@ xmlXPathCompPathExpr(xmlXPathParserContextPtr ctxt) { xmlChar *name = NULL; /* we may have to preparse a name to find out */ SKIP_BLANKS; - if ((CUR == '$') || (CUR == '(') || - (IS_ASCII_DIGIT(CUR)) || + if ((CUR == '$') || (CUR == '(') || + (IS_ASCII_DIGIT(CUR)) || (CUR == '\'') || (CUR == '"') || (CUR == '.' && IS_ASCII_DIGIT(NXT(1)))) { lc = 0; @@ -10501,7 +10501,7 @@ xmlXPathCompPathExpr(xmlXPathParserContextPtr ctxt) { } else if (name != NULL) { int len =xmlStrlen(name); - + while (NXT(len) != 0) { if (NXT(len) == '/') { /* element name */ @@ -10568,7 +10568,7 @@ xmlXPathCompPathExpr(xmlXPathParserContextPtr ctxt) { /* make sure all cases are covered explicitly */ XP_ERROR(XPATH_EXPR_ERROR); } - } + } if (lc) { if (CUR == '/') { @@ -10600,8 +10600,8 @@ xmlXPathCompPathExpr(xmlXPathParserContextPtr ctxt) { * xmlXPathCompUnionExpr: * @ctxt: the XPath Parser context * - * [18] UnionExpr ::= PathExpr - * | UnionExpr '|' PathExpr + * [18] UnionExpr ::= PathExpr + * | UnionExpr '|' PathExpr * * Compile an union expression. */ @@ -10629,8 +10629,8 @@ xmlXPathCompUnionExpr(xmlXPathParserContextPtr ctxt) { * xmlXPathCompUnaryExpr: * @ctxt: the XPath Parser context * - * [27] UnaryExpr ::= UnionExpr - * | '-' UnaryExpr + * [27] UnaryExpr ::= UnionExpr + * | '-' UnaryExpr * * Compile an unary expression. */ @@ -10662,10 +10662,10 @@ xmlXPathCompUnaryExpr(xmlXPathParserContextPtr ctxt) { * xmlXPathCompMultiplicativeExpr: * @ctxt: the XPath Parser context * - * [26] MultiplicativeExpr ::= UnaryExpr - * | MultiplicativeExpr MultiplyOperator UnaryExpr - * | MultiplicativeExpr 'div' UnaryExpr - * | MultiplicativeExpr 'mod' UnaryExpr + * [26] MultiplicativeExpr ::= UnaryExpr + * | MultiplicativeExpr MultiplyOperator UnaryExpr + * | MultiplicativeExpr 'div' UnaryExpr + * | MultiplicativeExpr 'mod' UnaryExpr * [34] MultiplyOperator ::= '*' * * Compile an Additive expression. @@ -10676,7 +10676,7 @@ xmlXPathCompMultiplicativeExpr(xmlXPathParserContextPtr ctxt) { xmlXPathCompUnaryExpr(ctxt); CHECK_ERROR; SKIP_BLANKS; - while ((CUR == '*') || + while ((CUR == '*') || ((CUR == 'd') && (NXT(1) == 'i') && (NXT(2) == 'v')) || ((CUR == 'm') && (NXT(1) == 'o') && (NXT(2) == 'd'))) { int op = -1; @@ -10704,9 +10704,9 @@ xmlXPathCompMultiplicativeExpr(xmlXPathParserContextPtr ctxt) { * xmlXPathCompAdditiveExpr: * @ctxt: the XPath Parser context * - * [25] AdditiveExpr ::= MultiplicativeExpr - * | AdditiveExpr '+' MultiplicativeExpr - * | AdditiveExpr '-' MultiplicativeExpr + * [25] AdditiveExpr ::= MultiplicativeExpr + * | AdditiveExpr '+' MultiplicativeExpr + * | AdditiveExpr '-' MultiplicativeExpr * * Compile an Additive expression. */ @@ -10736,11 +10736,11 @@ xmlXPathCompAdditiveExpr(xmlXPathParserContextPtr ctxt) { * xmlXPathCompRelationalExpr: * @ctxt: the XPath Parser context * - * [24] RelationalExpr ::= AdditiveExpr - * | RelationalExpr '<' AdditiveExpr - * | RelationalExpr '>' AdditiveExpr - * | RelationalExpr '<=' AdditiveExpr - * | RelationalExpr '>=' AdditiveExpr + * [24] RelationalExpr ::= AdditiveExpr + * | RelationalExpr '<' AdditiveExpr + * | RelationalExpr '>' AdditiveExpr + * | RelationalExpr '<=' AdditiveExpr + * | RelationalExpr '>=' AdditiveExpr * * A <= B > C is allowed ? Answer from James, yes with * (AdditiveExpr <= AdditiveExpr) > AdditiveExpr @@ -10780,9 +10780,9 @@ xmlXPathCompRelationalExpr(xmlXPathParserContextPtr ctxt) { * xmlXPathCompEqualityExpr: * @ctxt: the XPath Parser context * - * [23] EqualityExpr ::= RelationalExpr - * | EqualityExpr '=' RelationalExpr - * | EqualityExpr '!=' RelationalExpr + * [23] EqualityExpr ::= RelationalExpr + * | EqualityExpr '=' RelationalExpr + * | EqualityExpr '!=' RelationalExpr * * A != B != C is allowed ? Answer from James, yes with * (RelationalExpr = RelationalExpr) = RelationalExpr @@ -10817,8 +10817,8 @@ xmlXPathCompEqualityExpr(xmlXPathParserContextPtr ctxt) { * xmlXPathCompAndExpr: * @ctxt: the XPath Parser context * - * [22] AndExpr ::= EqualityExpr - * | AndExpr 'and' EqualityExpr + * [22] AndExpr ::= EqualityExpr + * | AndExpr 'and' EqualityExpr * * Compile an AND expression. * @@ -10843,9 +10843,9 @@ xmlXPathCompAndExpr(xmlXPathParserContextPtr ctxt) { * xmlXPathCompileExpr: * @ctxt: the XPath Parser context * - * [14] Expr ::= OrExpr - * [21] OrExpr ::= AndExpr - * | OrExpr 'or' AndExpr + * [14] Expr ::= OrExpr + * [21] OrExpr ::= AndExpr + * | OrExpr 'or' AndExpr * * Parse and compile an expression */ @@ -10881,7 +10881,7 @@ xmlXPathCompileExpr(xmlXPathParserContextPtr ctxt, int sort) { * @filter: act as a filter * * [8] Predicate ::= '[' PredicateExpr ']' - * [9] PredicateExpr ::= Expr + * [9] PredicateExpr ::= Expr * * Compile a predicate expression */ @@ -10998,7 +10998,7 @@ xmlXPathCompNodeTest(xmlXPathParserContextPtr ctxt, xmlXPathTestVal *test, } *test = NODE_TEST_TYPE; - + SKIP_BLANKS; if (*type == NODE_TYPE_PI) { /* @@ -11134,7 +11134,7 @@ xmlXPathIsAxisName(const xmlChar *name) { * @ctxt: the XPath Parser context * * [4] Step ::= AxisSpecifier NodeTest Predicate* - * | AbbreviatedStep + * | AbbreviatedStep * * [12] AbbreviatedStep ::= '.' | '..' * @@ -11306,10 +11306,10 @@ eval_predicates: * xmlXPathCompRelativeLocationPath: * @ctxt: the XPath Parser context * - * [3] RelativeLocationPath ::= Step - * | RelativeLocationPath '/' Step - * | AbbreviatedRelativeLocationPath - * [11] AbbreviatedRelativeLocationPath ::= RelativeLocationPath '//' Step + * [3] RelativeLocationPath ::= Step + * | RelativeLocationPath '/' Step + * | AbbreviatedRelativeLocationPath + * [11] AbbreviatedRelativeLocationPath ::= RelativeLocationPath '//' Step * * Compile a relative location path. */ @@ -11348,12 +11348,12 @@ xmlXPathCompRelativeLocationPath * xmlXPathCompLocationPath: * @ctxt: the XPath Parser context * - * [1] LocationPath ::= RelativeLocationPath - * | AbsoluteLocationPath + * [1] LocationPath ::= RelativeLocationPath + * | AbsoluteLocationPath * [2] AbsoluteLocationPath ::= '/' RelativeLocationPath? - * | AbbreviatedAbsoluteLocationPath - * [10] AbbreviatedAbsoluteLocationPath ::= - * '//' RelativeLocationPath + * | AbbreviatedAbsoluteLocationPath + * [10] AbbreviatedAbsoluteLocationPath ::= + * '//' RelativeLocationPath * * Compile a location path * @@ -11392,7 +11392,7 @@ xmlXPathCompLocationPath(xmlXPathParserContextPtr ctxt) { /************************************************************************ * * - * XPath precompiled expression evaluation * + * XPath precompiled expression evaluation * * * ************************************************************************/ @@ -11509,7 +11509,7 @@ xmlXPathCompOpEvalPredicate(xmlXPathParserContextPtr ctxt, CHECK_ERROR0; if (contextSize <= 0) return(0); - } + } if (op->ch2 != -1) { xmlXPathContextPtr xpctxt = ctxt->context; xmlNodePtr contextNode, oldContextNode; @@ -11553,7 +11553,7 @@ xmlXPathCompOpEvalPredicate(xmlXPathParserContextPtr ctxt, /* * Get the expression of this predicate. */ - exprOp = &ctxt->comp->steps[op->ch2]; + exprOp = &ctxt->comp->steps[op->ch2]; newContextSize = 0; for (i = 0; i < set->nodeNr; i++) { if (set->nodeTab[i] == NULL) @@ -11563,8 +11563,8 @@ xmlXPathCompOpEvalPredicate(xmlXPathParserContextPtr ctxt, xpctxt->node = contextNode; xpctxt->contextSize = contextSize; xpctxt->proximityPosition = ++contextPos; - - /* + + /* * Also set the xpath document in case things like * key() are evaluated in the predicate. */ @@ -11623,7 +11623,7 @@ xmlXPathCompOpEvalPredicate(xmlXPathParserContextPtr ctxt, if (ctxt->value == contextObj) valuePop(ctxt); xmlXPathReleaseObject(xpctxt, contextObj); - } + } evaluation_exit: if (exprRes != NULL) xmlXPathReleaseObject(ctxt->context, exprRes); @@ -11707,7 +11707,7 @@ xmlXPathCompOpEvalPositionalPredicate(xmlXPathParserContextPtr ctxt, xpctxt->node = contextNode; xpctxt->contextSize = contextSize; xpctxt->proximityPosition = ++contextPos; - + /* * Initialize the new set. * Also set the xpath document in case things like @@ -11729,7 +11729,7 @@ xmlXPathCompOpEvalPositionalPredicate(xmlXPathParserContextPtr ctxt, valuePush(ctxt, contextObj); res = xmlXPathCompOpEvalToBoolean(ctxt, exprOp, 1); - + if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) { xmlXPathObjectPtr tmp; /* pop the result */ @@ -11761,9 +11761,9 @@ xmlXPathCompOpEvalPositionalPredicate(xmlXPathParserContextPtr ctxt, } xmlXPathNodeSetClear(set, hasNsNodes); set->nodeNr = 1; - set->nodeTab[0] = contextNode; + set->nodeTab[0] = contextNode; goto evaluation_exit; - } + } if (pos == maxPos) { /* * We are done. @@ -11827,7 +11827,7 @@ evaluation_exit: static int xmlXPathIsPositionalPredicate(xmlXPathParserContextPtr ctxt, - xmlXPathStepOpPtr op, + xmlXPathStepOpPtr op, int *maxPos) { @@ -11836,7 +11836,7 @@ xmlXPathIsPositionalPredicate(xmlXPathParserContextPtr ctxt, /* * BIG NOTE: This is not intended for XPATH_OP_FILTER yet! */ - + /* * If not -1, then ch1 will point to: * 1) For predicates (XPATH_OP_PREDICATE): @@ -11845,13 +11845,13 @@ xmlXPathIsPositionalPredicate(xmlXPathParserContextPtr ctxt, * - an inner filter operater OR * - an expression selecting the node set. * E.g. "key('a', 'b')" or "(//foo | //bar)". - */ + */ if ((op->op != XPATH_OP_PREDICATE) && (op->op != XPATH_OP_FILTER)) return(0); if (op->ch2 != -1) { exprOp = &ctxt->comp->steps[op->ch2]; - } else + } else return(0); if ((exprOp != NULL) && @@ -11870,10 +11870,10 @@ xmlXPathIsPositionalPredicate(xmlXPathParserContextPtr ctxt, * Maybe we could rewrite the AST to ease the optimization. */ *maxPos = (int) ((xmlXPathObjectPtr) exprOp->value4)->floatval; - + if (((xmlXPathObjectPtr) exprOp->value4)->floatval == (float) *maxPos) - { + { return(1); } } @@ -11934,7 +11934,7 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, * Used to feed predicate evaluation. */ xmlNodeSetPtr seq; - xmlNodePtr cur; + xmlNodePtr cur; /* First predicate operator */ xmlXPathStepOpPtr predOp; int maxPos; /* The requested position() (when a "[n]" predicate) */ @@ -11946,7 +11946,7 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, xmlXPathTraversalFunctionExt outerNext = NULL; void (*addNode) (xmlNodeSetPtr, xmlNodePtr); xmlXPathNodeSetMergeFunction mergeAndClear; - xmlNodePtr oldContextNode; + xmlNodePtr oldContextNode; xmlXPathContextPtr xpctxt = ctxt->context; @@ -11961,7 +11961,7 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, xmlXPathReleaseObject(xpctxt, obj); XP_ERROR0(XPATH_UNDEF_PREFIX_ERROR); } - } + } /* * Setup axis. * @@ -11999,8 +11999,8 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, * This iterator will give us only nodes which can * hold element nodes. */ - outerNext = xmlXPathNextDescendantOrSelfElemParent; - } + outerNext = xmlXPathNextDescendantOrSelfElemParent; + } if (((test == NODE_TEST_NAME) || (test == NODE_TEST_ALL)) && (type == NODE_TYPE_NODE)) { @@ -12060,15 +12060,15 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, #endif if (next == NULL) { - xmlXPathReleaseObject(xpctxt, obj); + xmlXPathReleaseObject(xpctxt, obj); return(0); - } + } contextSeq = obj->nodesetval; if ((contextSeq == NULL) || (contextSeq->nodeNr <= 0)) { xmlXPathReleaseObject(xpctxt, obj); valuePush(ctxt, xmlXPathCacheWrapNodeSet(xpctxt, NULL)); return(0); - } + } /* * Predicate optimization --------------------------------------------- * If this step has a last predicate, which contains a position(), @@ -12076,7 +12076,7 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, * the short-hand form, i.e., "[n]". * * Example - expression "/foo[parent::bar][1]": - * + * * COLLECT 'child' 'name' 'node' foo -- op (we are here) * ROOT -- op->ch1 * PREDICATE -- op->ch2 (predOp) @@ -12109,7 +12109,7 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, */ predOp = NULL; hasAxisRange = 1; - } + } } } breakOnFirstHit = ((toBool) && (predOp == NULL)) ? 1 : 0; @@ -12118,7 +12118,7 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, */ /* * 2.3 Node Tests - * - For the attribute axis, the principal node type is attribute. + * - For the attribute axis, the principal node type is attribute. * - For the namespace axis, the principal node type is namespace. * - For other axes, the principal node type is element. * @@ -12155,8 +12155,8 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, */ xpctxt->node = contextNode; } else - xpctxt->node = contextSeq->nodeTab[contextIdx++]; - + xpctxt->node = contextSeq->nodeTab[contextIdx++]; + if (seq == NULL) { seq = xmlXPathNodeSetCreate(NULL); if (seq == NULL) { @@ -12210,7 +12210,7 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, #ifdef DEBUG_STEP xmlGenericError(xmlGenericErrorContext, " %s", cur->name); #endif - + switch (test) { case NODE_TEST_NONE: total = 0; @@ -12229,7 +12229,7 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, #ifdef LIBXML_DOCB_ENABLED case XML_DOCB_DOCUMENT_NODE: #endif - case XML_ELEMENT_NODE: + case XML_ELEMENT_NODE: case XML_ATTRIBUTE_NODE: case XML_PI_NODE: case XML_COMMENT_NODE: @@ -12357,7 +12357,7 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, goto apply_predicates; -axis_range_end: /* ----------------------------------------------------- */ +axis_range_end: /* ----------------------------------------------------- */ /* * We have a "/foo[n]", and position() = n was reached. * Note that we can have as well "/foo/::parent::foo[1]", so @@ -12396,11 +12396,11 @@ first_hit: /* ---------------------------------------------------------- */ apply_predicates: /* --------------------------------------------------- */ /* * Apply predicates. - */ + */ if ((predOp != NULL) && (seq->nodeNr > 0)) { /* * E.g. when we have a "/foo[some expression][n]". - */ + */ /* * QUESTION TODO: The old predicate evaluation took into * account location-sets. @@ -12409,7 +12409,7 @@ apply_predicates: /* --------------------------------------------------- */ * All what I learned now from the evaluation semantics * does not indicate that a location-set will be processed * here, so this looks OK. - */ + */ /* * Iterate over all predicates, starting with the outermost * predicate. @@ -12425,7 +12425,7 @@ apply_predicates: /* --------------------------------------------------- */ * * For the moment, I'll try to solve this with a recursive * function: xmlXPathCompOpEvalPredicate(). - */ + */ size = seq->nodeNr; if (hasPredicateRange != 0) newSize = xmlXPathCompOpEvalPositionalPredicate(ctxt, @@ -12480,7 +12480,7 @@ apply_predicates: /* --------------------------------------------------- */ } else { outSeq = mergeAndClear(outSeq, seq, 0); } - } + } } error: @@ -12509,7 +12509,7 @@ error: } if ((seq != NULL) && (seq != outSeq)) { xmlXPathFreeNodeSet(seq); - } + } /* * Hand over the result. Better to push the set also in * case of errors. @@ -12793,9 +12793,9 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op, xmlNodePtr * first) { int total = 0; - xmlXPathCompExprPtr comp; + xmlXPathCompExprPtr comp; xmlXPathObjectPtr res; - xmlXPathObjectPtr obj; + xmlXPathObjectPtr obj; xmlNodeSetPtr oldset; xmlNodePtr oldnode; xmlDocPtr oldDoc; @@ -12810,7 +12810,7 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, (comp->steps[op->ch1].op == XPATH_OP_SORT) && (comp->steps[op->ch2].op == XPATH_OP_SORT)) { int f = comp->steps[op->ch2].ch1; - + if ((f != -1) && (comp->steps[f].op == XPATH_OP_FUNCTION) && (comp->steps[f].value5 == NULL) && @@ -12819,7 +12819,7 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, (xmlStrEqual (comp->steps[f].value4, BAD_CAST "last"))) { xmlNodePtr last = NULL; - + total += xmlXPathCompOpEvalLast(ctxt, &comp->steps[op->ch1], @@ -12846,7 +12846,7 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, return (total); } } - + if (op->ch1 != -1) total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); CHECK_ERROR0; @@ -12854,7 +12854,7 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, return (total); if (ctxt->value == NULL) return (total); - + #ifdef LIBXML_XPTR_ENABLED oldnode = ctxt->context->node; /* @@ -12864,7 +12864,7 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr tmp = NULL; xmlLocationSetPtr newlocset = NULL; xmlLocationSetPtr oldlocset; - + /* * Extract the old locset, and then evaluate the result of the * expression for all the element in the locset. use it to grow @@ -12874,7 +12874,7 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, obj = valuePop(ctxt); oldlocset = obj->user; ctxt->context->node = NULL; - + if ((oldlocset == NULL) || (oldlocset->locNr == 0)) { ctxt->context->contextSize = 0; ctxt->context->proximityPosition = 0; @@ -12889,7 +12889,7 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, return (total); } newlocset = xmlXPtrLocationSetCreate(NULL); - + for (i = 0; i < oldlocset->locNr; i++) { /* * Run the evaluation with a node list made of a @@ -12904,7 +12904,7 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, } else { xmlXPathNodeSetAddUnique(tmp->nodesetval, ctxt->context->node); - } + } valuePush(ctxt, tmp); if (op->ch2 != -1) total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]); @@ -12930,14 +12930,14 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, } if (ctxt->value == tmp) { valuePop(ctxt); - xmlXPathNodeSetClear(tmp->nodesetval, 1); + xmlXPathNodeSetClear(tmp->nodesetval, 1); /* * REVISIT TODO: Don't create a temporary nodeset * for everly iteration. */ /* OLD: xmlXPathFreeObject(res); */ } else - tmp = NULL; + tmp = NULL; ctxt->context->node = NULL; /* * Only put the first node in the result, then leave. @@ -12962,7 +12962,7 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, return (total); } #endif /* LIBXML_XPTR_ENABLED */ - + /* * Extract the old set, and then evaluate the result of the * expression for all the element in the set. use it to grow @@ -12971,11 +12971,11 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, CHECK_TYPE0(XPATH_NODESET); obj = valuePop(ctxt); oldset = obj->nodesetval; - + oldnode = ctxt->context->node; oldDoc = ctxt->context->doc; ctxt->context->node = NULL; - + if ((oldset == NULL) || (oldset->nodeNr == 0)) { ctxt->context->contextSize = 0; ctxt->context->proximityPosition = 0; @@ -12999,10 +12999,10 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, * Initialize the new set. * Also set the xpath document in case things like * key() evaluation are attempted on the predicate - */ + */ newset = xmlXPathNodeSetCreate(NULL); /* XXX what if xmlXPathNodeSetCreate returned NULL? */ - + for (i = 0; i < oldset->nodeNr; i++) { /* * Run the evaluation with a node list made of @@ -13028,7 +13028,7 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, xmlXPathFreeNodeSet(newset); xmlXPathFreeObject(obj); return(0); - } + } /* * The result of the evaluation needs to be tested to * decide whether the filter succeeded or not @@ -13036,7 +13036,7 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, res = valuePop(ctxt); if (xmlXPathEvaluatePredicateResult(ctxt, res)) { xmlXPathNodeSetAdd(newset, oldset->nodeTab[i]); - } + } /* * Cleanup */ @@ -13172,7 +13172,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]); CHECK_ERROR0; if (op->value) - equal = xmlXPathEqualValues(ctxt); + equal = xmlXPathEqualValues(ctxt); else equal = xmlXPathNotEqualValues(ctxt); valuePush(ctxt, xmlXPathCacheNewBoolean(ctxt->context, equal)); @@ -13581,7 +13581,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) tmp = xmlXPathCacheNewNodeSet(ctxt->context, ctxt->context->node); valuePush(ctxt, tmp); - + if (op->ch2 != -1) total += xmlXPathCompOpEval(ctxt, @@ -13690,7 +13690,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) * nC 2 * * removed the first node in the node-set, then - * the context position of the + * the context position of the */ for (i = 0; i < oldset->nodeNr; i++) { /* @@ -13747,7 +13747,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) } if (ctxt->value == tmp) { valuePop(ctxt); - xmlXPathNodeSetClear(tmp->nodesetval, 1); + xmlXPathNodeSetClear(tmp->nodesetval, 1); /* * Don't free the temporary nodeset * in order to avoid massive recreation inside this @@ -13850,7 +13850,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) res = valuePop(ctxt); if (res->type == XPATH_LOCATIONSET) { - xmlLocationSetPtr rloc = + xmlLocationSetPtr rloc = (xmlLocationSetPtr)res->user; for (j=0; jlocNr; j++) { range = xmlXPtrNewRange( @@ -14012,7 +14012,7 @@ start: xmlXPathCompOpEval(ctxt, op); if (ctxt->error != XPATH_EXPRESSION_OK) return(-1); - + resObj = valuePop(ctxt); if (resObj == NULL) return(-1); @@ -14033,7 +14033,7 @@ start: * to true if the number is equal to the context position * and will be converted to false otherwise;" */ - res = xmlXPathEvaluatePredicateResult(ctxt, resObj); + res = xmlXPathEvaluatePredicateResult(ctxt, resObj); } else { res = xmlXPathCastToBoolean(resObj); } @@ -14056,13 +14056,13 @@ xmlXPathRunStreamEval(xmlXPathContextPtr ctxt, xmlPatternPtr comp, xmlXPathObjectPtr *resultSeq, int toBool) { int max_depth, min_depth; - int from_root; + int from_root; int ret, depth; int eval_all_nodes; xmlNodePtr cur = NULL, limit = NULL; xmlStreamCtxtPtr patstream = NULL; - - int nb_nodes = 0; + + int nb_nodes = 0; if ((ctxt == NULL) || (comp == NULL)) return(-1); @@ -14088,7 +14088,7 @@ xmlXPathRunStreamEval(xmlXPathContextPtr ctxt, xmlPatternPtr comp, if (*resultSeq == NULL) return(-1); } - + /* * handle the special cases of "/" amd "." being matched */ @@ -14185,7 +14185,7 @@ next_node: ret = xmlStreamPushNode(patstream, NULL, NULL, cur->type); else break; - + if (ret < 0) { /* NOP. */ } else if (ret == 1) { @@ -14209,7 +14209,7 @@ next_node: scan_children: if ((cur->children != NULL) && (depth < max_depth)) { /* - * Do not descend on entities declarations + * Do not descend on entities declarations */ if (cur->children->type != XML_ENTITY_DECL) { cur = cur->children; @@ -14231,7 +14231,7 @@ scan_children: (cur->type != XML_DTD_NODE)) goto next_node; } - + do { cur = cur->parent; depth--; @@ -14290,7 +14290,7 @@ xmlXPathRunEval(xmlXPathParserContextPtr ctxt, int toBool) if (ctxt->valueTab == NULL) { /* Allocate the value stack */ - ctxt->valueTab = (xmlXPathObjectPtr *) + ctxt->valueTab = (xmlXPathObjectPtr *) xmlMalloc(10 * sizeof(xmlXPathObjectPtr)); if (ctxt->valueTab == NULL) { xmlXPathPErrMemory(ctxt, "creating evaluation context\n"); @@ -14313,7 +14313,7 @@ xmlXPathRunEval(xmlXPathParserContextPtr ctxt, int toBool) if (res != -1) return(res); } else { - xmlXPathObjectPtr resObj = NULL; + xmlXPathObjectPtr resObj = NULL; /* * Evaluation to a sequence. @@ -14326,7 +14326,7 @@ xmlXPathRunEval(xmlXPathParserContextPtr ctxt, int toBool) return(0); } if (resObj != NULL) - xmlXPathReleaseObject(ctxt->context, resObj); + xmlXPathReleaseObject(ctxt->context, resObj); } /* * QUESTION TODO: This falls back to normal XPath evaluation @@ -14351,7 +14351,7 @@ xmlXPathRunEval(xmlXPathParserContextPtr ctxt, int toBool) /************************************************************************ * * - * Public interfaces * + * Public interfaces * * * ************************************************************************/ @@ -14367,7 +14367,7 @@ xmlXPathRunEval(xmlXPathParserContextPtr ctxt, int toBool) * context node in the context node list (as returned by the position * function) and will be converted to false otherwise; if the result * is not a number, then the result will be converted as if by a call - * to the boolean function. + * to the boolean function. * * Returns 1 if predicate is true, 0 otherwise */ @@ -14405,12 +14405,12 @@ xmlXPathEvalPredicate(xmlXPathContextPtr ctxt, xmlXPathObjectPtr res) { * context node in the context node list (as returned by the position * function) and will be converted to false otherwise; if the result * is not a number, then the result will be converted as if by a call - * to the boolean function. + * to the boolean function. * * Returns 1 if predicate is true, 0 otherwise */ int -xmlXPathEvaluatePredicateResult(xmlXPathParserContextPtr ctxt, +xmlXPathEvaluatePredicateResult(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr res) { if ((ctxt == NULL) || (res == NULL)) return(0); switch (res->type) { @@ -14483,7 +14483,7 @@ xmlXPathTryStreamCompile(xmlXPathContextPtr ctxt, const xmlChar *str) { tmp = xmlStrchr(str, ':'); if ((tmp != NULL) && ((ctxt == NULL) || (ctxt->nsNr == 0) || (tmp[1] == ':'))) - return(NULL); + return(NULL); if (ctxt != NULL) { dict = ctxt->dict; @@ -14507,7 +14507,7 @@ xmlXPathTryStreamCompile(xmlXPathContextPtr ctxt, const xmlChar *str) { &namespaces[0]); if (namespaces != NULL) { xmlFree((xmlChar **)namespaces); - } + } if ((stream != NULL) && (xmlPatternStreamable(stream) == 1)) { comp = xmlXPathNewCompExpr(); if (comp == NULL) { @@ -14546,30 +14546,30 @@ xmlXPathRewriteDOSExpression(xmlXPathCompExprPtr comp, xmlXPathStepOpPtr op) */ if (op->ch1 != -1) { if ((op->op == XPATH_OP_COLLECT /* 11 */) && - ((xmlXPathAxisVal) op->value == AXIS_CHILD /* 4 */) && + ((xmlXPathAxisVal) op->value == AXIS_CHILD /* 4 */) && ((xmlXPathTestVal) op->value2 == NODE_TEST_NAME /* 5 */) && ((xmlXPathTypeVal) op->value3 == NODE_TYPE_NODE /* 0 */)) { /* * This is a "child::foo" */ - xmlXPathStepOpPtr prevop = &comp->steps[op->ch1]; + xmlXPathStepOpPtr prevop = &comp->steps[op->ch1]; if ((prevop->op == XPATH_OP_COLLECT /* 11 */) && - (prevop->ch1 != -1) && + (prevop->ch1 != -1) && ((xmlXPathAxisVal) prevop->value == AXIS_DESCENDANT_OR_SELF) && (prevop->ch2 == -1) && ((xmlXPathTestVal) prevop->value2 == NODE_TEST_TYPE) && ((xmlXPathTypeVal) prevop->value3 == NODE_TYPE_NODE) && (comp->steps[prevop->ch1].op == XPATH_OP_ROOT)) - { + { /* * This is a "/descendant-or-self::node()" without predicates. * Eliminate it. */ op->ch1 = prevop->ch1; - op->rewriteType = XP_REWRITE_DOS_CHILD_ELEM; + op->rewriteType = XP_REWRITE_DOS_CHILD_ELEM; } } if (op->ch1 != -1) @@ -14614,7 +14614,7 @@ xmlXPathCtxtCompile(xmlXPathContextPtr ctxt, const xmlChar *str) { } if (*pctxt->cur != 0) { - /* + /* * aleksey: in some cases this line prints *second* error message * (see bug #78858) and probably this should be fixed. * However, we are not sure that all error messages are printed @@ -14633,7 +14633,7 @@ xmlXPathCtxtCompile(xmlXPathContextPtr ctxt, const xmlChar *str) { #ifdef DEBUG_EVAL_COUNTS comp->string = xmlStrdup(str); comp->nb = 0; -#endif +#endif if ((comp->expr != NULL) && (comp->nbStep > 2) && (comp->last >= 0) && @@ -14678,7 +14678,7 @@ xmlXPathCompiledEvalInternal(xmlXPathCompExprPtr comp, xmlXPathObjectPtr *resObj, int toBool) { - xmlXPathParserContextPtr pctxt; + xmlXPathParserContextPtr pctxt; #ifndef LIBXML_THREAD_ENABLED static int reentance = 0; #endif @@ -14707,15 +14707,15 @@ xmlXPathCompiledEvalInternal(xmlXPathCompExprPtr comp, res = xmlXPathRunEval(pctxt, toBool); if (resObj) { - if (pctxt->value == NULL) { + if (pctxt->value == NULL) { xmlGenericError(xmlGenericErrorContext, "xmlXPathCompiledEval: evaluation failed\n"); - *resObj = NULL; + *resObj = NULL; } else { *resObj = valuePop(pctxt); } } - + /* * Pop all remaining objects from the stack. */ @@ -14726,7 +14726,7 @@ xmlXPathCompiledEvalInternal(xmlXPathCompExprPtr comp, do { tmp = valuePop(pctxt); if (tmp != NULL) { - stack++; + stack++; xmlXPathReleaseObject(ctxt, tmp); } } while (tmp != NULL); @@ -14738,11 +14738,11 @@ xmlXPathCompiledEvalInternal(xmlXPathCompExprPtr comp, stack); } } - + if ((pctxt->error != XPATH_EXPRESSION_OK) && (resObj) && (*resObj)) { xmlXPathFreeObject(*resObj); *resObj = NULL; - } + } pctxt->comp = NULL; xmlXPathFreeParserContext(pctxt); #ifndef LIBXML_THREAD_ENABLED @@ -14803,7 +14803,7 @@ xmlXPathEvalExpr(xmlXPathParserContextPtr ctxt) { #endif if (ctxt == NULL) return; - + #ifdef XPATH_STREAMING comp = xmlXPathTryStreamCompile(ctxt->context, ctxt->base); if (comp != NULL) { @@ -14831,7 +14831,7 @@ xmlXPathEvalExpr(xmlXPathParserContextPtr ctxt) { } } CHECK_ERROR; - xmlXPathRunEval(ctxt, 0); + xmlXPathRunEval(ctxt, 0); } /** @@ -14863,7 +14863,7 @@ xmlXPathEval(const xmlChar *str, xmlXPathContextPtr ctx) { xmlGenericError(xmlGenericErrorContext, "xmlXPathEval: evaluation failed\n"); res = NULL; - } else if ((*ctxt->cur != 0) && (ctxt->comp != NULL) + } else if ((*ctxt->cur != 0) && (ctxt->comp != NULL) #ifdef XPATH_STREAMING && (ctxt->comp->stream == NULL) #endif @@ -14976,21 +14976,21 @@ xmlXPathEvalExpression(const xmlChar *str, xmlXPathContextPtr ctxt) { * If $escape-reserved is false, the behavior differs in that characters * referred to in [RFC 2396] as reserved characters are not escaped. These * characters are ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | ",". - * + * * [RFC 2396] does not define whether escaped URIs should use lower case or * upper case for hexadecimal digits. To ensure that escaped URIs can be * compared using string comparison functions, this function must always use * the upper-case letters A-F. - * + * * Generally, $escape-reserved should be set to true when escaping a string * that is to form a single part of a URI, and to false when escaping an * entire URI or URI reference. - * - * In the case of non-ascii characters, the string is encoded according to + * + * In the case of non-ascii characters, the string is encoded according to * utf-8 and then converted according to RFC 2396. * * Examples - * xf:escape-uri ("gopher://spinaltap.micro.umn.edu/00/Weather/California/Los%20Angeles#ocean"), true()) + * xf:escape-uri ("gopher://spinaltap.micro.umn.edu/00/Weather/California/Los%20Angeles#ocean"), true()) * returns "gopher%3A%2F%2Fspinaltap.micro.umn.edu%2F00%2FWeather%2FCalifornia%2FLos%20Angeles%23ocean" * xf:escape-uri ("gopher://spinaltap.micro.umn.edu/00/Weather/California/Los%20Angeles#ocean"), false()) * returns "gopher://spinaltap.micro.umn.edu/00/Weather/California/Los%20Angeles%23ocean" @@ -15003,28 +15003,28 @@ xmlXPathEscapeUriFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlBufferPtr target; xmlChar *cptr; xmlChar escape[4]; - + CHECK_ARITY(2); - + escape_reserved = xmlXPathPopBoolean(ctxt); - + CAST_TO_STRING; str = valuePop(ctxt); - + target = xmlBufferCreate(); - + escape[0] = '%'; escape[3] = 0; - + if (target) { for (cptr = str->stringval; *cptr; cptr++) { if ((*cptr >= 'A' && *cptr <= 'Z') || (*cptr >= 'a' && *cptr <= 'z') || (*cptr >= '0' && *cptr <= '9') || - *cptr == '-' || *cptr == '_' || *cptr == '.' || + *cptr == '-' || *cptr == '_' || *cptr == '.' || *cptr == '!' || *cptr == '~' || *cptr == '*' || *cptr == '\''|| *cptr == '(' || *cptr == ')' || - (*cptr == '%' && + (*cptr == '%' && ((cptr[1] >= 'A' && cptr[1] <= 'F') || (cptr[1] >= 'a' && cptr[1] <= 'f') || (cptr[1] >= '0' && cptr[1] <= '9')) && @@ -15046,7 +15046,7 @@ xmlXPathEscapeUriFunction(xmlXPathParserContextPtr ctxt, int nargs) { escape[2] = '0' + (*cptr & 0xF); else escape[2] = 'A' - 10 + (*cptr & 0xF); - + xmlBufferAdd(target, &escape[0], 3); } } diff --git a/xstc/Makefile.in b/xstc/Makefile.in index 26048e6..ea25f01 100644 --- a/xstc/Makefile.in +++ b/xstc/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -- cgit v1.2.3