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-schematron.html | 160 ++++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 doc/devhelp/libxml2-schematron.html (limited to 'doc/devhelp/libxml2-schematron.html') diff --git a/doc/devhelp/libxml2-schematron.html b/doc/devhelp/libxml2-schematron.html new file mode 100644 index 0000000..995d96a --- /dev/null +++ b/doc/devhelp/libxml2-schematron.html @@ -0,0 +1,160 @@ + + + + + schematron: XML Schemastron implementation + + + + + + + + + + + + + + + + +

+ schematron +

+

schematron - XML Schemastron implementation

+

interface to the XML Schematron validity checking.

+

Author(s): Daniel Veillard

+
+

Synopsis

+
typedef struct _xmlSchematronValidCtxt xmlSchematronValidCtxt;
+typedef enum xmlSchematronValidOptions;
+typedef xmlSchematron * xmlSchematronPtr;
+typedef struct _xmlSchematronParserCtxt xmlSchematronParserCtxt;
+typedef struct _xmlSchematron xmlSchematron;
+typedef xmlSchematronValidCtxt * xmlSchematronValidCtxtPtr;
+typedef xmlSchematronParserCtxt * xmlSchematronParserCtxtPtr;
+int	xmlSchematronValidateDoc	(xmlSchematronValidCtxtPtr ctxt, 
xmlDocPtr instance); +void xmlSchematronFreeParserCtxt (xmlSchematronParserCtxtPtr ctxt); +xmlSchematronParserCtxtPtr xmlSchematronNewMemParserCtxt (const char * buffer,
int size); +typedef void xmlSchematronValidityErrorFunc (void * ctx,
const char * msg,
... ...); +xmlSchematronParserCtxtPtr xmlSchematronNewParserCtxt (const char * URL); +typedef void xmlSchematronValidityWarningFunc (void * ctx,
const char * msg,
... ...); +void xmlSchematronFree (xmlSchematronPtr schema); +void xmlSchematronFreeValidCtxt (xmlSchematronValidCtxtPtr ctxt); +xmlSchematronPtr xmlSchematronParse (xmlSchematronParserCtxtPtr ctxt); +xmlSchematronParserCtxtPtr xmlSchematronNewDocParserCtxt (xmlDocPtr doc); +xmlSchematronValidCtxtPtr xmlSchematronNewValidCtxt (xmlSchematronPtr schema,
int options); +
+
+
+

Description

+
+
+

Details

+
+

Structure xmlSchematron

struct _xmlSchematron {
+The content of this structure is not made public by the API.
+} xmlSchematron;
+

+

+
+

Structure xmlSchematronParserCtxt

struct _xmlSchematronParserCtxt {
+The content of this structure is not made public by the API.
+} xmlSchematronParserCtxt;
+

+

+
+

Typedef xmlSchematronParserCtxtPtr

xmlSchematronParserCtxt * xmlSchematronParserCtxtPtr;
+

+

+
+

Typedef xmlSchematronPtr

xmlSchematron * xmlSchematronPtr;
+

+

+
+

Structure xmlSchematronValidCtxt

struct _xmlSchematronValidCtxt {
+The content of this structure is not made public by the API.
+} xmlSchematronValidCtxt;
+

+

+
+

Typedef xmlSchematronValidCtxtPtr

xmlSchematronValidCtxt * xmlSchematronValidCtxtPtr;
+

+

+
+

Enum xmlSchematronValidOptions

enum xmlSchematronValidOptions {
+    XML_SCHEMATRON_OUT_QUIET = 1 /* quiet no report */
+    XML_SCHEMATRON_OUT_TEXT = 2 /* build a textual report */
+    XML_SCHEMATRON_OUT_XML = 4 /* output SVRL */
+    XML_SCHEMATRON_OUT_FILE = 256 /* output to a file descriptor */
+    XML_SCHEMATRON_OUT_BUFFER = 512 /* output to a buffer */
+    XML_SCHEMATRON_OUT_IO = 1024 /*  output to I/O mechanism */
+};
+

+

+
+ +
+
+
+

xmlSchematronFree ()

void	xmlSchematronFree		(xmlSchematronPtr schema)
+

Deallocate a Schematron structure.

+
schema:a schema structure
+
+

xmlSchematronFreeParserCtxt ()

void	xmlSchematronFreeParserCtxt	(xmlSchematronParserCtxtPtr ctxt)
+

Free the resources associated to the schema parser context

+
ctxt:the schema parser context
+
+

xmlSchematronFreeValidCtxt ()

void	xmlSchematronFreeValidCtxt	(xmlSchematronValidCtxtPtr ctxt)
+

Free the resources associated to the schema validation context

+
ctxt:the schema validation context
+
+

xmlSchematronNewDocParserCtxt ()

xmlSchematronParserCtxtPtr	xmlSchematronNewDocParserCtxt	(xmlDocPtr doc)
+

Create an XML Schematrons 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
+
+

xmlSchematronNewMemParserCtxt ()

xmlSchematronParserCtxtPtr	xmlSchematronNewMemParserCtxt	(const char * buffer, 
int size)
+

Create an XML Schematrons parse context for that memory buffer expected to contain an XML Schematrons 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
+
+

xmlSchematronNewParserCtxt ()

xmlSchematronParserCtxtPtr	xmlSchematronNewParserCtxt	(const char * URL)
+

Create an XML Schematrons parse context for that file/resource expected to contain an XML Schematrons file.

+
URL:the location of the schema
Returns:the parser context or NULL in case of error
+
+

xmlSchematronNewValidCtxt ()

xmlSchematronValidCtxtPtr	xmlSchematronNewValidCtxt	(xmlSchematronPtr schema, 
int options)
+

Create an XML Schematrons validation context based on the given schema.

+
schema:a precompiled XML Schematrons
options:a set of xmlSchematronValidOptions
Returns:the validation context or NULL in case of error
+
+

xmlSchematronParse ()

xmlSchematronPtr	xmlSchematronParse	(xmlSchematronParserCtxtPtr 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 Schematron structure built from the resource or NULL in case of error
+
+

xmlSchematronValidateDoc ()

int	xmlSchematronValidateDoc	(xmlSchematronValidCtxtPtr ctxt, 
xmlDocPtr instance)
+

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.
+
+
+
+ + -- cgit v1.2.3 From 88f9c7ca80bfbc9a5429fc632b90d6c4a2a2787d Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Wed, 9 Apr 2008 10:33:41 +0200 Subject: Load /tmp/libxml2-2.6.32 into libxml2/branches/upstream/current. --- ChangeLog | 301 + HTMLparser.c | 39 +- SAX2.c | 4 +- config.h.in | 3 + configure | 76 +- configure.in | 25 +- debugXML.c | 4 +- dict.c | 9 +- doc/APIchunk1.html | 4 +- doc/APIchunk10.html | 7 +- doc/APIchunk11.html | 3 - doc/APIchunk12.html | 5 +- doc/APIchunk13.html | 3 +- doc/APIchunk14.html | 1 + doc/APIchunk15.html | 2 + doc/APIchunk16.html | 1 + doc/APIchunk17.html | 1 + doc/APIchunk19.html | 3 +- doc/APIchunk21.html | 2 + doc/APIchunk22.html | 2 +- doc/APIchunk23.html | 3 +- doc/APIchunk24.html | 5 + doc/APIchunk25.html | 2 + doc/APIchunk27.html | 1 + doc/APIchunk28.html | 1 + doc/APIchunk5.html | 1 + doc/APIchunk7.html | 4 +- doc/APIfiles.html | 6 + doc/APIfunctions.html | 3 + doc/APIsymbols.html | 6 + doc/devhelp/libxml2-parser.html | 16 +- doc/devhelp/libxml2-schematron.html | 6 + doc/devhelp/libxml2-xmlerror.html | 6 +- doc/devhelp/libxml2-xmlreader.html | 2 +- doc/devhelp/libxml2-xmlwriter.html | 4 +- doc/devhelp/libxml2.devhelp | 6 + doc/elfgcchack.xsl | 2 +- doc/examples/Makefile.am | 121 +- doc/examples/Makefile.in | 121 +- doc/examples/examples.xml | 787 +- doc/html/book1.html | 2 +- doc/html/index.html | 2 +- doc/html/libxml-DOCBparser.html | 2 +- doc/html/libxml-HTMLparser.html | 2 +- doc/html/libxml-HTMLtree.html | 2 +- doc/html/libxml-SAX.html | 2 +- doc/html/libxml-SAX2.html | 2 +- doc/html/libxml-c14n.html | 2 +- doc/html/libxml-catalog.html | 2 +- doc/html/libxml-chvalid.html | 2 +- doc/html/libxml-debugXML.html | 2 +- doc/html/libxml-dict.html | 2 +- doc/html/libxml-encoding.html | 2 +- doc/html/libxml-entities.html | 2 +- doc/html/libxml-globals.html | 2 +- doc/html/libxml-hash.html | 2 +- doc/html/libxml-lib.html | 2 +- doc/html/libxml-list.html | 2 +- doc/html/libxml-nanoftp.html | 2 +- doc/html/libxml-nanohttp.html | 2 +- doc/html/libxml-parser.html | 18 +- doc/html/libxml-parserInternals.html | 2 +- doc/html/libxml-pattern.html | 2 +- doc/html/libxml-relaxng.html | 2 +- doc/html/libxml-schemasInternals.html | 2 +- doc/html/libxml-schematron.html | 8 +- doc/html/libxml-threads.html | 2 +- doc/html/libxml-tree.html | 2 +- doc/html/libxml-uri.html | 2 +- doc/html/libxml-valid.html | 2 +- doc/html/libxml-xinclude.html | 2 +- doc/html/libxml-xlink.html | 2 +- doc/html/libxml-xmlIO.html | 2 +- doc/html/libxml-xmlautomata.html | 2 +- doc/html/libxml-xmlerror.html | 6 +- doc/html/libxml-xmlexports.html | 2 +- doc/html/libxml-xmlmemory.html | 2 +- doc/html/libxml-xmlmodule.html | 2 +- doc/html/libxml-xmlreader.html | 4 +- doc/html/libxml-xmlregexp.html | 2 +- doc/html/libxml-xmlsave.html | 2 +- doc/html/libxml-xmlschemas.html | 2 +- doc/html/libxml-xmlschemastypes.html | 2 +- doc/html/libxml-xmlstring.html | 2 +- doc/html/libxml-xmlunicode.html | 2 +- doc/html/libxml-xmlversion.html | 2 +- doc/html/libxml-xmlwriter.html | 6 +- doc/html/libxml-xpath.html | 2 +- doc/html/libxml-xpathInternals.html | 2 +- doc/html/libxml-xpointer.html | 2 +- doc/libxml2-api.xml | 43 +- doc/libxml2.xsa | 31 +- doc/newapi.xsl | 4 +- doc/news.html | 35 +- doc/xml.html | 72 +- doc/xmlmem.html | 33 +- elfgcchack.h | 12 + encoding.c | 11 +- error.c | 2 +- globals.c | 2 +- include/libxml/schematron.h | 3 +- include/libxml/threads.h | 30 +- include/libxml/xmlerror.h | 6 +- include/libxml/xmlversion.h | 8 +- include/libxml/xpath.h | 3 + include/win32config.h | 6 + libxml2.spec | 6 +- macos/src/XMLTestPrefix.h.orig | 1 + nanohttp.c | 10 + parser.c | 490 +- python/Makefile.am | 46 +- python/Makefile.in | 162 +- python/generator.py | 3 + python/libxml2-py.c | 14572 -------------------------------- python/setup.py | 2 +- python/tests/Makefile.am | 18 +- python/tests/Makefile.in | 71 +- python/tests/xpathns.py | 29 + python/types.c | 32 +- schematron.c | 76 +- testModule.c | 9 + testRegexp.c | 19 +- testapi.c | 13 +- threads.c | 460 +- tree.c | 42 +- uri.c | 29 + vms/build_libxml.com | 45 +- win32/Makefile.msvc | 14 +- win32/Makefile.msvc.orig | 462 + win32/libxml2.def.src | 2 + xinclude.c | 23 +- xmlIO.c | 11 + xmlmodule.c | 2 +- xmlreader.c | 7 +- xmlregexp.c | 25 +- xmlsave.c | 32 +- xmlschemas.c | 14 +- xmlschemastypes.c | 13 +- xmlwriter.c | 9 +- xpath.c | 32 +- xstc/Makefile.am | 5 +- xstc/Makefile.in | 12 +- 142 files changed, 3174 insertions(+), 15655 deletions(-) create mode 100644 macos/src/XMLTestPrefix.h.orig delete mode 100644 python/libxml2-py.c create mode 100755 python/tests/xpathns.py create mode 100644 win32/Makefile.msvc.orig (limited to 'doc/devhelp/libxml2-schematron.html') diff --git a/ChangeLog b/ChangeLog index bacb7a8..4da35e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,304 @@ +Tue Apr 8 10:19:01 CEST 2008 Daniel Veillard + + * tree.c: fix a bug introduced when fixing #438208 and reported by + Ashwin + * python/generator.py: fix an infinite loop bug + +Mon Apr 7 14:44:51 CEST 2008 Daniel Veillard + + * xmlreader.c: fix a link to XmlNodeType doc reported by Martijn Arts + * docs/*: rebuilt + +Fri Apr 4 18:09:50 CEST 2008 Daniel Veillard + + * parser.c: improve the *Recover* functions documentation + +Thu Apr 3 14:57:15 CEST 2008 Daniel Veillard + + * parser.c: patch from Mark Rowe fixing BOM or encoding detection + in external parsed entities, should fix #440415 + +Thu Apr 3 13:16:01 CEST 2008 Daniel Veillard + + * tree.c: fix some problems with the *EatName functions when + running out of memory raised by Eric Schrock , should fix #438208 + +Thu Apr 3 12:41:29 CEST 2008 Daniel Veillard + + * xmlschemastypes.c: horror around the definition of the lexical + values for decimal and derived types, fixing to reject empty + values, should fix #503268 + +Thu Apr 3 11:44:57 CEST 2008 Daniel Veillard + + * encoding.c: buffer may not be large enough to convert to + UCS4, patch from Christian Fruth , fixes #504015 + +Thu Apr 3 11:02:02 CEST 2008 Daniel Veillard + + * HTMLparser.c: apparently it's okay to forget the semicolumn after + entity refs in HTML, fixing char refs parsing accordingly based on + T. Manske patch, this should fix #517653 + +Thu Apr 3 09:30:29 CEST 2008 Daniel Veillard + + * error.c: avoid a scary realloc() loop should fix #520383 + +Thu Apr 3 08:22:52 CEST 2008 Daniel Veillard + + * parser.c: more realloc problems pointed out by Ashwin + +Thu Apr 3 07:40:13 CEST 2008 Daniel Veillard + + * xstc/Makefile.am: applied patch from Mike Hommey fixing distclean, + fixes #520387 + +Thu Apr 3 06:52:32 CEST 2008 Daniel Veillard + + * include/libxml/xpath.h: small doc improvement for xmlXPathContext + from Jack Jansen, fixes #524759 + * doc/newapi.xsl doc/*: fixed a problem and regenerated the docs + +Tue Apr 1 09:59:22 CEST 2008 Daniel Veillard + + * xpath.c: two patches from Alvaro Herrera to avoid problem when + running out of memory in XPath evaluations. + +Mon Mar 31 11:23:19 CEST 2008 Daniel Veillard + + * parser.c: lot of out of memory handling fixes from Ashwin + * elfgcchack.h doc/elfgcchack.xsl: work around a problem with xmlDllMain + * include/libxml/threads.h: indenting cleanups + +Mon Mar 31 10:25:37 CEST 2008 Daniel Veillard + + * parser.c docs/*: trying to clarify even more the xmlCleanupParser() + use and the memory documentation + +Wed Mar 26 18:39:58 CET 2008 Daniel Veillard + + * parser.c: changes based on Alex Khesin patch where xmlParseCharRef + seems to not be checked correctly, fixes #520198 + +Wed Mar 26 15:03:49 CET 2008 Daniel Veillard + + * parser.c: patch from Ashwin to avoid a problem of attribute + redefinition in the DTD. Remove a warning too. + +Wed Mar 26 14:38:31 CET 2008 Daniel Veillard + + * xmlschemas.c: fix a problem in externalSubsetSplit with a patch + from Ashwin + +Tue Mar 25 17:48:02 CET 2008 Daniel Veillard + + * parser.c: fix various attribute normalisation problems reported + by Ashwin + * result/c14n/without-comments/example-4 + result/c14n/with-comments/example-4: this impacted the result of + two c14n tests :-\ + * test/att9 test/att10 test/att11 result//att9* result//att10* + result//att11*: added 3 specific regression tests coming from the + XML spec revision and from Ashwin + +Tue Mar 25 14:20:49 CET 2008 Daniel Veillard + + * uri.c: fix saving for file:///X:/ URI embedding Windows file paths + should fix #524253 + +Mon Mar 24 21:42:33 CET 2008 Daniel Veillard + + * parser.c: fix a problem reported by Ashwin for system parameter + entities referenced from entities in external subset, add a + specific loading routine. + * test/valid/dtds/external.ent test/valid/dtds/external2.ent + test/valid/t11.xml result/valid/t11.xml*: added the test to + the regression suite + +Mon Mar 24 15:04:54 CET 2008 Daniel Veillard + + * xmlschemas.c: fix an XML Schemas crash raised by Stefan Behnel + when testing with W3C test suite + +Mon Mar 24 12:12:00 CET 2008 Daniel Veillard + + * threads.c: check some allocation with Ashwin patch + +Wed Mar 19 16:41:52 CET 2008 Daniel Veillard + + * vms/build_libxml.com: update from Tycho Hilhorst, should fix #523378 + +Tue Mar 18 09:23:05 CET 2008 Daniel Veillard + + * threads.c: check some malloc returns with Ashwin patch, add + error messages and reindent the module. + +Fri Mar 14 15:28:43 CET 2008 Daniel Veillard + + * xmlreader.c: patch from Ashwin removing duplicate tests + +Fri Mar 14 13:44:29 CET 2008 Daniel Veillard + + * include/libxml/schematron.h include/libxml/xmlerror.h schematron.c: + applied patch from Tobias Minich to allow plugin schematron error + reporting in the normal error system, should fix #513998 + +Fri Mar 14 11:52:09 CET 2008 Daniel Veillard + + * parser.c xinclude.c: patch from Vasily Chekalkin fixes memory + leaks, should fix 512647 + +Thu Mar 13 08:17:58 CET 2008 Daniel Veillard + + * xmlregexp.c: found a nasty bug in regexp automata build, + reported by Ashwin and Bjorn Reese + +Wed Mar 12 18:56:22 CET 2008 Daniel Veillard + + * HTMLparser.c: patch from Arnold Hendriks improving parsing of + html within html bogus data, still not a complete fix though + +Wed Mar 12 10:22:01 CET 2008 Daniel Veillard + + * python/types.c: fix a memory errro when using namespace nodes + returned from XPath queries, should fix #521699 + * python/tests/Makefile.am python/tests/xpathns.py: add a specific + regression test for it + +Mon Mar 10 16:25:32 CET 2008 Rob Richards + + * include/win32config.h: add ICONV_CONST define for win32 build + to satisfy encoding.c change in rev 3693 + +Fri Mar 7 17:45:27 CET 2008 Daniel Veillard + + * xmlsave.c parser.c: fix handling of empty CDATA nodes as + reported and discussed around #514181 and associated patches + * test/emptycdata.xml result/emptycdata.xml* + result/noent/emptycdata.xml: added a specific test in the + regression suite. + +Thu Mar 6 15:23:10 CET 2008 Daniel Veillard + + * encoding.c: poblem with encoding detection for UTF-16 reported by + Ashwin and found by Bill + * test/valid/dtds/utf16b.ent test/valid/dtds/utf16l.ent + test/valid/UTF16Entity.xml result/valid/UTF16Entity.xml*: added + the example to the regression tests + +Tue Mar 4 14:16:38 CET 2008 Daniel Veillard + + * xmlwriter.c: patch from Alex Khesin fixing CDATA output after + a text node. + * parser.c: fixed the comment for xmlParserCleanup + * globals.c: fixed indentation + +Mon Feb 25 16:42:19 CET 2008 Daniel Veillard + + * testModule.c: patch from Florent Guiliani to fix build on + SCO OpenServer + +Thu Feb 21 22:46:08 CET 2008 Daniel Veillard + + * debugXML.c: made one of the changes suggested by Brian Krahmer + * testRegexp.c: allow to pass '--' on the command line to allow + regexps starting with the character '-' + +Tue Feb 19 08:49:32 CET 2008 Daniel Veillard + + * python/Makefile.am python/tests/Makefile.am: applied cleanup + patches for cross compilation and MinGW from Roumen Petrov + +Sat Feb 16 11:06:54 CET 2008 Daniel Veillard + + * xmlIO.c: fix output bug reported by Petr Pajas and analyzed by + Bill + +Fri Feb 15 09:32:11 CET 2008 Daniel Veillard + + * include/libxml/xmlerror.h tree.c: patch from Julien Charbon + to simplify the processing of xmlSetProp() + +Fri Feb 15 08:45:32 CET 2008 Daniel Veillard + + * config.h.in configure.in encoding.c: patch from Roumen Petrov + to detect if iconv() needs a const for the second parameter + +Fri Feb 15 08:41:31 CET 2008 Daniel Veillard + + * macos/src/XMLTestPrefix2.h win32/Makefile.msvc: EOL cleanups + from Florent Guiliani + +Wed Feb 13 10:56:38 CET 2008 Daniel Veillard + + * xmlwriter.c: applied patch from Alfred Mickautsch to flush the + output at the end of document. + +Fri Feb 8 11:57:03 CET 2008 Daniel Veillard + + * doc/examples/examples.xml: regenerated, it was truncated. + +Fri Feb 8 11:47:18 CET 2008 Daniel Veillard + + * xmlmodule.c: apply simple patch from Carlo Bramini to avoid + compilation problems with Mingw32 + +Fri Feb 8 11:33:15 CET 2008 Daniel Veillard + + * xmlregexp.c: apply patch from Andrew Tosh to fix behaviour + when '.' is used in a posCharGroup + * test/schemas/poschargrp0_0.* result/schemas/poschargrp0_0_0*: + added the test to the regression suite + +Fri Feb 8 10:54:09 CET 2008 Daniel Veillard + + * dict.c: applied patch from Florent Guilian to remove an + useless mutex in the xmlDict structure. + +Wed Feb 6 17:00:20 CET 2008 Daniel Veillard + + * SAX2.c: another leak reported by Ashwin + * xinclude.c: fixed the behaviour when XIncluding a fragment + of the current document, patch from Chris Ryan + +Wed Feb 6 12:10:08 HKT 2008 William Brack + + * nanohttp.c: added space for port number (when not 80) in + xmlNanoHTTPMethodRedir, plus a few more comments. Should + fix #514521. + +Tue Feb 5 09:41:46 CET 2008 Daniel Veillard + + * schemas.c: apply fix suggested by Ashwin correcting a cut-n-paste + error about the SAX callback in cdataBlockSplit when streaming + XSD validation + +Tue Feb 5 09:36:46 CET 2008 Daniel Veillard + + * uri.c: applied a patch based on Petr Sumbera one to avoid a + problem with paths starting with // + +Mon Feb 4 17:48:30 CET 2008 Daniel Veillard + + * doc/xml.html doc/xmlmem.html: added a small section on returning + memory to the kernel by compacting the heap provided by Wolfram Sang + +Fri Jan 25 20:01:42 CET 2007 Rob Richards + + * include/win32config.h win32/Makefile.msvc: fix build under VS 2008. + patch by David Wimsey + +Thu Jan 24 15:37:04 CET 2008 Daniel Veillard + + * parser.c: fix a memeory leak in internal subset parsing with + a fix from Ashwin + * test/errors/content1.xml result/errors/content1.xml*: + add test to regressions + +Fri Jan 11 09:00:09 CET 2008 Daniel Veillard + + * configure.in doc/*: preparing release of 2.6.31 + Fri Jan 11 08:58:49 CET 2008 Daniel Veillard * parser.c: avoid a warning on 64bits introduced earlier diff --git a/HTMLparser.c b/HTMLparser.c index 38af5e3..92503a1 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -3115,9 +3115,9 @@ htmlParseCharRef(htmlParserCtxtPtr ctxt) { val = val * 16 + (CUR - 'A') + 10; else { htmlParseErr(ctxt, XML_ERR_INVALID_HEX_CHARREF, - "htmlParseCharRef: invalid hexadecimal value\n", + "htmlParseCharRef: missing semicolumn\n", NULL, NULL); - return(0); + break; } NEXT; } @@ -3130,9 +3130,9 @@ htmlParseCharRef(htmlParserCtxtPtr ctxt) { val = val * 10 + (CUR - '0'); else { htmlParseErr(ctxt, XML_ERR_INVALID_DEC_CHARREF, - "htmlParseCharRef: invalid decimal value\n", + "htmlParseCharRef: missing semicolumn\n", NULL, NULL); - return(0); + break; } NEXT; } @@ -3423,7 +3423,7 @@ htmlCheckMeta(htmlParserCtxtPtr ctxt, const xmlChar **atts) { * * [NS 10] EmptyElement ::= '<' QName (S Attribute)* S? '/>' * - * Returns 0 in case of success and -1 in case of error. + * Returns 0 in case of success, -1 in case of error and 1 if discarded */ static int @@ -3436,6 +3436,7 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) { int maxatts; int meta = 0; int i; + int discardtag = 0; if ((ctxt == NULL) || (ctxt->input == NULL)) { htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, @@ -3480,14 +3481,14 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) { htmlParseErr(ctxt, XML_HTML_STRUCURE_ERROR, "htmlParseStartTag: misplaced tag\n", name, NULL); - return 0; + discardtag = 1; } if ((ctxt->nameNr != 1) && (xmlStrEqual(name, BAD_CAST"head"))) { htmlParseErr(ctxt, XML_HTML_STRUCURE_ERROR, "htmlParseStartTag: misplaced tag\n", name, NULL); - return 0; + discardtag = 1; } if (xmlStrEqual(name, BAD_CAST"body")) { int indx; @@ -3496,9 +3497,7 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) { htmlParseErr(ctxt, XML_HTML_STRUCURE_ERROR, "htmlParseStartTag: misplaced tag\n", name, NULL); - while ((IS_CHAR_CH(CUR)) && (CUR != '>')) - NEXT; - return 0; + discardtag = 1; } } } @@ -3597,12 +3596,14 @@ failed: /* * SAX: Start of Element ! */ - htmlnamePush(ctxt, name); - if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL)) { - if (nbatts != 0) - ctxt->sax->startElement(ctxt->userData, name, atts); - else - ctxt->sax->startElement(ctxt->userData, name, NULL); + if (!discardtag) { + htmlnamePush(ctxt, name); + if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL)) { + if (nbatts != 0) + ctxt->sax->startElement(ctxt->userData, name, atts); + else + ctxt->sax->startElement(ctxt->userData, name, NULL); + } } if (atts != NULL) { @@ -3612,7 +3613,7 @@ failed: } } - return 0; + return(discardtag); } /** @@ -3991,7 +3992,7 @@ htmlParseElement(htmlParserCtxtPtr ctxt) { failed = htmlParseStartTag(ctxt); name = ctxt->name; - if (failed || (name == NULL)) { + if ((failed == -1) || (name == NULL)) { if (CUR == '>') NEXT; return; @@ -4893,7 +4894,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { failed = htmlParseStartTag(ctxt); name = ctxt->name; - if (failed || + if ((failed == -1) || (name == NULL)) { if (CUR == '>') NEXT; diff --git a/SAX2.c b/SAX2.c index 9739831..7dbc2b2 100644 --- a/SAX2.c +++ b/SAX2.c @@ -2366,7 +2366,9 @@ xmlSAX2Reference(void *ctx, const xmlChar *name) xmlGenericError(xmlGenericErrorContext, "add xmlSAX2Reference %s to %s \n", name, ctxt->node->name); #endif - xmlAddChild(ctxt->node, ret); + if (xmlAddChild(ctxt->node, ret) == NULL) { + xmlFreeNode(ret); + } } /** diff --git a/config.h.in b/config.h.in index 1dafc10..f8435d4 100644 --- a/config.h.in +++ b/config.h.in @@ -246,6 +246,9 @@ /* Whether __va_copy() is available */ #undef HAVE___VA_COPY +/* Define as const if the declaration of iconv() needs const. */ +#undef ICONV_CONST + /* Name of package */ #undef PACKAGE diff --git a/configure b/configure index d02721f..e80c4a9 100755 --- a/configure +++ b/configure @@ -2190,7 +2190,7 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac LIBXML_MAJOR_VERSION=2 LIBXML_MINOR_VERSION=6 -LIBXML_MICRO_VERSION=31 +LIBXML_MICRO_VERSION=32 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 @@ -29049,6 +29049,80 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ fi + + if test "$WITH_ICONV" = "1" ; then + { echo "$as_me:$LINENO: checking for iconv declaration" >&5 +echo $ECHO_N "checking for iconv declaration... $ECHO_C" >&6; } + if test "${xml_cv_iconv_arg2+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + xml_cv_iconv_arg2="" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + xml_cv_iconv_arg2="const" +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + + + xml_cv_iconv_decl="extern size_t iconv (iconv_t cd, $xml_cv_iconv_arg2 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);" + { echo "$as_me:$LINENO: result: ${xml_xxx:- + }$xml_cv_iconv_decl" >&5 +echo "${ECHO_T}${xml_xxx:- + }$xml_cv_iconv_decl" >&6; } + +cat >>confdefs.h <<_ACEOF +#define ICONV_CONST $xml_cv_iconv_arg2 +_ACEOF + + fi fi case "$host" in *mingw*) M_LIBS="" diff --git a/configure.in b/configure.in index 699232f..8fc76e5 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=31 +LIBXML_MICRO_VERSION=32 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 @@ -1224,6 +1224,29 @@ iconv (cd, NULL, NULL, NULL, NULL);],[ AC_MSG_RESULT(no) LIBS="${_libs}" LDFLAGS="${_ldflags}"])])) + + if test "$WITH_ICONV" = "1" ; then + AC_MSG_CHECKING([for iconv declaration]) + AC_CACHE_VAL(xml_cv_iconv_arg2, [ + AC_TRY_COMPILE([#include +#include +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif +], [], xml_cv_iconv_arg2="", xml_cv_iconv_arg2="const")]) + + xml_cv_iconv_decl="extern size_t iconv (iconv_t cd, $xml_cv_iconv_arg2 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);" + AC_MSG_RESULT([${xml_xxx:- + }$xml_cv_iconv_decl]) + AC_DEFINE_UNQUOTED(ICONV_CONST, $xml_cv_iconv_arg2, + [Define as const if the declaration of iconv() needs const.]) + fi fi case "$host" in *mingw*) M_LIBS="" diff --git a/debugXML.c b/debugXML.c index 3985ad3..de6fd6c 100644 --- a/debugXML.c +++ b/debugXML.c @@ -320,7 +320,8 @@ xmlCtxtGenericNodeCheck(xmlDebugCtxtPtr ctxt, xmlNodePtr node) { } if (node->next == NULL) { if ((node->parent != NULL) && (node->type != XML_ATTRIBUTE_NODE) && - (node->parent->last != node)) + (node->parent->last != node) && + (node->parent->type == XML_ELEMENT_NODE)) xmlDebugErr(ctxt, XML_CHECK_NO_NEXT, "Node has no next and not last of parent list\n"); } else { @@ -3244,6 +3245,7 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input, "Unknown command %s\n", command); } free(cmdline); /* not xmlFree here ! */ + cmdline = NULL; } #ifdef LIBXML_XPATH_ENABLED xmlXPathFreeContext(ctxt->pctxt); diff --git a/dict.c b/dict.c index 3b4054f..c071887 100644 --- a/dict.c +++ b/dict.c @@ -60,7 +60,6 @@ struct _xmlDictStrings { */ struct _xmlDict { int ref_counter; - xmlRMutexPtr mutex; struct _xmlDictEntry *dict; int size; @@ -337,11 +336,8 @@ xmlDictCreate(void) { dict->strings = NULL; dict->subdict = NULL; if (dict->dict) { - if ((dict->mutex = xmlNewRMutex()) != NULL) { - memset(dict->dict, 0, MIN_DICT_SIZE * sizeof(xmlDictEntry)); - return(dict); - } - xmlFree(dict->dict); + memset(dict->dict, 0, MIN_DICT_SIZE * sizeof(xmlDictEntry)); + return(dict); } xmlFree(dict); } @@ -545,7 +541,6 @@ xmlDictFree(xmlDictPtr dict) { xmlFree(pool); pool = nextp; } - xmlFreeRMutex(dict->mutex); xmlFree(dict); } diff --git a/doc/APIchunk1.html b/doc/APIchunk1.html index 881aedf..bedf943 100644 --- a/doc/APIchunk1.html +++ b/doc/APIchunk1.html @@ -119,8 +119,7 @@ A:link, A:visited, A:active { text-decoration: underline } referenceSAXFunc
startDocumentSAXFunc
startElementSAXFunc
-
Calling
xmlCleanupParser
-xmlRegisterHTTPPostCallbacks
+
Calling
xmlRegisterHTTPPostCallbacks
Canonical
xmlC14NDocDumpMemory
xmlC14NDocSave
xmlC14NDocSaveTo
@@ -200,7 +199,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlParseChunk
xmlParseInNodeContext
Cleanup
xmlCleanupCharEncodingHandlers
-xmlCleanupParser
xmlCleanupPredefinedEntities
xmlCtxtResetLastError
xmlNanoFTPCleanup
diff --git a/doc/APIchunk10.html b/doc/APIchunk10.html index 49042c0..cbcc86b 100644 --- a/doc/APIchunk10.html +++ b/doc/APIchunk10.html @@ -374,6 +374,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXPtrLocationSetAdd
also
xmlCharEncodingOutputFunc
xmlCheckHTTPInput
+xmlCleanupParser
xmlHasProp
xmlKeepBlanksDefault
xmlNanoFTPProxy
@@ -534,7 +535,8 @@ A:link, A:visited, A:active { text-decoration: underline } xmlStrdup
assumed
xmlCheckUTF8
assumes
xmlBuildRelativeURI
-
assuming
xmlSaveFileTo
+
assuming
xmlParseBalancedChunkMemoryRecover
+xmlSaveFileTo
xmlSaveFormatFileTo
assure
xmlGetUTF8Char
atom
xmlExpNewAtom
@@ -544,6 +546,9 @@ A:link, A:visited, A:active { text-decoration: underline }
atomic
xmlGcMemGet
xmlGcMemSetup
attached
xmlTextReaderGetRemainder
+
attempt
xmlRecoverDoc
+xmlRecoverMemory
+
attempts
xmlRecoverFile
attr
XML_SCHEMAS_ATTRGROUP_HAS_REFS
XML_SCHEMAS_ATTRGROUP_MARKED
XML_SCHEMAS_ATTRGROUP_REDEFINED
diff --git a/doc/APIchunk11.html b/doc/APIchunk11.html index 342ed29..bcb58cf 100644 --- a/doc/APIchunk11.html +++ b/doc/APIchunk11.html @@ -253,9 +253,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlParseNotationType
xmlParseURI
xmlParseURIRaw
-xmlRecoverDoc
-xmlRecoverFile
-xmlRecoverMemory
xmlRelaxNGParse
xmlSchemaGetBuiltInType
xmlSchemaGetCanonValue
diff --git a/doc/APIchunk12.html b/doc/APIchunk12.html index d65e701..769619b 100644 --- a/doc/APIchunk12.html +++ b/doc/APIchunk12.html @@ -259,10 +259,13 @@ A:link, A:visited, A:active { text-decoration: underline }
circular
XML_SCHEMAS_ATTRGROUP_MARKED
XML_SCHEMAS_ELEM_CIRCULAR
XML_SCHEMAS_TYPE_MARKED
+
clean
xmlCleanupParser
cleanly
xmlCheckHTTPInput
-
cleans
xmlNanoFTPScanProxy
+
cleans
xmlCleanupParser
+xmlNanoFTPScanProxy
xmlNanoHTTPScanProxy
cleanup
xmlCleanupGlobals
+xmlCleanupParser
xmlCleanupThreads
xmlNanoFTPCleanup
clear
xmlListMerge
diff --git a/doc/APIchunk13.html b/doc/APIchunk13.html index 00da28b..c86ff16 100644 --- a/doc/APIchunk13.html +++ b/doc/APIchunk13.html @@ -495,7 +495,8 @@ A:link, A:visited, A:active { text-decoration: underline }
docs
xmlBuildRelativeURI
doctypedecl
xmlParseDocTypeDecl
xmlParseDocument
-
documents
xmlIsID
+
documents
xmlCleanupParser
+xmlIsID
xmlParseEntityRef
xmlParserHandleReference
xmlSAXParseDoc
diff --git a/doc/APIchunk14.html b/doc/APIchunk14.html index 1005453..61e35fc 100644 --- a/doc/APIchunk14.html +++ b/doc/APIchunk14.html @@ -419,6 +419,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION
XML_SCHEMAS_TYPE_FINAL_EXTENSION
extensions
_xmlSAXHandler
+
extent
xmlParseBalancedChunkMemoryRecover
extract
XML_GET_CONTENT
XML_GET_LINE
xmlBufferContent
diff --git a/doc/APIchunk15.html b/doc/APIchunk15.html index 2f0774e..03616a5 100644 --- a/doc/APIchunk15.html +++ b/doc/APIchunk15.html @@ -231,6 +231,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlStringLenGetNodeList
floor
xmlXPathFloorFunction
flow
xmlScanName
+
flushed
xmlTextWriterEndDocument
flushes
xmlOutputBufferClose
xmlOutputBufferFlush
follow
xmlAutomataNewNegTrans
@@ -393,6 +394,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlRelaxNGSetValidStructuredErrors
xmlSchemaSetParserErrors
xmlSchemaSetParserStructuredErrors
+xmlSchematronSetValidStructuredErrors
xmlShellCmd
xmlSwitchEncoding
xmlSwitchInputEncoding
diff --git a/doc/APIchunk16.html b/doc/APIchunk16.html index b83d8e4..788a439 100644 --- a/doc/APIchunk16.html +++ b/doc/APIchunk16.html @@ -151,6 +151,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlInitializeGlobalState
xmlResetLastError
globally
xmlSAXDefaultVersion
+
gnu
xmlTextReaderNodeType
good
xmlTextReaderGetRemainder
grafted
xmlCopyProp
xmlCopyPropList
diff --git a/doc/APIchunk17.html b/doc/APIchunk17.html index f09d9bf..548d945 100644 --- a/doc/APIchunk17.html +++ b/doc/APIchunk17.html @@ -516,6 +516,7 @@ A:link, A:visited, A:active { text-decoration: underline }
itself
_xmlDoc
xlinkIsLink
xmlCharEncFirstLine
+xmlCleanupParser
xmlParsePEReference
xmlParserHandlePEReference
xmlXPathNextSelf
diff --git a/doc/APIchunk19.html b/doc/APIchunk19.html index 7264dff..a5db809 100644 --- a/doc/APIchunk19.html +++ b/doc/APIchunk19.html @@ -242,7 +242,8 @@ A:link, A:visited, A:active { text-decoration: underline }
minus
xmlXPathStringFunction
minute
ftpListCallback
misc
xmlXPathContextSetCache
-
misleading
xmlParsePEReference
+
misleading
xmlCleanupParser
+xmlParsePEReference
xmlParserHandlePEReference
missing
xmlParseSDDecl
mixed
XML_SCHEMAS_TYPE_MIXED
diff --git a/doc/APIchunk21.html b/doc/APIchunk21.html index 16d268c..05eab1d 100644 --- a/doc/APIchunk21.html +++ b/doc/APIchunk21.html @@ -214,6 +214,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXPathSubValues
xmlXPathValueFlipSign
operations
_xmlDOMWrapCtxt
+xmlCleanupParser
xmlModuleClose
xmlModuleFree
xmlReconciliateNs
@@ -226,6 +227,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXPathMultValues
xmlXPathSubValues
xmlXPathValueFlipSign
+
opposite
xmlCleanupParser
optimized
xmlXPathNodeSetAddUnique
option
xmlDOMWrapAdoptNode
xmlDOMWrapCloneNode
diff --git a/doc/APIchunk22.html b/doc/APIchunk22.html index 4d1c296..1fcc6c9 100644 --- a/doc/APIchunk22.html +++ b/doc/APIchunk22.html @@ -320,6 +320,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlDOMWrapAdoptNode
xmlDOMWrapCloneNode
xmlDOMWrapReconcileNamespaces
+
preparing
xmlCleanupParser
preparsed
xmlReaderNewWalker
xmlReaderWalker
xmlRelaxNGNewDocParserCtxt
@@ -352,7 +353,6 @@ A:link, A:visited, A:active { text-decoration: underline } xmlNodeSetSpacePreserve
prev
xmlValidGetValidElements
prevent
_xmlParserCtxt
-xmlCleanupParser
previous
_xmlAttr
_xmlAttribute
_xmlDoc
diff --git a/doc/APIchunk23.html b/doc/APIchunk23.html index bbf1165..4d76cc6 100644 --- a/doc/APIchunk23.html +++ b/doc/APIchunk23.html @@ -573,8 +573,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlReaderNewIO
xmlReaderNewMemory
xmlReaderNewWalker
-
reusing
xmlCleanupParser
-xmlXIncludeProcessNode
+
reusing
xmlXIncludeProcessNode
reverse
xmlListReverseSearch
xmlListReverseWalk
xmlXPathNextAncestor
diff --git a/doc/APIchunk24.html b/doc/APIchunk24.html index 5f563c6..0a798e6 100644 --- a/doc/APIchunk24.html +++ b/doc/APIchunk24.html @@ -399,6 +399,7 @@ A:link, A:visited, A:active { text-decoration: underline }
socket
xmlCheckFilename
xmlNanoFTPGetSocket
software
LIBXML_TEST_VERSION
+xmlTextReaderNodeType
solution
xmlNormalizeWindowsPath
some
XML_SKIP_IDS
characters
@@ -410,6 +411,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlHandleEntity
xmlMemSetup
xmlParseAttributeType
+xmlParseBalancedChunkMemoryRecover
xmlParserInputDeallocate
xmlRelaxNGValidatePushCData
xmlSAX2Characters
@@ -424,6 +426,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlXIncludeProcessTreeFlags
sometimes
xmlExpExpDerive
somewhat
xmlCheckLanguageID
+xmlCleanupParser
sorted
xmlParserAddNodeInfo
xmlParserFindNodeInfoIndex
xmlXPathDistinct
@@ -718,6 +721,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSchemaNewStringValue
structured
xmlRelaxNGSetValidStructuredErrors
xmlSchemaSetParserStructuredErrors
+xmlSchematronSetValidStructuredErrors
xmlSetStructuredErrorFunc
structures
xmlFreeDoc
xmlFreeNs
@@ -811,6 +815,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlHashUpdateEntry
xmlHashUpdateEntry2
xmlHashUpdateEntry3
+xmlParseBalancedChunkMemoryRecover
xmlSchemaValueAppend
xmlXPathCompareValues
xmlXPathContextSetCache
diff --git a/doc/APIchunk25.html b/doc/APIchunk25.html index cf24741..aa590d2 100644 --- a/doc/APIchunk25.html +++ b/doc/APIchunk25.html @@ -333,6 +333,8 @@ A:link, A:visited, A:active { text-decoration: underline }
traverse
xmlXPathAxisFunc
treaming
_xmlParserCtxt
treated
xmlParseAttValue
+
tried
xmlRecoverDoc
+xmlRecoverMemory
tries
INPUT_CHUNK
xlinkIsLink
xmlCleanupParser
diff --git a/doc/APIchunk27.html b/doc/APIchunk27.html index 1d0c9ae..d2272eb 100644 --- a/doc/APIchunk27.html +++ b/doc/APIchunk27.html @@ -293,6 +293,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlParserHandleReference
xmlSAX2GetSystemId
xmlSchemaGetPredefinedType
+xmlTextReaderNodeType

A-B C-C D-E diff --git a/doc/APIchunk28.html b/doc/APIchunk28.html index 5ab3207..bc198ee 100644 --- a/doc/APIchunk28.html +++ b/doc/APIchunk28.html @@ -222,6 +222,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSaveFormatFile
xmlSaveFormatFileEnc
xmlInitParser
htmlInitAutoClose
+xmlCleanupParser
xmlInitThreads
xmlInitThreads
xmlInitializeCatalog
xmlCatalogAdd
xmlInitializeGlobalState
xmlInitializeGlobalState
diff --git a/doc/APIchunk5.html b/doc/APIchunk5.html index f315b91..72067ed 100644 --- a/doc/APIchunk5.html +++ b/doc/APIchunk5.html @@ -61,6 +61,7 @@ A:link, A:visited, A:active { text-decoration: underline }
Ogham
xmlUCSIsOgham
OldItalic
xmlUCSIsOldItalic
One
INPUT_CHUNK
+xmlCleanupParser
xmlParseAttributeType
xmlSetGenericErrorFunc
xmlValidateElementDecl
diff --git a/doc/APIchunk7.html b/doc/APIchunk7.html index ae29cb4..df878bf 100644 --- a/doc/APIchunk7.html +++ b/doc/APIchunk7.html @@ -122,6 +122,7 @@ A:link, A:visited, A:active { text-decoration: underline }
Schematron
LIBXML_SCHEMATRON_ENABLED
xmlSchematronFree
xmlSchematronParse
+xmlSchematronSetValidStructuredErrors
Schematrons
xmlSchematronNewDocParserCtxt
xmlSchematronNewMemParserCtxt
xmlSchematronNewParserCtxt
@@ -158,7 +159,8 @@ A:link, A:visited, A:active { text-decoration: underline }
Second
xmlCheckLanguageID
Section
xmlGetCharEncodingName
xmlNormalizeURIPath
-
See
xmlLinkGetData
+
See
xmlCleanupParser
+xmlLinkGetData
xmlParseNotationDecl
xmlTextReaderByteConsumed
Seems
xmlParseTextDecl
diff --git a/doc/APIfiles.html b/doc/APIfiles.html index 00d34de..30d650a 100644 --- a/doc/APIfiles.html +++ b/doc/APIfiles.html @@ -1218,6 +1218,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSchemaWildcardNsPtr
xmlSchemaWildcardPtr

Module schematron:

XML_SCHEMATRON_OUT_BUFFER
+XML_SCHEMATRON_OUT_ERROR
XML_SCHEMATRON_OUT_FILE
XML_SCHEMATRON_OUT_IO
XML_SCHEMATRON_OUT_QUIET
@@ -1235,6 +1236,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSchematronParserCtxt
xmlSchematronParserCtxtPtr
xmlSchematronPtr
+xmlSchematronSetValidStructuredErrors
xmlSchematronValidCtxt
xmlSchematronValidCtxtPtr
xmlSchematronValidOptions
@@ -1991,6 +1993,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_FROM_RELAXNGV
XML_FROM_SCHEMASP
XML_FROM_SCHEMASV
+XML_FROM_SCHEMATRONV
XML_FROM_TREE
XML_FROM_VALID
XML_FROM_WRITER
@@ -2397,6 +2400,8 @@ A:link, A:visited, A:active { text-decoration: underline } XML_SCHEMAP_WARN_SKIP_SCHEMA
XML_SCHEMAP_WARN_UNLOCATED_SCHEMA
XML_SCHEMAP_WILDCARD_INVALID_NS_MEMBER
+XML_SCHEMATRONV_ASSERT
+XML_SCHEMATRONV_REPORT
XML_SCHEMAV_ATTRINVALID
XML_SCHEMAV_ATTRUNKNOWN
XML_SCHEMAV_CONSTRUCT
@@ -2478,6 +2483,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_SCHEMAV_WRONGELEM
XML_TREE_INVALID_DEC
XML_TREE_INVALID_HEX
+XML_TREE_NOT_UTF8
XML_TREE_UNTERMINATED_ENTITY
XML_WAR_CATALOG_PI
XML_WAR_ENTITY_REDEFINED
diff --git a/doc/APIfunctions.html b/doc/APIfunctions.html index 80b0a88..9e83889 100644 --- a/doc/APIfunctions.html +++ b/doc/APIfunctions.html @@ -852,6 +852,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSchemaValidateStream
xmlSchemaValidityErrorFunc
xmlSchemaValidityWarningFunc
+xmlSchematronSetValidStructuredErrors
xmlSchematronValidityErrorFunc
xmlSchematronValidityWarningFunc
xmlSetFeature
@@ -1956,6 +1957,7 @@ A:link, A:visited, A:active { text-decoration: underline }

Type xmlSchematronPtr:

xmlSchematronFree
xmlSchematronNewValidCtxt

Type xmlSchematronValidCtxtPtr:

xmlSchematronFreeValidCtxt
+xmlSchematronSetValidStructuredErrors
xmlSchematronValidateDoc

Type xmlShellCtxtPtr:

xmlShellBase
xmlShellCat
@@ -1983,6 +1985,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlRelaxNGSetValidStructuredErrors
xmlSchemaSetParserStructuredErrors
xmlSchemaSetValidStructuredErrors
+xmlSchematronSetValidStructuredErrors
xmlSetStructuredErrorFunc
xmlTextReaderSetStructuredErrorHandler
xmlThrDefSetStructuredErrorFunc
diff --git a/doc/APIsymbols.html b/doc/APIsymbols.html index 12a0b5d..af09644 100644 --- a/doc/APIsymbols.html +++ b/doc/APIsymbols.html @@ -435,6 +435,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_FROM_RELAXNGV
XML_FROM_SCHEMASP
XML_FROM_SCHEMASV
+XML_FROM_SCHEMATRONV
XML_FROM_TREE
XML_FROM_VALID
XML_FROM_WRITER
@@ -1128,7 +1129,10 @@ A:link, A:visited, A:active { text-decoration: underline } XML_SCHEMAS_UNKNOWN
XML_SCHEMAS_USHORT
XML_SCHEMAS_WILDCARD_COMPLETE
+XML_SCHEMATRONV_ASSERT
+XML_SCHEMATRONV_REPORT
XML_SCHEMATRON_OUT_BUFFER
+XML_SCHEMATRON_OUT_ERROR
XML_SCHEMATRON_OUT_FILE
XML_SCHEMATRON_OUT_IO
XML_SCHEMATRON_OUT_QUIET
@@ -1280,6 +1284,7 @@ A:link, A:visited, A:active { text-decoration: underline } XML_TEXT_NODE
XML_TREE_INVALID_DEC
XML_TREE_INVALID_HEX
+XML_TREE_NOT_UTF8
XML_TREE_UNTERMINATED_ENTITY
XML_WAR_CATALOG_PI
XML_WAR_ENTITY_REDEFINED
@@ -2779,6 +2784,7 @@ A:link, A:visited, A:active { text-decoration: underline } xmlSchematronParserCtxt
xmlSchematronParserCtxtPtr
xmlSchematronPtr
+xmlSchematronSetValidStructuredErrors
xmlSchematronValidCtxt
xmlSchematronValidCtxtPtr
xmlSchematronValidOptions
diff --git a/doc/devhelp/libxml2-parser.html b/doc/devhelp/libxml2-parser.html index c12cd02..76b4967 100644 --- a/doc/devhelp/libxml2-parser.html +++ b/doc/devhelp/libxml2-parser.html @@ -477,7 +477,7 @@ void xmlSetExternalEntityLoader (
ctxt:an XML parser context
Returns:the index in bytes from the beginning of the entity or -1 in case the index could not be computed.



xmlClearNodeInfoSeq ()

void	xmlClearNodeInfoSeq		(xmlParserNodeInfoSeqPtr seq)
@@ -594,7 +594,7 @@ void xmlSetExternalEntityLoader (

xmlParseBalancedChunkMemoryRecover ()

int	xmlParseBalancedChunkMemoryRecover	(xmlDocPtr doc, 
xmlSAXHandlerPtr sax,
void * user_data,
int depth,
const xmlChar * string,
xmlNodePtr * lst,
int recover)

Parse a well-balanced chunk of an XML document called by the parser The allowed sequence for the Well Balanced Chunk is the one defined by the content production in the XML grammar: [43] content ::= (element | CharData | Reference | CDSect | PI | Comment)*

-
doc:the document the chunk pertains to
sax:the SAX handler bloc (possibly NULL)
user_data:The user data returned on SAX callbacks (possibly NULL)
depth:Used for loop detection, use 0
string:the input string in UTF8 or ISO-Latin (zero terminated)
lst:the return value for the set of parsed nodes
recover:return nodes even if the data is broken (use 0)
Returns:0 if the chunk is well balanced, -1 in case of args problem 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.
+
doc:the document the chunk pertains to
sax:the SAX handler bloc (possibly NULL)
user_data:The user data returned on SAX callbacks (possibly NULL)
depth:Used for loop detection, use 0
string:the input string in UTF8 or ISO-Latin (zero terminated)
lst:the return value for the set of parsed nodes
recover:return nodes even if the data is broken (use 0)
Returns:0 if the chunk is well balanced, -1 in case of args problem 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, assuming the parsing succeeded to some extent.


xmlRecoverDoc ()

xmlDocPtr	xmlRecoverDoc		(xmlChar * cur)
-

parse an XML in-memory document and build a tree. In the case the document is not Well Formed, a tree is built anyway

-
cur:a pointer to an array of xmlChar
Returns:the resulting document tree
+

parse an XML in-memory document and build a tree. In the case the document is not Well Formed, a attempt to build a tree is tried anyway

+
cur:a pointer to an array of xmlChar
Returns:the resulting document tree or NULL in case of failure

xmlRecoverFile ()

xmlDocPtr	xmlRecoverFile		(const char * filename)
-

parse an XML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time. In the case the document is not Well Formed, a tree is built anyway

-
filename:the filename
Returns:the resulting document tree
+

parse an XML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time. In the case the document is not Well Formed, it attempts to build a tree anyway

+
filename:the filename
Returns:the resulting document tree or NULL in case of failure

xmlRecoverMemory ()

xmlDocPtr	xmlRecoverMemory	(const char * buffer, 
int size)
-

parse an XML in-memory block and build a tree. In the case the document is not Well Formed, a tree is built anyway

-
buffer:an pointer to a char array
size:the size of the array
Returns:the resulting document tree
+

parse an XML in-memory block and build a tree. In the case the document is not Well Formed, an attempt to build a tree is tried anyway

+
buffer:an pointer to a char array
size:the size of the array
Returns:the resulting document tree or NULL in case of error

xmlSAXParseDTD ()

xmlDtdPtr	xmlSAXParseDTD		(xmlSAXHandlerPtr sax, 
const xmlChar * ExternalID,
const xmlChar * SystemID)

Load and parse an external subset.

diff --git a/doc/devhelp/libxml2-schematron.html b/doc/devhelp/libxml2-schematron.html index 995d96a..bdcb944 100644 --- a/doc/devhelp/libxml2-schematron.html +++ b/doc/devhelp/libxml2-schematron.html @@ -57,6 +57,7 @@ typedef void xmlSchematronValidityErro xmlSchematronParserCtxtPtr xmlSchematronNewParserCtxt (const char * URL); typedef void xmlSchematronValidityWarningFunc (void * ctx,
const char * msg,
... ...); void xmlSchematronFree (xmlSchematronPtr schema); +void xmlSchematronSetValidStructuredErrors (xmlSchematronValidCtxtPtr ctxt,
xmlStructuredErrorFunc serror,
void * ctx); void xmlSchematronFreeValidCtxt (xmlSchematronValidCtxtPtr ctxt); xmlSchematronPtr xmlSchematronParse (xmlSchematronParserCtxtPtr ctxt); xmlSchematronParserCtxtPtr xmlSchematronNewDocParserCtxt (xmlDocPtr doc); @@ -103,6 +104,7 @@ The content of this structure is not made public by the API. XML_SCHEMATRON_OUT_QUIET = 1 /* quiet no report */ XML_SCHEMATRON_OUT_TEXT = 2 /* build a textual report */ XML_SCHEMATRON_OUT_XML = 4 /* output SVRL */ + XML_SCHEMATRON_OUT_ERROR = 8 /* output via xmlStructuredErrorFunc */ XML_SCHEMATRON_OUT_FILE = 256 /* output to a file descriptor */ XML_SCHEMATRON_OUT_BUFFER = 512 /* output to a buffer */ XML_SCHEMATRON_OUT_IO = 1024 /* output to I/O mechanism */ @@ -149,6 +151,10 @@ The content of this structure is not made public by the API.

xmlSchematronParse ()

xmlSchematronPtr	xmlSchematronParse	(xmlSchematronParserCtxtPtr 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 Schematron structure built from the resource or NULL in case of error
+
+

xmlSchematronSetValidStructuredErrors ()

void	xmlSchematronSetValidStructuredErrors	(xmlSchematronValidCtxtPtr ctxt, 
xmlStructuredErrorFunc serror,
void * ctx)
+

Set the structured error callback

+
ctxt:a Schematron validation context
serror:the structured error function
ctx:the functions context

xmlSchematronValidateDoc ()

int	xmlSchematronValidateDoc	(xmlSchematronValidCtxtPtr ctxt, 
xmlDocPtr instance)

Validate a tree instance against the schematron

diff --git a/doc/devhelp/libxml2-xmlerror.html b/doc/devhelp/libxml2-xmlerror.html index 7545da4..eaacd0b 100644 --- a/doc/devhelp/libxml2-xmlerror.html +++ b/doc/devhelp/libxml2-xmlerror.html @@ -119,7 +119,8 @@ void xmlResetError (XML_FROM_CHECK = 24 /* The error checking module */ XML_FROM_WRITER = 25 /* The xmlwriter module */ XML_FROM_MODULE = 26 /* The dynamically loaded module modul */ - XML_FROM_I18N = 27 /* The module handling character conversion */ + XML_FROM_I18N = 27 /* The module handling character conversion */ + XML_FROM_SCHEMATRONV = 28 /* The Schematron validator module */ };

@@ -442,6 +443,7 @@ void xmlResetError (XML_TREE_INVALID_HEX = 1300 XML_TREE_INVALID_DEC = 1301 /* 1301 */ XML_TREE_UNTERMINATED_ENTITY = 1302 /* 1302 */ + XML_TREE_NOT_UTF8 = 1303 /* 1303 */ XML_SAVE_NOT_UTF8 = 1400 XML_SAVE_CHAR_INVALID = 1401 /* 1401 */ XML_SAVE_NO_DOCTYPE = 1402 /* 1402 */ @@ -817,6 +819,8 @@ void xmlResetError (XML_SCHEMAP_AU_PROPS_CORRECT = 3089 /* 3088 */ XML_SCHEMAP_A_PROPS_CORRECT_3 = 3090 /* 3089 */ XML_SCHEMAP_COS_ALL_LIMITED = 3091 /* 3090 */ + XML_SCHEMATRONV_ASSERT = 4000 /* 4000 */ + XML_SCHEMATRONV_REPORT = 4001 XML_MODULE_OPEN = 4900 /* 4900 */ XML_MODULE_CLOSE = 4901 /* 4901 */ XML_CHECK_FOUND_ELEMENT = 5000 diff --git a/doc/devhelp/libxml2-xmlreader.html b/doc/devhelp/libxml2-xmlreader.html index e422f1d..1609a96 100644 --- a/doc/devhelp/libxml2-xmlreader.html +++ b/doc/devhelp/libxml2-xmlreader.html @@ -459,7 +459,7 @@ The content of this structure is not made public by the API.
reader:the xmlTextReaderPtr used
Returns:1 if the node was read successfully, 0 if there is no more nodes to read, or -1 in case of error

xmlTextReaderNodeType ()

int	xmlTextReaderNodeType		(xmlTextReaderPtr reader)
-

Get the node type of the current node Reference: http://dotgnu.org/pnetlib-doc/System/Xml/XmlNodeType.html

+

Get the node type of the current node Reference: http://www.gnu.org/software/dotgnu/pnetlib-doc/System/Xml/XmlNodeType.html

reader:the xmlTextReaderPtr used
Returns:the xmlNodeType of the current node or -1 in case of error

xmlTextReaderNormalization ()

int	xmlTextReaderNormalization	(xmlTextReaderPtr reader)
diff --git a/doc/devhelp/libxml2-xmlwriter.html b/doc/devhelp/libxml2-xmlwriter.html index e453daf..358c9e6 100644 --- a/doc/devhelp/libxml2-xmlwriter.html +++ b/doc/devhelp/libxml2-xmlwriter.html @@ -209,8 +209,8 @@ The content of this structure is not made public by the API.
writer:the xmlTextWriterPtr
Returns:the bytes written (may be 0 because of buffering) or -1 in case of error

xmlTextWriterEndDocument ()

int	xmlTextWriterEndDocument	(xmlTextWriterPtr writer)
-

End an xml document. All open elements are closed

-
writer:the xmlTextWriterPtr
Returns:the bytes written (may be 0 because of buffering) or -1 in case of error
+

End an xml document. All open elements are closed, and the content is flushed to the output.

+
writer:the xmlTextWriterPtr
Returns:the bytes written or -1 in case of error

xmlTextWriterEndElement ()

int	xmlTextWriterEndElement		(xmlTextWriterPtr writer)

End the current xml element.

diff --git a/doc/devhelp/libxml2.devhelp b/doc/devhelp/libxml2.devhelp index a932cdf..499bcb9 100644 --- a/doc/devhelp/libxml2.devhelp +++ b/doc/devhelp/libxml2.devhelp @@ -620,6 +620,7 @@ + @@ -1226,7 +1227,10 @@ + + + @@ -1373,6 +1377,7 @@ + @@ -2853,6 +2858,7 @@ + diff --git a/doc/elfgcchack.xsl b/doc/elfgcchack.xsl index 11169f9..1adf340 100644 --- a/doc/elfgcchack.xsl +++ b/doc/elfgcchack.xsl @@ -106,7 +106,7 @@ extern __typeof (__xmlGenericErrorContext) __xmlGenericErrorContext__internal_al - + #ifdef bottom_ diff --git a/doc/examples/Makefile.am b/doc/examples/Makefile.am index ea23621..d1beee5 100644 --- a/doc/examples/Makefile.am +++ b/doc/examples/Makefile.am @@ -9,127 +9,126 @@ 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: $(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 test1.xml test2.xml test3.xml tst.xml writer.xml io1.res io2.res reader1.res reader3.res reader4.res tree1.res tree2.res xpath1.res xpath2.res +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 -noinst_PROGRAMS=io1 io2 parse1 parse2 parse3 parse4 reader1 reader2 reader3 reader4 testWriter tree1 tree2 xpath1 xpath2 +noinst_PROGRAMS=xpath2 reader1 reader4 parse2 reader2 parse3 reader3 tree2 parse4 io2 testWriter io1 xpath1 parse1 tree1 -io1_SOURCES=io1.c -io1_LDFLAGS= -io1_DEPENDENCIES= $(DEPS) -io1_LDADD= @RDL_LIBS@ $(LDADDS) +xpath2_SOURCES=xpath2.c +xpath2_LDFLAGS= +xpath2_DEPENDENCIES= $(DEPS) +xpath2_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) -parse1_SOURCES=parse1.c -parse1_LDFLAGS= -parse1_DEPENDENCIES= $(DEPS) -parse1_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) -parse3_SOURCES=parse3.c -parse3_LDFLAGS= -parse3_DEPENDENCIES= $(DEPS) -parse3_LDADD= @RDL_LIBS@ $(LDADDS) - -parse4_SOURCES=parse4.c -parse4_LDFLAGS= -parse4_DEPENDENCIES= $(DEPS) -parse4_LDADD= @RDL_LIBS@ $(LDADDS) - -reader1_SOURCES=reader1.c -reader1_LDFLAGS= -reader1_DEPENDENCIES= $(DEPS) -reader1_LDADD= @RDL_LIBS@ $(LDADDS) - reader2_SOURCES=reader2.c reader2_LDFLAGS= reader2_DEPENDENCIES= $(DEPS) reader2_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) -reader4_SOURCES=reader4.c -reader4_LDFLAGS= -reader4_DEPENDENCIES= $(DEPS) -reader4_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) testWriter_SOURCES=testWriter.c testWriter_LDFLAGS= testWriter_DEPENDENCIES= $(DEPS) testWriter_LDADD= @RDL_LIBS@ $(LDADDS) -tree1_SOURCES=tree1.c -tree1_LDFLAGS= -tree1_DEPENDENCIES= $(DEPS) -tree1_LDADD= @RDL_LIBS@ $(LDADDS) - -tree2_SOURCES=tree2.c -tree2_LDFLAGS= -tree2_DEPENDENCIES= $(DEPS) -tree2_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) -xpath2_SOURCES=xpath2.c -xpath2_LDFLAGS= -xpath2_DEPENDENCIES= $(DEPS) -xpath2_LDADD= @RDL_LIBS@ $(LDADDS) +parse1_SOURCES=parse1.c +parse1_LDFLAGS= +parse1_DEPENDENCIES= $(DEPS) +parse1_LDADD= @RDL_LIBS@ $(LDADDS) + +tree1_SOURCES=tree1.c +tree1_LDFLAGS= +tree1_DEPENDENCIES= $(DEPS) +tree1_LDADD= @RDL_LIBS@ $(LDADDS) valgrind: - $(MAKE) CHECKER='valgrind -q' tests + $(MAKE) CHECKER='valgrind' tests tests: $(noinst_PROGRAMS) @(echo '## examples regression tests') @(echo > .memdump) - @($(CHECKER) ./io1 > io1.tmp ; diff io1.tmp io1.res ; rm -f io1.tmp) + @($(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) ./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) ./parse1 test1.xml) + @($(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) - @($(CHECKER) ./parse3) + @($(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) ./parse4 test3.xml) + @($(CHECKER) ./parse3) @(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) + @($(CHECKER) ./reader3 > reader3.tmp ; diff reader3.tmp reader3.res ; rm reader3.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) ./tree2 > tree2.tmp ; diff tree2.tmp tree2.res ; rm tree2.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./reader3 > reader3.tmp ; diff reader3.tmp reader3.res ; rm reader3.tmp) + @($(CHECKER) ./parse4 test3.xml) @(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) ./io2 > io2.tmp ; diff io2.tmp io2.res ; rm -f io2.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) ./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) ./tree2 > tree2.tmp ; diff tree2.tmp tree2.res ; rm tree2.tmp) + @($(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) ././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) ./xpath2 test3.xml '//discarded' discarded > xpath2.tmp ; diff xpath2.tmp xpath2.res ; rm xpath2.tmp) + @($(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) diff --git a/doc/examples/Makefile.in b/doc/examples/Makefile.in index 314343a..14681b4 100644 --- a/doc/examples/Makefile.in +++ b/doc/examples/Makefile.in @@ -32,11 +32,11 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -noinst_PROGRAMS = io1$(EXEEXT) io2$(EXEEXT) parse1$(EXEEXT) \ - parse2$(EXEEXT) parse3$(EXEEXT) parse4$(EXEEXT) \ - reader1$(EXEEXT) reader2$(EXEEXT) reader3$(EXEEXT) \ - reader4$(EXEEXT) testWriter$(EXEEXT) tree1$(EXEEXT) \ - tree2$(EXEEXT) xpath1$(EXEEXT) xpath2$(EXEEXT) +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) subdir = doc/examples DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -370,67 +370,67 @@ 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 test1.xml test2.xml test3.xml tst.xml writer.xml io1.res io2.res reader1.res reader3.res reader4.res tree1.res tree2.res xpath1.res xpath2.res -io1_SOURCES = io1.c -io1_LDFLAGS = -io1_DEPENDENCIES = $(DEPS) -io1_LDADD = @RDL_LIBS@ $(LDADDS) -io2_SOURCES = io2.c -io2_LDFLAGS = -io2_DEPENDENCIES = $(DEPS) -io2_LDADD = @RDL_LIBS@ $(LDADDS) -parse1_SOURCES = parse1.c -parse1_LDFLAGS = -parse1_DEPENDENCIES = $(DEPS) -parse1_LDADD = @RDL_LIBS@ $(LDADDS) -parse2_SOURCES = parse2.c -parse2_LDFLAGS = -parse2_DEPENDENCIES = $(DEPS) -parse2_LDADD = @RDL_LIBS@ $(LDADDS) -parse3_SOURCES = parse3.c -parse3_LDFLAGS = -parse3_DEPENDENCIES = $(DEPS) -parse3_LDADD = @RDL_LIBS@ $(LDADDS) -parse4_SOURCES = parse4.c -parse4_LDFLAGS = -parse4_DEPENDENCIES = $(DEPS) -parse4_LDADD = @RDL_LIBS@ $(LDADDS) +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) reader2_SOURCES = reader2.c reader2_LDFLAGS = reader2_DEPENDENCIES = $(DEPS) reader2_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) -reader4_SOURCES = reader4.c -reader4_LDFLAGS = -reader4_DEPENDENCIES = $(DEPS) -reader4_LDADD = @RDL_LIBS@ $(LDADDS) -testWriter_SOURCES = testWriter.c -testWriter_LDFLAGS = -testWriter_DEPENDENCIES = $(DEPS) -testWriter_LDADD = @RDL_LIBS@ $(LDADDS) -tree1_SOURCES = tree1.c -tree1_LDFLAGS = -tree1_DEPENDENCIES = $(DEPS) -tree1_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) +testWriter_SOURCES = testWriter.c +testWriter_LDFLAGS = +testWriter_DEPENDENCIES = $(DEPS) +testWriter_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) -xpath2_SOURCES = xpath2.c -xpath2_LDFLAGS = -xpath2_DEPENDENCIES = $(DEPS) -xpath2_LDADD = @RDL_LIBS@ $(LDADDS) +parse1_SOURCES = parse1.c +parse1_LDFLAGS = +parse1_DEPENDENCIES = $(DEPS) +parse1_LDADD = @RDL_LIBS@ $(LDADDS) +tree1_SOURCES = tree1.c +tree1_LDFLAGS = +tree1_DEPENDENCIES = $(DEPS) +tree1_LDADD = @RDL_LIBS@ $(LDADDS) all: all-am .SUFFIXES: @@ -750,7 +750,6 @@ 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: @@ -758,40 +757,40 @@ install-data-local: -@INSTALL@ -m 0644 $(srcdir)/*.html $(srcdir)/*.c $(srcdir)/*.xml $(srcdir)/*.xsl $(srcdir)/*.res $(DESTDIR)$(HTML_DIR) valgrind: - $(MAKE) CHECKER='valgrind -q' tests + $(MAKE) CHECKER='valgrind' tests tests: $(noinst_PROGRAMS) @(echo '## examples regression tests') @(echo > .memdump) - @($(CHECKER) ./io1 > io1.tmp ; diff io1.tmp io1.res ; rm -f io1.tmp) + @($(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) ./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) ./parse1 test1.xml) + @($(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) - @($(CHECKER) ./parse3) + @($(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) ./parse4 test3.xml) + @($(CHECKER) ./parse3) @(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) + @($(CHECKER) ./reader3 > reader3.tmp ; diff reader3.tmp reader3.res ; rm reader3.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) ./tree2 > tree2.tmp ; diff tree2.tmp tree2.res ; rm tree2.tmp) @(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0) - @($(CHECKER) ./reader3 > reader3.tmp ; diff reader3.tmp reader3.res ; rm reader3.tmp) + @($(CHECKER) ./parse4 test3.xml) @(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) ./io2 > io2.tmp ; diff io2.tmp io2.res ; rm -f io2.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) ./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) ./tree2 > tree2.tmp ; diff tree2.tmp tree2.res ; rm tree2.tmp) + @($(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) ././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) ./xpath2 test3.xml '//discarded' discarded > xpath2.tmp ; diff xpath2.tmp xpath2.res ; rm xpath2.tmp) + @($(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) # 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. diff --git a/doc/examples/examples.xml b/doc/examples/examples.xml index 31b8525..2a0827b 100644 --- a/doc/examples/examples.xml +++ b/doc/examples/examples.xml @@ -1,53 +1,4 @@ - - 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 - parse1 test1.xml - parse1 test1.xml - Daniel Veillard - see Copyright for the status of this software. -
Parsing
- - <libxml/tree.h> - <libxml/parser.h> - - - - - - - - - -
- - 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> - - - - - - - - - - - - - - - - - -
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 @@ -81,148 +32,57 @@ - - 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. - io1 - io1 > io1.tmp ; diff io1.tmp io1.res ; rm -f io1.tmp + + 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. -
InputOutput
+
xmlReader
- <libxml/parser.h> - <libxml/xmlIO.h> - <libxml/xinclude.h> - <libxml/tree.h> + <libxml/xmlreader.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 + + 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> - - - - - - - - - - - - -
- - use various APIs for the xmlWriter - tests a number of APIs for the xmlWriter, especially the various methods to write to a filename, to a memory buffer, to a new document, or to a subtree. It shows how to do encoding string conversions too. The resulting documents are then serialized. - testWriter - testWriter ; for i in 1 2 3 4 ; do diff writer.xml writer$$i.res ; done ; rm writer*.res - Alfred Mickautsch - see Copyright for the status of this software. -
xmlWriter
- - <libxml/encoding.h> - <libxml/xmlwriter.h> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Navigates a tree to print element names - Parse a file to a tree, use xmlDocGetRootElement() to get the root element, then walk the document and print all the element name in document order. - tree1 filename_or_URL - tree1 test2.xml > tree1.tmp ; diff tree1.tmp tree1.res ; rm tree1.tmp - Dodji Seketeli - see Copyright for the status of this software. -
Tree
- - <libxml/tree.h> - <libxml/parser.h> - - - - - - - -
- - Creates a tree - Shows how to create document, nodes and dump it to stdout or file. - tree2 <filename> -Default output: stdout - tree2 > tree2.tmp ; diff tree2.tmp tree2.res ; rm tree2.tmp - Lucas Brasilino <brasilino@recife.pe.gov.br> - see Copyright for the status of this software -
Tree
- - <libxml/tree.h> - <libxml/parser.h> - - - - - - - - - - - + + + + + + + + + +
@@ -243,7 +103,11 @@ + + + + @@ -259,14 +123,17 @@ + + + @@ -275,24 +142,73 @@ - - 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 + + Parse an XML document in memory to a tree and free it + Demonstrate the use of xmlReadMemory() to read an XML file into a tree and and xmlFreeDoc() to free the resulting tree + parse3 + parse3 + 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> - - - - - - + + + + + + + + + + +
+ + Creates a tree + Shows how to create document, nodes and dump it to stdout or file. + tree2 <filename> -Default output: stdout + tree2 > tree2.tmp ; diff tree2.tmp tree2.res ; rm tree2.tmp + Lucas Brasilino <brasilino@recife.pe.gov.br> + see Copyright for the status of this software +
Tree
+ + <libxml/tree.h> + <libxml/parser.h> + + + + + + + + + + + +
@@ -312,22 +228,93 @@ + - - Parse an XML document in memory to a tree and free it - Demonstrate the use of xmlReadMemory() to read an XML file into a tree and and xmlFreeDoc() to free the resulting tree - parse3 - parse3 + + 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
+ + <libxml/parser.h> + + + + + + + + + + +
+ + use various APIs for the xmlWriter + tests a number of APIs for the xmlWriter, especially the various methods to write to a filename, to a memory buffer, to a new document, or to a subtree. It shows how to do encoding string conversions too. The resulting documents are then serialized. + testWriter + testWriter ; for i in 1 2 3 4 ; do diff writer.xml writer$$i.res ; done ; rm writer*.res + Alfred Mickautsch + see Copyright for the status of this software. +
xmlWriter
+ + <libxml/encoding.h> + <libxml/xmlwriter.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. + io1 + io1 > io1.tmp ; diff io1.tmp io1.res ; rm -f io1.tmp Daniel Veillard see Copyright for the status of this software. -
Parsing
+
InputOutput
- <libxml/tree.h> <libxml/parser.h> + <libxml/xmlIO.h> + <libxml/xinclude.h> + <libxml/tree.h> - + + + +
@@ -363,24 +350,402 @@ - - 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 + + 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 + parse1 test1.xml + parse1 test1.xml + Daniel Veillard see Copyright for the status of this software. -
InputOutput
+
Parsing
+ <libxml/tree.h> <libxml/parser.h> - - - - - - - + + +
+ + Navigates a tree to print element names + Parse a file to a tree, use xmlDocGetRootElement() to get the root element, then walk the document and print all the element name in document order. + tree1 filename_or_URL + tree1 test2.xml > tree1.tmp ; diff tree1.tmp tree1.res ; rm tree1.tmp + Dodji Seketeli + see Copyright for the status of this software. +
Tree
+ + <libxml/tree.h> + <libxml/parser.h> + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ + + + +
+
+ + +
+
+ + +
+
+ + + + +
+
+ +
+
+
diff --git a/doc/html/book1.html b/doc/html/book1.html index 4a4962a..70263a1 100644 --- a/doc/html/book1.html +++ b/doc/html/book1.html @@ -10,4 +10,4 @@ A:link, A:visited, A:active { text-decoration: underline } 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

+ 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/index.html b/doc/html/index.html index 4a4962a..70263a1 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -10,4 +10,4 @@ A:link, A:visited, A:active { text-decoration: underline } 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

+ 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-DOCBparser.html b/doc/html/libxml-DOCBparser.html index c75bd26..bb3ef1c 100644 --- a/doc/html/libxml-DOCBparser.html +++ b/doc/html/libxml-DOCBparser.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } Module DOCBparser from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module DOCBparser from libxml2

API Menu
API Indexes
Related links

This module is deprecated

interface for a DocBook SGML non-verifying parser This code is DEPRECATED, and should not be used anymore.

Table of Contents

Typedef xmlParserInputPtr docbParserInputPtr
+    Module DOCBparser from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module DOCBparser from libxml2

API Menu
API Indexes
Related links

This module is deprecated

interface for a DocBook SGML non-verifying parser This code is DEPRECATED, and should not be used anymore.

Table of Contents

Typedef xmlParserInputPtr docbParserInputPtr
 
Typedef xmlParserCtxt docbParserCtxt
 
Typedef xmlParserCtxtPtr docbParserCtxtPtr
 
Typedef xmlParserInput docbParserInput
diff --git a/doc/html/libxml-HTMLparser.html b/doc/html/libxml-HTMLparser.html
index 694a08f..7034fe0 100644
--- a/doc/html/libxml-HTMLparser.html
+++ b/doc/html/libxml-HTMLparser.html
@@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline }
 Module HTMLparser from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module HTMLparser from libxml2

API Menu
API Indexes
Related links

this module implements an HTML 4.0 non-verifying parser with API compatible with the XML parser ones. It should be able to parse "real world" HTML, even if severely broken from a specification point of view.

Table of Contents

#define htmlDefaultSubelement
#define htmlElementAllowedHereDesc
#define htmlRequiredAttrs
Typedef xmlDocPtr htmlDocPtr
+    Module HTMLparser from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module HTMLparser from libxml2

API Menu
API Indexes
Related links

this module implements an HTML 4.0 non-verifying parser with API compatible with the XML parser ones. It should be able to parse "real world" HTML, even if severely broken from a specification point of view.

Table of Contents

#define htmlDefaultSubelement
#define htmlElementAllowedHereDesc
#define htmlRequiredAttrs
Typedef xmlDocPtr htmlDocPtr
 
Structure htmlElemDesc
struct _htmlElemDesc
Typedef htmlElemDesc * htmlElemDescPtr
 
Structure htmlEntityDesc
struct _htmlEntityDesc diff --git a/doc/html/libxml-HTMLtree.html b/doc/html/libxml-HTMLtree.html index 1f430aa..a2270e0 100644 --- a/doc/html/libxml-HTMLtree.html +++ b/doc/html/libxml-HTMLtree.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } Module HTMLtree from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module HTMLtree from libxml2

API Menu
API Indexes
Related links

this module implements a few function needed to process tree in an HTML specific way.

Table of Contents

#define HTML_COMMENT_NODE
#define HTML_ENTITY_REF_NODE
#define HTML_PI_NODE
#define HTML_PRESERVE_NODE
#define HTML_TEXT_NODE
void	htmlDocContentDumpFormatOutput	(xmlOutputBufferPtr buf, 
xmlDocPtr cur,
const char * encoding,
int format)
+ Module HTMLtree from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module HTMLtree from libxml2

API Menu
API Indexes
Related links

this module implements a few function needed to process tree in an HTML specific way.

Table of Contents

#define HTML_COMMENT_NODE
#define HTML_ENTITY_REF_NODE
#define HTML_PI_NODE
#define HTML_PRESERVE_NODE
#define HTML_TEXT_NODE
void	htmlDocContentDumpFormatOutput	(xmlOutputBufferPtr buf, 
xmlDocPtr cur,
const char * encoding,
int format)
void	htmlDocContentDumpOutput	(xmlOutputBufferPtr buf, 
xmlDocPtr cur,
const char * encoding)
int	htmlDocDump			(FILE * f, 
xmlDocPtr cur)
void	htmlDocDumpMemory		(xmlDocPtr cur, 
xmlChar ** mem,
int * size)
diff --git a/doc/html/libxml-SAX.html b/doc/html/libxml-SAX.html index d2c8ac3..746c55b 100644 --- a/doc/html/libxml-SAX.html +++ b/doc/html/libxml-SAX.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } Module SAX from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module SAX from libxml2

API Menu
API Indexes
Related links

This module is deprecated

DEPRECATED set of SAX version 1 interfaces used to build the DOM tree.

Table of Contents

void	comment			(void * ctx, 
const xmlChar * value)
+ Module SAX from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module SAX from libxml2

API Menu
API Indexes
Related links

This module is deprecated

DEPRECATED set of SAX version 1 interfaces used to build the DOM tree.

Table of Contents

void	comment			(void * ctx, 
const xmlChar * value)
int	checkNamespace			(void * ctx, 
xmlChar * namespace)
int	getColumnNumber			(void * ctx)
void	entityDecl			(void * ctx, 
const xmlChar * name,
int type,
const xmlChar * publicId,
const xmlChar * systemId,
xmlChar * content)
diff --git a/doc/html/libxml-SAX2.html b/doc/html/libxml-SAX2.html index 028692d..02fdad1 100644 --- a/doc/html/libxml-SAX2.html +++ b/doc/html/libxml-SAX2.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } Module SAX2 from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module SAX2 from libxml2

API Menu
API Indexes
Related links

those are the default SAX2 interfaces used by the library when building DOM tree.

Table of Contents

void	docbDefaultSAXHandlerInit	(void)
+ Module SAX2 from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module SAX2 from libxml2

API Menu
API Indexes
Related links

those are the default SAX2 interfaces used by the library when building DOM tree.

Table of Contents

void	docbDefaultSAXHandlerInit	(void)
void	htmlDefaultSAXHandlerInit	(void)
void	xmlDefaultSAXHandlerInit	(void)
void	xmlSAX2AttributeDecl		(void * ctx, 
const xmlChar * elem,
const xmlChar * fullname,
int type,
int def,
const xmlChar * defaultValue,
xmlEnumerationPtr tree)
diff --git a/doc/html/libxml-c14n.html b/doc/html/libxml-c14n.html index a4a1bc3..f4b3ecd 100644 --- a/doc/html/libxml-c14n.html +++ b/doc/html/libxml-c14n.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } Module c14n from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module c14n from libxml2

API Menu
API Indexes
Related links

the c14n modules provides a "Canonical XML" implementation

Table of Contents

int	xmlC14NDocDumpMemory		(xmlDocPtr doc, 
xmlNodeSetPtr nodes,
int exclusive,
xmlChar ** inclusive_ns_prefixes,
int with_comments,
xmlChar ** doc_txt_ptr)
+ Module c14n from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module c14n from libxml2

API Menu
API Indexes
Related links

the c14n modules provides a "Canonical XML" implementation

Table of Contents

int	xmlC14NDocDumpMemory		(xmlDocPtr doc, 
xmlNodeSetPtr nodes,
int exclusive,
xmlChar ** inclusive_ns_prefixes,
int with_comments,
xmlChar ** doc_txt_ptr)
int	xmlC14NDocSave			(xmlDocPtr doc, 
xmlNodeSetPtr nodes,
int exclusive,
xmlChar ** inclusive_ns_prefixes,
int with_comments,
const char * filename,
int compression)
int	xmlC14NDocSaveTo		(xmlDocPtr doc, 
xmlNodeSetPtr nodes,
int exclusive,
xmlChar ** inclusive_ns_prefixes,
int with_comments,
xmlOutputBufferPtr buf)
int	xmlC14NExecute			(xmlDocPtr doc, 
xmlC14NIsVisibleCallback is_visible_callback,
void * user_data,
int exclusive,
xmlChar ** inclusive_ns_prefixes,
int with_comments,
xmlOutputBufferPtr buf)
diff --git a/doc/html/libxml-catalog.html b/doc/html/libxml-catalog.html index 51da79b..9a58bbf 100644 --- a/doc/html/libxml-catalog.html +++ b/doc/html/libxml-catalog.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } Module catalog from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module catalog from libxml2

API Menu
API Indexes
Related links

the catalog module implements the support for XML Catalogs and SGML catalogs

Table of Contents

#define XML_CATALOGS_NAMESPACE
#define XML_CATALOG_PI
Structure xmlCatalog
struct _xmlCatalog + Module catalog from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module catalog from libxml2

API Menu
API Indexes
Related links

the catalog module implements the support for XML Catalogs and SGML catalogs

Table of Contents

#define XML_CATALOGS_NAMESPACE
#define XML_CATALOG_PI
Structure xmlCatalog
struct _xmlCatalog The content of this structure is not made public by the API.
Enum xmlCatalogAllow
 
Enum xmlCatalogPrefer
diff --git a/doc/html/libxml-chvalid.html b/doc/html/libxml-chvalid.html
index b0ea1d4..4b1ebf1 100644
--- a/doc/html/libxml-chvalid.html
+++ b/doc/html/libxml-chvalid.html
@@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline }
 Module chvalid from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module chvalid from libxml2

API Menu
API Indexes
Related links

this module exports interfaces for the character range validation APIs This file is automatically generated from the cvs source definition files using the genChRanges.py Python script

Table of Contents

#define xmlIsBaseCharQ
#define xmlIsBaseChar_ch
#define xmlIsBlankQ
#define xmlIsBlank_ch
#define xmlIsCharQ
#define xmlIsChar_ch
#define xmlIsCombiningQ
#define xmlIsDigitQ
#define xmlIsDigit_ch
#define xmlIsExtenderQ
#define xmlIsExtender_ch
#define xmlIsIdeographicQ
#define xmlIsPubidCharQ
#define xmlIsPubidChar_ch
Structure xmlChLRange
struct _xmlChLRange + Module chvalid from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module chvalid from libxml2

API Menu
API Indexes
Related links

this module exports interfaces for the character range validation APIs This file is automatically generated from the cvs source definition files using the genChRanges.py Python script

Table of Contents

#define xmlIsBaseCharQ
#define xmlIsBaseChar_ch
#define xmlIsBlankQ
#define xmlIsBlank_ch
#define xmlIsCharQ
#define xmlIsChar_ch
#define xmlIsCombiningQ
#define xmlIsDigitQ
#define xmlIsDigit_ch
#define xmlIsExtenderQ
#define xmlIsExtender_ch
#define xmlIsIdeographicQ
#define xmlIsPubidCharQ
#define xmlIsPubidChar_ch
Structure xmlChLRange
struct _xmlChLRange
Typedef xmlChLRange * xmlChLRangePtr
 
Structure xmlChRangeGroup
struct _xmlChRangeGroup
Typedef xmlChRangeGroup * xmlChRangeGroupPtr
diff --git a/doc/html/libxml-debugXML.html b/doc/html/libxml-debugXML.html
index ae944be..6cae0a6 100644
--- a/doc/html/libxml-debugXML.html
+++ b/doc/html/libxml-debugXML.html
@@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline }
 Module debugXML from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module debugXML from libxml2

API Menu
API Indexes
Related links

Interfaces to a set of routines used for debugging the tree produced by the XML parser.

Table of Contents

Structure xmlShellCtxt
struct _xmlShellCtxt + Module debugXML from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module debugXML from libxml2

API Menu
API Indexes
Related links

Interfaces to a set of routines used for debugging the tree produced by the XML parser.

Table of Contents

Structure xmlShellCtxt
struct _xmlShellCtxt
Typedef xmlShellCtxt * xmlShellCtxtPtr
 
const char *	xmlBoolToText		(int boolval)
int	xmlDebugCheckDocument		(FILE * output, 
xmlDocPtr doc)
diff --git a/doc/html/libxml-dict.html b/doc/html/libxml-dict.html index ae1b99a..412a881 100644 --- a/doc/html/libxml-dict.html +++ b/doc/html/libxml-dict.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } Module dict from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module dict from libxml2

API Menu
API Indexes
Related links

dictionary of reusable strings, just used to avoid allocation and freeing operations.

Table of Contents

Structure xmlDict
struct _xmlDict + Module dict from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module dict from libxml2

API Menu
API Indexes
Related links

dictionary of reusable strings, just used to avoid allocation and freeing operations.

Table of Contents

Structure xmlDict
struct _xmlDict The content of this structure is not made public by the API.
Typedef xmlDict * xmlDictPtr
 
void	xmlDictCleanup			(void)
diff --git a/doc/html/libxml-encoding.html b/doc/html/libxml-encoding.html index 259f573..16ced2a 100644 --- a/doc/html/libxml-encoding.html +++ b/doc/html/libxml-encoding.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } Module encoding from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module encoding from libxml2

API Menu
API Indexes
Related links

interface for the encoding conversion functions needed for XML basic encoding and iconv() support. Related specs are rfc2044 (UTF-8 and UTF-16) F. Yergeau Alis Technologies [ISO-10646] UTF-8 and UTF-16 in Annexes [ISO-8859-1] ISO Latin-1 characters codes. [UNICODE] The Unicode Consortium, "The Unicode Standard -- Worldwide Character Encoding -- Version 1.0", Addison- Wesley, Volume 1, 1991, Volume 2, 1992. UTF-8 is described in Unicode Technical Report #4. [US-ASCII] Coded Character Set--7-bit American Standard Code for Information Interchange, ANSI X3.4-1986.

Table of Contents

Enum xmlCharEncoding
+    Module encoding from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module encoding from libxml2

API Menu
API Indexes
Related links

interface for the encoding conversion functions needed for XML basic encoding and iconv() support. Related specs are rfc2044 (UTF-8 and UTF-16) F. Yergeau Alis Technologies [ISO-10646] UTF-8 and UTF-16 in Annexes [ISO-8859-1] ISO Latin-1 characters codes. [UNICODE] The Unicode Consortium, "The Unicode Standard -- Worldwide Character Encoding -- Version 1.0", Addison- Wesley, Volume 1, 1991, Volume 2, 1992. UTF-8 is described in Unicode Technical Report #4. [US-ASCII] Coded Character Set--7-bit American Standard Code for Information Interchange, ANSI X3.4-1986.

Table of Contents

Enum xmlCharEncoding
 
Structure xmlCharEncodingHandler
struct _xmlCharEncodingHandler
Typedef xmlCharEncodingHandler * xmlCharEncodingHandlerPtr
 
int	UTF8Toisolat1			(unsigned char * out, 
int * outlen,
const unsigned char * in,
int * inlen)
diff --git a/doc/html/libxml-entities.html b/doc/html/libxml-entities.html index ac203f3..fe4ea86 100644 --- a/doc/html/libxml-entities.html +++ b/doc/html/libxml-entities.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } Module entities from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module entities from libxml2

API Menu
API Indexes
Related links

this module provides some of the entity API needed for the parser and applications.

Table of Contents

Structure xmlEntitiesTable
struct _xmlHashTable + Module entities from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module entities from libxml2

API Menu
API Indexes
Related links

this module provides some of the entity API needed for the parser and applications.

Table of Contents

Structure xmlEntitiesTable
struct _xmlHashTable The content of this structure is not made public by the API.
Typedef xmlEntitiesTable * xmlEntitiesTablePtr
 
Enum xmlEntityType
diff --git a/doc/html/libxml-globals.html b/doc/html/libxml-globals.html
index 1e7c1e9..fd9a06c 100644
--- a/doc/html/libxml-globals.html
+++ b/doc/html/libxml-globals.html
@@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline }
 Module globals from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module globals from libxml2

API Menu
API Indexes
Related links

all the global variables and thread handling for those variables is handled by this module. The bottom of this file is automatically generated by build_glob.py based on the description file global.data

Table of Contents

Structure xmlGlobalState
struct _xmlGlobalState + Module globals from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module globals from libxml2

API Menu
API Indexes
Related links

all the global variables and thread handling for those variables is handled by this module. The bottom of this file is automatically generated by build_glob.py based on the description file global.data

Table of Contents

Structure xmlGlobalState
struct _xmlGlobalState
Typedef xmlGlobalState * xmlGlobalStatePtr
 
void	xmlCleanupGlobals		(void)
xmlDeregisterNodeFunc	xmlDeregisterNodeDefault	(xmlDeregisterNodeFunc func)
diff --git a/doc/html/libxml-hash.html b/doc/html/libxml-hash.html index e2ffa53..ef5b903 100644 --- a/doc/html/libxml-hash.html +++ b/doc/html/libxml-hash.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } Module hash from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module hash from libxml2

API Menu
API Indexes
Related links

This module implements the hash table support used in various places in the library.

Table of Contents

#define XML_CAST_FPTR
Structure xmlHashTable
struct _xmlHashTable + Module hash from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module hash from libxml2

API Menu
API Indexes
Related links

This module implements the hash table support used in various places in the library.

Table of Contents

#define XML_CAST_FPTR
Structure xmlHashTable
struct _xmlHashTable The content of this structure is not made public by the API.
Typedef xmlHashTable * xmlHashTablePtr
 
int	xmlHashAddEntry			(xmlHashTablePtr table, 
const xmlChar * name,
void * userdata)
diff --git a/doc/html/libxml-lib.html b/doc/html/libxml-lib.html index 4a4962a..70263a1 100644 --- a/doc/html/libxml-lib.html +++ b/doc/html/libxml-lib.html @@ -10,4 +10,4 @@ A:link, A:visited, A:active { text-decoration: underline } 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

+ 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-list.html b/doc/html/libxml-list.html index b8254bb..41d94af 100644 --- a/doc/html/libxml-list.html +++ b/doc/html/libxml-list.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } Module list from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module list from libxml2

API Menu
API Indexes
Related links

this module implement the list support used in various place in the library.

Table of Contents

Structure xmlLink
struct _xmlLink + Module list from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module list from libxml2

API Menu
API Indexes
Related links

this module implement the list support used in various place in the library.

Table of Contents

Structure xmlLink
struct _xmlLink The content of this structure is not made public by the API.
Typedef xmlLink * xmlLinkPtr
 
Structure xmlList
struct _xmlList diff --git a/doc/html/libxml-nanoftp.html b/doc/html/libxml-nanoftp.html index 32aca49..bf10179 100644 --- a/doc/html/libxml-nanoftp.html +++ b/doc/html/libxml-nanoftp.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } Module nanoftp from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module nanoftp from libxml2

API Menu
API Indexes
Related links

minimal FTP implementation allowing to fetch resources like external subset.

Table of Contents

Function type: ftpDataCallback
+    Module nanoftp from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module nanoftp from libxml2

API Menu
API Indexes
Related links

minimal FTP implementation allowing to fetch resources like external subset.

Table of Contents

Function type: ftpDataCallback
 void	ftpDataCallback			(void * userData, 
const char * data,
int len)
Function type: ftpListCallback
diff --git a/doc/html/libxml-nanohttp.html b/doc/html/libxml-nanohttp.html
index b26e9d2..39510d3 100644
--- a/doc/html/libxml-nanohttp.html
+++ b/doc/html/libxml-nanohttp.html
@@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline }
 Module nanohttp from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module nanohttp from libxml2

API Menu
API Indexes
Related links

minimal HTTP implementation allowing to fetch resources like external subset.

Table of Contents

const char *	xmlNanoHTTPAuthHeader	(void * ctx)
+ Module nanohttp from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module nanohttp from libxml2

API Menu
API Indexes
Related links

minimal HTTP implementation allowing to fetch resources like external subset.

Table of Contents

const char *	xmlNanoHTTPAuthHeader	(void * ctx)
void	xmlNanoHTTPCleanup		(void)
void	xmlNanoHTTPClose		(void * ctx)
int	xmlNanoHTTPContentLength	(void * ctx)
diff --git a/doc/html/libxml-parser.html b/doc/html/libxml-parser.html index b0849cf..82c6f8e 100644 --- a/doc/html/libxml-parser.html +++ b/doc/html/libxml-parser.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } Module parser from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module parser from libxml2

API Menu
API Indexes
Related links

Interfaces, constants and types related to the XML parser

Table of Contents

#define XML_COMPLETE_ATTRS
#define XML_DEFAULT_VERSION
#define XML_DETECT_IDS
#define XML_SAX2_MAGIC
#define XML_SKIP_IDS
Enum xmlFeature
+    Module parser from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module parser from libxml2

API Menu
API Indexes
Related links

Interfaces, constants and types related to the XML parser

Table of Contents

#define XML_COMPLETE_ATTRS
#define XML_DEFAULT_VERSION
#define XML_DETECT_IDS
#define XML_SAX2_MAGIC
#define XML_SKIP_IDS
Enum xmlFeature
 
Enum xmlParserInputState
 
Enum xmlParserMode
 
Structure xmlParserNodeInfo
struct _xmlParserNodeInfo @@ -405,7 +405,7 @@ void warningSAXFunc (void * ctx,
const char * msg,
...

Function: xmlByteConsumed

long	xmlByteConsumed			(xmlParserCtxtPtr ctxt)

This function provides the current index of the parser relative to the start of the current entity. This function is computed in bytes from the beginning starting at zero and finishing at the size in byte of the file if parsing a file. The function is of constant cost if the input is UTF-8 but can be costly if run on non-UTF-8 input.

ctxt:an XML parser context
Returns:the index in bytes from the beginning of the entity or -1 in case the index could not be computed.

Function: xmlCleanupParser

void	xmlCleanupParser		(void)
-

Cleanup function for the XML library. It tries to reclaim all parsing related global memory allocated for the library processing. It doesn't deallocate any document related memory. Calling this function should not prevent reusing the library but one should call xmlCleanupParser() only when the process has finished using the library or XML document built with it.

+

This function name is somewhat misleading. It does not clean up parser state, it cleans up memory allocated by the library itself. It is a cleanup function for the XML library. It tries to reclaim all related global memory allocated for the library processing. It doesn't deallocate any document related memory. One should call xmlCleanupParser() only when the process has finished using the library and all XML/HTML documents built with it. See also xmlInitParser() which has the opposite function of preparing the library for operations.

Function: xmlClearNodeInfoSeq

void	xmlClearNodeInfoSeq		(xmlParserNodeInfoSeqPtr seq)

-- Clear (release memory and reinitialize) node info sequence

seq:a node info sequence pointer

Function: xmlClearParserCtxt

void	xmlClearParserCtxt		(xmlParserCtxtPtr ctxt)
@@ -467,7 +467,7 @@ void warningSAXFunc (void * ctx,
const char * msg,
...

Parse a well-balanced chunk of an XML document called by the parser The allowed sequence for the Well Balanced Chunk is the one defined by the content production in the XML grammar: [43] content ::= (element | CharData | Reference | CDSect | PI | Comment)*

doc:the document the chunk pertains to
sax:the SAX handler bloc (possibly NULL)
user_data:The user data returned on SAX callbacks (possibly NULL)
depth:Used for loop detection, use 0
string:the input string in UTF8 or ISO-Latin (zero terminated)
lst:the return value for the set of parsed nodes
Returns:0 if the chunk is well balanced, -1 in case of args problem and the parser error code otherwise

Function: xmlParseBalancedChunkMemoryRecover

int	xmlParseBalancedChunkMemoryRecover	(xmlDocPtr doc, 
xmlSAXHandlerPtr sax,
void * user_data,
int depth,
const xmlChar * string,
xmlNodePtr * lst,
int recover)

Parse a well-balanced chunk of an XML document called by the parser The allowed sequence for the Well Balanced Chunk is the one defined by the content production in the XML grammar: [43] content ::= (element | CharData | Reference | CDSect | PI | Comment)*

-
doc:the document the chunk pertains to
sax:the SAX handler bloc (possibly NULL)
user_data:The user data returned on SAX callbacks (possibly NULL)
depth:Used for loop detection, use 0
string:the input string in UTF8 or ISO-Latin (zero terminated)
lst:the return value for the set of parsed nodes
recover:return nodes even if the data is broken (use 0)
Returns:0 if the chunk is well balanced, -1 in case of args problem 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.

Function: xmlParseChunk

int	xmlParseChunk			(xmlParserCtxtPtr ctxt, 
const char * chunk,
int size,
int terminate)
+
doc:the document the chunk pertains to
sax:the SAX handler bloc (possibly NULL)
user_data:The user data returned on SAX callbacks (possibly NULL)
depth:Used for loop detection, use 0
string:the input string in UTF8 or ISO-Latin (zero terminated)
lst:the return value for the set of parsed nodes
recover:return nodes even if the data is broken (use 0)
Returns:0 if the chunk is well balanced, -1 in case of args problem 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, assuming the parsing succeeded to some extent.

Function: xmlParseChunk

int	xmlParseChunk			(xmlParserCtxtPtr ctxt, 
const char * chunk,
int size,
int terminate)

Parse a Chunk of memory

ctxt:an XML parser context
chunk:an char array
size:the size in byte of the chunk
terminate:last chunk indicator
Returns:zero if no error, the xmlParserErrors otherwise.

Function: xmlParseCtxtExternalEntity

int	xmlParseCtxtExternalEntity	(xmlParserCtxtPtr ctx, 
const xmlChar * URL,
const xmlChar * ID,
xmlNodePtr * lst)

Parse an external general entity within an existing parsing context An external general parsed entity is well-formed if it matches the production labeled extParsedEnt. [78] extParsedEnt ::= TextDecl? content

@@ -515,12 +515,12 @@ void xmlParserInputDeallocate (xmlChar
ioread:an I/O read function
ioclose:an I/O close function
ioctx:an I/O handler
URL:the base URL to use for the document
encoding:the document encoding, or NULL
options:a combination of xmlParserOption
Returns:the resulting document tree

Function: xmlReadMemory

xmlDocPtr	xmlReadMemory		(const char * buffer, 
int size,
const char * URL,
const char * encoding,
int options)

parse an XML in-memory document and build a tree.

buffer:a pointer to a char array
size:the size of the array
URL:the base URL to use for the document
encoding:the document encoding, or NULL
options:a combination of xmlParserOption
Returns:the resulting document tree

Function: xmlRecoverDoc

xmlDocPtr	xmlRecoverDoc		(xmlChar * cur)
-

parse an XML in-memory document and build a tree. In the case the document is not Well Formed, a tree is built anyway

-
cur:a pointer to an array of xmlChar
Returns:the resulting document tree

Function: xmlRecoverFile

xmlDocPtr	xmlRecoverFile		(const char * filename)
-

parse an XML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time. In the case the document is not Well Formed, a tree is built anyway

-
filename:the filename
Returns:the resulting document tree

Function: xmlRecoverMemory

xmlDocPtr	xmlRecoverMemory	(const char * buffer, 
int size)
-

parse an XML in-memory block and build a tree. In the case the document is not Well Formed, a tree is built anyway

-
buffer:an pointer to a char array
size:the size of the array
Returns:the resulting document tree

Function: xmlSAXParseDTD

xmlDtdPtr	xmlSAXParseDTD		(xmlSAXHandlerPtr sax, 
const xmlChar * ExternalID,
const xmlChar * SystemID)
+

parse an XML in-memory document and build a tree. In the case the document is not Well Formed, a attempt to build a tree is tried anyway

+
cur:a pointer to an array of xmlChar
Returns:the resulting document tree or NULL in case of failure

Function: xmlRecoverFile

xmlDocPtr	xmlRecoverFile		(const char * filename)
+

parse an XML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time. In the case the document is not Well Formed, it attempts to build a tree anyway

+
filename:the filename
Returns:the resulting document tree or NULL in case of failure

Function: xmlRecoverMemory

xmlDocPtr	xmlRecoverMemory	(const char * buffer, 
int size)
+

parse an XML in-memory block and build a tree. In the case the document is not Well Formed, an attempt to build a tree is tried anyway

+
buffer:an pointer to a char array
size:the size of the array
Returns:the resulting document tree or NULL in case of error

Function: xmlSAXParseDTD

xmlDtdPtr	xmlSAXParseDTD		(xmlSAXHandlerPtr sax, 
const xmlChar * ExternalID,
const xmlChar * SystemID)

Load and parse an external subset.

sax:the SAX handler block
ExternalID:a NAME* containing the External ID of the DTD
SystemID:a NAME* containing the URL to the DTD
Returns:the resulting xmlDtdPtr or NULL in case of error.

Function: xmlSAXParseDoc

xmlDocPtr	xmlSAXParseDoc		(xmlSAXHandlerPtr sax, 
const xmlChar * cur,
int recovery)

parse an XML in-memory document and build a tree. It use the given SAX function block to handle the parsing callback. If sax is NULL, fallback to the default DOM tree building routines.

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

Module parserInternals from libxml2

API Menu
API Indexes
Related links

this module exports a number of internal parsing routines they are not really all intended for applications but can prove useful doing low level processing.

Table of Contents

#define INPUT_CHUNK
#define IS_ASCII_DIGIT
#define IS_ASCII_LETTER
#define IS_BASECHAR
#define IS_BLANK
#define IS_BLANK_CH
#define IS_BYTE_CHAR
#define IS_CHAR
#define IS_CHAR_CH
#define IS_COMBINING
#define IS_COMBINING_CH
#define IS_DIGIT
#define IS_DIGIT_CH
#define IS_EXTENDER
#define IS_EXTENDER_CH
#define IS_IDEOGRAPHIC
#define IS_LETTER
#define IS_LETTER_CH
#define IS_PUBIDCHAR
#define IS_PUBIDCHAR_CH
#define MOVETO_ENDTAG
#define MOVETO_STARTTAG
#define SKIP_EOL
#define XML_MAX_NAMELEN
#define XML_SUBSTITUTE_BOTH
#define XML_SUBSTITUTE_NONE
#define XML_SUBSTITUTE_PEREF
#define XML_SUBSTITUTE_REF
htmlParserCtxtPtr	htmlCreateFileParserCtxt	(const char * filename, 
const char * encoding)
+ Module parserInternals from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module parserInternals from libxml2

API Menu
API Indexes
Related links

this module exports a number of internal parsing routines they are not really all intended for applications but can prove useful doing low level processing.

Table of Contents

#define INPUT_CHUNK
#define IS_ASCII_DIGIT
#define IS_ASCII_LETTER
#define IS_BASECHAR
#define IS_BLANK
#define IS_BLANK_CH
#define IS_BYTE_CHAR
#define IS_CHAR
#define IS_CHAR_CH
#define IS_COMBINING
#define IS_COMBINING_CH
#define IS_DIGIT
#define IS_DIGIT_CH
#define IS_EXTENDER
#define IS_EXTENDER_CH
#define IS_IDEOGRAPHIC
#define IS_LETTER
#define IS_LETTER_CH
#define IS_PUBIDCHAR
#define IS_PUBIDCHAR_CH
#define MOVETO_ENDTAG
#define MOVETO_STARTTAG
#define SKIP_EOL
#define XML_MAX_NAMELEN
#define XML_SUBSTITUTE_BOTH
#define XML_SUBSTITUTE_NONE
#define XML_SUBSTITUTE_PEREF
#define XML_SUBSTITUTE_REF
htmlParserCtxtPtr	htmlCreateFileParserCtxt	(const char * filename, 
const char * encoding)
void	htmlInitAutoClose		(void)
xmlParserInputPtr	inputPop	(xmlParserCtxtPtr ctxt)
int	inputPush			(xmlParserCtxtPtr ctxt, 
xmlParserInputPtr value)
diff --git a/doc/html/libxml-pattern.html b/doc/html/libxml-pattern.html index fe72902..2edeafd 100644 --- a/doc/html/libxml-pattern.html +++ b/doc/html/libxml-pattern.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } Module pattern from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module pattern from libxml2

API Menu
API Indexes
Related links

allows to compile and test pattern expressions for nodes either in a tree or based on a parser state.

Table of Contents

Structure xmlPattern
struct _xmlPattern + Module pattern from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module pattern from libxml2

API Menu
API Indexes
Related links

allows to compile and test pattern expressions for nodes either in a tree or based on a parser state.

Table of Contents

Structure xmlPattern
struct _xmlPattern The content of this structure is not made public by the API.
Enum xmlPatternFlags
 
Typedef xmlPattern * xmlPatternPtr
diff --git a/doc/html/libxml-relaxng.html b/doc/html/libxml-relaxng.html
index 6a64233..650d058 100644
--- a/doc/html/libxml-relaxng.html
+++ b/doc/html/libxml-relaxng.html
@@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline }
 Module relaxng from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module relaxng from libxml2

API Menu
API Indexes
Related links

implementation of the Relax-NG validation

Table of Contents

Structure xmlRelaxNG
struct _xmlRelaxNG + Module relaxng from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module relaxng from libxml2

API Menu
API Indexes
Related links

implementation of the Relax-NG validation

Table of Contents

Structure xmlRelaxNG
struct _xmlRelaxNG The content of this structure is not made public by the API.
Structure xmlRelaxNGParserCtxt
struct _xmlRelaxNGParserCtxt The content of this structure is not made public by the API. diff --git a/doc/html/libxml-schemasInternals.html b/doc/html/libxml-schemasInternals.html index 96d4150..2ebd4a3 100644 --- a/doc/html/libxml-schemasInternals.html +++ b/doc/html/libxml-schemasInternals.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } Module schemasInternals from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module schemasInternals from libxml2

API Menu
API Indexes
Related links

internal interfaces for the XML Schemas handling and schema validity checking The Schemas development is a Work In Progress. Some of those interfaces are not garanteed to be API or ABI stable !

Table of Contents

#define XML_SCHEMAS_ANYATTR_LAX
#define XML_SCHEMAS_ANYATTR_SKIP
#define XML_SCHEMAS_ANYATTR_STRICT
#define XML_SCHEMAS_ANY_LAX
#define XML_SCHEMAS_ANY_SKIP
#define XML_SCHEMAS_ANY_STRICT
#define XML_SCHEMAS_ATTRGROUP_GLOBAL
#define XML_SCHEMAS_ATTRGROUP_HAS_REFS
#define XML_SCHEMAS_ATTRGROUP_MARKED
#define XML_SCHEMAS_ATTRGROUP_REDEFINED
#define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED
#define XML_SCHEMAS_ATTR_FIXED
#define XML_SCHEMAS_ATTR_GLOBAL
#define XML_SCHEMAS_ATTR_INTERNAL_RESOLVED
#define XML_SCHEMAS_ATTR_NSDEFAULT
#define XML_SCHEMAS_ATTR_USE_OPTIONAL
#define XML_SCHEMAS_ATTR_USE_PROHIBITED
#define XML_SCHEMAS_ATTR_USE_REQUIRED
#define XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION
#define XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION
#define XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION
#define XML_SCHEMAS_ELEM_ABSTRACT
#define XML_SCHEMAS_ELEM_BLOCK_ABSENT
#define XML_SCHEMAS_ELEM_BLOCK_EXTENSION
#define XML_SCHEMAS_ELEM_BLOCK_RESTRICTION
#define XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION
#define XML_SCHEMAS_ELEM_CIRCULAR
#define XML_SCHEMAS_ELEM_DEFAULT
#define XML_SCHEMAS_ELEM_FINAL_ABSENT
#define XML_SCHEMAS_ELEM_FINAL_EXTENSION
#define XML_SCHEMAS_ELEM_FINAL_RESTRICTION
#define XML_SCHEMAS_ELEM_FIXED
#define XML_SCHEMAS_ELEM_GLOBAL
#define XML_SCHEMAS_ELEM_INTERNAL_CHECKED
#define XML_SCHEMAS_ELEM_INTERNAL_RESOLVED
#define XML_SCHEMAS_ELEM_NILLABLE
#define XML_SCHEMAS_ELEM_NSDEFAULT
#define XML_SCHEMAS_ELEM_REF
#define XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD
#define XML_SCHEMAS_ELEM_TOPLEVEL
#define XML_SCHEMAS_FACET_COLLAPSE
#define XML_SCHEMAS_FACET_PRESERVE
#define XML_SCHEMAS_FACET_REPLACE
#define XML_SCHEMAS_FACET_UNKNOWN
#define XML_SCHEMAS_FINAL_DEFAULT_EXTENSION
#define XML_SCHEMAS_FINAL_DEFAULT_LIST
#define XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION
#define XML_SCHEMAS_FINAL_DEFAULT_UNION
#define XML_SCHEMAS_INCLUDING_CONVERT_NS
#define XML_SCHEMAS_QUALIF_ATTR
#define XML_SCHEMAS_QUALIF_ELEM
#define XML_SCHEMAS_TYPE_ABSTRACT
#define XML_SCHEMAS_TYPE_BLOCK_DEFAULT
#define XML_SCHEMAS_TYPE_BLOCK_EXTENSION
#define XML_SCHEMAS_TYPE_BLOCK_RESTRICTION
#define XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE
#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION
#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION
#define XML_SCHEMAS_TYPE_FACETSNEEDVALUE
#define XML_SCHEMAS_TYPE_FINAL_DEFAULT
#define XML_SCHEMAS_TYPE_FINAL_EXTENSION
#define XML_SCHEMAS_TYPE_FINAL_LIST
#define XML_SCHEMAS_TYPE_FINAL_RESTRICTION
#define XML_SCHEMAS_TYPE_FINAL_UNION
#define XML_SCHEMAS_TYPE_FIXUP_1
#define XML_SCHEMAS_TYPE_GLOBAL
#define XML_SCHEMAS_TYPE_HAS_FACETS
#define XML_SCHEMAS_TYPE_INTERNAL_INVALID
#define XML_SCHEMAS_TYPE_INTERNAL_RESOLVED
#define XML_SCHEMAS_TYPE_MARKED
#define XML_SCHEMAS_TYPE_MIXED
#define XML_SCHEMAS_TYPE_NORMVALUENEEDED
#define XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD
#define XML_SCHEMAS_TYPE_REDEFINED
#define XML_SCHEMAS_TYPE_VARIETY_ABSENT
#define XML_SCHEMAS_TYPE_VARIETY_ATOMIC
#define XML_SCHEMAS_TYPE_VARIETY_LIST
#define XML_SCHEMAS_TYPE_VARIETY_UNION
#define XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE
#define XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE
#define XML_SCHEMAS_TYPE_WHITESPACE_REPLACE
#define XML_SCHEMAS_WILDCARD_COMPLETE
Structure xmlSchemaAnnot
struct _xmlSchemaAnnot + Module schemasInternals from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module schemasInternals from libxml2

API Menu
API Indexes
Related links

internal interfaces for the XML Schemas handling and schema validity checking The Schemas development is a Work In Progress. Some of those interfaces are not garanteed to be API or ABI stable !

Table of Contents

#define XML_SCHEMAS_ANYATTR_LAX
#define XML_SCHEMAS_ANYATTR_SKIP
#define XML_SCHEMAS_ANYATTR_STRICT
#define XML_SCHEMAS_ANY_LAX
#define XML_SCHEMAS_ANY_SKIP
#define XML_SCHEMAS_ANY_STRICT
#define XML_SCHEMAS_ATTRGROUP_GLOBAL
#define XML_SCHEMAS_ATTRGROUP_HAS_REFS
#define XML_SCHEMAS_ATTRGROUP_MARKED
#define XML_SCHEMAS_ATTRGROUP_REDEFINED
#define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED
#define XML_SCHEMAS_ATTR_FIXED
#define XML_SCHEMAS_ATTR_GLOBAL
#define XML_SCHEMAS_ATTR_INTERNAL_RESOLVED
#define XML_SCHEMAS_ATTR_NSDEFAULT
#define XML_SCHEMAS_ATTR_USE_OPTIONAL
#define XML_SCHEMAS_ATTR_USE_PROHIBITED
#define XML_SCHEMAS_ATTR_USE_REQUIRED
#define XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION
#define XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION
#define XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION
#define XML_SCHEMAS_ELEM_ABSTRACT
#define XML_SCHEMAS_ELEM_BLOCK_ABSENT
#define XML_SCHEMAS_ELEM_BLOCK_EXTENSION
#define XML_SCHEMAS_ELEM_BLOCK_RESTRICTION
#define XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION
#define XML_SCHEMAS_ELEM_CIRCULAR
#define XML_SCHEMAS_ELEM_DEFAULT
#define XML_SCHEMAS_ELEM_FINAL_ABSENT
#define XML_SCHEMAS_ELEM_FINAL_EXTENSION
#define XML_SCHEMAS_ELEM_FINAL_RESTRICTION
#define XML_SCHEMAS_ELEM_FIXED
#define XML_SCHEMAS_ELEM_GLOBAL
#define XML_SCHEMAS_ELEM_INTERNAL_CHECKED
#define XML_SCHEMAS_ELEM_INTERNAL_RESOLVED
#define XML_SCHEMAS_ELEM_NILLABLE
#define XML_SCHEMAS_ELEM_NSDEFAULT
#define XML_SCHEMAS_ELEM_REF
#define XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD
#define XML_SCHEMAS_ELEM_TOPLEVEL
#define XML_SCHEMAS_FACET_COLLAPSE
#define XML_SCHEMAS_FACET_PRESERVE
#define XML_SCHEMAS_FACET_REPLACE
#define XML_SCHEMAS_FACET_UNKNOWN
#define XML_SCHEMAS_FINAL_DEFAULT_EXTENSION
#define XML_SCHEMAS_FINAL_DEFAULT_LIST
#define XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION
#define XML_SCHEMAS_FINAL_DEFAULT_UNION
#define XML_SCHEMAS_INCLUDING_CONVERT_NS
#define XML_SCHEMAS_QUALIF_ATTR
#define XML_SCHEMAS_QUALIF_ELEM
#define XML_SCHEMAS_TYPE_ABSTRACT
#define XML_SCHEMAS_TYPE_BLOCK_DEFAULT
#define XML_SCHEMAS_TYPE_BLOCK_EXTENSION
#define XML_SCHEMAS_TYPE_BLOCK_RESTRICTION
#define XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE
#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION
#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION
#define XML_SCHEMAS_TYPE_FACETSNEEDVALUE
#define XML_SCHEMAS_TYPE_FINAL_DEFAULT
#define XML_SCHEMAS_TYPE_FINAL_EXTENSION
#define XML_SCHEMAS_TYPE_FINAL_LIST
#define XML_SCHEMAS_TYPE_FINAL_RESTRICTION
#define XML_SCHEMAS_TYPE_FINAL_UNION
#define XML_SCHEMAS_TYPE_FIXUP_1
#define XML_SCHEMAS_TYPE_GLOBAL
#define XML_SCHEMAS_TYPE_HAS_FACETS
#define XML_SCHEMAS_TYPE_INTERNAL_INVALID
#define XML_SCHEMAS_TYPE_INTERNAL_RESOLVED
#define XML_SCHEMAS_TYPE_MARKED
#define XML_SCHEMAS_TYPE_MIXED
#define XML_SCHEMAS_TYPE_NORMVALUENEEDED
#define XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD
#define XML_SCHEMAS_TYPE_REDEFINED
#define XML_SCHEMAS_TYPE_VARIETY_ABSENT
#define XML_SCHEMAS_TYPE_VARIETY_ATOMIC
#define XML_SCHEMAS_TYPE_VARIETY_LIST
#define XML_SCHEMAS_TYPE_VARIETY_UNION
#define XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE
#define XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE
#define XML_SCHEMAS_TYPE_WHITESPACE_REPLACE
#define XML_SCHEMAS_WILDCARD_COMPLETE
Structure xmlSchemaAnnot
struct _xmlSchemaAnnot
Typedef xmlSchemaAnnot * xmlSchemaAnnotPtr
 
Structure xmlSchemaAttribute
struct _xmlSchemaAttribute
Structure xmlSchemaAttributeGroup
struct _xmlSchemaAttributeGroup diff --git a/doc/html/libxml-schematron.html b/doc/html/libxml-schematron.html index 6797672..5ec67e5 100644 --- a/doc/html/libxml-schematron.html +++ b/doc/html/libxml-schematron.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } Module schematron from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module schematron from libxml2

API Menu
API Indexes
Related links

interface to the XML Schematron validity checking.

Table of Contents

Structure xmlSchematron
struct _xmlSchematron + Module schematron from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module schematron from libxml2

API Menu
API Indexes
Related links

interface to the XML Schematron validity checking.

Table of Contents

Structure xmlSchematron
struct _xmlSchematron The content of this structure is not made public by the API.
Structure xmlSchematronParserCtxt
struct _xmlSchematronParserCtxt The content of this structure is not made public by the API. @@ -28,6 +28,7 @@ The content of this structure is not made public by the API.
xmlSchematronParserCtxtPtr	xmlSchematronNewParserCtxt	(const char * URL)
xmlSchematronValidCtxtPtr	xmlSchematronNewValidCtxt	(xmlSchematronPtr schema, 
int options)
xmlSchematronPtr	xmlSchematronParse	(xmlSchematronParserCtxtPtr ctxt)
+
void	xmlSchematronSetValidStructuredErrors	(xmlSchematronValidCtxtPtr ctxt, 
xmlStructuredErrorFunc serror,
void * ctx)
int	xmlSchematronValidateDoc	(xmlSchematronValidCtxtPtr ctxt, 
xmlDocPtr instance)
Function type: xmlSchematronValidityErrorFunc
 void	xmlSchematronValidityErrorFunc	(void * ctx, 
const char * msg,
... ...) @@ -46,6 +47,7 @@ The content of this structure is not made public by the API. XML_SCHEMATRON_OUT_QUIET = 1 : quiet no report XML_SCHEMATRON_OUT_TEXT = 2 : build a textual report XML_SCHEMATRON_OUT_XML = 4 : output SVRL + XML_SCHEMATRON_OUT_ERROR = 8 : output via xmlStructuredErrorFunc XML_SCHEMATRON_OUT_FILE = 256 : output to a file descriptor XML_SCHEMATRON_OUT_BUFFER = 512 : output to a buffer XML_SCHEMATRON_OUT_IO = 1024 : output to I/O mechanism @@ -66,7 +68,9 @@ The content of this structure is not made public by the API.

Create an XML Schematrons validation context based on the given schema.

schema:a precompiled XML Schematrons
options:a set of xmlSchematronValidOptions
Returns:the validation context or NULL in case of error

Function: xmlSchematronParse

xmlSchematronPtr	xmlSchematronParse	(xmlSchematronParserCtxtPtr 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 Schematron structure built from the resource or NULL in case of error

Function: xmlSchematronValidateDoc

int	xmlSchematronValidateDoc	(xmlSchematronValidCtxtPtr ctxt, 
xmlDocPtr instance)
+
ctxt:a schema validation context
Returns:the internal XML Schematron structure built from the resource or NULL in case of error

Function: xmlSchematronSetValidStructuredErrors

void	xmlSchematronSetValidStructuredErrors	(xmlSchematronValidCtxtPtr ctxt, 
xmlStructuredErrorFunc serror,
void * ctx)
+

Set the structured error callback

+
ctxt:a Schematron validation context
serror:the structured error function
ctx:the functions context

Function: xmlSchematronValidateDoc

int	xmlSchematronValidateDoc	(xmlSchematronValidCtxtPtr ctxt, 
xmlDocPtr instance)

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,
... ...) diff --git a/doc/html/libxml-threads.html b/doc/html/libxml-threads.html index 8bb2cbf..b31cfd4 100644 --- a/doc/html/libxml-threads.html +++ b/doc/html/libxml-threads.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } Module threads from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module threads from libxml2

API Menu
API Indexes
Related links

set of generic threading related routines should work with pthreads, Windows native or TLS threads

Table of Contents

Structure xmlMutex
struct _xmlMutex + Module threads from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module threads from libxml2

API Menu
API Indexes
Related links

set of generic threading related routines should work with pthreads, Windows native or TLS threads

Table of Contents

Structure xmlMutex
struct _xmlMutex The content of this structure is not made public by the API.
Typedef xmlMutex * xmlMutexPtr
 
Structure xmlRMutex
struct _xmlRMutex diff --git a/doc/html/libxml-tree.html b/doc/html/libxml-tree.html index 7a5c31b..34914cb 100644 --- a/doc/html/libxml-tree.html +++ b/doc/html/libxml-tree.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } Module tree from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module tree from libxml2

API Menu
API Indexes
Related links

this module describes the structures found in an tree resulting from an XML or HTML parsing, as well as the API provided for various processing on that tree

Table of Contents

#define BASE_BUFFER_SIZE
#define XML_GET_CONTENT
#define XML_GET_LINE
#define XML_LOCAL_NAMESPACE
#define XML_XML_ID
#define XML_XML_NAMESPACE
#define xmlChildrenNode
#define xmlRootNode
Structure xmlAttr
struct _xmlAttr + Module tree from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module tree from libxml2

API Menu
API Indexes
Related links

this module describes the structures found in an tree resulting from an XML or HTML parsing, as well as the API provided for various processing on that tree

Table of Contents

#define BASE_BUFFER_SIZE
#define XML_GET_CONTENT
#define XML_GET_LINE
#define XML_LOCAL_NAMESPACE
#define XML_XML_ID
#define XML_XML_NAMESPACE
#define xmlChildrenNode
#define xmlRootNode
Structure xmlAttr
struct _xmlAttr
Typedef xmlAttr * xmlAttrPtr
 
Structure xmlAttribute
struct _xmlAttribute
Enum xmlAttributeDefault
diff --git a/doc/html/libxml-uri.html b/doc/html/libxml-uri.html
index 1c668e8..9b8cdb6 100644
--- a/doc/html/libxml-uri.html
+++ b/doc/html/libxml-uri.html
@@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline }
 Module uri from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module uri from libxml2

API Menu
API Indexes
Related links

library of generic URI related routines Implements RFC 2396

Table of Contents

Structure xmlURI
struct _xmlURI + Module uri from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module uri from libxml2

API Menu
API Indexes
Related links

library of generic URI related routines Implements RFC 2396

Table of Contents

Structure xmlURI
struct _xmlURI
Typedef xmlURI * xmlURIPtr
 
xmlChar *	xmlBuildRelativeURI	(const xmlChar * URI, 
const xmlChar * base)
xmlChar *	xmlBuildURI		(const xmlChar * URI, 
const xmlChar * base)
diff --git a/doc/html/libxml-valid.html b/doc/html/libxml-valid.html index e8abbaa..30ef3cd 100644 --- a/doc/html/libxml-valid.html +++ b/doc/html/libxml-valid.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } Module valid from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module valid from libxml2

API Menu
API Indexes
Related links

API for the DTD handling and the validity checking

Table of Contents

#define XML_CTXT_FINISH_DTD_0
#define XML_CTXT_FINISH_DTD_1
Structure xmlAttributeTable
struct _xmlHashTable + Module valid from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module valid from libxml2

API Menu
API Indexes
Related links

API for the DTD handling and the validity checking

Table of Contents

#define XML_CTXT_FINISH_DTD_0
#define XML_CTXT_FINISH_DTD_1
Structure xmlAttributeTable
struct _xmlHashTable The content of this structure is not made public by the API.
Typedef xmlAttributeTable * xmlAttributeTablePtr
 
Structure xmlElementTable
struct _xmlHashTable diff --git a/doc/html/libxml-xinclude.html b/doc/html/libxml-xinclude.html index 58c1c19..6ccb123 100644 --- a/doc/html/libxml-xinclude.html +++ b/doc/html/libxml-xinclude.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } Module xinclude from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xinclude from libxml2

API Menu
API Indexes
Related links

API to handle XInclude processing, implements the World Wide Web Consortium Last Call Working Draft 10 November 2003

Table of Contents

#define XINCLUDE_FALLBACK
#define XINCLUDE_HREF
#define XINCLUDE_NODE
#define XINCLUDE_NS
#define XINCLUDE_OLD_NS
#define XINCLUDE_PARSE
#define XINCLUDE_PARSE_ENCODING
#define XINCLUDE_PARSE_TEXT
#define XINCLUDE_PARSE_XML
#define XINCLUDE_PARSE_XPOINTER
Structure xmlXIncludeCtxt
struct _xmlXIncludeCtxt + Module xinclude from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xinclude from libxml2

API Menu
API Indexes
Related links

API to handle XInclude processing, implements the World Wide Web Consortium Last Call Working Draft 10 November 2003

Table of Contents

#define XINCLUDE_FALLBACK
#define XINCLUDE_HREF
#define XINCLUDE_NODE
#define XINCLUDE_NS
#define XINCLUDE_OLD_NS
#define XINCLUDE_PARSE
#define XINCLUDE_PARSE_ENCODING
#define XINCLUDE_PARSE_TEXT
#define XINCLUDE_PARSE_XML
#define XINCLUDE_PARSE_XPOINTER
Structure xmlXIncludeCtxt
struct _xmlXIncludeCtxt The content of this structure is not made public by the API.
Typedef xmlXIncludeCtxt * xmlXIncludeCtxtPtr
 
void	xmlXIncludeFreeContext		(xmlXIncludeCtxtPtr ctxt)
diff --git a/doc/html/libxml-xlink.html b/doc/html/libxml-xlink.html index 0350911..4c1c7ba 100644 --- a/doc/html/libxml-xlink.html +++ b/doc/html/libxml-xlink.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } Module xlink from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xlink from libxml2

API Menu
API Indexes
Related links

unfinished XLink detection module

Table of Contents

Enum xlinkActuate
+    Module xlink from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xlink from libxml2

API Menu
API Indexes
Related links

unfinished XLink detection module

Table of Contents

Enum xlinkActuate
 
Typedef xmlChar * xlinkHRef
 
Structure xlinkHandler
struct _xlinkHandler
Typedef xlinkHandler * xlinkHandlerPtr
diff --git a/doc/html/libxml-xmlIO.html b/doc/html/libxml-xmlIO.html
index 5c0b9b0..0ca4bc9 100644
--- a/doc/html/libxml-xmlIO.html
+++ b/doc/html/libxml-xmlIO.html
@@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline }
 Module xmlIO from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xmlIO from libxml2

API Menu
API Indexes
Related links

interface for the I/O interfaces used by the parser

Table of Contents

xmlOutputBufferPtr	xmlAllocOutputBuffer	(xmlCharEncodingHandlerPtr encoder)
+ Module xmlIO from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xmlIO from libxml2

API Menu
API Indexes
Related links

interface for the I/O interfaces used by the parser

Table of Contents

xmlOutputBufferPtr	xmlAllocOutputBuffer	(xmlCharEncodingHandlerPtr encoder)
xmlParserInputBufferPtr	xmlAllocParserInputBuffer	(xmlCharEncoding enc)
int	xmlCheckFilename		(const char * path)
xmlParserInputPtr	xmlCheckHTTPInput	(xmlParserCtxtPtr ctxt, 
xmlParserInputPtr ret)
diff --git a/doc/html/libxml-xmlautomata.html b/doc/html/libxml-xmlautomata.html index d10c787..1361214 100644 --- a/doc/html/libxml-xmlautomata.html +++ b/doc/html/libxml-xmlautomata.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } Module xmlautomata from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xmlautomata from libxml2

API Menu
API Indexes
Related links

the API to build regexp automata

Table of Contents

Structure xmlAutomata
struct _xmlAutomata + Module xmlautomata from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xmlautomata from libxml2

API Menu
API Indexes
Related links

the API to build regexp automata

Table of Contents

Structure xmlAutomata
struct _xmlAutomata The content of this structure is not made public by the API.
Typedef xmlAutomata * xmlAutomataPtr
 
Structure xmlAutomataState
struct _xmlAutomataState diff --git a/doc/html/libxml-xmlerror.html b/doc/html/libxml-xmlerror.html index aefa967..9803b4a 100644 --- a/doc/html/libxml-xmlerror.html +++ b/doc/html/libxml-xmlerror.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } Module xmlerror from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xmlerror from libxml2

API Menu
API Indexes
Related links

the API used to report errors

Table of Contents

Structure xmlError
struct _xmlError + Module xmlerror from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xmlerror from libxml2

API Menu
API Indexes
Related links

the API used to report errors

Table of Contents

Structure xmlError
struct _xmlError
Enum xmlErrorDomain
 
Enum xmlErrorLevel
 
Typedef xmlError * xmlErrorPtr
@@ -80,6 +80,7 @@ void	xmlStructuredErrorFunc		(void * userD
     XML_FROM_WRITER = 25 : The xmlwriter module
     XML_FROM_MODULE = 26 : The dynamically loaded module modul
     XML_FROM_I18N = 27 : The module handling character conversion
+    XML_FROM_SCHEMATRONV = 28 : The Schematron validator module
 }
 

Enum xmlErrorLevel

Enum xmlErrorLevel {
     XML_ERR_NONE = 0
@@ -392,6 +393,7 @@ void	xmlStructuredErrorFunc		(void * userD
     XML_TREE_INVALID_HEX = 1300
     XML_TREE_INVALID_DEC = 1301 : 1301
     XML_TREE_UNTERMINATED_ENTITY = 1302 : 1302
+    XML_TREE_NOT_UTF8 = 1303 : 1303
     XML_SAVE_NOT_UTF8 = 1400
     XML_SAVE_CHAR_INVALID = 1401 : 1401
     XML_SAVE_NO_DOCTYPE = 1402 : 1402
@@ -767,6 +769,8 @@ void	xmlStructuredErrorFunc		(void * userD
     XML_SCHEMAP_AU_PROPS_CORRECT = 3089 : 3088
     XML_SCHEMAP_A_PROPS_CORRECT_3 = 3090 : 3089
     XML_SCHEMAP_COS_ALL_LIMITED = 3091 : 3090
+    XML_SCHEMATRONV_ASSERT = 4000 : 4000
+    XML_SCHEMATRONV_REPORT = 4001
     XML_MODULE_OPEN = 4900 : 4900
     XML_MODULE_CLOSE = 4901 : 4901
     XML_CHECK_FOUND_ELEMENT = 5000
diff --git a/doc/html/libxml-xmlexports.html b/doc/html/libxml-xmlexports.html
index 1ce2de8..38a05a3 100644
--- a/doc/html/libxml-xmlexports.html
+++ b/doc/html/libxml-xmlexports.html
@@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline }
 Module xmlexports from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xmlexports from libxml2

API Menu
API Indexes
Related links

macros for marking symbols as exportable/importable.

Table of Contents

#define LIBXML_DLL_IMPORT
#define XMLCALL
#define XMLCDECL
#define XMLPUBFUN
#define XMLPUBVAR
#define _REENTRANT

Description

+ Module xmlexports from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xmlexports from libxml2

API Menu
API Indexes
Related links

macros for marking symbols as exportable/importable.

Table of Contents

#define LIBXML_DLL_IMPORT
#define XMLCALL
#define XMLCDECL
#define XMLPUBFUN
#define XMLPUBVAR
#define _REENTRANT

Description

Macro: LIBXML_DLL_IMPORT

#define LIBXML_DLL_IMPORT

Macro: XMLCALL

#define XMLCALL

Macro: XMLCDECL

#define XMLCDECL

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

Module xmlmemory from libxml2

API Menu
API Indexes
Related links

provides interfaces for the memory allocator, including debugging capabilities.

Table of Contents

#define DEBUG_MEMORY
Variable xmlMallocFunc xmlMalloc
+    Module xmlmemory from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xmlmemory from libxml2

API Menu
API Indexes
Related links

provides interfaces for the memory allocator, including debugging capabilities.

Table of Contents

#define DEBUG_MEMORY
Variable xmlMallocFunc xmlMalloc
 
 
Variable xmlMallocFunc xmlMallocAtomic
 
diff --git a/doc/html/libxml-xmlmodule.html b/doc/html/libxml-xmlmodule.html
index c5a6441..0a6c4a8 100644
--- a/doc/html/libxml-xmlmodule.html
+++ b/doc/html/libxml-xmlmodule.html
@@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline }
 Module xmlmodule from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xmlmodule from libxml2

API Menu
API Indexes
Related links

basic API for dynamic module loading, used by libexslt added in 2.6.17

Table of Contents

Structure xmlModule
struct _xmlModule + Module xmlmodule from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xmlmodule from libxml2

API Menu
API Indexes
Related links

basic API for dynamic module loading, used by libexslt added in 2.6.17

Table of Contents

Structure xmlModule
struct _xmlModule The content of this structure is not made public by the API.
Enum xmlModuleOption
 
Typedef xmlModule * xmlModulePtr
diff --git a/doc/html/libxml-xmlreader.html b/doc/html/libxml-xmlreader.html
index b69d759..b4c1cbc 100644
--- a/doc/html/libxml-xmlreader.html
+++ b/doc/html/libxml-xmlreader.html
@@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline }
 Module xmlreader from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xmlreader from libxml2

API Menu
API Indexes
Related links

API of the XML streaming API based on C# interfaces.

Table of Contents

Enum xmlParserProperties
+    Module xmlreader from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xmlreader from libxml2

API Menu
API Indexes
Related links

API of the XML streaming API based on C# interfaces.

Table of Contents

Enum xmlParserProperties
 
Enum xmlParserSeverities
 
Enum xmlReaderTypes
 
Structure xmlTextReader
struct _xmlTextReader @@ -277,7 +277,7 @@ void xmlTextReaderErrorFunc (void * arg,
const char * msg,
reader:the xmlTextReaderPtr used
Returns:1 if the node was read successfully, 0 if there is no more nodes to read, or -1 in case of error

Function: xmlTextReaderNextSibling

int	xmlTextReaderNextSibling	(xmlTextReaderPtr reader)

Skip to the node following the current one in document order while avoiding the subtree if any. Currently implemented only for Readers built on a document

reader:the xmlTextReaderPtr used
Returns:1 if the node was read successfully, 0 if there is no more nodes to read, or -1 in case of error

Function: xmlTextReaderNodeType

int	xmlTextReaderNodeType		(xmlTextReaderPtr reader)
-

Get the node type of the current node Reference: http://dotgnu.org/pnetlib-doc/System/Xml/XmlNodeType.html

+

Get the node type of the current node Reference: http://www.gnu.org/software/dotgnu/pnetlib-doc/System/Xml/XmlNodeType.html

reader:the xmlTextReaderPtr used
Returns:the xmlNodeType of the current node or -1 in case of error

Function: xmlTextReaderNormalization

int	xmlTextReaderNormalization	(xmlTextReaderPtr reader)

The value indicating whether to normalize white space and attribute values. Since attribute value and end of line normalizations are a MUST in the XML specification only the value true is accepted. The broken bahaviour of accepting out of range character entities like &#0; is of course not supported either.

reader:the xmlTextReaderPtr used
Returns:1 or -1 in case of error.

Function: xmlTextReaderPrefix

xmlChar *	xmlTextReaderPrefix	(xmlTextReaderPtr reader)
diff --git a/doc/html/libxml-xmlregexp.html b/doc/html/libxml-xmlregexp.html index 69834f0..642e930 100644 --- a/doc/html/libxml-xmlregexp.html +++ b/doc/html/libxml-xmlregexp.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } Module xmlregexp from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xmlregexp from libxml2

API Menu
API Indexes
Related links

basic API for libxml regular expressions handling used for XML Schemas and validation.

Table of Contents

Structure xmlExpCtxt
struct _xmlExpCtxt + Module xmlregexp from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xmlregexp from libxml2

API Menu
API Indexes
Related links

basic API for libxml regular expressions handling used for XML Schemas and validation.

Table of Contents

Structure xmlExpCtxt
struct _xmlExpCtxt The content of this structure is not made public by the API.
Typedef xmlExpCtxt * xmlExpCtxtPtr
 
Structure xmlExpNode
struct _xmlExpNode diff --git a/doc/html/libxml-xmlsave.html b/doc/html/libxml-xmlsave.html index d649ef7..ec9b5da 100644 --- a/doc/html/libxml-xmlsave.html +++ b/doc/html/libxml-xmlsave.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } Module xmlsave from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xmlsave from libxml2

API Menu
API Indexes
Related links

API to save document or subtree of document

Table of Contents

Structure xmlSaveCtxt
struct _xmlSaveCtxt + Module xmlsave from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xmlsave from libxml2

API Menu
API Indexes
Related links

API to save document or subtree of document

Table of Contents

Structure xmlSaveCtxt
struct _xmlSaveCtxt The content of this structure is not made public by the API.
Typedef xmlSaveCtxt * xmlSaveCtxtPtr
 
Enum xmlSaveOption
diff --git a/doc/html/libxml-xmlschemas.html b/doc/html/libxml-xmlschemas.html
index b5de305..261f221 100644
--- a/doc/html/libxml-xmlschemas.html
+++ b/doc/html/libxml-xmlschemas.html
@@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline }
 Module xmlschemas from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xmlschemas from libxml2

API Menu
API Indexes
Related links

interface to the XML Schemas handling and schema validity checking, it is incomplete right now.

Table of Contents

Structure xmlSchema
struct _xmlSchema + Module xmlschemas from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xmlschemas from libxml2

API Menu
API Indexes
Related links

interface to the XML Schemas handling and schema validity checking, it is incomplete right now.

Table of Contents

Structure xmlSchema
struct _xmlSchema
Structure xmlSchemaParserCtxt
struct _xmlSchemaParserCtxt The content of this structure is not made public by the API.
Typedef xmlSchemaParserCtxt * xmlSchemaParserCtxtPtr
diff --git a/doc/html/libxml-xmlschemastypes.html b/doc/html/libxml-xmlschemastypes.html
index c890b59..ef44e80 100644
--- a/doc/html/libxml-xmlschemastypes.html
+++ b/doc/html/libxml-xmlschemastypes.html
@@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline }
 Module xmlschemastypes from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xmlschemastypes from libxml2

API Menu
API Indexes
Related links

module providing the XML Schema Datatypes implementation both definition and validity checking

Table of Contents

Enum xmlSchemaWhitespaceValueType
+    Module xmlschemastypes from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xmlschemastypes from libxml2

API Menu
API Indexes
Related links

module providing the XML Schema Datatypes implementation both definition and validity checking

Table of Contents

Enum xmlSchemaWhitespaceValueType
 
int	xmlSchemaCheckFacet		(xmlSchemaFacetPtr facet, 
xmlSchemaTypePtr typeDecl,
xmlSchemaParserCtxtPtr pctxt,
const xmlChar * name)
void	xmlSchemaCleanupTypes		(void)
xmlChar *	xmlSchemaCollapseString	(const xmlChar * value)
diff --git a/doc/html/libxml-xmlstring.html b/doc/html/libxml-xmlstring.html index e29d740..f7c9a64 100644 --- a/doc/html/libxml-xmlstring.html +++ b/doc/html/libxml-xmlstring.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } Module xmlstring from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xmlstring from libxml2

API Menu
API Indexes
Related links

type and interfaces needed for the internal string handling of the library, especially UTF8 processing.

Table of Contents

#define BAD_CAST
Typedef unsigned char xmlChar
+    Module xmlstring from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xmlstring from libxml2

API Menu
API Indexes
Related links

type and interfaces needed for the internal string handling of the library, especially UTF8 processing.

Table of Contents

#define BAD_CAST
Typedef unsigned char xmlChar
 
xmlChar *	xmlCharStrdup		(const char * cur)
xmlChar *	xmlCharStrndup		(const char * cur, 
int len)
int	xmlCheckUTF8			(const unsigned char * utf)
diff --git a/doc/html/libxml-xmlunicode.html b/doc/html/libxml-xmlunicode.html index ceb8450..7ee50ef 100644 --- a/doc/html/libxml-xmlunicode.html +++ b/doc/html/libxml-xmlunicode.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } Module xmlunicode from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xmlunicode from libxml2

API Menu
API Indexes
Related links

API for the Unicode character APIs This file is automatically generated from the UCS description files of the Unicode Character Database

Table of Contents

int	xmlUCSIsAegeanNumbers		(int code)
+ Module xmlunicode from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xmlunicode from libxml2

API Menu
API Indexes
Related links

API for the Unicode character APIs This file is automatically generated from the UCS description files of the Unicode Character Database

Table of Contents

int	xmlUCSIsAegeanNumbers		(int code)
int	xmlUCSIsAlphabeticPresentationForms	(int code)
int	xmlUCSIsArabic			(int code)
int	xmlUCSIsArabicPresentationFormsA	(int code)
diff --git a/doc/html/libxml-xmlversion.html b/doc/html/libxml-xmlversion.html index 3e9d50a..c76206c 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 LIBXML_ZLIB_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

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

Module xmlwriter from libxml2

API Menu
API Indexes
Related links

text writing API for XML

Table of Contents

#define xmlTextWriterWriteDocType
#define xmlTextWriterWriteProcessingInstruction
Structure xmlTextWriter
struct _xmlTextWriter + Module xmlwriter from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xmlwriter from libxml2

API Menu
API Indexes
Related links

text writing API for XML

Table of Contents

#define xmlTextWriterWriteDocType
#define xmlTextWriterWriteProcessingInstruction
Structure xmlTextWriter
struct _xmlTextWriter The content of this structure is not made public by the API.
Typedef xmlTextWriter * xmlTextWriterPtr
 
void	xmlFreeTextWriter		(xmlTextWriterPtr writer)
@@ -126,8 +126,8 @@ The content of this structure is not made public by the API.
writer:the xmlTextWriterPtr
Returns:the bytes written (may be 0 because of buffering) or -1 in case of error

Function: xmlTextWriterEndDTDEntity

int	xmlTextWriterEndDTDEntity	(xmlTextWriterPtr writer)

End an xml DTD entity.

writer:the xmlTextWriterPtr
Returns:the bytes written (may be 0 because of buffering) or -1 in case of error

Function: xmlTextWriterEndDocument

int	xmlTextWriterEndDocument	(xmlTextWriterPtr writer)
-

End an xml document. All open elements are closed

-
writer:the xmlTextWriterPtr
Returns:the bytes written (may be 0 because of buffering) or -1 in case of error

Function: xmlTextWriterEndElement

int	xmlTextWriterEndElement		(xmlTextWriterPtr writer)
+

End an xml document. All open elements are closed, and the content is flushed to the output.

+
writer:the xmlTextWriterPtr
Returns:the bytes written or -1 in case of error

Function: xmlTextWriterEndElement

int	xmlTextWriterEndElement		(xmlTextWriterPtr writer)

End the current xml element.

writer:the xmlTextWriterPtr
Returns:the bytes written (may be 0 because of buffering) or -1 in case of error

Function: xmlTextWriterEndPI

int	xmlTextWriterEndPI		(xmlTextWriterPtr writer)

End the current xml PI.

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

Module xpath from libxml2

API Menu
API Indexes
Related links

API for the XML Path Language implementation XML Path Language implementation XPath is a language for addressing parts of an XML document, designed to be used by both XSLT and XPointer

Table of Contents

#define XML_XPATH_CHECKNS
#define XML_XPATH_NOVAR
#define xmlXPathNodeSetGetLength
#define xmlXPathNodeSetIsEmpty
#define xmlXPathNodeSetItem
Structure xmlNodeSet
struct _xmlNodeSet + Module xpath from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xpath from libxml2

API Menu
API Indexes
Related links

API for the XML Path Language implementation XML Path Language implementation XPath is a language for addressing parts of an XML document, designed to be used by both XSLT and XPointer

Table of Contents

#define XML_XPATH_CHECKNS
#define XML_XPATH_NOVAR
#define xmlXPathNodeSetGetLength
#define xmlXPathNodeSetIsEmpty
#define xmlXPathNodeSetItem
Structure xmlNodeSet
struct _xmlNodeSet
Typedef xmlNodeSet * xmlNodeSetPtr
 
Structure xmlXPathAxis
struct _xmlXPathAxis
Typedef xmlXPathAxis * xmlXPathAxisPtr
diff --git a/doc/html/libxml-xpathInternals.html b/doc/html/libxml-xpathInternals.html
index eae9705..d3ac35f 100644
--- a/doc/html/libxml-xpathInternals.html
+++ b/doc/html/libxml-xpathInternals.html
@@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline }
 Module xpathInternals from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xpathInternals from libxml2

API Menu
API Indexes
Related links

internal interfaces for XML Path Language implementation used to build new modules on top of XPath like XPointer and XSLT

Table of Contents

#define CAST_TO_BOOLEAN
#define CAST_TO_NUMBER
#define CAST_TO_STRING
#define CHECK_ARITY
#define CHECK_ERROR
#define CHECK_ERROR0
#define CHECK_TYPE
#define CHECK_TYPE0
#define XP_ERROR
#define XP_ERROR0
#define xmlXPathCheckError
#define xmlXPathEmptyNodeSet
#define xmlXPathGetContextNode
#define xmlXPathGetDocument
#define xmlXPathGetError
#define xmlXPathReturnBoolean
#define xmlXPathReturnEmptyNodeSet
#define xmlXPathReturnEmptyString
#define xmlXPathReturnExternal
#define xmlXPathReturnFalse
#define xmlXPathReturnNodeSet
#define xmlXPathReturnNumber
#define xmlXPathReturnString
#define xmlXPathReturnTrue
#define xmlXPathSetArityError
#define xmlXPathSetError
#define xmlXPathSetTypeError
#define xmlXPathStackIsExternal
#define xmlXPathStackIsNodeSet
xmlXPathObjectPtr	valuePop	(xmlXPathParserContextPtr ctxt)
+ Module xpathInternals from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xpathInternals from libxml2

API Menu
API Indexes
Related links

internal interfaces for XML Path Language implementation used to build new modules on top of XPath like XPointer and XSLT

Table of Contents

#define CAST_TO_BOOLEAN
#define CAST_TO_NUMBER
#define CAST_TO_STRING
#define CHECK_ARITY
#define CHECK_ERROR
#define CHECK_ERROR0
#define CHECK_TYPE
#define CHECK_TYPE0
#define XP_ERROR
#define XP_ERROR0
#define xmlXPathCheckError
#define xmlXPathEmptyNodeSet
#define xmlXPathGetContextNode
#define xmlXPathGetDocument
#define xmlXPathGetError
#define xmlXPathReturnBoolean
#define xmlXPathReturnEmptyNodeSet
#define xmlXPathReturnEmptyString
#define xmlXPathReturnExternal
#define xmlXPathReturnFalse
#define xmlXPathReturnNodeSet
#define xmlXPathReturnNumber
#define xmlXPathReturnString
#define xmlXPathReturnTrue
#define xmlXPathSetArityError
#define xmlXPathSetError
#define xmlXPathSetTypeError
#define xmlXPathStackIsExternal
#define xmlXPathStackIsNodeSet
xmlXPathObjectPtr	valuePop	(xmlXPathParserContextPtr ctxt)
int	valuePush			(xmlXPathParserContextPtr ctxt, 
xmlXPathObjectPtr value)
void	xmlXPathAddValues		(xmlXPathParserContextPtr ctxt)
void	xmlXPathBooleanFunction		(xmlXPathParserContextPtr ctxt, 
int nargs)
diff --git a/doc/html/libxml-xpointer.html b/doc/html/libxml-xpointer.html index 7b0c350..45f8d7d 100644 --- a/doc/html/libxml-xpointer.html +++ b/doc/html/libxml-xpointer.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } Module xpointer from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xpointer from libxml2

API Menu
API Indexes
Related links

API to handle XML Pointers Base implementation was made accordingly to W3C Candidate Recommendation 7 June 2000

Table of Contents

Structure xmlLocationSet
struct _xmlLocationSet + Module xpointer from libxml2
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xpointer from libxml2

API Menu
API Indexes
Related links

API to handle XML Pointers Base implementation was made accordingly to W3C Candidate Recommendation 7 June 2000

Table of Contents

Structure xmlLocationSet
struct _xmlLocationSet
Typedef xmlLocationSet * xmlLocationSetPtr
 
xmlNodePtr	xmlXPtrBuildNodeList	(xmlXPathObjectPtr obj)
xmlXPathObjectPtr	xmlXPtrEval	(const xmlChar * str, 
xmlXPathContextPtr ctx)
diff --git a/doc/libxml2-api.xml b/doc/libxml2-api.xml index df478d6..867ac92 100644 --- a/doc/libxml2-api.xml +++ b/doc/libxml2-api.xml @@ -1328,6 +1328,7 @@ interface to the XML Schematron validity checking. Daniel Veillard + @@ -1347,6 +1348,7 @@ + @@ -2011,6 +2013,7 @@ + @@ -2512,6 +2515,7 @@ + @@ -2593,6 +2597,7 @@ + @@ -2618,6 +2623,7 @@ + @@ -4844,7 +4850,7 @@ - + @@ -4857,6 +4863,7 @@ + @@ -5465,7 +5472,10 @@ crash if you try to modify the tree)'/> + + + @@ -5614,6 +5624,7 @@ crash if you try to modify the tree)'/> + @@ -8787,7 +8798,7 @@ Could we use @subtypes for this?'/> - Cleanup function for the XML library. It tries to reclaim all parsing related global memory allocated for the library processing. It doesn't deallocate any document related memory. Calling this function should not prevent reusing the library but one should call xmlCleanupParser() only when the process has finished using the library or XML document built with it. + This function name is somewhat misleading. It does not clean up parser state, it cleans up memory allocated by the library itself. It is a cleanup function for the XML library. It tries to reclaim all related global memory allocated for the library processing. It doesn't deallocate any document related memory. One should call xmlCleanupParser() only when the process has finished using the library and all XML/HTML documents built with it. See also xmlInitParser() which has the opposite function of preparing the library for operations. @@ -11724,7 +11735,7 @@ Could we use @subtypes for this?'/> defined(LIBXML_SAX1_ENABLED) Parse a well-balanced chunk of an XML document called by the parser The allowed sequence for the Well Balanced Chunk is the one defined by the content production in the XML grammar: [43] content ::= (element | CharData | Reference | CDSect | PI | Comment)* - + @@ -12495,20 +12506,20 @@ Could we use @subtypes for this?'/> defined(LIBXML_SAX1_ENABLED) - parse an XML in-memory document and build a tree. In the case the document is not Well Formed, a tree is built anyway - + parse an XML in-memory document and build a tree. In the case the document is not Well Formed, a attempt to build a tree is tried anyway + defined(LIBXML_SAX1_ENABLED) - parse an XML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time. In the case the document is not Well Formed, a tree is built anyway - + parse an XML file and build a tree. Automatic support for ZLIB/Compress compressed document is provided by default if found at compile-time. In the case the document is not Well Formed, it attempts to build a tree anyway + defined(LIBXML_SAX1_ENABLED) - parse an XML in-memory block and build a tree. In the case the document is not Well Formed, a tree is built anyway - + parse an XML in-memory block and build a tree. In the case the document is not Well Formed, an attempt to build a tree is tried anyway + @@ -13815,6 +13826,14 @@ Could we use @subtypes for this?'/> + + defined(LIBXML_SCHEMATRON_ENABLED) + Set the structured error callback + + + + + defined(LIBXML_SCHEMATRON_ENABLED) Validate a tree instance against the schematron @@ -14662,7 +14681,7 @@ Could we use @subtypes for this?'/> defined(LIBXML_READER_ENABLED) - Get the node type of the current node Reference: http://dotgnu.org/pnetlib-doc/System/Xml/XmlNodeType.html + Get the node type of the current node Reference: http://www.gnu.org/software/dotgnu/pnetlib-doc/System/Xml/XmlNodeType.html @@ -14866,8 +14885,8 @@ Could we use @subtypes for this?'/> defined(LIBXML_WRITER_ENABLED) - End an xml document. All open elements are closed - + End an xml document. All open elements are closed, and the content is flushed to the output. + diff --git a/doc/libxml2.xsa b/doc/libxml2.xsa index c9fb529..9133b40 100644 --- a/doc/libxml2.xsa +++ b/doc/libxml2.xsa @@ -8,19 +8,26 @@ libxml2 - 2.6.30 - Aug 23 2007 + 2.6.31 + Jan 11 2008 http://xmlsoft.org/ - - Portability: Solaris crash on error handling, windows path fixes - (Roland Schwarz and Rob Richards), mingw build (Roland Schwarz) - - Bugfixes: xmlXPathNodeSetSort problem (William Brack), leak when - reusing a writer for a new document (Dodji Seketeli), Schemas - xsi:nil handling patch (Frank Gross), relative URI build problem - (Patrik Fimml), crash in xmlDocFormatDump, invalid char in comment - detection bug, fix disparity with xmlSAXUserParseMemory, automata - generation for complex regexp counts problems, Schemas IDC import - problems (Frank Gross), xpath predicate evailation error handling - (William Brack) + - 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, diff --git a/doc/newapi.xsl b/doc/newapi.xsl index 17d0464..c2709c7 100644 --- a/doc/newapi.xsl +++ b/doc/newapi.xsl @@ -556,6 +556,7 @@ + + Module from diff --git a/doc/news.html b/doc/news.html index f320d17..4c89278 100644 --- a/doc/news.html +++ b/doc/news.html @@ -12,7 +12,40 @@ to help those

The change log describes the recents commits -to the SVN code base.

Here is the list of public releases:

2.6.31: Jan 11 2008

  • Security fix: missing of checks in UTF-8 parsing
  • +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), + 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 xmlFree(NULL) to not crash in debug mode, Schematron parsing crash (Rob Richards), global lock free on Windows (Marc-Antoine Ruel), diff --git a/doc/xml.html b/doc/xml.html index 355dbed..8e42443 100644 --- a/doc/xml.html +++ b/doc/xml.html @@ -739,6 +739,43 @@ 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), + 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
      • @@ -3356,9 +3393,10 @@ should be both simple and complete enough to allow you to build your own.

        1. General overview
        2. Setting libxml2 set of memory routines
        3. -
        4. Cleaning up after parsing
        5. +
        6. Cleaning up after using the library
        7. Debugging routines
        8. General memory requirements
        9. +
        10. Returning memory to the kernel

        General overview

        @@ -3391,27 +3429,29 @@ debugging, analysis or to implement a specific behaviour on memory management any other libxml2 routines (unless you are sure your allocations routines are compatibles).

        -

        Cleaning up after parsing

        +

        Cleaning up after using the library

        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:

        +reuse the library or any document built with it:

        • 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).
        • + () is a centralized routine to free the library state and data. Note + that it won't deallocate any produced tree if any (use the xmlFreeDoc() + and related routines for this). This should be called only when the library + is not used anymore.
        • 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.

        +

        Generally xmlCleanupParser() is safe assuming no parsing is ongoing and +no document is still being used, if needed the state will be rebuild at the +next invocation of parser routines (or by xmlInitParser()), but be careful +of the consequences in multithreaded applications.

        Debugging routines

        @@ -3496,6 +3536,20 @@ of a number of things:

        then the SAX interface should be used, but it has known restrictions.
      +

      +

      Returning memory to the kernel

      + +

      You may encounter that your process using libxml2 does not have a +reduced memory usage although you freed the trees. This is because +libxml2 allocates memory in a number of small chunks. When freeing one +of those chunks, the OS may decide that giving this little memory back +to the kernel will cause too much overhead and delay the operation. As +all chunks are this small, they get actually freed but not returned to +the kernel. On systems using glibc, there is a function call +"malloc_trim" from malloc.h which does this missing operation (note that +it is allowed to fail). Thus, after freeing your tree you may simply try +"malloc_trim(0);" to really get the memory back. If your OS does not +provide malloc_trim, try searching for a similar function.

      Encodings support

      diff --git a/doc/xmlmem.html b/doc/xmlmem.html index 1ca4334..5599444 100644 --- a/doc/xmlmem.html +++ b/doc/xmlmem.html @@ -9,9 +9,10 @@ H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } Memory Management
      Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
      Made with Libxml2 Logo

      The XML C parser and toolkit of Gnome

      Memory Management

      Developer Menu
      API Indexes
      Related links

      Table of Content:

      1. General overview
      2. Setting libxml2 set of memory routines
      3. -
      4. Cleaning up after parsing
      5. +
      6. Cleaning up after using the library
      7. Debugging routines
      8. General memory requirements
      9. +
      10. Returning memory to the kernel

      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()
      • @@ -26,21 +27,23 @@ debugging, analysis or to implement a specific behaviour on memory management 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 +compatibles).

      Cleaning up after using the library

      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).
      • +reuse the library or any document built with it:

        • xmlCleanupParser + () is a centralized routine to free the library state and data. Note + that it won't deallocate any produced tree if any (use the xmlFreeDoc() + and related routines for this). This should be called only when the library + is not used anymore.
        • 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 +

      Generally xmlCleanupParser() is safe assuming no parsing is ongoing and +no document is still being used, if needed the state will be rebuild at the +next invocation of parser routines (or by xmlInitParser()), but be careful +of the consequences in multithreaded applications.

      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 @@ -99,4 +102,14 @@ of a number of things:

      • the parser itself should work in a fixed amou 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

      +

    Returning memory to the kernel

    You may encounter that your process using libxml2 does not have a +reduced memory usage although you freed the trees. This is because +libxml2 allocates memory in a number of small chunks. When freeing one +of those chunks, the OS may decide that giving this little memory back +to the kernel will cause too much overhead and delay the operation. As +all chunks are this small, they get actually freed but not returned to +the kernel. On systems using glibc, there is a function call +"malloc_trim" from malloc.h which does this missing operation (note that +it is allowed to fail). Thus, after freeing your tree you may simply try +"malloc_trim(0);" to really get the memory back. If your OS does not +provide malloc_trim, try searching for a similar function.

    Daniel Veillard

diff --git a/elfgcchack.h b/elfgcchack.h index cd9605c..e1d21bb 100644 --- a/elfgcchack.h +++ b/elfgcchack.h @@ -10117,6 +10117,18 @@ extern __typeof (xmlSchematronParse) xmlSchematronParse__internal_alias __attrib #endif #endif +#if defined(LIBXML_SCHEMATRON_ENABLED) +#ifdef bottom_schematron +#undef xmlSchematronSetValidStructuredErrors +extern __typeof (xmlSchematronSetValidStructuredErrors) xmlSchematronSetValidStructuredErrors __attribute((alias("xmlSchematronSetValidStructuredErrors__internal_alias"))); +#else +#ifndef xmlSchematronSetValidStructuredErrors +extern __typeof (xmlSchematronSetValidStructuredErrors) xmlSchematronSetValidStructuredErrors__internal_alias __attribute((visibility("hidden"))); +#define xmlSchematronSetValidStructuredErrors xmlSchematronSetValidStructuredErrors__internal_alias +#endif +#endif +#endif + #if defined(LIBXML_SCHEMATRON_ENABLED) #ifdef bottom_schematron #undef xmlSchematronValidateDoc diff --git a/encoding.c b/encoding.c index 002eeba..6c49fff 100644 --- a/encoding.c +++ b/encoding.c @@ -1703,7 +1703,7 @@ xmlIconvWrapper(iconv_t cd, unsigned char *out, int *outlen, } icv_inlen = *inlen; icv_outlen = *outlen; - ret = iconv(cd, (char **) &icv_in, &icv_inlen, &icv_out, &icv_outlen); + ret = iconv(cd, (ICONV_CONST char **) &icv_in, &icv_inlen, &icv_out, &icv_outlen); *inlen -= icv_inlen; *outlen -= icv_outlen; if ((icv_inlen != 0) || (ret == -1)) { @@ -1768,9 +1768,10 @@ xmlCharEncFirstLine(xmlCharEncodingHandler *handler, xmlBufferPtr out, * 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. + * on UTF-16 this means 90bytes, on UCS4 this means 180 */ - if (toconv > 45) - toconv = 45; + if (toconv > 180) + toconv = 180; if (toconv * 2 >= written) { xmlBufferGrow(out, toconv); written = out->size - out->use - 1; @@ -1991,8 +1992,8 @@ retry: toconv = in->use; if (toconv == 0) return(0); - if (toconv * 2 >= written) { - xmlBufferGrow(out, toconv * 2); + if (toconv * 4 >= written) { + xmlBufferGrow(out, toconv * 4); written = out->size - out->use - 1; } if (handler->output != NULL) { diff --git a/error.c b/error.c index 722ffbb..5f03d94 100644 --- a/error.c +++ b/error.c @@ -31,7 +31,7 @@ void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED, \ size = 150; \ \ - while (1) { \ + while (size < 64000) { \ va_start(ap, msg); \ chars = vsnprintf(str, size, msg, ap); \ va_end(ap); \ diff --git a/globals.c b/globals.c index 636ff87..cbc6625 100644 --- a/globals.c +++ b/globals.c @@ -60,7 +60,7 @@ void xmlCleanupGlobals(void) xmlFreeMutex(xmlThrDefMutex); xmlThrDefMutex = NULL; } - __xmlGlobalInitMutexDestroy(); + __xmlGlobalInitMutexDestroy(); } /************************************************************************ diff --git a/include/libxml/schematron.h b/include/libxml/schematron.h index 6eaa699..9e36c0e 100644 --- a/include/libxml/schematron.h +++ b/include/libxml/schematron.h @@ -25,6 +25,7 @@ typedef enum { XML_SCHEMATRON_OUT_QUIET = 1 << 0, /* quiet no report */ XML_SCHEMATRON_OUT_TEXT = 1 << 1, /* build a textual report */ XML_SCHEMATRON_OUT_XML = 1 << 2, /* output SVRL */ + XML_SCHEMATRON_OUT_ERROR = 1 << 3, /* output via xmlStructuredErrorFunc */ XML_SCHEMATRON_OUT_FILE = 1 << 8, /* output to a file descriptor */ XML_SCHEMATRON_OUT_BUFFER = 1 << 9, /* output to a buffer */ XML_SCHEMATRON_OUT_IO = 1 << 10 /* output to I/O mechanism */ @@ -81,12 +82,12 @@ XMLPUBFUN void XMLCALL /* * Interfaces for validating */ -/****** XMLPUBFUN void XMLCALL xmlSchematronSetValidStructuredErrors( xmlSchematronValidCtxtPtr ctxt, xmlStructuredErrorFunc serror, void *ctx); +/****** XMLPUBFUN void XMLCALL xmlSchematronSetValidErrors (xmlSchematronValidCtxtPtr ctxt, xmlSchematronValidityErrorFunc err, diff --git a/include/libxml/threads.h b/include/libxml/threads.h index f81f982..d31f16a 100644 --- a/include/libxml/threads.h +++ b/include/libxml/threads.h @@ -36,40 +36,40 @@ typedef xmlRMutex *xmlRMutexPtr; #ifdef __cplusplus extern "C" { #endif -XMLPUBFUN xmlMutexPtr XMLCALL +XMLPUBFUN xmlMutexPtr XMLCALL xmlNewMutex (void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlMutexLock (xmlMutexPtr tok); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlMutexUnlock (xmlMutexPtr tok); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeMutex (xmlMutexPtr tok); -XMLPUBFUN xmlRMutexPtr XMLCALL +XMLPUBFUN xmlRMutexPtr XMLCALL xmlNewRMutex (void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlRMutexLock (xmlRMutexPtr tok); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlRMutexUnlock (xmlRMutexPtr tok); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeRMutex (xmlRMutexPtr tok); /* * Library wide APIs. */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlInitThreads (void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlLockLibrary (void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlUnlockLibrary(void); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlGetThreadId (void); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlIsMainThread (void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlCleanupThreads(void); -XMLPUBFUN xmlGlobalStatePtr XMLCALL +XMLPUBFUN xmlGlobalStatePtr XMLCALL xmlGetGlobalState(void); #if defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && defined(LIBXML_STATIC_FOR_DLL) diff --git a/include/libxml/xmlerror.h b/include/libxml/xmlerror.h index c5f2164..8cbab5e 100644 --- a/include/libxml/xmlerror.h +++ b/include/libxml/xmlerror.h @@ -61,7 +61,8 @@ typedef enum { XML_FROM_CHECK, /* The error checking module */ XML_FROM_WRITER, /* The xmlwriter module */ XML_FROM_MODULE, /* The dynamically loaded module module*/ - XML_FROM_I18N /* The module handling character conversion */ + XML_FROM_I18N, /* The module handling character conversion */ + XML_FROM_SCHEMATRONV /* The Schematron validator module */ } xmlErrorDomain; /** @@ -398,6 +399,7 @@ typedef enum { XML_TREE_INVALID_HEX = 1300, XML_TREE_INVALID_DEC, /* 1301 */ XML_TREE_UNTERMINATED_ENTITY, /* 1302 */ + XML_TREE_NOT_UTF8, /* 1303 */ XML_SAVE_NOT_UTF8 = 1400, XML_SAVE_CHAR_INVALID, /* 1401 */ XML_SAVE_NO_DOCTYPE, /* 1402 */ @@ -773,6 +775,8 @@ typedef enum { XML_SCHEMAP_AU_PROPS_CORRECT, /* 3088 */ XML_SCHEMAP_A_PROPS_CORRECT_3, /* 3089 */ XML_SCHEMAP_COS_ALL_LIMITED, /* 3090 */ + XML_SCHEMATRONV_ASSERT = 4000, /* 4000 */ + XML_SCHEMATRONV_REPORT, XML_MODULE_OPEN = 4900, /* 4900 */ XML_MODULE_CLOSE, /* 4901 */ XML_CHECK_FOUND_ELEMENT = 5000, diff --git a/include/libxml/xmlversion.h b/include/libxml/xmlversion.h index adb4f4e..9fc51a2 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.31" +#define LIBXML_DOTTED_VERSION "2.6.32" /** * LIBXML_VERSION: * * the version number: 1.2.3 value is 10203 */ -#define LIBXML_VERSION 20631 +#define LIBXML_VERSION 20632 /** * LIBXML_VERSION_STRING: * * the version number string, 1.2.3 value is "10203" */ -#define LIBXML_VERSION_STRING "20631" +#define LIBXML_VERSION_STRING "20632" /** * 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(20631); +#define LIBXML_TEST_VERSION xmlCheckVersion(20632); #ifndef VMS #if 0 diff --git a/include/libxml/xpath.h b/include/libxml/xpath.h index 725cebe..1a9e30e 100644 --- a/include/libxml/xpath.h +++ b/include/libxml/xpath.h @@ -278,6 +278,9 @@ typedef xmlXPathFunction (*xmlXPathFuncLookupFunc) (void *ctxt, * - the set of namespace declarations in scope for the expression * Following the switch to hash tables, this need to be trimmed up at * the next binary incompatible release. + * The node may be modified when the context is passed to libxml2 + * for an XPath evaluation so you may need to initialize it again + * before the next call. */ struct _xmlXPathContext { diff --git a/include/win32config.h b/include/win32config.h index 6e9b33b..3fc9be5 100644 --- a/include/win32config.h +++ b/include/win32config.h @@ -23,6 +23,10 @@ #include +#ifndef ICONV_CONST +#define ICONV_CONST const +#endif + #ifdef NEED_SOCKETS #include #endif @@ -92,7 +96,9 @@ static int isnan (double d) { #if defined(_MSC_VER) #define mkdir(p,m) _mkdir(p) #define snprintf _snprintf +#if _MSC_VER < 1500 #define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a) +#endif #elif defined(__MINGW32__) #define mkdir(p,m) _mkdir(p) #endif diff --git a/libxml2.spec b/libxml2.spec index 40632aa..887e8a1 100644 --- a/libxml2.spec +++ b/libxml2.spec @@ -1,6 +1,6 @@ Summary: Library providing XML and HTML support Name: libxml2 -Version: 2.6.31 +Version: 2.6.32 Release: 1 License: MIT Group: Development/Libraries @@ -128,6 +128,6 @@ rm -fr %{buildroot} %doc doc/python.html %changelog -* Fri Jan 11 2008 Daniel Veillard -- upstream release 2.6.31 see http://xmlsoft.org/news.html +* Tue Apr 8 2008 Daniel Veillard +- upstream release 2.6.32 see http://xmlsoft.org/news.html diff --git a/macos/src/XMLTestPrefix.h.orig b/macos/src/XMLTestPrefix.h.orig new file mode 100644 index 0000000..3e84255 --- /dev/null +++ b/macos/src/XMLTestPrefix.h.orig @@ -0,0 +1 @@ +int test_main(int argc, char **argv); #define main(X,Y) test_main(X,Y) \ No newline at end of file diff --git a/nanohttp.c b/nanohttp.c index 91c7e87..07829c7 100644 --- a/nanohttp.c +++ b/nanohttp.c @@ -1332,13 +1332,23 @@ retry: if (headers != NULL) blen += strlen(headers) + 2; if (contentType && *contentType) + /* reserve for string plus 'Content-Type: \r\n" */ blen += strlen(*contentType) + 16; if (ctxt->query != NULL) + /* 1 for '?' */ blen += strlen(ctxt->query) + 1; blen += strlen(method) + strlen(ctxt->path) + 24; #ifdef HAVE_ZLIB_H + /* reserve for possible 'Accept-Encoding: gzip' string */ blen += 23; #endif + if (ctxt->port != 80) { + /* reserve space for ':xxxxx', incl. potential proxy */ + if (proxy) + blen += 12; + else + blen += 6; + } bp = (char*)xmlMallocAtomic(blen); if ( bp == NULL ) { xmlNanoHTTPFreeCtxt( ctxt ); diff --git a/parser.c b/parser.c index 529e061..f20fd05 100644 --- a/parser.c +++ b/parser.c @@ -126,6 +126,9 @@ static xmlParserErrors xmlParseBalancedChunkMemoryInternal(xmlParserCtxtPtr oldctxt, const xmlChar *string, void *user_data, xmlNodePtr *lst); +static int +xmlLoadEntityContent(xmlParserCtxtPtr ctxt, xmlEntityPtr entity); + /************************************************************************ * * * Some factorized error routines * @@ -859,6 +862,103 @@ struct _xmlDefAttrs { const xmlChar *values[4]; /* array of localname/prefix/values */ }; +/** + * xmlAttrNormalizeSpace: + * @src: the source string + * @dst: the target string + * + * Normalize the space in non CDATA attribute values: + * If the attribute type is not CDATA, then the XML processor MUST further + * process the normalized attribute value by discarding any leading and + * trailing space (#x20) characters, and by replacing sequences of space + * (#x20) characters by a single space (#x20) character. + * Note that the size of dst need to be at least src, and if one doesn't need + * to preserve dst (and it doesn't come from a dictionary or read-only) then + * passing src as dst is just fine. + * + * Returns a pointer to the normalized value (dst) or NULL if no conversion + * is needed. + */ +static xmlChar * +xmlAttrNormalizeSpace(const xmlChar *src, xmlChar *dst) +{ + if ((src == NULL) || (dst == NULL)) + return(NULL); + + while (*src == 0x20) src++; + while (*src != 0) { + if (*src == 0x20) { + while (*src == 0x20) src++; + if (*src != 0) + *dst++ = 0x20; + } else { + *dst++ = *src++; + } + } + *dst = 0; + if (dst == src) + return(NULL); + return(dst); +} + +/** + * xmlAttrNormalizeSpace2: + * @src: the source string + * + * Normalize the space in non CDATA attribute values, a slightly more complex + * front end to avoid allocation problems when running on attribute values + * coming from the input. + * + * Returns a pointer to the normalized value (dst) or NULL if no conversion + * is needed. + */ +static const xmlChar * +xmlAttrNormalizeSpace2(xmlParserCtxtPtr ctxt, const xmlChar *src, int *len) +{ + int i; + int remove_head = 0; + int need_realloc = 0; + const xmlChar *cur; + + if ((ctxt == NULL) || (src == NULL) || (len == NULL)) + return(NULL); + i = *len; + if (i <= 0) + return(NULL); + + cur = src; + while (*cur == 0x20) { + cur++; + remove_head++; + } + while (*cur != 0) { + if (*cur == 0x20) { + cur++; + if ((*cur == 0x20) || (*cur == 0)) { + need_realloc = 1; + break; + } + } else + cur++; + } + if (need_realloc) { + xmlChar *ret; + + ret = xmlStrndup(src + remove_head, i - remove_head + 1); + if (ret == NULL) { + xmlErrMemory(ctxt, NULL); + return(NULL); + } + xmlAttrNormalizeSpace(ret, ret); + *len = (int) strlen((const char *)ret); + return(ret); + } else if (remove_head) { + *len -= remove_head; + return(src + remove_head); + } + return(NULL); +} + /** * xmlAddDefAttrs: * @ctxt: an XML parser context @@ -878,6 +978,14 @@ xmlAddDefAttrs(xmlParserCtxtPtr ctxt, const xmlChar *name; const xmlChar *prefix; + /* + * Allows to detect attribute redefinitions + */ + if (ctxt->attsSpecial != NULL) { + if (xmlHashLookup2(ctxt->attsSpecial, fullname, fullattr) != NULL) + return; + } + if (ctxt->attsDefault == NULL) { ctxt->attsDefault = xmlHashCreateDict(10, ctxt->dict); if (ctxt->attsDefault == NULL) @@ -908,7 +1016,11 @@ xmlAddDefAttrs(xmlParserCtxtPtr ctxt, goto mem_error; defaults->nbAttrs = 0; defaults->maxAttrs = 4; - xmlHashUpdateEntry2(ctxt->attsDefault, name, prefix, defaults, NULL); + if (xmlHashUpdateEntry2(ctxt->attsDefault, name, prefix, + defaults, NULL) < 0) { + xmlFree(defaults); + goto mem_error; + } } else if (defaults->nbAttrs >= defaults->maxAttrs) { xmlDefAttrsPtr temp; @@ -918,7 +1030,11 @@ xmlAddDefAttrs(xmlParserCtxtPtr ctxt, goto mem_error; defaults = temp; defaults->maxAttrs *= 2; - xmlHashUpdateEntry2(ctxt->attsDefault, name, prefix, defaults, NULL); + if (xmlHashUpdateEntry2(ctxt->attsDefault, name, prefix, + defaults, NULL) < 0) { + xmlFree(defaults); + goto mem_error; + } } /* @@ -1141,15 +1257,16 @@ nsPush(xmlParserCtxtPtr ctxt, const xmlChar *prefix, const xmlChar *URL) return (-1); } } else if (ctxt->nsNr >= ctxt->nsMax) { + const xmlChar ** tmp; ctxt->nsMax *= 2; - ctxt->nsTab = (const xmlChar **) - xmlRealloc((char *) ctxt->nsTab, - ctxt->nsMax * sizeof(ctxt->nsTab[0])); - if (ctxt->nsTab == NULL) { + tmp = (const xmlChar **) xmlRealloc((char *) ctxt->nsTab, + ctxt->nsMax * sizeof(ctxt->nsTab[0])); + if (tmp == NULL) { xmlErrMemory(ctxt, NULL); ctxt->nsMax /= 2; return (-1); } + ctxt->nsTab = tmp; } ctxt->nsTab[ctxt->nsNr++] = prefix; ctxt->nsTab[ctxt->nsNr++] = URL; @@ -1470,13 +1587,16 @@ namePop(xmlParserCtxtPtr ctxt) static int spacePush(xmlParserCtxtPtr ctxt, int val) { if (ctxt->spaceNr >= ctxt->spaceMax) { + int *tmp; + ctxt->spaceMax *= 2; - ctxt->spaceTab = (int *) xmlRealloc(ctxt->spaceTab, - ctxt->spaceMax * sizeof(ctxt->spaceTab[0])); - if (ctxt->spaceTab == NULL) { + tmp = (int *) xmlRealloc(ctxt->spaceTab, + ctxt->spaceMax * sizeof(ctxt->spaceTab[0])); + if (tmp == NULL) { xmlErrMemory(ctxt, NULL); return(0); } + ctxt->spaceTab = tmp; } ctxt->spaceTab[ctxt->spaceNr] = val; ctxt->space = &ctxt->spaceTab[ctxt->spaceNr]; @@ -1966,6 +2086,7 @@ xmlNewBlanksWrapperInputStream(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) { buffer = xmlMallocAtomic(length); if (buffer == NULL) { xmlErrMemory(ctxt, NULL); + xmlFree(input); return(NULL); } buffer [0] = ' '; @@ -2182,7 +2303,7 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) { xmlChar *tmp; \ buffer##_size *= 2; \ tmp = (xmlChar *) \ - xmlRealloc(buffer, buffer##_size * sizeof(xmlChar)); \ + xmlRealloc(buffer, buffer##_size * sizeof(xmlChar)); \ if (tmp == NULL) goto mem_error; \ buffer = tmp; \ } @@ -2213,6 +2334,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, int buffer_size = 0; xmlChar *current = NULL; + xmlChar *rep = NULL; const xmlChar *last; xmlEntityPtr ent; int c,l; @@ -2272,8 +2394,6 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, "predefined entity has no content\n"); } } else if ((ent != NULL) && (ent->content != NULL)) { - xmlChar *rep; - ctxt->depth++; rep = xmlStringDecodeEntities(ctxt, ent->content, what, 0, 0, 0); @@ -2288,6 +2408,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, } } xmlFree(rep); + rep = NULL; } } else if (ent != NULL) { int i = xmlStrlen(ent->name); @@ -2307,8 +2428,10 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, "String decoding PE Reference: %.30s\n", str); ent = xmlParseStringPEReference(ctxt, &str); if (ent != NULL) { - xmlChar *rep; - + if (ent->content == NULL) { + if (xmlLoadEntityContent(ctxt, ent) < 0) { + } + } ctxt->depth++; rep = xmlStringDecodeEntities(ctxt, ent->content, what, 0, 0, 0); @@ -2323,6 +2446,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, } } xmlFree(rep); + rep = NULL; } } } else { @@ -2342,6 +2466,10 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, mem_error: xmlErrMemory(ctxt, NULL); + if (rep != NULL) + xmlFree(rep); + if (buffer != NULL) + xmlFree(buffer); return(NULL); } @@ -2456,7 +2584,7 @@ static int areBlanks(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, * xmlSplitQName: * @ctxt: an XML parser context * @name: an XML parser context - * @prefix: a xmlChar ** + * @prefix: a xmlChar ** * * parse an UTF8 encoded XML qualified name string * @@ -2507,7 +2635,7 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) { * for the processing speed. */ max = len * 2; - + buffer = (xmlChar *) xmlMallocAtomic(max * sizeof(xmlChar)); if (buffer == NULL) { xmlErrMemory(ctxt, NULL); @@ -2522,7 +2650,7 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) { tmp = (xmlChar *) xmlRealloc(buffer, max * sizeof(xmlChar)); if (tmp == NULL) { - xmlFree(tmp); + xmlFree(buffer); xmlErrMemory(ctxt, NULL); return(NULL); } @@ -2533,7 +2661,7 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) { } buffer[len] = 0; } - + if ((c == ':') && (*cur == 0)) { if (buffer != NULL) xmlFree(buffer); @@ -2586,7 +2714,7 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) { * for the processing speed. */ max = len * 2; - + buffer = (xmlChar *) xmlMallocAtomic(max * sizeof(xmlChar)); if (buffer == NULL) { xmlErrMemory(ctxt, NULL); @@ -2612,7 +2740,7 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) { } buffer[len] = 0; } - + if (buffer == NULL) ret = xmlStrndup(buf, len); else { @@ -3085,6 +3213,7 @@ static xmlChar * xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { xmlChar limit = 0; xmlChar *buf = NULL; + xmlChar *rep = NULL; int len = 0; int buf_size = 0; int c, l, in_space = 0; @@ -3103,7 +3232,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { xmlFatalErr(ctxt, XML_ERR_ATTRIBUTE_NOT_STARTED, NULL); return(NULL); } - + /* * allocate a translation buffer. */ @@ -3143,7 +3272,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { buf[len++] = '8'; buf[len++] = ';'; } - } else { + } else if (val != 0) { if (len > buf_size - 10) { growBuffer(buf); } @@ -3168,8 +3297,6 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { } } else if ((ent != NULL) && (ctxt->replaceEntities != 0)) { - xmlChar *rep; - if (ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) { rep = xmlStringDecodeEntities(ctxt, ent->content, XML_SUBSTITUTE_REF, @@ -3183,6 +3310,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { } } xmlFree(rep); + rep = NULL; } } else { if (len > buf_size - 10) { @@ -3201,11 +3329,12 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { */ if ((ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) && (ent->content != NULL)) { - xmlChar *rep; rep = xmlStringDecodeEntities(ctxt, ent->content, - XML_SUBSTITUTE_REF, 0, 0, 0); - if (rep != NULL) + XML_SUBSTITUTE_REF, 0, 0, 0); + if (rep != NULL) { xmlFree(rep); + rep = NULL; + } } /* @@ -3264,6 +3393,10 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { mem_error: xmlErrMemory(ctxt, NULL); + if (buf != NULL) + xmlFree(buf); + if (rep != NULL) + xmlFree(rep); return(NULL); } @@ -4532,6 +4665,10 @@ xmlParseEntityDecl(xmlParserCtxtPtr ctxt) { (xmlStrEqual(ctxt->myDoc->version, SAX_COMPAT_MODE))) { if (ctxt->myDoc == NULL) { ctxt->myDoc = xmlNewDoc(SAX_COMPAT_MODE); + if (ctxt->myDoc == NULL) { + xmlErrMemory(ctxt, "New Doc failed"); + return; + } } if (ctxt->myDoc->intSubset == NULL) ctxt->myDoc->intSubset = xmlNewDtd(ctxt->myDoc, @@ -4600,6 +4737,10 @@ xmlParseEntityDecl(xmlParserCtxtPtr ctxt) { (xmlStrEqual(ctxt->myDoc->version, SAX_COMPAT_MODE)))) { if (ctxt->myDoc == NULL) { ctxt->myDoc = xmlNewDoc(SAX_COMPAT_MODE); + if (ctxt->myDoc == NULL) { + xmlErrMemory(ctxt, "New Doc failed"); + return; + } } if (ctxt->myDoc->intSubset == NULL) @@ -5013,6 +5154,8 @@ xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt) { xmlFreeEnumeration(tree); break; } + if ((type != XML_ATTRIBUTE_CDATA) && (defaultValue != NULL)) + xmlAttrNormalizeSpace(defaultValue, defaultValue); GROW; if (RAW != '>') { @@ -5102,6 +5245,8 @@ xmlParseElementMixedContentDecl(xmlParserCtxtPtr ctxt, int inputchk) { } NEXT; ret = xmlNewDocElementContent(ctxt->myDoc, NULL, XML_ELEMENT_CONTENT_PCDATA); + if (ret == NULL) + return(NULL); if (RAW == '*') { ret->ocur = XML_ELEMENT_CONTENT_MULT; NEXT; @@ -5332,6 +5477,8 @@ xmlParseElementChildrenContentDecl (xmlParserCtxtPtr ctxt, int inputchk) { } } else { xmlFatalErr(ctxt, XML_ERR_ELEMCONTENT_NOT_FINISHED, NULL); + if ((last != NULL) && (last != ret)) + xmlFreeDocElementContent(ctxt->myDoc, last); if (ret != NULL) xmlFreeDocElementContent(ctxt->myDoc, ret); return(NULL); @@ -5355,6 +5502,11 @@ xmlParseElementChildrenContentDecl (xmlParserCtxtPtr ctxt, int inputchk) { return(NULL); } last = xmlNewDocElementContent(ctxt->myDoc, elem, XML_ELEMENT_CONTENT_ELEMENT); + if (last == NULL) { + if (ret != NULL) + xmlFreeDocElementContent(ctxt->myDoc, ret); + return(NULL); + } if (RAW == '?') { last->ocur = XML_ELEMENT_CONTENT_OPT; NEXT; @@ -5907,6 +6059,21 @@ xmlParseExternalSubset(xmlParserCtxtPtr ctxt, const xmlChar *ExternalID, const xmlChar *SystemID) { xmlDetectSAX2(ctxt); GROW; + + if ((ctxt->encoding == (const xmlChar *)XML_CHAR_ENCODING_NONE) && + (ctxt->input->end - ctxt->input->cur >= 4)) { + xmlChar start[4]; + xmlCharEncoding enc; + + start[0] = RAW; + start[1] = NXT(1); + start[2] = NXT(2); + start[3] = NXT(3); + enc = xmlDetectCharEncoding(start, 4); + if (enc != XML_CHAR_ENCODING_NONE) + xmlSwitchEncoding(ctxt, enc); + } + if (CMP5(CUR_PTR, '<', '?', 'x', 'm', 'l')) { xmlParseTextDecl(ctxt); if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) { @@ -5982,6 +6149,8 @@ xmlParseReference(xmlParserCtxtPtr ctxt) { int hex = NXT(2); int value = xmlParseCharRef(ctxt); + if (value == 0) + return; if (ctxt->charset != XML_CHAR_ENCODING_UTF8) { /* * So we are using non-UTF-8 buffers @@ -6825,6 +6994,86 @@ xmlParsePEReference(xmlParserCtxtPtr ctxt) } } +/** + * xmlLoadEntityContent: + * @ctxt: an XML parser context + * @entity: an unloaded system entity + * + * Load the original content of the given system entity from the + * ExternalID/SystemID given. This is to be used for Included in Literal + * http://www.w3.org/TR/REC-xml/#inliteral processing of entities references + * + * Returns 0 in case of success and -1 in case of failure + */ +static int +xmlLoadEntityContent(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) { + xmlParserInputPtr input; + xmlBufferPtr buf; + int l, c; + int count = 0; + + if ((ctxt == NULL) || (entity == NULL) || + ((entity->etype != XML_EXTERNAL_PARAMETER_ENTITY) && + (entity->etype != XML_EXTERNAL_GENERAL_PARSED_ENTITY)) || + (entity->content != NULL)) { + xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, + "xmlLoadEntityContent parameter error"); + return(-1); + } + + if (xmlParserDebugEntities) + xmlGenericError(xmlGenericErrorContext, + "Reading %s entity content input\n", entity->name); + + buf = xmlBufferCreate(); + if (buf == NULL) { + xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, + "xmlLoadEntityContent parameter error"); + return(-1); + } + + input = xmlNewEntityInputStream(ctxt, entity); + if (input == NULL) { + xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, + "xmlLoadEntityContent input error"); + xmlBufferFree(buf); + return(-1); + } + + /* + * 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); + GROW; + c = CUR_CHAR(l); + while ((ctxt->input == input) && (ctxt->input->cur < ctxt->input->end) && + (IS_CHAR(c))) { + xmlBufferAdd(buf, ctxt->input->cur, l); + if (count++ > 100) { + count = 0; + GROW; + } + NEXTL(l); + c = CUR_CHAR(l); + } + + if ((ctxt->input == input) && (ctxt->input->cur >= ctxt->input->end)) { + xmlPopInput(ctxt); + } else if (!IS_CHAR(c)) { + xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR, + "xmlLoadEntityContent: invalid char value %d\n", + c); + xmlBufferFree(buf); + return(-1); + } + entity->content = buf->content; + buf->content = NULL; + xmlBufferFree(buf); + + return(0); +} + /** * xmlParseStringPEReference: * @ctxt: an XML parser context @@ -6836,7 +7085,7 @@ xmlParsePEReference(xmlParserCtxtPtr ctxt) * * [ WFC: No Recursion ] * A parsed entity must not contain a recursive - * reference to itself, either directly or indirectly. + * reference to itself, either directly or indirectly. * * [ WFC: Entity Declared ] * In a document without any DTD, a document with only an internal DTD @@ -7811,9 +8060,10 @@ need_complex: static const xmlChar * xmlParseAttribute2(xmlParserCtxtPtr ctxt, - const xmlChar *pref, const xmlChar *elem, - const xmlChar **prefix, xmlChar **value, - int *len, int *alloc) { + const xmlChar * pref, const xmlChar * elem, + const xmlChar ** prefix, xmlChar ** value, + int *len, int *alloc) +{ const xmlChar *name; xmlChar *val, *internal_val = NULL; int normalize = 0; @@ -7822,9 +8072,9 @@ xmlParseAttribute2(xmlParserCtxtPtr ctxt, GROW; name = xmlParseQName(ctxt, prefix); if (name == NULL) { - xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, - "error parsing attribute name\n"); - return(NULL); + xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, + "error parsing attribute name\n"); + return (NULL); } /* @@ -7834,8 +8084,9 @@ xmlParseAttribute2(xmlParserCtxtPtr ctxt, int type; type = (int) (long) xmlHashQLookup2(ctxt->attsSpecial, - pref, elem, *prefix, name); - if (type != 0) normalize = 1; + pref, elem, *prefix, name); + if (type != 0) + normalize = 1; } /* @@ -7844,54 +8095,71 @@ xmlParseAttribute2(xmlParserCtxtPtr ctxt, SKIP_BLANKS; if (RAW == '=') { NEXT; - SKIP_BLANKS; - val = xmlParseAttValueInternal(ctxt, len, alloc, normalize); - ctxt->instate = XML_PARSER_CONTENT; + SKIP_BLANKS; + val = xmlParseAttValueInternal(ctxt, len, alloc, normalize); + if (normalize) { + /* + * Sometimes a second normalisation pass for spaces is needed + * but that only happens if charrefs or entities refernces + * have been used in the attribute value, i.e. the attribute + * value have been extracted in an allocated string already. + */ + if (*alloc) { + const xmlChar *val2; + + val2 = xmlAttrNormalizeSpace2(ctxt, val, len); + if (val2 != NULL) { + xmlFree(val); + val = (xmlChar *) val2; + } + } + } + ctxt->instate = XML_PARSER_CONTENT; } else { - xmlFatalErrMsgStr(ctxt, XML_ERR_ATTRIBUTE_WITHOUT_VALUE, - "Specification mandate value for attribute %s\n", name); - return(NULL); + xmlFatalErrMsgStr(ctxt, XML_ERR_ATTRIBUTE_WITHOUT_VALUE, + "Specification mandate value for attribute %s\n", + name); + return (NULL); } - if (*prefix == ctxt->str_xml) { - /* - * Check that xml:lang conforms to the specification - * No more registered as an error, just generate a warning now - * since this was deprecated in XML second edition - */ - if ((ctxt->pedantic) && (xmlStrEqual(name, BAD_CAST "lang"))) { - internal_val = xmlStrndup(val, *len); - if (!xmlCheckLanguageID(internal_val)) { - xmlWarningMsg(ctxt, XML_WAR_LANG_VALUE, - "Malformed value for xml:lang : %s\n", - internal_val, NULL); - } - } + if (*prefix == ctxt->str_xml) { + /* + * Check that xml:lang conforms to the specification + * No more registered as an error, just generate a warning now + * since this was deprecated in XML second edition + */ + if ((ctxt->pedantic) && (xmlStrEqual(name, BAD_CAST "lang"))) { + internal_val = xmlStrndup(val, *len); + if (!xmlCheckLanguageID(internal_val)) { + xmlWarningMsg(ctxt, XML_WAR_LANG_VALUE, + "Malformed value for xml:lang : %s\n", + internal_val, NULL); + } + } - /* - * Check that xml:space conforms to the specification - */ - if (xmlStrEqual(name, BAD_CAST "space")) { - internal_val = xmlStrndup(val, *len); - if (xmlStrEqual(internal_val, BAD_CAST "default")) - *(ctxt->space) = 0; - else if (xmlStrEqual(internal_val, BAD_CAST "preserve")) - *(ctxt->space) = 1; - else { - xmlWarningMsg(ctxt, XML_WAR_SPACE_VALUE, -"Invalid value \"%s\" for xml:space : \"default\" or \"preserve\" expected\n", - internal_val, NULL); - } - } - if (internal_val) { - xmlFree(internal_val); - } - } + /* + * Check that xml:space conforms to the specification + */ + if (xmlStrEqual(name, BAD_CAST "space")) { + internal_val = xmlStrndup(val, *len); + if (xmlStrEqual(internal_val, BAD_CAST "default")) + *(ctxt->space) = 0; + else if (xmlStrEqual(internal_val, BAD_CAST "preserve")) + *(ctxt->space) = 1; + else { + xmlWarningMsg(ctxt, XML_WAR_SPACE_VALUE, + "Invalid value \"%s\" for xml:space : \"default\" or \"preserve\" expected\n", + internal_val, NULL); + } + } + if (internal_val) { + xmlFree(internal_val); + } + } *value = val; - return(name); + return (name); } - /** * xmlParseStartTag2: * @ctxt: an XML parser context @@ -8763,6 +9031,7 @@ xmlParseVersionNum(xmlParserCtxtPtr ctxt) { size *= 2; tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); if (tmp == NULL) { + xmlFree(buf); xmlErrMemory(ctxt, NULL); return(NULL); } @@ -8779,11 +9048,11 @@ xmlParseVersionNum(xmlParserCtxtPtr ctxt) { /** * xmlParseVersionInfo: * @ctxt: an XML parser context - * + * * parse the XML version. * * [24] VersionInfo ::= S 'version' Eq (' VersionNum ' | " VersionNum ") - * + * * [25] Eq ::= S? '=' S? * * Returns the version string, e.g. "1.0" @@ -10163,7 +10432,20 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) { ctxt->input->cur += tmp; goto encoding_error; } - if ((ctxt->sax != NULL) && (base > 0) && + if ((ctxt->sax != NULL) && (base == 0) && + (ctxt->sax->cdataBlock != NULL) && + (!ctxt->disableSAX)) { + /* + * Special case to provide identical behaviour + * between pull and push parsers on enpty CDATA + * sections + */ + if ((ctxt->input->cur - ctxt->input->base >= 9) && + (!strncmp((const char *)&ctxt->input->cur[-9], + "sax->cdataBlock(ctxt->userData, + BAD_CAST "", 0); + } else if ((ctxt->sax != NULL) && (base > 0) && (!ctxt->disableSAX)) { if (ctxt->sax->cdataBlock != NULL) ctxt->sax->cdataBlock(ctxt->userData, @@ -12003,13 +12285,14 @@ xmlParseInNodeContext(xmlNodePtr node, const char *data, int datalen, * * Returns 0 if the chunk is well balanced, -1 in case of args problem 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, assuming the parsing succeeded to + * some extent. */ int xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, xmlSAXHandlerPtr sax, - void *user_data, int depth, const xmlChar *string, xmlNodePtr *lst, + void *user_data, int depth, const xmlChar *string, xmlNodePtr *lst, int recover) { xmlParserCtxtPtr ctxt; xmlDocPtr newDoc; @@ -12361,7 +12644,6 @@ xmlSAXParseFileWithData(xmlSAXHandlerPtr sax, const char *filename, int recovery, void *data) { xmlDocPtr ret; xmlParserCtxtPtr ctxt; - char *directory = NULL; xmlInitParser(); @@ -12379,10 +12661,8 @@ xmlSAXParseFileWithData(xmlSAXHandlerPtr sax, const char *filename, ctxt->_private = data; } - if ((ctxt->directory == NULL) && (directory == NULL)) - directory = xmlParserGetDirectory(filename); - if ((ctxt->directory == NULL) && (directory != NULL)) - ctxt->directory = (char *) xmlStrdup((xmlChar *) directory); + if (ctxt->directory == NULL) + ctxt->directory = xmlParserGetDirectory(filename); ctxt->recovery = recovery; @@ -12435,9 +12715,10 @@ xmlSAXParseFile(xmlSAXHandlerPtr sax, const char *filename, * @cur: a pointer to an array of xmlChar * * parse an XML in-memory document and build a tree. - * In the case the document is not Well Formed, a tree is built anyway - * - * Returns the resulting document tree + * In the case the document is not Well Formed, a attempt to build a + * tree is tried anyway + * + * Returns the resulting document tree or NULL in case of failure */ xmlDocPtr @@ -12467,9 +12748,10 @@ xmlParseFile(const char *filename) { * * parse an XML file and build a tree. Automatic support for ZLIB/Compress * compressed document is provided by default if found at compile-time. - * In the case the document is not Well Formed, a tree is built anyway + * In the case the document is not Well Formed, it attempts to build + * a tree anyway * - * Returns the resulting document tree + * Returns the resulting document tree or NULL in case of failure */ xmlDocPtr @@ -12711,9 +12993,10 @@ xmlDocPtr xmlParseMemory(const char *buffer, int size) { * @size: the size of the array * * parse an XML in-memory block and build a tree. - * In the case the document is not Well Formed, a tree is built anyway - * - * Returns the resulting document tree + * In the case the document is not Well Formed, an attempt to + * build a tree is tried anyway + * + * Returns the resulting document tree or NULL in case of error */ xmlDocPtr xmlRecoverMemory(const char *buffer, int size) { @@ -12949,12 +13232,15 @@ xmlInitParser(void) { /** * xmlCleanupParser: * - * Cleanup function for the XML library. It tries to reclaim all - * parsing related global memory allocated for the library processing. - * It doesn't deallocate any document related memory. Calling this - * function should not prevent reusing the library but one should - * call xmlCleanupParser() only when the process has - * finished using the library or XML document built with it. + * This function name is somewhat misleading. It does not clean up + * parser state, it cleans up memory allocated by the library itself. + * It is a cleanup function for the XML library. It tries to reclaim all + * related global memory allocated for the library processing. + * It doesn't deallocate any document related memory. One should + * call xmlCleanupParser() only when the process has finished using + * the library and all XML/HTML documents built with it. + * See also xmlInitParser() which has the opposite function of preparing + * the library for operations. */ void diff --git a/python/Makefile.am b/python/Makefile.am index 667c2c8..23898fa 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -9,21 +9,17 @@ INCLUDES = \ -I$(top_builddir)/include \ -I$(top_builddir)/$(subdir) -DOCS_DIR = $(datadir)/doc/libxml2-python-$(LIBXML_VERSION) +docsdir = $(datadir)/doc/libxml2-python-$(LIBXML_VERSION) # libxml2class.txt is generated -DOCS = ${srcdir}/TODO +dist_docs_DATA = TODO EXTRA_DIST = \ - libxml.c \ - types.c \ setup.py \ setup.py.in \ generator.py \ libxml_wrap.h \ libxml.py \ - drv_libxml2.py \ - libxml2-python-api.xml \ - $(DOCS) + libxml2-python-api.xml libxml2mod_la_LDFLAGS = @CYGWIN_EXTRA_LDFLAGS@ @WIN32_EXTRA_LDFLAGS@ -module -avoid-version @@ -31,29 +27,23 @@ if WITH_PYTHON mylibs = \ $(top_builddir)/libxml2.la -all-local: libxml2.py - python_LTLIBRARIES = libxml2mod.la -libxml2mod_la_SOURCES = libxml.c types.c libxml2-py.c +libxml2mod_la_SOURCES = libxml.c types.c +nodist_libxml2mod_la_SOURCES = libxml2-py.c libxml2mod_la_LIBADD = $(mylibs) @CYGWIN_EXTRA_PYTHON_LIBADD@ +libxml.c: libxml2-py.h # to generate before to compile + + libxml2.py: $(srcdir)/libxml.py libxml2class.py - cat $(srcdir)/libxml.py libxml2class.py > libxml2.py - -install-data-local: - $(mkinstalldirs) $(DESTDIR)$(pythondir) - @INSTALL@ -m 0644 libxml2.py $(DESTDIR)$(pythondir) - @INSTALL@ -m 0644 $(srcdir)/drv_libxml2.py $(DESTDIR)$(pythondir) - $(mkinstalldirs) $(DESTDIR)$(DOCS_DIR) - @(for doc in $(DOCS) ; \ - do @INSTALL@ -m 0644 $$doc $(DESTDIR)$(DOCS_DIR) ; done) - -uninstall-local: - @(for doc in $(DOCS) ; \ - do rm $(DESTDIR)$(DOCS_DIR)/`basename $$doc` ; done) - rm $(DESTDIR)$(pythondir)/drv_libxml2.py - rm $(DESTDIR)$(pythondir)/libxml2.py + cat $(srcdir)/libxml.py libxml2class.py > $@ + +python_DATA = \ + libxml2.py + +dist_python_DATA = \ + drv_libxml2.py GENERATE = generator.py API_DESC = $(top_srcdir)/doc/libxml2-api.xml $(srcdir)/libxml2-python-api.xml @@ -70,12 +60,8 @@ $(GENERATED): gen_prog gen_prog: $(srcdir)/$(GENERATE) $(API_DESC) $(PYTHON) $(srcdir)/$(GENERATE) $(srcdir) touch gen_prog - -$(libxml2mod_la_OBJECTS): $(GENERATED) - -else -all: endif + tests test: all cd tests && $(MAKE) MAKEFLAGS+=--silent tests diff --git a/python/Makefile.in b/python/Makefile.in index fb1acf5..7ffe750 100644 --- a/python/Makefile.in +++ b/python/Makefile.in @@ -14,6 +14,7 @@ @SET_MAKE@ + VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -33,7 +34,8 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = python -DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ +DIST_COMMON = README $(am__dist_python_DATA_DIST) $(dist_docs_DATA) \ + $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/setup.py.in TODO ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ @@ -49,14 +51,16 @@ am__vpath_adj = case $$p in \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pythondir)" +am__installdirs = "$(DESTDIR)$(pythondir)" "$(DESTDIR)$(docsdir)" \ + "$(DESTDIR)$(pythondir)" "$(DESTDIR)$(pythondir)" pythonLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(python_LTLIBRARIES) @WITH_PYTHON_TRUE@libxml2mod_la_DEPENDENCIES = $(mylibs) -am__libxml2mod_la_SOURCES_DIST = libxml.c types.c libxml2-py.c -@WITH_PYTHON_TRUE@am_libxml2mod_la_OBJECTS = libxml.lo types.lo \ -@WITH_PYTHON_TRUE@ libxml2-py.lo -libxml2mod_la_OBJECTS = $(am_libxml2mod_la_OBJECTS) +am__libxml2mod_la_SOURCES_DIST = libxml.c types.c +@WITH_PYTHON_TRUE@am_libxml2mod_la_OBJECTS = libxml.lo types.lo +@WITH_PYTHON_TRUE@nodist_libxml2mod_la_OBJECTS = libxml2-py.lo +libxml2mod_la_OBJECTS = $(am_libxml2mod_la_OBJECTS) \ + $(nodist_libxml2mod_la_OBJECTS) libxml2mod_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libxml2mod_la_LDFLAGS) $(LDFLAGS) -o $@ @@ -73,7 +77,7 @@ CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ -SOURCES = $(libxml2mod_la_SOURCES) +SOURCES = $(libxml2mod_la_SOURCES) $(nodist_libxml2mod_la_SOURCES) DIST_SOURCES = $(am__libxml2mod_la_SOURCES_DIST) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ @@ -82,6 +86,11 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive +dist_docsDATA_INSTALL = $(INSTALL_DATA) +am__dist_python_DATA_DIST = drv_libxml2.py +dist_pythonDATA_INSTALL = $(INSTALL_DATA) +pythonDATA_INSTALL = $(INSTALL_DATA) +DATA = $(dist_docs_DATA) $(dist_python_DATA) $(python_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive ETAGS = etags @@ -313,28 +322,31 @@ INCLUDES = \ -I$(top_builddir)/include \ -I$(top_builddir)/$(subdir) -DOCS_DIR = $(datadir)/doc/libxml2-python-$(LIBXML_VERSION) +docsdir = $(datadir)/doc/libxml2-python-$(LIBXML_VERSION) # libxml2class.txt is generated -DOCS = ${srcdir}/TODO +dist_docs_DATA = TODO EXTRA_DIST = \ - libxml.c \ - types.c \ setup.py \ setup.py.in \ generator.py \ libxml_wrap.h \ libxml.py \ - drv_libxml2.py \ - libxml2-python-api.xml \ - $(DOCS) + libxml2-python-api.xml libxml2mod_la_LDFLAGS = @CYGWIN_EXTRA_LDFLAGS@ @WIN32_EXTRA_LDFLAGS@ -module -avoid-version @WITH_PYTHON_TRUE@mylibs = \ @WITH_PYTHON_TRUE@ $(top_builddir)/libxml2.la @WITH_PYTHON_TRUE@python_LTLIBRARIES = libxml2mod.la -@WITH_PYTHON_TRUE@libxml2mod_la_SOURCES = libxml.c types.c libxml2-py.c +@WITH_PYTHON_TRUE@libxml2mod_la_SOURCES = libxml.c types.c +@WITH_PYTHON_TRUE@nodist_libxml2mod_la_SOURCES = libxml2-py.c @WITH_PYTHON_TRUE@libxml2mod_la_LIBADD = $(mylibs) @CYGWIN_EXTRA_PYTHON_LIBADD@ +@WITH_PYTHON_TRUE@python_DATA = \ +@WITH_PYTHON_TRUE@ libxml2.py + +@WITH_PYTHON_TRUE@dist_python_DATA = \ +@WITH_PYTHON_TRUE@ drv_libxml2.py + @WITH_PYTHON_TRUE@GENERATE = generator.py @WITH_PYTHON_TRUE@API_DESC = $(top_srcdir)/doc/libxml2-api.xml $(srcdir)/libxml2-python-api.xml @WITH_PYTHON_TRUE@GENERATED = libxml2class.py \ @@ -445,6 +457,57 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs +install-dist_docsDATA: $(dist_docs_DATA) + @$(NORMAL_INSTALL) + test -z "$(docsdir)" || $(MKDIR_P) "$(DESTDIR)$(docsdir)" + @list='$(dist_docs_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(dist_docsDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(docsdir)/$$f'"; \ + $(dist_docsDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(docsdir)/$$f"; \ + done + +uninstall-dist_docsDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_docs_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(docsdir)/$$f'"; \ + rm -f "$(DESTDIR)$(docsdir)/$$f"; \ + done +install-dist_pythonDATA: $(dist_python_DATA) + @$(NORMAL_INSTALL) + test -z "$(pythondir)" || $(MKDIR_P) "$(DESTDIR)$(pythondir)" + @list='$(dist_python_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(dist_pythonDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pythondir)/$$f'"; \ + $(dist_pythonDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pythondir)/$$f"; \ + done + +uninstall-dist_pythonDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_python_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pythondir)/$$f'"; \ + rm -f "$(DESTDIR)$(pythondir)/$$f"; \ + done +install-pythonDATA: $(python_DATA) + @$(NORMAL_INSTALL) + test -z "$(pythondir)" || $(MKDIR_P) "$(DESTDIR)$(pythondir)" + @list='$(python_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(pythonDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pythondir)/$$f'"; \ + $(pythonDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pythondir)/$$f"; \ + done + +uninstall-pythonDATA: + @$(NORMAL_UNINSTALL) + @list='$(python_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pythondir)/$$f'"; \ + rm -f "$(DESTDIR)$(pythondir)/$$f"; \ + done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. @@ -622,11 +685,10 @@ distdir: $(DISTFILES) done check-am: all-am check: check-recursive -@WITH_PYTHON_FALSE@all-local: -all-am: Makefile $(LTLIBRARIES) all-local +all-am: Makefile $(LTLIBRARIES) $(DATA) installdirs: installdirs-recursive installdirs-am: - for dir in "$(DESTDIR)$(pythondir)"; do \ + for dir in "$(DESTDIR)$(pythondir)" "$(DESTDIR)$(docsdir)" "$(DESTDIR)$(pythondir)" "$(DESTDIR)$(pythondir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive @@ -654,8 +716,6 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -@WITH_PYTHON_FALSE@uninstall-local: -@WITH_PYTHON_FALSE@install-data-local: clean: clean-recursive clean-am: clean-generic clean-libtool clean-pythonLTLIBRARIES \ @@ -677,7 +737,8 @@ info: info-recursive info-am: -install-data-am: install-data-local install-pythonLTLIBRARIES +install-data-am: install-dist_docsDATA install-dist_pythonDATA \ + install-pythonDATA install-pythonLTLIBRARIES install-dvi: install-dvi-recursive @@ -713,47 +774,35 @@ ps: ps-recursive ps-am: -uninstall-am: uninstall-local uninstall-pythonLTLIBRARIES +uninstall-am: uninstall-dist_docsDATA uninstall-dist_pythonDATA \ + uninstall-pythonDATA uninstall-pythonLTLIBRARIES .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ install-strip .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ - all all-am all-local check check-am clean clean-generic \ - clean-libtool clean-pythonLTLIBRARIES ctags ctags-recursive \ - distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-data-local install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am \ - install-pythonLTLIBRARIES install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-recursive uninstall uninstall-am uninstall-local \ - uninstall-pythonLTLIBRARIES - - -@WITH_PYTHON_TRUE@all-local: libxml2.py + all all-am check check-am clean clean-generic clean-libtool \ + clean-pythonLTLIBRARIES ctags ctags-recursive distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am \ + install-dist_docsDATA install-dist_pythonDATA install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-pythonDATA install-pythonLTLIBRARIES install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ + uninstall-dist_docsDATA uninstall-dist_pythonDATA \ + uninstall-pythonDATA uninstall-pythonLTLIBRARIES + + +@WITH_PYTHON_TRUE@libxml.c: libxml2-py.h # to generate before to compile @WITH_PYTHON_TRUE@libxml2.py: $(srcdir)/libxml.py libxml2class.py -@WITH_PYTHON_TRUE@ cat $(srcdir)/libxml.py libxml2class.py > libxml2.py - -@WITH_PYTHON_TRUE@install-data-local: -@WITH_PYTHON_TRUE@ $(mkinstalldirs) $(DESTDIR)$(pythondir) -@WITH_PYTHON_TRUE@ @INSTALL@ -m 0644 libxml2.py $(DESTDIR)$(pythondir) -@WITH_PYTHON_TRUE@ @INSTALL@ -m 0644 $(srcdir)/drv_libxml2.py $(DESTDIR)$(pythondir) -@WITH_PYTHON_TRUE@ $(mkinstalldirs) $(DESTDIR)$(DOCS_DIR) -@WITH_PYTHON_TRUE@ @(for doc in $(DOCS) ; \ -@WITH_PYTHON_TRUE@ do @INSTALL@ -m 0644 $$doc $(DESTDIR)$(DOCS_DIR) ; done) - -@WITH_PYTHON_TRUE@uninstall-local: -@WITH_PYTHON_TRUE@ @(for doc in $(DOCS) ; \ -@WITH_PYTHON_TRUE@ do rm $(DESTDIR)$(DOCS_DIR)/`basename $$doc` ; done) -@WITH_PYTHON_TRUE@ rm $(DESTDIR)$(pythondir)/drv_libxml2.py -@WITH_PYTHON_TRUE@ rm $(DESTDIR)$(pythondir)/libxml2.py +@WITH_PYTHON_TRUE@ cat $(srcdir)/libxml.py libxml2class.py > $@ @WITH_PYTHON_TRUE@$(GENERATED): gen_prog @@ -761,9 +810,6 @@ uninstall-am: uninstall-local uninstall-pythonLTLIBRARIES @WITH_PYTHON_TRUE@ $(PYTHON) $(srcdir)/$(GENERATE) $(srcdir) @WITH_PYTHON_TRUE@ touch gen_prog -@WITH_PYTHON_TRUE@$(libxml2mod_la_OBJECTS): $(GENERATED) - -@WITH_PYTHON_FALSE@all: tests test: all cd tests && $(MAKE) MAKEFLAGS+=--silent tests # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/python/generator.py b/python/generator.py index a38a23c..8cf327b 100755 --- a/python/generator.py +++ b/python/generator.py @@ -849,6 +849,9 @@ def writeDoc(name, args, indent, output): output.write(indent) output.write('"""') while len(val) > 60: + if val[0] == " ": + val = val[1:] + continue str = val[0:60] i = string.rfind(str, " "); if i < 0: diff --git a/python/libxml2-py.c b/python/libxml2-py.c deleted file mode 100644 index adf552f..0000000 --- a/python/libxml2-py.c +++ /dev/null @@ -1,14572 +0,0 @@ -/* Generated */ - -#include -#include -#include -#include -#include "libxml_wrap.h" -#include "libxml2-py.h" - -PyObject * -libxml_xmlGetDocEntity(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlEntityPtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlChar * name; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlGetDocEntity", &pyobj_doc, &name)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlGetDocEntity(doc, name); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsBopomofo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsBopomofo", &code)) - return(NULL); - - c_retval = xmlUCSIsBopomofo(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathNsLookup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const xmlChar * c_retval; - xmlXPathContextPtr ctxt; - PyObject *pyobj_ctxt; - xmlChar * prefix; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlXPathNsLookup", &pyobj_ctxt, &prefix)) - return(NULL); - ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt); - - c_retval = xmlXPathNsLookup(ctxt, prefix); - py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -PyObject * -libxml_xmlStrstr(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const xmlChar * c_retval; - xmlChar * str; - xmlChar * val; - - if (!PyArg_ParseTuple(args, (char *)"zz:xmlStrstr", &str, &val)) - return(NULL); - - c_retval = xmlStrstr(str, val); - py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlReaderForFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlTextReaderPtr c_retval; - char * filename; - char * encoding; - int options; - - if (!PyArg_ParseTuple(args, (char *)"zzi:xmlReaderForFile", &filename, &encoding, &options)) - return(NULL); - - c_retval = xmlReaderForFile(filename, encoding, options); - py_retval = libxml_xmlTextReaderPtrWrap((xmlTextReaderPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderExpand(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderExpand", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderExpand(reader); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -PyObject * -libxml_xmlFreeParserInputBuffer(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserInputBufferPtr in; - PyObject *pyobj_in; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlFreeParserInputBuffer", &pyobj_in)) - return(NULL); - in = (xmlParserInputBufferPtr) PyinputBuffer_Get(pyobj_in); - - xmlFreeParserInputBuffer(in); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsMathematicalAlphanumericSymbols(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsMathematicalAlphanumericSymbols", &code)) - return(NULL); - - c_retval = xmlUCSIsMathematicalAlphanumericSymbols(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_DEBUG_ENABLED) -PyObject * -libxml_xmlDebugDumpNodeList(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - FILE * output; - PyObject *pyobj_output; - xmlNodePtr node; - PyObject *pyobj_node; - int depth; - - if (!PyArg_ParseTuple(args, (char *)"OOi:xmlDebugDumpNodeList", &pyobj_output, &pyobj_node, &depth)) - return(NULL); - output = (FILE *) PyFile_Get(pyobj_output); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - - xmlDebugDumpNodeList(output, node, depth); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_DEBUG_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsHangulJamo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsHangulJamo", &code)) - return(NULL); - - c_retval = xmlUCSIsHangulJamo(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlSchemaWhiteSpaceReplace(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlChar * value; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlSchemaWhiteSpaceReplace", &value)) - return(NULL); - - c_retval = xmlSchemaWhiteSpaceReplace(value); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -#if defined(LIBXML_FTP_ENABLED) -PyObject * -libxml_xmlNanoFTPCleanup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - - xmlNanoFTPCleanup(); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_FTP_ENABLED) */ -#if defined(LIBXML_VALID_ENABLED) -PyObject * -libxml_xmlValidateOneElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlValidCtxtPtr ctxt; - PyObject *pyobj_ctxt; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlNodePtr elem; - PyObject *pyobj_elem; - - if (!PyArg_ParseTuple(args, (char *)"OOO:xmlValidateOneElement", &pyobj_ctxt, &pyobj_doc, &pyobj_elem)) - return(NULL); - ctxt = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_ctxt); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem); - - c_retval = xmlValidateOneElement(ctxt, doc, elem); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_VALID_ENABLED) */ -PyObject * -libxml_xmlGetID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlAttrPtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlChar * ID; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlGetID", &pyobj_doc, &ID)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlGetID(doc, ID); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsMalayalam(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsMalayalam", &code)) - return(NULL); - - c_retval = xmlUCSIsMalayalam(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlXPathInit(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - - xmlXPathInit(); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlRelaxNGFreeParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlRelaxNGParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlRelaxNGFreeParserCtxt", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlRelaxNGParserCtxtPtr) PyrelaxNgParserCtxt_Get(pyobj_ctxt); - - xmlRelaxNGFreeParserCtxt(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -PyObject * -libxml_xmlCheckLanguageID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlChar * lang; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlCheckLanguageID", &lang)) - return(NULL); - - c_retval = xmlCheckLanguageID(lang); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlSchemaSetValidOptions(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlSchemaValidCtxtPtr ctxt; - PyObject *pyobj_ctxt; - int options; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlSchemaSetValidOptions", &pyobj_ctxt, &options)) - return(NULL); - ctxt = (xmlSchemaValidCtxtPtr) PySchemaValidCtxt_Get(pyobj_ctxt); - - c_retval = xmlSchemaSetValidOptions(ctxt, options); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -#if defined(LIBXML_VALID_ENABLED) -PyObject * -libxml_xmlValidCtxtNormalizeAttributeValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlValidCtxtPtr ctxt; - PyObject *pyobj_ctxt; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlNodePtr elem; - PyObject *pyobj_elem; - xmlChar * name; - xmlChar * value; - - if (!PyArg_ParseTuple(args, (char *)"OOOzz:xmlValidCtxtNormalizeAttributeValue", &pyobj_ctxt, &pyobj_doc, &pyobj_elem, &name, &value)) - return(NULL); - ctxt = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_ctxt); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem); - - c_retval = xmlValidCtxtNormalizeAttributeValue(ctxt, doc, elem, name, value); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_VALID_ENABLED) */ -PyObject * -libxml_xmlFreeNs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlNsPtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlFreeNs", &pyobj_cur)) - return(NULL); - cur = (xmlNsPtr) PyxmlNode_Get(pyobj_cur); - - xmlFreeNs(cur); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathNormalizeFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - int nargs; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathNormalizeFunction", &pyobj_ctxt, &nargs)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathNormalizeFunction(ctxt, nargs); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -PyObject * -libxml_xmlGetNoNsProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlNodePtr node; - PyObject *pyobj_node; - xmlChar * name; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlGetNoNsProp", &pyobj_node, &name)) - return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - - c_retval = xmlGetNoNsProp(node, name); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlURIGetPath(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const char * c_retval; - xmlURIPtr URI; - PyObject *pyobj_URI; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlURIGetPath", &pyobj_URI)) - return(NULL); - URI = (xmlURIPtr) PyURI_Get(pyobj_URI); - - c_retval = URI->path; - py_retval = libxml_charPtrConstWrap((const char *) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlNodeAddContentLen(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlNodePtr cur; - PyObject *pyobj_cur; - xmlChar * content; - int len; - - if (!PyArg_ParseTuple(args, (char *)"Ozi:xmlNodeAddContentLen", &pyobj_cur, &content, &len)) - return(NULL); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - xmlNodeAddContentLen(cur, content, len); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_OUTPUT_ENABLED) -PyObject * -libxml_xmlRegisterDefaultOutputCallbacks(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - - xmlRegisterDefaultOutputCallbacks(); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_OUTPUT_ENABLED) */ -#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) -PyObject * -libxml_htmlNodeDumpFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - FILE * out; - PyObject *pyobj_out; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlNodePtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"OOO:htmlNodeDumpFile", &pyobj_out, &pyobj_doc, &pyobj_cur)) - return(NULL); - out = (FILE *) PyFile_Get(pyobj_out); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - htmlNodeDumpFile(out, doc, cur); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathModValues(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathModValues", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathModValues(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_XPTR_ENABLED) -PyObject * -libxml_xmlXPtrRangeToFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - int nargs; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPtrRangeToFunction", &pyobj_ctxt, &nargs)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPtrRangeToFunction(ctxt, nargs); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPTR_ENABLED) */ -#if defined(LIBXML_CATALOG_ENABLED) -PyObject * -libxml_xmlCatalogIsEmpty(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlCatalogPtr catal; - PyObject *pyobj_catal; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlCatalogIsEmpty", &pyobj_catal)) - return(NULL); - catal = (xmlCatalogPtr) Pycatalog_Get(pyobj_catal); - - c_retval = xmlCatalogIsEmpty(catal); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_CATALOG_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderClose(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderClose", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderClose(reader); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_CATALOG_ENABLED) -PyObject * -libxml_xmlLoadSGMLSuperCatalog(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlCatalogPtr c_retval; - char * filename; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlLoadSGMLSuperCatalog", &filename)) - return(NULL); - - c_retval = xmlLoadSGMLSuperCatalog(filename); - py_retval = libxml_xmlCatalogPtrWrap((xmlCatalogPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_CATALOG_ENABLED) */ -PyObject * -libxml_xmlCopyChar(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int len; - xmlChar * out; - int val; - - if (!PyArg_ParseTuple(args, (char *)"izi:xmlCopyChar", &len, &out, &val)) - return(NULL); - - c_retval = xmlCopyChar(len, out, val); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlSchemaNewMemParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlSchemaParserCtxtPtr c_retval; - char * buffer; - int size; - - if (!PyArg_ParseTuple(args, (char *)"zi:xmlSchemaNewMemParserCtxt", &buffer, &size)) - return(NULL); - - c_retval = xmlSchemaNewMemParserCtxt(buffer, size); - py_retval = libxml_xmlSchemaParserCtxtPtrWrap((xmlSchemaParserCtxtPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -PyObject * -libxml_xmlGetDtdQElementDesc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlElementPtr c_retval; - xmlDtdPtr dtd; - PyObject *pyobj_dtd; - xmlChar * name; - xmlChar * prefix; - - if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlGetDtdQElementDesc", &pyobj_dtd, &name, &prefix)) - return(NULL); - dtd = (xmlDtdPtr) PyxmlNode_Get(pyobj_dtd); - - c_retval = xmlGetDtdQElementDesc(dtd, name, prefix); - py_retval = libxml_xmlElementPtrWrap((xmlElementPtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED) -PyObject * -libxml_xmlValidatePopElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlValidCtxtPtr ctxt; - PyObject *pyobj_ctxt; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlNodePtr elem; - PyObject *pyobj_elem; - xmlChar * qname; - - if (!PyArg_ParseTuple(args, (char *)"OOOz:xmlValidatePopElement", &pyobj_ctxt, &pyobj_doc, &pyobj_elem, &qname)) - return(NULL); - ctxt = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_ctxt); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem); - - c_retval = xmlValidatePopElement(ctxt, doc, elem, qname); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathLocalNameFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - int nargs; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathLocalNameFunction", &pyobj_ctxt, &nargs)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathLocalNameFunction(ctxt, nargs); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_LEGACY_ENABLED) -PyObject * -libxml_xmlParserHandleReference(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParserHandleReference", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - xmlParserHandleReference(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_LEGACY_ENABLED) */ -#if defined(LIBXML_HTTP_ENABLED) -PyObject * -libxml_xmlNanoHTTPInit(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - - xmlNanoHTTPInit(); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_HTTP_ENABLED) */ -PyObject * -libxml_xmlCopyNamespaceList(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNsPtr c_retval; - xmlNsPtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlCopyNamespaceList", &pyobj_cur)) - return(NULL); - cur = (xmlNsPtr) PyxmlNode_Get(pyobj_cur); - - c_retval = xmlCopyNamespaceList(cur); - py_retval = libxml_xmlNsPtrWrap((xmlNsPtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsSpecials(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsSpecials", &code)) - return(NULL); - - c_retval = xmlUCSIsSpecials(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlParseCDSect(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParseCDSect", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - xmlParseCDSect(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsLatinExtendedA(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsLatinExtendedA", &code)) - return(NULL); - - c_retval = xmlUCSIsLatinExtendedA(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_TREE_ENABLED) -PyObject * -libxml_xmlCopyDtd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlDtdPtr c_retval; - xmlDtdPtr dtd; - PyObject *pyobj_dtd; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlCopyDtd", &pyobj_dtd)) - return(NULL); - dtd = (xmlDtdPtr) PyxmlNode_Get(pyobj_dtd); - - c_retval = xmlCopyDtd(dtd); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_TREE_ENABLED) */ -#if defined(LIBXML_TREE_ENABLED) -PyObject * -libxml_xmlNodeListGetRawString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlNodePtr list; - PyObject *pyobj_list; - int inLine; - - if (!PyArg_ParseTuple(args, (char *)"OOi:xmlNodeListGetRawString", &pyobj_doc, &pyobj_list, &inLine)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - list = (xmlNodePtr) PyxmlNode_Get(pyobj_list); - - c_retval = xmlNodeListGetRawString(doc, list, inLine); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_TREE_ENABLED) */ -PyObject * -libxml_xmlErrorGetLine(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlErrorPtr Error; - PyObject *pyobj_Error; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlErrorGetLine", &pyobj_Error)) - return(NULL); - Error = (xmlErrorPtr) PyError_Get(pyobj_Error); - - c_retval = Error->line; - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlNewDocNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlNsPtr ns; - PyObject *pyobj_ns; - xmlChar * name; - xmlChar * content; - - if (!PyArg_ParseTuple(args, (char *)"OOzz:xmlNewDocNode", &pyobj_doc, &pyobj_ns, &name, &content)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - ns = (xmlNsPtr) PyxmlNode_Get(pyobj_ns); - - c_retval = xmlNewDocNode(doc, ns, name, content); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_HTML_ENABLED) -PyObject * -libxml_htmlParseDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - htmlDocPtr c_retval; - xmlChar * cur; - char * encoding; - - if (!PyArg_ParseTuple(args, (char *)"zz:htmlParseDoc", &cur, &encoding)) - return(NULL); - - c_retval = htmlParseDoc(cur, encoding); - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_HTML_ENABLED) */ -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlRelaxNGInitTypes(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - PyObject *py_retval; - int c_retval; - - c_retval = xmlRelaxNGInitTypes(); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsMiscellaneousMathematicalSymbolsA(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsMiscellaneousMathematicalSymbolsA", &code)) - return(NULL); - - c_retval = xmlUCSIsMiscellaneousMathematicalSymbolsA(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathFreeParserContext(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathFreeParserContext", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathFreeParserContext(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -PyObject * -libxml_xmlURIGetAuthority(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const char * c_retval; - xmlURIPtr URI; - PyObject *pyobj_URI; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlURIGetAuthority", &pyobj_URI)) - return(NULL); - URI = (xmlURIPtr) PyURI_Get(pyobj_URI); - - c_retval = URI->authority; - py_retval = libxml_charPtrConstWrap((const char *) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlCreateURI(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - PyObject *py_retval; - xmlURIPtr c_retval; - - c_retval = xmlCreateURI(); - py_retval = libxml_xmlURIPtrWrap((xmlURIPtr) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlStrcat(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlChar * cur; - xmlChar * add; - - if (!PyArg_ParseTuple(args, (char *)"zz:xmlStrcat", &cur, &add)) - return(NULL); - - c_retval = xmlStrcat(cur, add); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlSchemaFreeParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlSchemaParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlSchemaFreeParserCtxt", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlSchemaParserCtxtPtr) PySchemaParserCtxt_Get(pyobj_ctxt); - - xmlSchemaFreeParserCtxt(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderGetParserLineNumber(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderGetParserLineNumber", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderGetParserLineNumber(reader); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -PyObject * -libxml_xmlCheckVersion(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - int version; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlCheckVersion", &version)) - return(NULL); - - xmlCheckVersion(version); - Py_INCREF(Py_None); - return(Py_None); -} - -PyObject * -libxml_xmlParseMarkupDecl(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParseMarkupDecl", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - xmlParseMarkupDecl(ctxt); - Py_INCREF(Py_None); - 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; - xmlAttrPtr c_retval; - xmlNodePtr node; - PyObject *pyobj_node; - xmlChar * name; - xmlChar * nameSpace; - - if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlHasNsProp", &pyobj_node, &name, &nameSpace)) - return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - - c_retval = xmlHasNsProp(node, name, nameSpace); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlAddPrevSibling(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlNodePtr cur; - PyObject *pyobj_cur; - xmlNodePtr elem; - PyObject *pyobj_elem; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlAddPrevSibling", &pyobj_cur, &pyobj_elem)) - return(NULL); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem); - - c_retval = xmlAddPrevSibling(cur, elem); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ -PyObject * -libxml_xmlGetDtdAttrDesc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlAttributePtr c_retval; - xmlDtdPtr dtd; - PyObject *pyobj_dtd; - xmlChar * elem; - xmlChar * name; - - if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlGetDtdAttrDesc", &pyobj_dtd, &elem, &name)) - return(NULL); - dtd = (xmlDtdPtr) PyxmlNode_Get(pyobj_dtd); - - c_retval = xmlGetDtdAttrDesc(dtd, elem, name); - py_retval = libxml_xmlAttributePtrWrap((xmlAttributePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_HTML_ENABLED) -PyObject * -libxml_htmlGetMetaEncoding(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const xmlChar * c_retval; - htmlDocPtr doc; - PyObject *pyobj_doc; - - if (!PyArg_ParseTuple(args, (char *)"O:htmlGetMetaEncoding", &pyobj_doc)) - return(NULL); - doc = (htmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = htmlGetMetaEncoding(doc); - py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_HTML_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsEnclosedCJKLettersandMonths(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsEnclosedCJKLettersandMonths", &code)) - return(NULL); - - c_retval = xmlUCSIsEnclosedCJKLettersandMonths(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlGetIntSubset(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlDtdPtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlGetIntSubset", &pyobj_doc)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlGetIntSubset(doc); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlCleanupInputCallbacks(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - - xmlCleanupInputCallbacks(); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_VALID_ENABLED) -PyObject * -libxml_xmlValidateRoot(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlValidCtxtPtr ctxt; - PyObject *pyobj_ctxt; - xmlDocPtr doc; - PyObject *pyobj_doc; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlValidateRoot", &pyobj_ctxt, &pyobj_doc)) - return(NULL); - ctxt = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_ctxt); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlValidateRoot(ctxt, doc); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_VALID_ENABLED) */ -PyObject * -libxml_xmlNormalizeURIPath(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - char * path; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlNormalizeURIPath", &path)) - return(NULL); - - c_retval = xmlNormalizeURIPath(path); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderConstXmlVersion(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const xmlChar * c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderConstXmlVersion", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderConstXmlVersion(reader); - py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCombiningDiacriticalMarksforSymbols(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCombiningDiacriticalMarksforSymbols", &code)) - return(NULL); - - c_retval = xmlUCSIsCombiningDiacriticalMarksforSymbols(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlParserInputBufferRead(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlParserInputBufferPtr in; - PyObject *pyobj_in; - int len; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlParserInputBufferRead", &pyobj_in, &len)) - return(NULL); - in = (xmlParserInputBufferPtr) PyinputBuffer_Get(pyobj_in); - - c_retval = xmlParserInputBufferRead(in, len); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_HTTP_ENABLED) -PyObject * -libxml_xmlIOHTTPMatch(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - char * filename; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlIOHTTPMatch", &filename)) - return(NULL); - - c_retval = xmlIOHTTPMatch(filename); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_HTTP_ENABLED) */ -PyObject * -libxml_xmlStringLenDecodeEntities(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - xmlChar * str; - int len; - int what; - xmlChar end; - xmlChar end2; - xmlChar end3; - - if (!PyArg_ParseTuple(args, (char *)"Oziiccc:xmlStringLenDecodeEntities", &pyobj_ctxt, &str, &len, &what, &end, &end2, &end3)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlStringLenDecodeEntities(ctxt, str, len, what, end, end2, end3); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatCc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatCc", &code)) - return(NULL); - - c_retval = xmlUCSIsCatCc(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlURISetServer(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlURIPtr URI; - PyObject *pyobj_URI; - char * server; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlURISetServer", &pyobj_URI, &server)) - return(NULL); - URI = (xmlURIPtr) PyURI_Get(pyobj_URI); - - if (URI->server != NULL) xmlFree(URI->server); - URI->server = (char *)xmlStrdup((const xmlChar *)server); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsSpacingModifierLetters(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsSpacingModifierLetters", &code)) - return(NULL); - - c_retval = xmlUCSIsSpacingModifierLetters(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_HTML_ENABLED) -#endif -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsHighPrivateUseSurrogates(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsHighPrivateUseSurrogates", &code)) - return(NULL); - - c_retval = xmlUCSIsHighPrivateUseSurrogates(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlDefaultSAXHandlerInit(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - - xmlDefaultSAXHandlerInit(); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsBraillePatterns(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsBraillePatterns", &code)) - return(NULL); - - c_retval = xmlUCSIsBraillePatterns(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlParseAttValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParseAttValue", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlParseAttValue(ctxt); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlStringGetNodeList(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlChar * value; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlStringGetNodeList", &pyobj_doc, &value)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlStringGetNodeList(doc, value); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_HTML_ENABLED) -PyObject * -libxml_htmlHandleOmittedElem(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int val; - - if (!PyArg_ParseTuple(args, (char *)"i:htmlHandleOmittedElem", &val)) - return(NULL); - - c_retval = htmlHandleOmittedElem(val); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_HTML_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathTrueFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - int nargs; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathTrueFunction", &pyobj_ctxt, &nargs)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathTrueFunction(ctxt, nargs); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_CATALOG_ENABLED) -PyObject * -libxml_xmlCatalogAdd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlChar * type; - xmlChar * orig; - xmlChar * replace; - - if (!PyArg_ParseTuple(args, (char *)"zzz:xmlCatalogAdd", &type, &orig, &replace)) - return(NULL); - - c_retval = xmlCatalogAdd(type, orig, replace); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_CATALOG_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCombiningDiacriticalMarks(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCombiningDiacriticalMarks", &code)) - return(NULL); - - c_retval = xmlUCSIsCombiningDiacriticalMarks(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathEqualValues(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathEqualValues", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - c_retval = xmlXPathEqualValues(ctxt); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -PyObject * -libxml_xmlCtxtUseOptions(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - int options; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlCtxtUseOptions", &pyobj_ctxt, &options)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlCtxtUseOptions(ctxt, options); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsShavian(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsShavian", &code)) - return(NULL); - - c_retval = xmlUCSIsShavian(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsHebrew(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsHebrew", &code)) - return(NULL); - - c_retval = xmlUCSIsHebrew(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathLangFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - int nargs; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathLangFunction", &pyobj_ctxt, &nargs)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathLangFunction(ctxt, nargs); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlSchemaValidateDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlSchemaValidCtxtPtr ctxt; - PyObject *pyobj_ctxt; - xmlDocPtr instance; - PyObject *pyobj_instance; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlSchemaValidateDoc", &pyobj_ctxt, &pyobj_instance)) - return(NULL); - ctxt = (xmlSchemaValidCtxtPtr) PySchemaValidCtxt_Get(pyobj_ctxt); - instance = (xmlDocPtr) PyxmlNode_Get(pyobj_instance); - - c_retval = xmlSchemaValidateDoc(ctxt, instance); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -PyObject * -libxml_xmlCopyError(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlErrorPtr from; - PyObject *pyobj_from; - xmlErrorPtr to; - PyObject *pyobj_to; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlCopyError", &pyobj_from, &pyobj_to)) - return(NULL); - from = (xmlErrorPtr) PyError_Get(pyobj_from); - to = (xmlErrorPtr) PyError_Get(pyobj_to); - - c_retval = xmlCopyError(from, to); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlRelaxNGValidateDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlRelaxNGValidCtxtPtr ctxt; - PyObject *pyobj_ctxt; - xmlDocPtr doc; - PyObject *pyobj_doc; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlRelaxNGValidateDoc", &pyobj_ctxt, &pyobj_doc)) - return(NULL); - ctxt = (xmlRelaxNGValidCtxtPtr) PyrelaxNgValidCtxt_Get(pyobj_ctxt); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlRelaxNGValidateDoc(ctxt, doc); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -#if defined(LIBXML_TREE_ENABLED) -PyObject * -libxml_xmlNodeSetSpacePreserve(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlNodePtr cur; - PyObject *pyobj_cur; - int val; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlNodeSetSpacePreserve", &pyobj_cur, &val)) - return(NULL); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - xmlNodeSetSpacePreserve(cur, val); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_TREE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsArmenian(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsArmenian", &code)) - return(NULL); - - c_retval = xmlUCSIsArmenian(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathCastNodeToNumber(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - double c_retval; - xmlNodePtr node; - PyObject *pyobj_node; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathCastNodeToNumber", &pyobj_node)) - return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - - c_retval = xmlXPathCastNodeToNumber(node); - py_retval = libxml_doubleWrap((double) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -PyObject * -libxml_xmlUTF8Size(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlChar * utf; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlUTF8Size", &utf)) - return(NULL); - - c_retval = xmlUTF8Size(utf); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlNewText(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlChar * content; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlNewText", &content)) - return(NULL); - - c_retval = xmlNewText(content); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlDocCopyNodeList(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlNodePtr node; - PyObject *pyobj_node; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlDocCopyNodeList", &pyobj_doc, &pyobj_node)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - - c_retval = xmlDocCopyNodeList(doc, node); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlNewDocText(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlChar * content; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlNewDocText", &pyobj_doc, &content)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlNewDocText(doc, content); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlNewReference(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlChar * name; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlNewReference", &pyobj_doc, &name)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlNewReference(doc, name); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathNewValueTree(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlXPathObjectPtr c_retval; - xmlNodePtr val; - PyObject *pyobj_val; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathNewValueTree", &pyobj_val)) - return(NULL); - val = (xmlNodePtr) PyxmlNode_Get(pyobj_val); - - c_retval = xmlXPathNewValueTree(val); - py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsSupplementalMathematicalOperators(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsSupplementalMathematicalOperators", &code)) - return(NULL); - - c_retval = xmlUCSIsSupplementalMathematicalOperators(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_OUTPUT_ENABLED) -PyObject * -libxml_xmlOutputBufferWriteString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlOutputBufferPtr out; - PyObject *pyobj_out; - char * str; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlOutputBufferWriteString", &pyobj_out, &str)) - return(NULL); - out = (xmlOutputBufferPtr) PyoutputBuffer_Get(pyobj_out); - - c_retval = xmlOutputBufferWriteString(out, str); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_OUTPUT_ENABLED) */ -#if defined(LIBXML_VALID_ENABLED) -PyObject * -libxml_xmlValidateDtd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlValidCtxtPtr ctxt; - PyObject *pyobj_ctxt; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlDtdPtr dtd; - PyObject *pyobj_dtd; - - if (!PyArg_ParseTuple(args, (char *)"OOO:xmlValidateDtd", &pyobj_ctxt, &pyobj_doc, &pyobj_dtd)) - return(NULL); - ctxt = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_ctxt); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - dtd = (xmlDtdPtr) PyxmlNode_Get(pyobj_dtd); - - c_retval = xmlValidateDtd(ctxt, doc, dtd); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_VALID_ENABLED) */ -PyObject * -libxml_xmlIsBlank(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - unsigned int ch; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlIsBlank", &ch)) - return(NULL); - - c_retval = xmlIsBlank(ch); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_XPTR_ENABLED) -PyObject * -libxml_xmlXPtrNewLocationSetNodes(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlXPathObjectPtr c_retval; - xmlNodePtr start; - PyObject *pyobj_start; - xmlNodePtr end; - PyObject *pyobj_end; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPtrNewLocationSetNodes", &pyobj_start, &pyobj_end)) - return(NULL); - start = (xmlNodePtr) PyxmlNode_Get(pyobj_start); - end = (xmlNodePtr) PyxmlNode_Get(pyobj_end); - - c_retval = xmlXPtrNewLocationSetNodes(start, end); - py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPTR_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCombiningMarksforSymbols(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCombiningMarksforSymbols", &code)) - return(NULL); - - c_retval = xmlUCSIsCombiningMarksforSymbols(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_VALID_ENABLED) -PyObject * -libxml_xmlValidateElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlValidCtxtPtr ctxt; - PyObject *pyobj_ctxt; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlNodePtr elem; - PyObject *pyobj_elem; - - if (!PyArg_ParseTuple(args, (char *)"OOO:xmlValidateElement", &pyobj_ctxt, &pyobj_doc, &pyobj_elem)) - return(NULL); - ctxt = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_ctxt); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem); - - c_retval = xmlValidateElement(ctxt, doc, elem); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_VALID_ENABLED) */ -PyObject * -libxml_xmlPopInputCallbacks(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - PyObject *py_retval; - int c_retval; - - c_retval = xmlPopInputCallbacks(); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsLao(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsLao", &code)) - return(NULL); - - c_retval = xmlUCSIsLao(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_TREE_ENABLED) -PyObject * -libxml_xmlNewDocFragment(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlNewDocFragment", &pyobj_doc)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlNewDocFragment(doc); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_TREE_ENABLED) */ -#if defined(LIBXML_HTML_ENABLED) -PyObject * -libxml_htmlReadMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - htmlDocPtr c_retval; - char * buffer; - int py_buffsize0; - int size; - char * URL; - char * encoding; - int options; - - if (!PyArg_ParseTuple(args, (char *)"t#izzi:htmlReadMemory", &buffer, &py_buffsize0, &size, &URL, &encoding, &options)) - return(NULL); - - c_retval = htmlReadMemory(buffer, size, URL, encoding, options); - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_HTML_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathNodeSetFreeNs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlNsPtr ns; - PyObject *pyobj_ns; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathNodeSetFreeNs", &pyobj_ns)) - return(NULL); - ns = (xmlNsPtr) PyxmlNode_Get(pyobj_ns); - - xmlXPathNodeSetFreeNs(ns); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderHasAttributes(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderHasAttributes", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderHasAttributes(reader); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsGothic(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsGothic", &code)) - return(NULL); - - c_retval = xmlUCSIsGothic(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_OUTPUT_ENABLED) -PyObject * -libxml_xmlNodeDumpOutput(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlOutputBufferPtr buf; - PyObject *pyobj_buf; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlNodePtr cur; - PyObject *pyobj_cur; - int level; - int format; - char * encoding; - - if (!PyArg_ParseTuple(args, (char *)"OOOiiz:xmlNodeDumpOutput", &pyobj_buf, &pyobj_doc, &pyobj_cur, &level, &format, &encoding)) - return(NULL); - buf = (xmlOutputBufferPtr) PyoutputBuffer_Get(pyobj_buf); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - xmlNodeDumpOutput(buf, doc, cur, level, format, encoding); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_OUTPUT_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathRegisteredFuncsCleanup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathRegisteredFuncsCleanup", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt); - - xmlXPathRegisteredFuncsCleanup(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsBlock(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - char * block; - - if (!PyArg_ParseTuple(args, (char *)"iz:xmlUCSIsBlock", &code, &block)) - return(NULL); - - c_retval = xmlUCSIsBlock(code, block); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderMoveToNextAttribute(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderMoveToNextAttribute", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderMoveToNextAttribute(reader); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatNd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatNd", &code)) - return(NULL); - - c_retval = xmlUCSIsCatNd(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlParseSDDecl(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParseSDDecl", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlParseSDDecl(ctxt); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlReaderNewWalker(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - xmlDocPtr doc; - PyObject *pyobj_doc; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlReaderNewWalker", &pyobj_reader, &pyobj_doc)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlReaderNewWalker(reader, doc); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatNl(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatNl", &code)) - return(NULL); - - c_retval = xmlUCSIsCatNl(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatNo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatNo", &code)) - return(NULL); - - c_retval = xmlUCSIsCatNo(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlSkipBlankChars(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlSkipBlankChars", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlSkipBlankChars(ctxt); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_VALID_ENABLED) -PyObject * -libxml_xmlValidateNmtokenValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlChar * value; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlValidateNmtokenValue", &value)) - return(NULL); - - c_retval = xmlValidateNmtokenValue(value); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_VALID_ENABLED) */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) -PyObject * -libxml_xmlGetNodePath(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlNodePtr node; - PyObject *pyobj_node; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlGetNodePath", &pyobj_node)) - return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - - c_retval = xmlGetNodePath(node); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) */ -#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) -PyObject * -libxml_htmlDocContentDumpOutput(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlOutputBufferPtr buf; - PyObject *pyobj_buf; - xmlDocPtr cur; - PyObject *pyobj_cur; - char * encoding; - - if (!PyArg_ParseTuple(args, (char *)"OOz:htmlDocContentDumpOutput", &pyobj_buf, &pyobj_cur, &encoding)) - return(NULL); - buf = (xmlOutputBufferPtr) PyoutputBuffer_Get(pyobj_buf); - cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur); - - htmlDocContentDumpOutput(buf, cur, encoding); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathPopBoolean(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathPopBoolean", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - c_retval = xmlXPathPopBoolean(ctxt); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -PyObject * -libxml_xmlIsIdeographic(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - unsigned int ch; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlIsIdeographic", &ch)) - return(NULL); - - c_retval = xmlIsIdeographic(ch); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsLatinExtendedAdditional(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsLatinExtendedAdditional", &code)) - return(NULL); - - c_retval = xmlUCSIsLatinExtendedAdditional(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlURISetAuthority(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlURIPtr URI; - PyObject *pyobj_URI; - char * authority; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlURISetAuthority", &pyobj_URI, &authority)) - return(NULL); - URI = (xmlURIPtr) PyURI_Get(pyobj_URI); - - if (URI->authority != NULL) xmlFree(URI->authority); - URI->authority = (char *)xmlStrdup((const xmlChar *)authority); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlRelaxNGValidatePushCData(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlRelaxNGValidCtxtPtr ctxt; - PyObject *pyobj_ctxt; - xmlChar * data; - int len; - - if (!PyArg_ParseTuple(args, (char *)"Ozi:xmlRelaxNGValidatePushCData", &pyobj_ctxt, &data, &len)) - return(NULL); - ctxt = (xmlRelaxNGValidCtxtPtr) PyrelaxNgValidCtxt_Get(pyobj_ctxt); - - c_retval = xmlRelaxNGValidatePushCData(ctxt, data, len); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -PyObject * -libxml_xmlGetLastError(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - PyObject *py_retval; - xmlErrorPtr c_retval; - - c_retval = xmlGetLastError(); - py_retval = libxml_xmlErrorPtrWrap((xmlErrorPtr) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlEncodeEntitiesReentrant(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlChar * input; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlEncodeEntitiesReentrant", &pyobj_doc, &input)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlEncodeEntitiesReentrant(doc, input); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlRemoveProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlAttrPtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlRemoveProp", &pyobj_cur)) - return(NULL); - cur = (xmlAttrPtr) PyxmlNode_Get(pyobj_cur); - - c_retval = xmlRemoveProp(cur); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) -PyObject * -libxml_xmlACatalogDump(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlCatalogPtr catal; - PyObject *pyobj_catal; - FILE * out; - PyObject *pyobj_out; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlACatalogDump", &pyobj_catal, &pyobj_out)) - return(NULL); - catal = (xmlCatalogPtr) Pycatalog_Get(pyobj_catal); - out = (FILE *) PyFile_Get(pyobj_out); - - xmlACatalogDump(catal, out); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) */ -PyObject * -libxml_xmlReadFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlDocPtr c_retval; - char * filename; - char * encoding; - int options; - - if (!PyArg_ParseTuple(args, (char *)"zzi:xmlReadFile", &filename, &encoding, &options)) - return(NULL); - - c_retval = xmlReadFile(filename, encoding, options); - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsNumberForms(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsNumberForms", &code)) - return(NULL); - - c_retval = xmlUCSIsNumberForms(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlStrncmp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlChar * str1; - xmlChar * str2; - int len; - - if (!PyArg_ParseTuple(args, (char *)"zzi:xmlStrncmp", &str1, &str2, &len)) - return(NULL); - - c_retval = xmlStrncmp(str1, str2, len); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_CATALOG_ENABLED) -PyObject * -libxml_xmlCatalogGetPublic(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const xmlChar * c_retval; - xmlChar * pubID; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlCatalogGetPublic", &pubID)) - return(NULL); - - c_retval = xmlCatalogGetPublic(pubID); - py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_CATALOG_ENABLED) */ -#if defined(LIBXML_OUTPUT_ENABLED) -PyObject * -libxml_xmlSaveFormatFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - char * filename; - xmlDocPtr cur; - PyObject *pyobj_cur; - int format; - - if (!PyArg_ParseTuple(args, (char *)"zOi:xmlSaveFormatFile", &filename, &pyobj_cur, &format)) - return(NULL); - cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur); - - c_retval = xmlSaveFormatFile(filename, cur, format); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#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; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParseXMLDecl", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - xmlParseXMLDecl(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -PyObject * -libxml_xmlNewComment(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlChar * content; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlNewComment", &content)) - return(NULL); - - c_retval = xmlNewComment(content); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlRelaxNGNewValidCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlRelaxNGValidCtxtPtr c_retval; - xmlRelaxNGPtr schema; - PyObject *pyobj_schema; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlRelaxNGNewValidCtxt", &pyobj_schema)) - return(NULL); - schema = (xmlRelaxNGPtr) PyrelaxNgSchema_Get(pyobj_schema); - - c_retval = xmlRelaxNGNewValidCtxt(schema); - py_retval = libxml_xmlRelaxNGValidCtxtPtrWrap((xmlRelaxNGValidCtxtPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsKatakana(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsKatakana", &code)) - return(NULL); - - c_retval = xmlUCSIsKatakana(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsHalfwidthandFullwidthForms(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsHalfwidthandFullwidthForms", &code)) - return(NULL); - - c_retval = xmlUCSIsHalfwidthandFullwidthForms(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_VALID_ENABLED) -PyObject * -libxml_xmlValidateNamesValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlChar * value; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlValidateNamesValue", &value)) - return(NULL); - - c_retval = xmlValidateNamesValue(value); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_VALID_ENABLED) */ -PyObject * -libxml_xmlParseURIReference(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlURIPtr uri; - PyObject *pyobj_uri; - char * str; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlParseURIReference", &pyobj_uri, &str)) - return(NULL); - uri = (xmlURIPtr) PyURI_Get(pyobj_uri); - - c_retval = xmlParseURIReference(uri, str); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathOrderDocElems(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - long c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathOrderDocElems", &pyobj_doc)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlXPathOrderDocElems(doc); - py_retval = libxml_longWrap((long) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsGurmukhi(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsGurmukhi", &code)) - return(NULL); - - c_retval = xmlUCSIsGurmukhi(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_namePush(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - xmlChar * value; - - if (!PyArg_ParseTuple(args, (char *)"Oz:namePush", &pyobj_ctxt, &value)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = namePush(ctxt, value); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) -PyObject * -libxml_xmlNodeSetBase(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlNodePtr cur; - PyObject *pyobj_cur; - xmlChar * uri; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlNodeSetBase", &pyobj_cur, &uri)) - return(NULL); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - xmlNodeSetBase(cur, uri); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlTextReaderRelaxNGSetSchema(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - xmlRelaxNGPtr schema; - PyObject *pyobj_schema; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlTextReaderRelaxNGSetSchema", &pyobj_reader, &pyobj_schema)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - schema = (xmlRelaxNGPtr) PyrelaxNgSchema_Get(pyobj_schema); - - c_retval = xmlTextReaderRelaxNGSetSchema(reader, schema); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) */ -#if defined(LIBXML_DEBUG_ENABLED) -PyObject * -libxml_xmlDebugDumpAttr(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - FILE * output; - PyObject *pyobj_output; - xmlAttrPtr attr; - PyObject *pyobj_attr; - int depth; - - if (!PyArg_ParseTuple(args, (char *)"OOi:xmlDebugDumpAttr", &pyobj_output, &pyobj_attr, &depth)) - return(NULL); - output = (FILE *) PyFile_Get(pyobj_output); - attr = (xmlAttrPtr) PyxmlNode_Get(pyobj_attr); - - xmlDebugDumpAttr(output, attr, depth); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_DEBUG_ENABLED) */ -#if defined(LIBXML_OUTPUT_ENABLED) -PyObject * -libxml_xmlCleanupOutputCallbacks(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - - xmlCleanupOutputCallbacks(); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_OUTPUT_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathSetContextNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathContextPtr ctxt; - PyObject *pyobj_ctxt; - xmlNodePtr node; - PyObject *pyobj_node; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathSetContextNode", &pyobj_ctxt, &pyobj_node)) - return(NULL); - ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - - ctxt->node = node; - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_OUTPUT_ENABLED) -PyObject * -libxml_xmlSaveFileEnc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - char * filename; - xmlDocPtr cur; - PyObject *pyobj_cur; - char * encoding; - - if (!PyArg_ParseTuple(args, (char *)"zOz:xmlSaveFileEnc", &filename, &pyobj_cur, &encoding)) - return(NULL); - cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur); - - c_retval = xmlSaveFileEnc(filename, cur, encoding); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_OUTPUT_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathGetFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const xmlChar * c_retval; - xmlXPathContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathGetFunction", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt); - - c_retval = ctxt->function; - py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_DEBUG_ENABLED) -PyObject * -libxml_xmlDebugDumpOneNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - FILE * output; - PyObject *pyobj_output; - xmlNodePtr node; - PyObject *pyobj_node; - int depth; - - if (!PyArg_ParseTuple(args, (char *)"OOi:xmlDebugDumpOneNode", &pyobj_output, &pyobj_node, &depth)) - return(NULL); - output = (FILE *) PyFile_Get(pyobj_output); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - - xmlDebugDumpOneNode(output, node, depth); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_DEBUG_ENABLED) */ -PyObject * -libxml_xmlNewNs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNsPtr c_retval; - xmlNodePtr node; - PyObject *pyobj_node; - xmlChar * href; - xmlChar * prefix; - - if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlNewNs", &pyobj_node, &href, &prefix)) - return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - - c_retval = xmlNewNs(node, href, prefix); - py_retval = libxml_xmlNsPtrWrap((xmlNsPtr) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlStrcasestr(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const xmlChar * c_retval; - xmlChar * str; - xmlChar * val; - - if (!PyArg_ParseTuple(args, (char *)"zz:xmlStrcasestr", &str, &val)) - return(NULL); - - c_retval = xmlStrcasestr(str, val); - py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderReadState(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderReadState", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderReadState(reader); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsHangulSyllables(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsHangulSyllables", &code)) - return(NULL); - - c_retval = xmlUCSIsHangulSyllables(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlValidateQName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlChar * value; - int space; - - if (!PyArg_ParseTuple(args, (char *)"zi:xmlValidateQName", &value, &space)) - return(NULL); - - c_retval = xmlValidateQName(value, space); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathCompareValues(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - int inf; - int strict; - - if (!PyArg_ParseTuple(args, (char *)"Oii:xmlXPathCompareValues", &pyobj_ctxt, &inf, &strict)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - c_retval = xmlXPathCompareValues(ctxt, inf, strict); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsSyriac(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsSyriac", &code)) - return(NULL); - - c_retval = xmlUCSIsSyriac(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlStrQEqual(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlChar * pref; - xmlChar * name; - xmlChar * str; - - if (!PyArg_ParseTuple(args, (char *)"zzz:xmlStrQEqual", &pref, &name, &str)) - return(NULL); - - c_retval = xmlStrQEqual(pref, name, str); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlBuildURI(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlChar * URI; - xmlChar * base; - - if (!PyArg_ParseTuple(args, (char *)"zz:xmlBuildURI", &URI, &base)) - return(NULL); - - c_retval = xmlBuildURI(URI, base); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderGetParserColumnNumber(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderGetParserColumnNumber", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderGetParserColumnNumber(reader); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_valuePop(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlXPathObjectPtr c_retval; - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:valuePop", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - c_retval = valuePop(ctxt); - py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathContainsFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - int nargs; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathContainsFunction", &pyobj_ctxt, &nargs)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathContainsFunction(ctxt, nargs); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_HTML_ENABLED) -PyObject * -libxml_htmlCtxtUseOptions(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - htmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - int options; - - if (!PyArg_ParseTuple(args, (char *)"Oi:htmlCtxtUseOptions", &pyobj_ctxt, &options)) - return(NULL); - ctxt = (htmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = htmlCtxtUseOptions(ctxt, options); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_HTML_ENABLED) */ -#if defined(LIBXML_CATALOG_ENABLED) -PyObject * -libxml_xmlFreeCatalog(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlCatalogPtr catal; - PyObject *pyobj_catal; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlFreeCatalog", &pyobj_catal)) - return(NULL); - catal = (xmlCatalogPtr) Pycatalog_Get(pyobj_catal); - - xmlFreeCatalog(catal); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_CATALOG_ENABLED) */ -#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED) -PyObject * -libxml_xmlValidatePushElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlValidCtxtPtr ctxt; - PyObject *pyobj_ctxt; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlNodePtr elem; - PyObject *pyobj_elem; - xmlChar * qname; - - if (!PyArg_ParseTuple(args, (char *)"OOOz:xmlValidatePushElement", &pyobj_ctxt, &pyobj_doc, &pyobj_elem, &qname)) - return(NULL); - ctxt = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_ctxt); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem); - - c_retval = xmlValidatePushElement(ctxt, doc, elem, qname); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED) */ -PyObject * -libxml_xmlResetError(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlErrorPtr err; - PyObject *pyobj_err; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlResetError", &pyobj_err)) - return(NULL); - err = (xmlErrorPtr) PyError_Get(pyobj_err); - - xmlResetError(err); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsArrows(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsArrows", &code)) - return(NULL); - - c_retval = xmlUCSIsArrows(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathGetContextSize(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlXPathContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathGetContextSize", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt); - - c_retval = ctxt->contextSize; - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsLimbu(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsLimbu", &code)) - return(NULL); - - c_retval = xmlUCSIsLimbu(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlRemoveID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlAttrPtr attr; - PyObject *pyobj_attr; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlRemoveID", &pyobj_doc, &pyobj_attr)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - attr = (xmlAttrPtr) PyxmlNode_Get(pyobj_attr); - - c_retval = xmlRemoveID(doc, attr); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlNewDocPI(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlChar * name; - xmlChar * content; - - if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlNewDocPI", &pyobj_doc, &name, &content)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlNewDocPI(doc, name, content); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathTranslateFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - int nargs; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathTranslateFunction", &pyobj_ctxt, &nargs)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathTranslateFunction(ctxt, nargs); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -PyObject * -libxml_xmlNodeGetSpacePreserve(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlNodePtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlNodeGetSpacePreserve", &pyobj_cur)) - return(NULL); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - c_retval = xmlNodeGetSpacePreserve(cur); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlResetLastError(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - - xmlResetLastError(); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlXPathIsNaN(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - double val; - - if (!PyArg_ParseTuple(args, (char *)"d:xmlXPathIsNaN", &val)) - return(NULL); - - c_retval = xmlXPathIsNaN(val); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ -#if defined(LIBXML_VALID_ENABLED) -PyObject * -libxml_xmlValidateDtdFinal(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlValidCtxtPtr ctxt; - PyObject *pyobj_ctxt; - xmlDocPtr doc; - PyObject *pyobj_doc; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlValidateDtdFinal", &pyobj_ctxt, &pyobj_doc)) - return(NULL); - ctxt = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_ctxt); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlValidateDtdFinal(ctxt, doc); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_VALID_ENABLED) */ -PyObject * -libxml_xmlParseEncName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParseEncName", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlParseEncName(ctxt); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathNextAttribute(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - xmlNodePtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathNextAttribute", &pyobj_ctxt, &pyobj_cur)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - c_retval = xmlXPathNextAttribute(ctxt, cur); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_XPTR_ENABLED) -PyObject * -libxml_xmlXPtrEvalRangePredicate(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPtrEvalRangePredicate", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPtrEvalRangePredicate(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPTR_ENABLED) */ -#if defined(LIBXML_HTML_ENABLED) -PyObject * -libxml_htmlAutoCloseTag(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - htmlDocPtr doc; - PyObject *pyobj_doc; - xmlChar * name; - htmlNodePtr elem; - PyObject *pyobj_elem; - - if (!PyArg_ParseTuple(args, (char *)"OzO:htmlAutoCloseTag", &pyobj_doc, &name, &pyobj_elem)) - return(NULL); - doc = (htmlDocPtr) PyxmlNode_Get(pyobj_doc); - elem = (htmlNodePtr) PyxmlNode_Get(pyobj_elem); - - c_retval = htmlAutoCloseTag(doc, name, elem); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_HTML_ENABLED) */ -PyObject * -libxml_xmlThrDefLoadExtDtdDefaultValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int v; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlThrDefLoadExtDtdDefaultValue", &v)) - return(NULL); - - c_retval = xmlThrDefLoadExtDtdDefaultValue(v); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlThrDefTreeIndentString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const char * c_retval; - char * v; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlThrDefTreeIndentString", &v)) - return(NULL); - - c_retval = xmlThrDefTreeIndentString(v); - py_retval = libxml_charPtrConstWrap((const char *) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlGetDocCompressMode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlGetDocCompressMode", &pyobj_doc)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlGetDocCompressMode(doc); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_DEBUG_ENABLED) -PyObject * -libxml_xmlDebugDumpDocumentHead(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - FILE * output; - PyObject *pyobj_output; - xmlDocPtr doc; - PyObject *pyobj_doc; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlDebugDumpDocumentHead", &pyobj_output, &pyobj_doc)) - return(NULL); - output = (FILE *) PyFile_Get(pyobj_output); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - xmlDebugDumpDocumentHead(output, doc); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_DEBUG_ENABLED) */ -#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) -PyObject * -libxml_htmlNodeDumpOutput(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlOutputBufferPtr buf; - PyObject *pyobj_buf; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlNodePtr cur; - PyObject *pyobj_cur; - char * encoding; - - if (!PyArg_ParseTuple(args, (char *)"OOOz:htmlNodeDumpOutput", &pyobj_buf, &pyobj_doc, &pyobj_cur, &encoding)) - return(NULL); - buf = (xmlOutputBufferPtr) PyoutputBuffer_Get(pyobj_buf); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - htmlNodeDumpOutput(buf, doc, cur, encoding); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) */ -#if defined(LIBXML_HTML_ENABLED) -PyObject * -libxml_htmlParseElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - htmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:htmlParseElement", &pyobj_ctxt)) - return(NULL); - ctxt = (htmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - htmlParseElement(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_HTML_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsGreek(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsGreek", &code)) - return(NULL); - - c_retval = xmlUCSIsGreek(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_LEGACY_ENABLED) -PyObject * -libxml_xmlDecodeEntities(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - int len; - int what; - xmlChar end; - xmlChar end2; - xmlChar end3; - - if (!PyArg_ParseTuple(args, (char *)"Oiiccc:xmlDecodeEntities", &pyobj_ctxt, &len, &what, &end, &end2, &end3)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlDecodeEntities(ctxt, len, what, end, end2, end3); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_LEGACY_ENABLED) */ -#if defined(LIBXML_LEGACY_ENABLED) -PyObject * -libxml_xmlNamespaceParseNSDef(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlNamespaceParseNSDef", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlNamespaceParseNSDef(ctxt); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_LEGACY_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathCastNumberToString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - double val; - - if (!PyArg_ParseTuple(args, (char *)"d:xmlXPathCastNumberToString", &val)) - return(NULL); - - c_retval = xmlXPathCastNumberToString(val); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_CATALOG_ENABLED) -PyObject * -libxml_xmlCatalogRemove(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlChar * value; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlCatalogRemove", &value)) - return(NULL); - - c_retval = xmlCatalogRemove(value); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_CATALOG_ENABLED) */ -#if defined(LIBXML_OUTPUT_ENABLED) -PyObject * -libxml_xmlOutputBufferWrite(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlOutputBufferPtr out; - PyObject *pyobj_out; - int len; - char * buf; - - if (!PyArg_ParseTuple(args, (char *)"Oiz:xmlOutputBufferWrite", &pyobj_out, &len, &buf)) - return(NULL); - out = (xmlOutputBufferPtr) PyoutputBuffer_Get(pyobj_out); - - c_retval = xmlOutputBufferWrite(out, len, buf); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_OUTPUT_ENABLED) */ -#if defined(LIBXML_FTP_ENABLED) -PyObject * -libxml_xmlIOFTPMatch(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - char * filename; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlIOFTPMatch", &filename)) - return(NULL); - - c_retval = xmlIOFTPMatch(filename); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_FTP_ENABLED) */ -PyObject * -libxml_xmlParseReference(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParseReference", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - xmlParseReference(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_HTTP_ENABLED) -PyObject * -libxml_xmlNanoHTTPScanProxy(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - char * URL; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlNanoHTTPScanProxy", &URL)) - return(NULL); - - xmlNanoHTTPScanProxy(URL); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_HTTP_ENABLED) */ -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlRelaxNGCleanupTypes(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - - xmlRelaxNGCleanupTypes(); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -PyObject * -libxml_xmlStringLenGetNodeList(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlChar * value; - int len; - - if (!PyArg_ParseTuple(args, (char *)"Ozi:xmlStringLenGetNodeList", &pyobj_doc, &value, &len)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlStringLenGetNodeList(doc, value, len); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderLocatorBaseURI(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlTextReaderLocatorPtr locator; - PyObject *pyobj_locator; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderLocatorBaseURI", &pyobj_locator)) - return(NULL); - locator = (xmlTextReaderLocatorPtr) PyxmlTextReaderLocator_Get(pyobj_locator); - - c_retval = xmlTextReaderLocatorBaseURI(locator); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) -PyObject * -libxml_xmlSetNsProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlAttrPtr c_retval; - xmlNodePtr node; - PyObject *pyobj_node; - xmlNsPtr ns; - PyObject *pyobj_ns; - xmlChar * name; - xmlChar * value; - - if (!PyArg_ParseTuple(args, (char *)"OOzz:xmlSetNsProp", &pyobj_node, &pyobj_ns, &name, &value)) - return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - ns = (xmlNsPtr) PyxmlNode_Get(pyobj_ns); - - c_retval = xmlSetNsProp(node, ns, name, value); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) */ -#if defined(LIBXML_SAX1_ENABLED) -PyObject * -libxml_xmlSAXDefaultVersion(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int version; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlSAXDefaultVersion", &version)) - return(NULL); - - c_retval = xmlSAXDefaultVersion(version); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SAX1_ENABLED) */ -#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlValidateNotationUse(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlValidCtxtPtr ctxt; - PyObject *pyobj_ctxt; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlChar * notationName; - - if (!PyArg_ParseTuple(args, (char *)"OOz:xmlValidateNotationUse", &pyobj_ctxt, &pyobj_doc, ¬ationName)) - return(NULL); - ctxt = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_ctxt); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlValidateNotationUse(ctxt, doc, notationName); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ -PyObject * -libxml_xmlGetCompressMode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - PyObject *py_retval; - int c_retval; - - c_retval = xmlGetCompressMode(); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_HTML_ENABLED) -PyObject * -libxml_htmlNewDocNoDtD(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - htmlDocPtr c_retval; - xmlChar * URI; - xmlChar * ExternalID; - - if (!PyArg_ParseTuple(args, (char *)"zz:htmlNewDocNoDtD", &URI, &ExternalID)) - return(NULL); - - c_retval = htmlNewDocNoDtD(URI, ExternalID); - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_HTML_ENABLED) */ -PyObject * -libxml_xmlURIEscape(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlChar * str; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlURIEscape", &str)) - return(NULL); - - c_retval = xmlURIEscape(str); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) -PyObject * -libxml_htmlDocContentDumpFormatOutput(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlOutputBufferPtr buf; - PyObject *pyobj_buf; - xmlDocPtr cur; - PyObject *pyobj_cur; - char * encoding; - int format; - - if (!PyArg_ParseTuple(args, (char *)"OOzi:htmlDocContentDumpFormatOutput", &pyobj_buf, &pyobj_cur, &encoding, &format)) - return(NULL); - buf = (xmlOutputBufferPtr) PyoutputBuffer_Get(pyobj_buf); - cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur); - - htmlDocContentDumpFormatOutput(buf, cur, encoding, format); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) */ -PyObject * -libxml_xmlURISetQuery(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlURIPtr URI; - PyObject *pyobj_URI; - char * query; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlURISetQuery", &pyobj_URI, &query)) - return(NULL); - URI = (xmlURIPtr) PyURI_Get(pyobj_URI); - - if (URI->query != NULL) xmlFree(URI->query); - URI->query = (char *)xmlStrdup((const xmlChar *)query); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlTextReaderSchemaValidate(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - char * xsd; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlTextReaderSchemaValidate", &pyobj_reader, &xsd)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderSchemaValidate(reader, xsd); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsGreekandCoptic(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsGreekandCoptic", &code)) - return(NULL); - - c_retval = xmlUCSIsGreekandCoptic(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlUTF8Strlen(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlChar * utf; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlUTF8Strlen", &utf)) - return(NULL); - - c_retval = xmlUTF8Strlen(utf); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathAddValues(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathAddValues", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathAddValues(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -PyObject * -libxml_xmlStrchr(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const xmlChar * c_retval; - xmlChar * str; - xmlChar val; - - if (!PyArg_ParseTuple(args, (char *)"zc:xmlStrchr", &str, &val)) - return(NULL); - - c_retval = xmlStrchr(str, val); - py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlNewTextLen(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlChar * content; - int len; - - if (!PyArg_ParseTuple(args, (char *)"zi:xmlNewTextLen", &content, &len)) - return(NULL); - - c_retval = xmlNewTextLen(content, len); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlXPathIsInf(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - double val; - - if (!PyArg_ParseTuple(args, (char *)"d:xmlXPathIsInf", &val)) - return(NULL); - - c_retval = xmlXPathIsInf(val); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCJKUnifiedIdeographs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCJKUnifiedIdeographs", &code)) - return(NULL); - - c_retval = xmlUCSIsCJKUnifiedIdeographs(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlValidateName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlChar * value; - int space; - - if (!PyArg_ParseTuple(args, (char *)"zi:xmlValidateName", &value, &space)) - return(NULL); - - c_retval = xmlValidateName(value, space); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderConstString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const xmlChar * c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - xmlChar * str; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlTextReaderConstString", &pyobj_reader, &str)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderConstString(reader, str); - py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlSchemaValidateFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlSchemaValidCtxtPtr ctxt; - PyObject *pyobj_ctxt; - char * filename; - int options; - - if (!PyArg_ParseTuple(args, (char *)"Ozi:xmlSchemaValidateFile", &pyobj_ctxt, &filename, &options)) - return(NULL); - ctxt = (xmlSchemaValidCtxtPtr) PySchemaValidCtxt_Get(pyobj_ctxt); - - c_retval = xmlSchemaValidateFile(ctxt, filename, options); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -PyObject * -libxml_xmlAddNextSibling(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlNodePtr cur; - PyObject *pyobj_cur; - xmlNodePtr elem; - PyObject *pyobj_elem; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlAddNextSibling", &pyobj_cur, &pyobj_elem)) - return(NULL); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem); - - c_retval = xmlAddNextSibling(cur, elem); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsSupplementalArrowsA(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsSupplementalArrowsA", &code)) - return(NULL); - - c_retval = xmlUCSIsSupplementalArrowsA(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsSupplementalArrowsB(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsSupplementalArrowsB", &code)) - return(NULL); - - c_retval = xmlUCSIsSupplementalArrowsB(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlErrorGetMessage(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const char * c_retval; - xmlErrorPtr Error; - PyObject *pyobj_Error; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlErrorGetMessage", &pyobj_Error)) - return(NULL); - Error = (xmlErrorPtr) PyError_Get(pyobj_Error); - - c_retval = Error->message; - py_retval = libxml_charPtrConstWrap((const char *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_HTML_ENABLED) -#endif -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathFalseFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - int nargs; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathFalseFunction", &pyobj_ctxt, &nargs)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathFalseFunction(ctxt, nargs); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderHasValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderHasValue", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderHasValue(reader); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) -PyObject * -libxml_xmlRelaxNGDumpTree(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - FILE * output; - PyObject *pyobj_output; - xmlRelaxNGPtr schema; - PyObject *pyobj_schema; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlRelaxNGDumpTree", &pyobj_output, &pyobj_schema)) - return(NULL); - output = (FILE *) PyFile_Get(pyobj_output); - schema = (xmlRelaxNGPtr) PyrelaxNgSchema_Get(pyobj_schema); - - xmlRelaxNGDumpTree(output, schema); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) */ -#if defined(LIBXML_REGEXP_ENABLED) -PyObject * -libxml_xmlRegexpPrint(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - FILE * output; - PyObject *pyobj_output; - xmlRegexpPtr regexp; - PyObject *pyobj_regexp; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlRegexpPrint", &pyobj_output, &pyobj_regexp)) - return(NULL); - output = (FILE *) PyFile_Get(pyobj_output); - regexp = (xmlRegexpPtr) PyxmlReg_Get(pyobj_regexp); - - xmlRegexpPrint(output, regexp); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_REGEXP_ENABLED) */ -#if defined(LIBXML_VALID_ENABLED) -PyObject * -libxml_xmlNewValidCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - PyObject *py_retval; - xmlValidCtxtPtr c_retval; - - c_retval = xmlNewValidCtxt(); - py_retval = libxml_xmlValidCtxtPtrWrap((xmlValidCtxtPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_VALID_ENABLED) */ -PyObject * -libxml_xmlURIEscapeStr(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlChar * str; - xmlChar * list; - - if (!PyArg_ParseTuple(args, (char *)"zz:xmlURIEscapeStr", &str, &list)) - return(NULL); - - c_retval = xmlURIEscapeStr(str, list); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathCountFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - int nargs; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathCountFunction", &pyobj_ctxt, &nargs)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathCountFunction(ctxt, nargs); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderNext(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderNext", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderNext(reader); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -PyObject * -libxml_xmlParserSetPedantic(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - int pedantic; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlParserSetPedantic", &pyobj_ctxt, &pedantic)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - ctxt->pedantic = pedantic; - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatLu(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatLu", &code)) - return(NULL); - - c_retval = xmlUCSIsCatLu(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatLt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatLt", &code)) - return(NULL); - - c_retval = xmlUCSIsCatLt(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatLo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatLo", &code)) - return(NULL); - - c_retval = xmlUCSIsCatLo(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlIsPubidChar(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - unsigned int ch; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlIsPubidChar", &ch)) - return(NULL); - - c_retval = xmlIsPubidChar(ch); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatLm(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatLm", &code)) - return(NULL); - - c_retval = xmlUCSIsCatLm(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatLl(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatLl", &code)) - return(NULL); - - c_retval = xmlUCSIsCatLl(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlNewDocProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlAttrPtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlChar * name; - xmlChar * value; - - if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlNewDocProp", &pyobj_doc, &name, &value)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlNewDocProp(doc, name, value); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_CATALOG_ENABLED) -PyObject * -libxml_xmlLoadACatalog(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlCatalogPtr c_retval; - char * filename; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlLoadACatalog", &filename)) - return(NULL); - - c_retval = xmlLoadACatalog(filename); - py_retval = libxml_xmlCatalogPtrWrap((xmlCatalogPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_CATALOG_ENABLED) */ -#if defined(LIBXML_REGEXP_ENABLED) -PyObject * -libxml_xmlRegexpExec(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlRegexpPtr comp; - PyObject *pyobj_comp; - xmlChar * content; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlRegexpExec", &pyobj_comp, &content)) - return(NULL); - comp = (xmlRegexpPtr) PyxmlReg_Get(pyobj_comp); - - c_retval = xmlRegexpExec(comp, content); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_REGEXP_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatPe(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatPe", &code)) - return(NULL); - - c_retval = xmlUCSIsCatPe(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlByteConsumed(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - long c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlByteConsumed", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlByteConsumed(ctxt); - py_retval = libxml_longWrap((long) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlHasProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlAttrPtr c_retval; - xmlNodePtr node; - PyObject *pyobj_node; - xmlChar * name; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlHasProp", &pyobj_node, &name)) - return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - - c_retval = xmlHasProp(node, name); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathNamespaceURIFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - int nargs; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathNamespaceURIFunction", &pyobj_ctxt, &nargs)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathNamespaceURIFunction(ctxt, nargs); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -PyObject * -libxml_xmlURISetScheme(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlURIPtr URI; - PyObject *pyobj_URI; - char * scheme; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlURISetScheme", &pyobj_URI, &scheme)) - return(NULL); - URI = (xmlURIPtr) PyURI_Get(pyobj_URI); - - if (URI->scheme != NULL) xmlFree(URI->scheme); - URI->scheme = (char *)xmlStrdup((const xmlChar *)scheme); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsMiscellaneousSymbols(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsMiscellaneousSymbols", &code)) - return(NULL); - - c_retval = xmlUCSIsMiscellaneousSymbols(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlGetDtdQAttrDesc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlAttributePtr c_retval; - xmlDtdPtr dtd; - PyObject *pyobj_dtd; - xmlChar * elem; - xmlChar * name; - xmlChar * prefix; - - if (!PyArg_ParseTuple(args, (char *)"Ozzz:xmlGetDtdQAttrDesc", &pyobj_dtd, &elem, &name, &prefix)) - return(NULL); - dtd = (xmlDtdPtr) PyxmlNode_Get(pyobj_dtd); - - c_retval = xmlGetDtdQAttrDesc(dtd, elem, name, prefix); - py_retval = libxml_xmlAttributePtrWrap((xmlAttributePtr) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlSetNs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlNodePtr node; - PyObject *pyobj_node; - xmlNsPtr ns; - PyObject *pyobj_ns; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlSetNs", &pyobj_node, &pyobj_ns)) - return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - ns = (xmlNsPtr) PyxmlNode_Get(pyobj_ns); - - xmlSetNs(node, ns); - Py_INCREF(Py_None); - return(Py_None); -} - -PyObject * -libxml_xmlGetDtdEntity(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlEntityPtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlChar * name; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlGetDtdEntity", &pyobj_doc, &name)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlGetDtdEntity(doc, name); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlIsXHTML(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlChar * systemID; - xmlChar * publicID; - - if (!PyArg_ParseTuple(args, (char *)"zz:xmlIsXHTML", &systemID, &publicID)) - return(NULL); - - c_retval = xmlIsXHTML(systemID, publicID); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlURIUnescapeString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - char * c_retval; - char * str; - int len; - char * target; - - if (!PyArg_ParseTuple(args, (char *)"ziz:xmlURIUnescapeString", &str, &len, &target)) - return(NULL); - - c_retval = xmlURIUnescapeString(str, len, target); - py_retval = libxml_charPtrWrap((char *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsRunic(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsRunic", &code)) - return(NULL); - - c_retval = xmlUCSIsRunic(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlGetParameterEntity(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlEntityPtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlChar * name; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlGetParameterEntity", &pyobj_doc, &name)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlGetParameterEntity(doc, name); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlNewDocTextLen(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlChar * content; - int len; - - if (!PyArg_ParseTuple(args, (char *)"Ozi:xmlNewDocTextLen", &pyobj_doc, &content, &len)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlNewDocTextLen(doc, content, len); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathParseName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathParseName", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - c_retval = xmlXPathParseName(ctxt); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -PyObject * -libxml_xmlURISetPath(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlURIPtr URI; - PyObject *pyobj_URI; - char * path; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlURISetPath", &pyobj_URI, &path)) - return(NULL); - URI = (xmlURIPtr) PyURI_Get(pyobj_URI); - - if (URI->path != NULL) xmlFree(URI->path); - URI->path = (char *)xmlStrdup((const xmlChar *)path); - Py_INCREF(Py_None); - return(Py_None); -} - -PyObject * -libxml_xmlErrorGetFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const char * c_retval; - xmlErrorPtr Error; - PyObject *pyobj_Error; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlErrorGetFile", &pyobj_Error)) - return(NULL); - Error = (xmlErrorPtr) PyError_Get(pyobj_Error); - - c_retval = Error->file; - py_retval = libxml_charPtrConstWrap((const char *) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlGetProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlNodePtr node; - PyObject *pyobj_node; - xmlChar * name; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlGetProp", &pyobj_node, &name)) - return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - - c_retval = xmlGetProp(node, name); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsLatinExtendedB(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsLatinExtendedB", &code)) - return(NULL); - - c_retval = xmlUCSIsLatinExtendedB(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_CATALOG_ENABLED) -PyObject * -libxml_xmlACatalogResolveURI(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlCatalogPtr catal; - PyObject *pyobj_catal; - xmlChar * URI; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlACatalogResolveURI", &pyobj_catal, &URI)) - return(NULL); - catal = (xmlCatalogPtr) Pycatalog_Get(pyobj_catal); - - c_retval = xmlACatalogResolveURI(catal, URI); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_CATALOG_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsVariationSelectors(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsVariationSelectors", &code)) - return(NULL); - - c_retval = xmlUCSIsVariationSelectors(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_CATALOG_ENABLED) -PyObject * -libxml_xmlLoadCatalog(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - char * filename; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlLoadCatalog", &filename)) - return(NULL); - - c_retval = xmlLoadCatalog(filename); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_CATALOG_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathEval(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlXPathObjectPtr c_retval; - xmlChar * str; - xmlXPathContextPtr ctx; - PyObject *pyobj_ctx; - - if (!PyArg_ParseTuple(args, (char *)"zO:xmlXPathEval", &str, &pyobj_ctx)) - return(NULL); - ctx = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctx); - - c_retval = xmlXPathEval(str, ctx); - py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsTags(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsTags", &code)) - return(NULL); - - c_retval = xmlUCSIsTags(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlNewPI(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlChar * name; - xmlChar * content; - - if (!PyArg_ParseTuple(args, (char *)"zz:xmlNewPI", &name, &content)) - return(NULL); - - c_retval = xmlNewPI(name, content); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsLowSurrogates(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsLowSurrogates", &code)) - return(NULL); - - c_retval = xmlUCSIsLowSurrogates(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsOsmanya(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsOsmanya", &code)) - return(NULL); - - c_retval = xmlUCSIsOsmanya(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlThrDefDoValidityCheckingDefaultValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int v; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlThrDefDoValidityCheckingDefaultValue", &v)) - return(NULL); - - c_retval = xmlThrDefDoValidityCheckingDefaultValue(v); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsBoxDrawing(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsBoxDrawing", &code)) - return(NULL); - - c_retval = xmlUCSIsBoxDrawing(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlStrndup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlChar * cur; - int len; - - if (!PyArg_ParseTuple(args, (char *)"zi:xmlStrndup", &cur, &len)) - return(NULL); - - c_retval = xmlStrndup(cur, len); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderIsValid(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderIsValid", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderIsValid(reader); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsByzantineMusicalSymbols(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsByzantineMusicalSymbols", &code)) - return(NULL); - - c_retval = xmlUCSIsByzantineMusicalSymbols(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_HTML_ENABLED) -PyObject * -libxml_htmlDefaultSAXHandlerInit(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - - htmlDefaultSAXHandlerInit(); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_HTML_ENABLED) */ -#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlShellPrintXPathError(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - int errorType; - char * arg; - - if (!PyArg_ParseTuple(args, (char *)"iz:xmlShellPrintXPathError", &errorType, &arg)) - return(NULL); - - xmlShellPrintXPathError(errorType, arg); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_CATALOG_ENABLED) -PyObject * -libxml_xmlCatalogResolve(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlChar * pubID; - xmlChar * sysID; - - if (!PyArg_ParseTuple(args, (char *)"zz:xmlCatalogResolve", &pubID, &sysID)) - return(NULL); - - c_retval = xmlCatalogResolve(pubID, sysID); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_CATALOG_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderConstName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const xmlChar * c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderConstName", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderConstName(reader); - py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlSchemaNewValidCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlSchemaValidCtxtPtr c_retval; - xmlSchemaPtr schema; - PyObject *pyobj_schema; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlSchemaNewValidCtxt", &pyobj_schema)) - return(NULL); - schema = (xmlSchemaPtr) PySchema_Get(pyobj_schema); - - c_retval = xmlSchemaNewValidCtxt(schema); - py_retval = libxml_xmlSchemaValidCtxtPtrWrap((xmlSchemaValidCtxtPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsKhmer(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsKhmer", &code)) - return(NULL); - - c_retval = xmlUCSIsKhmer(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlParseCharRef(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParseCharRef", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlParseCharRef(ctxt); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlCopyCharMultiByte(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlChar * out; - int val; - - if (!PyArg_ParseTuple(args, (char *)"zi:xmlCopyCharMultiByte", &out, &val)) - return(NULL); - - c_retval = xmlCopyCharMultiByte(out, val); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlParseVersionNum(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParseVersionNum", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlParseVersionNum(ctxt); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlReaderWalker(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlTextReaderPtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlReaderWalker", &pyobj_doc)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlReaderWalker(doc); - py_retval = libxml_xmlTextReaderPtrWrap((xmlTextReaderPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderNodeType(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderNodeType", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderNodeType(reader); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -PyObject * -libxml_xmlIsBlankNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlNodePtr node; - PyObject *pyobj_node; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlIsBlankNode", &pyobj_node)) - return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - - c_retval = xmlIsBlankNode(node); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlRelaxNGFree(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlRelaxNGPtr schema; - PyObject *pyobj_schema; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlRelaxNGFree", &pyobj_schema)) - return(NULL); - schema = (xmlRelaxNGPtr) PyrelaxNgSchema_Get(pyobj_schema); - - xmlRelaxNGFree(schema); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -PyObject * -libxml_xmlFreeProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlAttrPtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlFreeProp", &pyobj_cur)) - return(NULL); - cur = (xmlAttrPtr) PyxmlNode_Get(pyobj_cur); - - xmlFreeProp(cur); - Py_INCREF(Py_None); - return(Py_None); -} - -PyObject * -libxml_xmlStrcmp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlChar * str1; - xmlChar * str2; - - if (!PyArg_ParseTuple(args, (char *)"zz:xmlStrcmp", &str1, &str2)) - return(NULL); - - c_retval = xmlStrcmp(str1, str2); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) -PyObject * -libxml_xmlDocSetRootElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlNodePtr root; - PyObject *pyobj_root; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlDocSetRootElement", &pyobj_doc, &pyobj_root)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - root = (xmlNodePtr) PyxmlNode_Get(pyobj_root); - - c_retval = xmlDocSetRootElement(doc, root); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsKhmerSymbols(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsKhmerSymbols", &code)) - return(NULL); - - c_retval = xmlUCSIsKhmerSymbols(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_REGEXP_ENABLED) -PyObject * -libxml_xmlRegFreeRegexp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlRegexpPtr regexp; - PyObject *pyobj_regexp; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlRegFreeRegexp", &pyobj_regexp)) - return(NULL); - regexp = (xmlRegexpPtr) PyxmlReg_Get(pyobj_regexp); - - xmlRegFreeRegexp(regexp); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_REGEXP_ENABLED) */ -PyObject * -libxml_xmlSearchNs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNsPtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlNodePtr node; - PyObject *pyobj_node; - xmlChar * nameSpace; - - if (!PyArg_ParseTuple(args, (char *)"OOz:xmlSearchNs", &pyobj_doc, &pyobj_node, &nameSpace)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - - c_retval = xmlSearchNs(doc, node, nameSpace); - py_retval = libxml_xmlNsPtrWrap((xmlNsPtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathParserGetContext(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlXPathContextPtr c_retval; - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathParserGetContext", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - c_retval = ctxt->context; - py_retval = libxml_xmlXPathContextPtrWrap((xmlXPathContextPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderReadAttributeValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderReadAttributeValue", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderReadAttributeValue(reader); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_XINCLUDE_ENABLED) -PyObject * -libxml_xmlXIncludeProcessTreeFlags(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlNodePtr tree; - PyObject *pyobj_tree; - int flags; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXIncludeProcessTreeFlags", &pyobj_tree, &flags)) - return(NULL); - tree = (xmlNodePtr) PyxmlNode_Get(pyobj_tree); - - c_retval = xmlXIncludeProcessTreeFlags(tree, flags); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XINCLUDE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsGeorgian(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsGeorgian", &code)) - return(NULL); - - c_retval = xmlUCSIsGeorgian(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlParserSetValidate(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - int validate; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlParserSetValidate", &pyobj_ctxt, &validate)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - ctxt->validate = validate; - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_VALID_ENABLED) -PyObject * -libxml_xmlValidNormalizeAttributeValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlNodePtr elem; - PyObject *pyobj_elem; - xmlChar * name; - xmlChar * value; - - if (!PyArg_ParseTuple(args, (char *)"OOzz:xmlValidNormalizeAttributeValue", &pyobj_doc, &pyobj_elem, &name, &value)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem); - - c_retval = xmlValidNormalizeAttributeValue(doc, elem, name, value); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_VALID_ENABLED) */ -PyObject * -libxml_xmlParsePubidLiteral(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParsePubidLiteral", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlParsePubidLiteral(ctxt); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlNewCharRef(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlChar * name; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlNewCharRef", &pyobj_doc, &name)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlNewCharRef(doc, name); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsArabic(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsArabic", &code)) - return(NULL); - - c_retval = xmlUCSIsArabic(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsMiscellaneousMathematicalSymbolsB(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsMiscellaneousMathematicalSymbolsB", &code)) - return(NULL); - - c_retval = xmlUCSIsMiscellaneousMathematicalSymbolsB(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_HTTP_ENABLED) -PyObject * -libxml_xmlNanoHTTPCleanup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - - xmlNanoHTTPCleanup(); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_HTTP_ENABLED) */ -#if defined(LIBXML_LEGACY_ENABLED) -PyObject * -libxml_xmlParseQuotedString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParseQuotedString", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlParseQuotedString(ctxt); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_LEGACY_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathCastStringToNumber(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - double c_retval; - xmlChar * val; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlXPathCastStringToNumber", &val)) - return(NULL); - - c_retval = xmlXPathCastStringToNumber(val); - py_retval = libxml_doubleWrap((double) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathNewCString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlXPathObjectPtr c_retval; - char * val; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlXPathNewCString", &val)) - return(NULL); - - c_retval = xmlXPathNewCString(val); - py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderIsNamespaceDecl(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderIsNamespaceDecl", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderIsNamespaceDecl(reader); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -PyObject * -libxml_xmlStopParser(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlStopParser", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - xmlStopParser(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -PyObject * -libxml_xmlReadFd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlDocPtr c_retval; - int fd; - char * URL; - char * encoding; - int options; - - if (!PyArg_ParseTuple(args, (char *)"izzi:xmlReadFd", &fd, &URL, &encoding, &options)) - return(NULL); - - c_retval = xmlReadFd(fd, URL, encoding, options); - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_CATALOG_ENABLED) -PyObject * -libxml_xmlACatalogResolveSystem(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlCatalogPtr catal; - PyObject *pyobj_catal; - xmlChar * sysID; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlACatalogResolveSystem", &pyobj_catal, &sysID)) - return(NULL); - catal = (xmlCatalogPtr) Pycatalog_Get(pyobj_catal); - - c_retval = xmlACatalogResolveSystem(catal, sysID); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_CATALOG_ENABLED) */ -PyObject * -libxml_xmlCreateDocParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlParserCtxtPtr c_retval; - xmlChar * cur; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlCreateDocParserCtxt", &cur)) - return(NULL); - - c_retval = xmlCreateDocParserCtxt(cur); - py_retval = libxml_xmlParserCtxtPtrWrap((xmlParserCtxtPtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsTaiXuanJingSymbols(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsTaiXuanJingSymbols", &code)) - return(NULL); - - c_retval = xmlUCSIsTaiXuanJingSymbols(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) -PyObject * -libxml_htmlDocDump(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - FILE * f; - PyObject *pyobj_f; - xmlDocPtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"OO:htmlDocDump", &pyobj_f, &pyobj_cur)) - return(NULL); - f = (FILE *) PyFile_Get(pyobj_f); - cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur); - - c_retval = htmlDocDump(f, cur); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) */ -PyObject * -libxml_xmlCheckFilename(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - char * path; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlCheckFilename", &path)) - return(NULL); - - c_retval = xmlCheckFilename(path); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlTextReaderRelaxNGValidate(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - char * rng; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlTextReaderRelaxNGValidate", &pyobj_reader, &rng)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderRelaxNGValidate(reader, rng); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) */ -PyObject * -libxml_xmlFreeNodeList(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlNodePtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlFreeNodeList", &pyobj_cur)) - return(NULL); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - xmlFreeNodeList(cur); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathDivValues(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathDivValues", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathDivValues(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathPositionFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - int nargs; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathPositionFunction", &pyobj_ctxt, &nargs)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathPositionFunction(ctxt, nargs); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsTelugu(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsTelugu", &code)) - return(NULL); - - c_retval = xmlUCSIsTelugu(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_DEBUG_ENABLED) -PyObject * -libxml_xmlLsCountNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlNodePtr node; - PyObject *pyobj_node; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlLsCountNode", &pyobj_node)) - return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - - c_retval = xmlLsCountNode(node); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_DEBUG_ENABLED) */ -#if defined(LIBXML_CATALOG_ENABLED) -PyObject * -libxml_xmlParseCatalogFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlDocPtr c_retval; - char * filename; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlParseCatalogFile", &filename)) - return(NULL); - - c_retval = xmlParseCatalogFile(filename); - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_CATALOG_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathGetFunctionURI(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const xmlChar * c_retval; - xmlXPathContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathGetFunctionURI", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt); - - c_retval = ctxt->functionURI; - py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatMn(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatMn", &code)) - return(NULL); - - c_retval = xmlUCSIsCatMn(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatMc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatMc", &code)) - return(NULL); - - c_retval = xmlUCSIsCatMc(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatMe(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatMe", &code)) - return(NULL); - - c_retval = xmlUCSIsCatMe(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlGetEncodingAlias(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const char * c_retval; - char * alias; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlGetEncodingAlias", &alias)) - return(NULL); - - c_retval = xmlGetEncodingAlias(alias); - py_retval = libxml_charPtrConstWrap((const char *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_CATALOG_ENABLED) -PyObject * -libxml_xmlACatalogAdd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlCatalogPtr catal; - PyObject *pyobj_catal; - xmlChar * type; - xmlChar * orig; - xmlChar * replace; - - if (!PyArg_ParseTuple(args, (char *)"Ozzz:xmlACatalogAdd", &pyobj_catal, &type, &orig, &replace)) - return(NULL); - catal = (xmlCatalogPtr) Pycatalog_Get(pyobj_catal); - - c_retval = xmlACatalogAdd(catal, type, orig, replace); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_CATALOG_ENABLED) */ -PyObject * -libxml_xmlNewNsPropEatName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlAttrPtr c_retval; - xmlNodePtr node; - PyObject *pyobj_node; - xmlNsPtr ns; - PyObject *pyobj_ns; - xmlChar * name; - xmlChar * value; - - if (!PyArg_ParseTuple(args, (char *)"OOzz:xmlNewNsPropEatName", &pyobj_node, &pyobj_ns, &name, &value)) - return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - ns = (xmlNsPtr) PyxmlNode_Get(pyobj_ns); - - c_retval = xmlNewNsPropEatName(node, ns, name, value); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlStrdup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlChar * cur; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlStrdup", &cur)) - return(NULL); - - c_retval = xmlStrdup(cur); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlCtxtReadDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlDocPtr c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - xmlChar * cur; - char * URL; - char * encoding; - int options; - - if (!PyArg_ParseTuple(args, (char *)"Ozzzi:xmlCtxtReadDoc", &pyobj_ctxt, &cur, &URL, &encoding, &options)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlCtxtReadDoc(ctxt, cur, URL, encoding, options); - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlSubstituteEntitiesDefault(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int val; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlSubstituteEntitiesDefault", &val)) - return(NULL); - - c_retval = xmlSubstituteEntitiesDefault(val); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderQuoteChar(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderQuoteChar", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderQuoteChar(reader); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -PyObject * -libxml_xmlInitCharEncodingHandlers(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - - xmlInitCharEncodingHandlers(); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_REGEXP_ENABLED) -PyObject * -libxml_xmlRegexpCompile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlRegexpPtr c_retval; - xmlChar * regexp; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlRegexpCompile", ®exp)) - return(NULL); - - c_retval = xmlRegexpCompile(regexp); - py_retval = libxml_xmlRegexpPtrWrap((xmlRegexpPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_REGEXP_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathRegisteredNsCleanup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathRegisteredNsCleanup", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt); - - xmlXPathRegisteredNsCleanup(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsKannada(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsKannada", &code)) - return(NULL); - - c_retval = xmlUCSIsKannada(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderConstValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const xmlChar * c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderConstValue", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderConstValue(reader); - py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_DOCB_ENABLED) -PyObject * -libxml_docbDefaultSAXHandlerInit(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - - docbDefaultSAXHandlerInit(); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_DOCB_ENABLED) */ -#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED) -PyObject * -libxml_xmlValidatePushCData(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlValidCtxtPtr ctxt; - PyObject *pyobj_ctxt; - xmlChar * data; - int len; - - if (!PyArg_ParseTuple(args, (char *)"Ozi:xmlValidatePushCData", &pyobj_ctxt, &data, &len)) - return(NULL); - ctxt = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_ctxt); - - c_retval = xmlValidatePushCData(ctxt, data, len); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED) */ -PyObject * -libxml_xmlErrorGetDomain(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlErrorPtr Error; - PyObject *pyobj_Error; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlErrorGetDomain", &pyobj_Error)) - return(NULL); - Error = (xmlErrorPtr) PyError_Get(pyobj_Error); - - c_retval = Error->domain; - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathFloorFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - int nargs; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathFloorFunction", &pyobj_ctxt, &nargs)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathFloorFunction(ctxt, nargs); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsTibetan(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsTibetan", &code)) - return(NULL); - - c_retval = xmlUCSIsTibetan(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlUTF8Strndup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlChar * utf; - int len; - - if (!PyArg_ParseTuple(args, (char *)"zi:xmlUTF8Strndup", &utf, &len)) - return(NULL); - - c_retval = xmlUTF8Strndup(utf, len); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_LEGACY_ENABLED) -PyObject * -libxml_xmlNewGlobalNs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNsPtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlChar * href; - xmlChar * prefix; - - if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlNewGlobalNs", &pyobj_doc, &href, &prefix)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlNewGlobalNs(doc, href, prefix); - py_retval = libxml_xmlNsPtrWrap((xmlNsPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_LEGACY_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathStringLengthFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - int nargs; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathStringLengthFunction", &pyobj_ctxt, &nargs)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathStringLengthFunction(ctxt, nargs); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_OUTPUT_ENABLED) -PyObject * -libxml_xmlDocDump(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - FILE * f; - PyObject *pyobj_f; - xmlDocPtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlDocDump", &pyobj_f, &pyobj_cur)) - return(NULL); - f = (FILE *) PyFile_Get(pyobj_f); - cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur); - - c_retval = xmlDocDump(f, cur); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_OUTPUT_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathNextSelf(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - xmlNodePtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathNextSelf", &pyobj_ctxt, &pyobj_cur)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - c_retval = xmlXPathNextSelf(ctxt, cur); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCyrillicSupplement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCyrillicSupplement", &code)) - return(NULL); - - c_retval = xmlUCSIsCyrillicSupplement(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlParseURI(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlURIPtr c_retval; - char * str; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlParseURI", &str)) - return(NULL); - - c_retval = xmlParseURI(str); - py_retval = libxml_xmlURIPtrWrap((xmlURIPtr) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlCopyProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlAttrPtr c_retval; - xmlNodePtr target; - PyObject *pyobj_target; - xmlAttrPtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlCopyProp", &pyobj_target, &pyobj_cur)) - return(NULL); - target = (xmlNodePtr) PyxmlNode_Get(pyobj_target); - cur = (xmlAttrPtr) PyxmlNode_Get(pyobj_cur); - - c_retval = xmlCopyProp(target, cur); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlURIGetPort(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlURIPtr URI; - PyObject *pyobj_URI; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlURIGetPort", &pyobj_URI)) - return(NULL); - URI = (xmlURIPtr) PyURI_Get(pyobj_URI); - - c_retval = URI->port; - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) -PyObject * -libxml_htmlSaveFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - char * filename; - xmlDocPtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"zO:htmlSaveFile", &filename, &pyobj_cur)) - return(NULL); - cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur); - - c_retval = htmlSaveFile(filename, cur); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderCurrentDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlDocPtr c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderCurrentDoc", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderCurrentDoc(reader); - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -PyObject * -libxml_xmlParsePITarget(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const xmlChar * c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParsePITarget", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlParsePITarget(ctxt); - py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlURISetOpaque(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlURIPtr URI; - PyObject *pyobj_URI; - char * opaque; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlURISetOpaque", &pyobj_URI, &opaque)) - return(NULL); - URI = (xmlURIPtr) PyURI_Get(pyobj_URI); - - if (URI->opaque != NULL) xmlFree(URI->opaque); - URI->opaque = (char *)xmlStrdup((const xmlChar *)opaque); - Py_INCREF(Py_None); - return(Py_None); -} - -PyObject * -libxml_xmlNewNodeEatName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlNsPtr ns; - PyObject *pyobj_ns; - xmlChar * name; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlNewNodeEatName", &pyobj_ns, &name)) - return(NULL); - ns = (xmlNsPtr) PyxmlNode_Get(pyobj_ns); - - c_retval = xmlNewNodeEatName(ns, name); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlIsCombining(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - unsigned int ch; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlIsCombining", &ch)) - return(NULL); - - c_retval = xmlIsCombining(ch); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_HTML_ENABLED) -PyObject * -libxml_htmlReadFd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - htmlDocPtr c_retval; - int fd; - char * URL; - char * encoding; - int options; - - if (!PyArg_ParseTuple(args, (char *)"izzi:htmlReadFd", &fd, &URL, &encoding, &options)) - return(NULL); - - c_retval = htmlReadFd(fd, URL, encoding, options); - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_HTML_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderNormalization(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderNormalization", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderNormalization(reader); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathEvalExpression(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlXPathObjectPtr c_retval; - xmlChar * str; - xmlXPathContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"zO:xmlXPathEvalExpression", &str, &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt); - - c_retval = xmlXPathEvalExpression(str, ctxt); - py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -PyObject * -libxml_xmlStrncatNew(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlChar * str1; - xmlChar * str2; - int len; - - if (!PyArg_ParseTuple(args, (char *)"zzi:xmlStrncatNew", &str1, &str2, &len)) - return(NULL); - - c_retval = xmlStrncatNew(str1, str2, len); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_CATALOG_ENABLED) -PyObject * -libxml_xmlCatalogResolvePublic(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlChar * pubID; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlCatalogResolvePublic", &pubID)) - return(NULL); - - c_retval = xmlCatalogResolvePublic(pubID); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_CATALOG_ENABLED) */ -PyObject * -libxml_xmlNewCDataBlock(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlChar * content; - int len; - - if (!PyArg_ParseTuple(args, (char *)"Ozi:xmlNewCDataBlock", &pyobj_doc, &content, &len)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlNewCDataBlock(doc, content, len); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlURIGetServer(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const char * c_retval; - xmlURIPtr URI; - PyObject *pyobj_URI; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlURIGetServer", &pyobj_URI)) - return(NULL); - URI = (xmlURIPtr) PyURI_Get(pyobj_URI); - - c_retval = URI->server; - py_retval = libxml_charPtrConstWrap((const char *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) -PyObject * -libxml_htmlSaveFileFormat(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - char * filename; - xmlDocPtr cur; - PyObject *pyobj_cur; - char * encoding; - int format; - - if (!PyArg_ParseTuple(args, (char *)"zOzi:htmlSaveFileFormat", &filename, &pyobj_cur, &encoding, &format)) - return(NULL); - cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur); - - c_retval = htmlSaveFileFormat(filename, cur, encoding, format); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) */ -PyObject * -libxml_xmlNodeIsText(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlNodePtr node; - PyObject *pyobj_node; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlNodeIsText", &pyobj_node)) - return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - - c_retval = xmlNodeIsText(node); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlParserSetReplaceEntities(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - int replaceEntities; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlParserSetReplaceEntities", &pyobj_ctxt, &replaceEntities)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - ctxt->replaceEntities = replaceEntities; - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathStringEvalNumber(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - double c_retval; - xmlChar * str; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlXPathStringEvalNumber", &str)) - return(NULL); - - c_retval = xmlXPathStringEvalNumber(str); - py_retval = libxml_doubleWrap((double) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -PyObject * -libxml_xmlUTF8Strsize(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlChar * utf; - int len; - - if (!PyArg_ParseTuple(args, (char *)"zi:xmlUTF8Strsize", &utf, &len)) - return(NULL); - - c_retval = xmlUTF8Strsize(utf, len); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderStandalone(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderStandalone", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderStandalone(reader); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_SAX1_ENABLED) -PyObject * -libxml_xmlParseStartTag(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const xmlChar * c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParseStartTag", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlParseStartTag(ctxt); - py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SAX1_ENABLED) */ -#if defined(LIBXML_SAX1_ENABLED) -PyObject * -libxml_xmlSetupParserForBuffer(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - xmlChar * buffer; - char * filename; - - if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlSetupParserForBuffer", &pyobj_ctxt, &buffer, &filename)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - xmlSetupParserForBuffer(ctxt, buffer, filename); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_SAX1_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlNewTextReaderFilename(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlTextReaderPtr c_retval; - char * URI; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlNewTextReaderFilename", &URI)) - return(NULL); - - c_retval = xmlNewTextReaderFilename(URI); - py_retval = libxml_xmlTextReaderPtrWrap((xmlTextReaderPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathNumberFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - int nargs; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathNumberFunction", &pyobj_ctxt, &nargs)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathNumberFunction(ctxt, nargs); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_DEBUG_ENABLED) -PyObject * -libxml_xmlLsOneNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - FILE * output; - PyObject *pyobj_output; - xmlNodePtr node; - PyObject *pyobj_node; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlLsOneNode", &pyobj_output, &pyobj_node)) - return(NULL); - output = (FILE *) PyFile_Get(pyobj_output); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - - xmlLsOneNode(output, node); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_DEBUG_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsGreekExtended(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsGreekExtended", &code)) - return(NULL); - - c_retval = xmlUCSIsGreekExtended(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlNewDocNodeEatName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlNsPtr ns; - PyObject *pyobj_ns; - xmlChar * name; - xmlChar * content; - - if (!PyArg_ParseTuple(args, (char *)"OOzz:xmlNewDocNodeEatName", &pyobj_doc, &pyobj_ns, &name, &content)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - ns = (xmlNsPtr) PyxmlNode_Get(pyobj_ns); - - c_retval = xmlNewDocNodeEatName(doc, ns, name, content); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlReaderForDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlTextReaderPtr c_retval; - xmlChar * cur; - char * URL; - char * encoding; - int options; - - if (!PyArg_ParseTuple(args, (char *)"zzzi:xmlReaderForDoc", &cur, &URL, &encoding, &options)) - return(NULL); - - c_retval = xmlReaderForDoc(cur, URL, encoding, options); - py_retval = libxml_xmlTextReaderPtrWrap((xmlTextReaderPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlRelaxNGParse(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlRelaxNGPtr c_retval; - xmlRelaxNGParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlRelaxNGParse", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlRelaxNGParserCtxtPtr) PyrelaxNgParserCtxt_Get(pyobj_ctxt); - - c_retval = xmlRelaxNGParse(ctxt); - py_retval = libxml_xmlRelaxNGPtrWrap((xmlRelaxNGPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -PyObject * -libxml_xmlAddDocEntity(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlEntityPtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlChar * name; - int type; - xmlChar * ExternalID; - xmlChar * SystemID; - xmlChar * content; - - if (!PyArg_ParseTuple(args, (char *)"Ozizzz:xmlAddDocEntity", &pyobj_doc, &name, &type, &ExternalID, &SystemID, &content)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlAddDocEntity(doc, name, type, ExternalID, SystemID, content); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsMyanmar(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsMyanmar", &code)) - return(NULL); - - c_retval = xmlUCSIsMyanmar(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathIsNodeType(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlChar * name; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlXPathIsNodeType", &name)) - return(NULL); - - c_retval = xmlXPathIsNodeType(name); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathRoot(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathRoot", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathRoot(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathVariableLookup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlXPathObjectPtr c_retval; - xmlXPathContextPtr ctxt; - PyObject *pyobj_ctxt; - xmlChar * name; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlXPathVariableLookup", &pyobj_ctxt, &name)) - return(NULL); - ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt); - - c_retval = xmlXPathVariableLookup(ctxt, name); - py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathNextFollowing(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - xmlNodePtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathNextFollowing", &pyobj_ctxt, &pyobj_cur)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - c_retval = xmlXPathNextFollowing(ctxt, cur); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsHangulCompatibilityJamo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsHangulCompatibilityJamo", &code)) - return(NULL); - - c_retval = xmlUCSIsHangulCompatibilityJamo(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_TREE_ENABLED) -PyObject * -libxml_xmlNewTextChild(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlNodePtr parent; - PyObject *pyobj_parent; - xmlNsPtr ns; - PyObject *pyobj_ns; - xmlChar * name; - xmlChar * content; - - if (!PyArg_ParseTuple(args, (char *)"OOzz:xmlNewTextChild", &pyobj_parent, &pyobj_ns, &name, &content)) - return(NULL); - parent = (xmlNodePtr) PyxmlNode_Get(pyobj_parent); - ns = (xmlNsPtr) PyxmlNode_Get(pyobj_ns); - - c_retval = xmlNewTextChild(parent, ns, name, content); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_TREE_ENABLED) */ -PyObject * -libxml_xmlAddChild(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlNodePtr parent; - PyObject *pyobj_parent; - xmlNodePtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlAddChild", &pyobj_parent, &pyobj_cur)) - return(NULL); - parent = (xmlNodePtr) PyxmlNode_Get(pyobj_parent); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - c_retval = xmlAddChild(parent, cur); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathErr(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - int error; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathErr", &pyobj_ctxt, &error)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathErr(ctxt, error); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderDepth(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderDepth", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderDepth(reader); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsHiragana(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsHiragana", &code)) - return(NULL); - - c_retval = xmlUCSIsHiragana(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) -PyObject * -libxml_xmlRelaxNGDump(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - FILE * output; - PyObject *pyobj_output; - xmlRelaxNGPtr schema; - PyObject *pyobj_schema; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlRelaxNGDump", &pyobj_output, &pyobj_schema)) - return(NULL); - output = (FILE *) PyFile_Get(pyobj_output); - schema = (xmlRelaxNGPtr) PyrelaxNgSchema_Get(pyobj_schema); - - xmlRelaxNGDump(output, schema); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) */ -PyObject * -libxml_xmlFreeURI(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlURIPtr uri; - PyObject *pyobj_uri; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlFreeURI", &pyobj_uri)) - return(NULL); - uri = (xmlURIPtr) PyURI_Get(pyobj_uri); - - xmlFreeURI(uri); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathNextParent(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - xmlNodePtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathNextParent", &pyobj_ctxt, &pyobj_cur)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - c_retval = xmlXPathNextParent(ctxt, cur); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsDevanagari(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsDevanagari", &code)) - return(NULL); - - c_retval = xmlUCSIsDevanagari(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlNodeGetContent(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlNodePtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlNodeGetContent", &pyobj_cur)) - return(NULL); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - c_retval = xmlNodeGetContent(cur); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderIsEmptyElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderIsEmptyElement", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderIsEmptyElement(reader); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsIPAExtensions(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsIPAExtensions", &code)) - return(NULL); - - c_retval = xmlUCSIsIPAExtensions(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_XPTR_ENABLED) -PyObject * -libxml_xmlXPtrNewContext(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlXPathContextPtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlNodePtr here; - PyObject *pyobj_here; - xmlNodePtr origin; - PyObject *pyobj_origin; - - if (!PyArg_ParseTuple(args, (char *)"OOO:xmlXPtrNewContext", &pyobj_doc, &pyobj_here, &pyobj_origin)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - here = (xmlNodePtr) PyxmlNode_Get(pyobj_here); - origin = (xmlNodePtr) PyxmlNode_Get(pyobj_origin); - - c_retval = xmlXPtrNewContext(doc, here, origin); - py_retval = libxml_xmlXPathContextPtrWrap((xmlXPathContextPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPTR_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsYiSyllables(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsYiSyllables", &code)) - return(NULL); - - c_retval = xmlUCSIsYiSyllables(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderLookupNamespace(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - xmlChar * prefix; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlTextReaderLookupNamespace", &pyobj_reader, &prefix)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderLookupNamespace(reader, prefix); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -PyObject * -libxml_xmlNodeGetLang(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlNodePtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlNodeGetLang", &pyobj_cur)) - return(NULL); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - c_retval = xmlNodeGetLang(cur); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlNewParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - PyObject *py_retval; - xmlParserCtxtPtr c_retval; - - c_retval = xmlNewParserCtxt(); - py_retval = libxml_xmlParserCtxtPtrWrap((xmlParserCtxtPtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_FTP_ENABLED) -PyObject * -libxml_xmlNanoFTPScanProxy(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - char * URL; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlNanoFTPScanProxy", &URL)) - return(NULL); - - xmlNanoFTPScanProxy(URL); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_FTP_ENABLED) */ -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlSchemaFree(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlSchemaPtr schema; - PyObject *pyobj_schema; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlSchemaFree", &pyobj_schema)) - return(NULL); - schema = (xmlSchemaPtr) PySchema_Get(pyobj_schema); - - xmlSchemaFree(schema); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderNextSibling(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderNextSibling", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderNextSibling(reader); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -PyObject * -libxml_xmlClearParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlClearParserCtxt", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - xmlClearParserCtxt(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#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; - int c_retval; - xmlChar * value; - int space; - - if (!PyArg_ParseTuple(args, (char *)"zi:xmlValidateNCName", &value, &space)) - return(NULL); - - c_retval = xmlValidateNCName(value, space); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#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; - int c_retval; - xmlChar * str; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlStrlen", &str)) - return(NULL); - - c_retval = xmlStrlen(str); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_DEBUG_ENABLED) -PyObject * -libxml_xmlDebugDumpDocument(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - FILE * output; - PyObject *pyobj_output; - xmlDocPtr doc; - PyObject *pyobj_doc; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlDebugDumpDocument", &pyobj_output, &pyobj_doc)) - return(NULL); - output = (FILE *) PyFile_Get(pyobj_output); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - xmlDebugDumpDocument(output, doc); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_DEBUG_ENABLED) */ -#if defined(LIBXML_XPTR_ENABLED) -PyObject * -libxml_xmlXPtrEval(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlXPathObjectPtr c_retval; - xmlChar * str; - xmlXPathContextPtr ctx; - PyObject *pyobj_ctx; - - if (!PyArg_ParseTuple(args, (char *)"zO:xmlXPtrEval", &str, &pyobj_ctx)) - return(NULL); - ctx = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctx); - - c_retval = xmlXPtrEval(str, ctx); - py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPTR_ENABLED) */ -PyObject * -libxml_xmlPopInput(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlPopInput", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlPopInput(ctxt); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathBooleanFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - int nargs; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathBooleanFunction", &pyobj_ctxt, &nargs)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathBooleanFunction(ctxt, nargs); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderSetParserProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - int prop; - int value; - - if (!PyArg_ParseTuple(args, (char *)"Oii:xmlTextReaderSetParserProp", &pyobj_reader, &prop, &value)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderSetParserProp(reader, prop, value); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderGetRemainder(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlParserInputBufferPtr c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderGetRemainder", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderGetRemainder(reader); - py_retval = libxml_xmlParserInputBufferPtrWrap((xmlParserInputBufferPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsGujarati(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsGujarati", &code)) - return(NULL); - - c_retval = xmlUCSIsGujarati(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_HTML_ENABLED) -PyObject * -libxml_htmlSetMetaEncoding(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - htmlDocPtr doc; - PyObject *pyobj_doc; - xmlChar * encoding; - - if (!PyArg_ParseTuple(args, (char *)"Oz:htmlSetMetaEncoding", &pyobj_doc, &encoding)) - return(NULL); - doc = (htmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = htmlSetMetaEncoding(doc, encoding); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_HTML_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlReaderNewDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - xmlChar * cur; - char * URL; - char * encoding; - int options; - - if (!PyArg_ParseTuple(args, (char *)"Ozzzi:xmlReaderNewDoc", &pyobj_reader, &cur, &URL, &encoding, &options)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlReaderNewDoc(reader, cur, URL, encoding, options); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderConstPrefix(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const xmlChar * c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderConstPrefix", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderConstPrefix(reader); - py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_SAX1_ENABLED) -PyObject * -libxml_xmlRecoverDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlDocPtr c_retval; - xmlChar * cur; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlRecoverDoc", &cur)) - return(NULL); - - c_retval = xmlRecoverDoc(cur); - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SAX1_ENABLED) */ -PyObject * -libxml_xmlNormalizeWindowsPath(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlChar * path; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlNormalizeWindowsPath", &path)) - return(NULL); - - c_retval = xmlNormalizeWindowsPath(path); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_XINCLUDE_ENABLED) -PyObject * -libxml_xmlXIncludeProcessTree(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlNodePtr tree; - PyObject *pyobj_tree; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXIncludeProcessTree", &pyobj_tree)) - return(NULL); - tree = (xmlNodePtr) PyxmlNode_Get(pyobj_tree); - - c_retval = xmlXIncludeProcessTree(tree); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XINCLUDE_ENABLED) */ -#if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) -PyObject * -libxml_xmlCatalogDump(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - FILE * out; - PyObject *pyobj_out; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlCatalogDump", &pyobj_out)) - return(NULL); - out = (FILE *) PyFile_Get(pyobj_out); - - xmlCatalogDump(out); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathNextDescendantOrSelf(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - xmlNodePtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathNextDescendantOrSelf", &pyobj_ctxt, &pyobj_cur)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - c_retval = xmlXPathNextDescendantOrSelf(ctxt, cur); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_LEGACY_ENABLED) -PyObject * -libxml_xmlParseNamespace(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParseNamespace", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - xmlParseNamespace(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_LEGACY_ENABLED) */ -PyObject * -libxml_xmlStrcasecmp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlChar * str1; - xmlChar * str2; - - if (!PyArg_ParseTuple(args, (char *)"zz:xmlStrcasecmp", &str1, &str2)) - return(NULL); - - c_retval = xmlStrcasecmp(str1, str2); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlReaderForMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlTextReaderPtr c_retval; - char * buffer; - int size; - char * URL; - char * encoding; - int options; - - if (!PyArg_ParseTuple(args, (char *)"zizzi:xmlReaderForMemory", &buffer, &size, &URL, &encoding, &options)) - return(NULL); - - c_retval = xmlReaderForMemory(buffer, size, URL, encoding, options); - py_retval = libxml_xmlTextReaderPtrWrap((xmlTextReaderPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderByteConsumed(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - long c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderByteConsumed", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderByteConsumed(reader); - py_retval = libxml_longWrap((long) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -PyObject * -libxml_xmlNewDtd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlDtdPtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlChar * name; - xmlChar * ExternalID; - xmlChar * SystemID; - - if (!PyArg_ParseTuple(args, (char *)"Ozzz:xmlNewDtd", &pyobj_doc, &name, &ExternalID, &SystemID)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlNewDtd(doc, name, ExternalID, SystemID); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsBlockElements(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsBlockElements", &code)) - return(NULL); - - c_retval = xmlUCSIsBlockElements(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlNodeGetBase(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlNodePtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlNodeGetBase", &pyobj_doc, &pyobj_cur)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - c_retval = xmlNodeGetBase(doc, cur); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathNextAncestorOrSelf(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - xmlNodePtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathNextAncestorOrSelf", &pyobj_ctxt, &pyobj_cur)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - c_retval = xmlXPathNextAncestorOrSelf(ctxt, cur); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathNewFloat(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlXPathObjectPtr c_retval; - double val; - - if (!PyArg_ParseTuple(args, (char *)"d:xmlXPathNewFloat", &val)) - return(NULL); - - c_retval = xmlXPathNewFloat(val); - py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathNewString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlXPathObjectPtr c_retval; - xmlChar * val; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlXPathNewString", &val)) - return(NULL); - - c_retval = xmlXPathNewString(val); - py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -PyObject * -libxml_xmlAddSibling(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlNodePtr cur; - PyObject *pyobj_cur; - xmlNodePtr elem; - PyObject *pyobj_elem; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlAddSibling", &pyobj_cur, &pyobj_elem)) - return(NULL); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem); - - c_retval = xmlAddSibling(cur, elem); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_LEGACY_ENABLED) -PyObject * -libxml_xmlScanName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlScanName", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlScanName(ctxt); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_LEGACY_ENABLED) */ -PyObject * -libxml_xmlRegisterDefaultInputCallbacks(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - - xmlRegisterDefaultInputCallbacks(); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_DEBUG_ENABLED) -PyObject * -libxml_xmlDebugDumpEntities(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - FILE * output; - PyObject *pyobj_output; - xmlDocPtr doc; - PyObject *pyobj_doc; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlDebugDumpEntities", &pyobj_output, &pyobj_doc)) - return(NULL); - output = (FILE *) PyFile_Get(pyobj_output); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - xmlDebugDumpEntities(output, doc); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_DEBUG_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathNextAncestor(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - xmlNodePtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathNextAncestor", &pyobj_ctxt, &pyobj_cur)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - c_retval = xmlXPathNextAncestor(ctxt, cur); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathCastNumberToBoolean(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - double val; - - if (!PyArg_ParseTuple(args, (char *)"d:xmlXPathCastNumberToBoolean", &val)) - return(NULL); - - c_retval = xmlXPathCastNumberToBoolean(val); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatCs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatCs", &code)) - return(NULL); - - c_retval = xmlUCSIsCatCs(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatCf(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatCf", &code)) - return(NULL); - - c_retval = xmlUCSIsCatCf(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatCo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatCo", &code)) - return(NULL); - - c_retval = xmlUCSIsCatCo(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_SAX1_ENABLED) -PyObject * -libxml_xmlRecoverMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlDocPtr c_retval; - char * buffer; - int py_buffsize0; - int size; - - if (!PyArg_ParseTuple(args, (char *)"t#i:xmlRecoverMemory", &buffer, &py_buffsize0, &size)) - return(NULL); - - c_retval = xmlRecoverMemory(buffer, size); - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SAX1_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderIsDefault(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderIsDefault", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderIsDefault(reader); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -PyObject * -libxml_xmlParserGetWellFormed(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParserGetWellFormed", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = ctxt->wellFormed; - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlRemoveRef(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlAttrPtr attr; - PyObject *pyobj_attr; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlRemoveRef", &pyobj_doc, &pyobj_attr)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - attr = (xmlAttrPtr) PyxmlNode_Get(pyobj_attr); - - c_retval = xmlRemoveRef(doc, attr); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlReaderNewMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - char * buffer; - int size; - char * URL; - char * encoding; - int options; - - if (!PyArg_ParseTuple(args, (char *)"Ozizzi:xmlReaderNewMemory", &pyobj_reader, &buffer, &size, &URL, &encoding, &options)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlReaderNewMemory(reader, buffer, size, URL, encoding, options); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlTextReaderSchemaValidateCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - xmlSchemaValidCtxtPtr ctxt; - PyObject *pyobj_ctxt; - int options; - - if (!PyArg_ParseTuple(args, (char *)"OOi:xmlTextReaderSchemaValidateCtxt", &pyobj_reader, &pyobj_ctxt, &options)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - ctxt = (xmlSchemaValidCtxtPtr) PySchemaValidCtxt_Get(pyobj_ctxt); - - c_retval = xmlTextReaderSchemaValidateCtxt(reader, ctxt, options); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlNewProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlAttrPtr c_retval; - xmlNodePtr node; - PyObject *pyobj_node; - xmlChar * name; - xmlChar * value; - - if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlNewProp", &pyobj_node, &name, &value)) - return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - - c_retval = xmlNewProp(node, name, value); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ -PyObject * -libxml_xmlParserGetDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlDocPtr c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParserGetDoc", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = ctxt->myDoc; - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlCleanupCharEncodingHandlers(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - - xmlCleanupCharEncodingHandlers(); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlRelaxNGValidatePopElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlRelaxNGValidCtxtPtr ctxt; - PyObject *pyobj_ctxt; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlNodePtr elem; - PyObject *pyobj_elem; - - if (!PyArg_ParseTuple(args, (char *)"OOO:xmlRelaxNGValidatePopElement", &pyobj_ctxt, &pyobj_doc, &pyobj_elem)) - return(NULL); - ctxt = (xmlRelaxNGValidCtxtPtr) PyrelaxNgValidCtxt_Get(pyobj_ctxt); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem); - - c_retval = xmlRelaxNGValidatePopElement(ctxt, doc, elem); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -PyObject * -libxml_xmlParseEntityRef(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlEntityPtr c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParseEntityRef", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlParseEntityRef(ctxt); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_HTML_ENABLED) -PyObject * -libxml_htmlInitAutoClose(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - - htmlInitAutoClose(); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_HTML_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_WRITER_ENABLED) -PyObject * -libxml_xmlTextReaderReadOuterXml(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderReadOuterXml", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderReadOuterXml(reader); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) && defined(LIBXML_WRITER_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsTamil(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsTamil", &code)) - return(NULL); - - c_retval = xmlUCSIsTamil(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_DEBUG_ENABLED) -PyObject * -libxml_xmlDebugDumpString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - FILE * output; - PyObject *pyobj_output; - xmlChar * str; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlDebugDumpString", &pyobj_output, &str)) - return(NULL); - output = (FILE *) PyFile_Get(pyobj_output); - - xmlDebugDumpString(output, str); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_DEBUG_ENABLED) */ -PyObject * -libxml_xmlCleanupGlobals(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - - xmlCleanupGlobals(); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_LEGACY_ENABLED) -PyObject * -libxml_xmlEncodeEntities(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const xmlChar * c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlChar * input; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlEncodeEntities", &pyobj_doc, &input)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlEncodeEntities(doc, input); - py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_LEGACY_ENABLED) */ -#if defined(LIBXML_CATALOG_ENABLED) -PyObject * -libxml_xmlNewCatalog(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlCatalogPtr c_retval; - int sgml; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlNewCatalog", &sgml)) - return(NULL); - - c_retval = xmlNewCatalog(sgml); - py_retval = libxml_xmlCatalogPtrWrap((xmlCatalogPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_CATALOG_ENABLED) */ -PyObject * -libxml_xmlStrncasecmp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlChar * str1; - xmlChar * str2; - int len; - - if (!PyArg_ParseTuple(args, (char *)"zzi:xmlStrncasecmp", &str1, &str2, &len)) - return(NULL); - - c_retval = xmlStrncasecmp(str1, str2, len); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlCanonicPath(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlChar * path; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlCanonicPath", &path)) - return(NULL); - - c_retval = xmlCanonicPath(path); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathNextPrecedingSibling(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - xmlNodePtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathNextPrecedingSibling", &pyobj_ctxt, &pyobj_cur)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - c_retval = xmlXPathNextPrecedingSibling(ctxt, cur); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_CATALOG_ENABLED) -PyObject * -libxml_xmlCatalogCleanup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - - xmlCatalogCleanup(); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_CATALOG_ENABLED) */ -PyObject * -libxml_xmlNextChar(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlNextChar", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - xmlNextChar(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -PyObject * -libxml_xmlIsID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlNodePtr elem; - PyObject *pyobj_elem; - xmlAttrPtr attr; - PyObject *pyobj_attr; - - if (!PyArg_ParseTuple(args, (char *)"OOO:xmlIsID", &pyobj_doc, &pyobj_elem, &pyobj_attr)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem); - attr = (xmlAttrPtr) PyxmlNode_Get(pyobj_attr); - - c_retval = xmlIsID(doc, elem, attr); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlParseExtParsedEnt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParseExtParsedEnt", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlParseExtParsedEnt(ctxt); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_FTP_ENABLED) -PyObject * -libxml_xmlNanoFTPProxy(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - char * host; - int port; - char * user; - char * passwd; - int type; - - if (!PyArg_ParseTuple(args, (char *)"zizzi:xmlNanoFTPProxy", &host, &port, &user, &passwd, &type)) - return(NULL); - - xmlNanoFTPProxy(host, port, user, passwd, type); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_FTP_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCJKUnifiedIdeographsExtensionA(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCJKUnifiedIdeographsExtensionA", &code)) - return(NULL); - - c_retval = xmlUCSIsCJKUnifiedIdeographsExtensionA(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCJKUnifiedIdeographsExtensionB(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCJKUnifiedIdeographsExtensionB", &code)) - return(NULL); - - c_retval = xmlUCSIsCJKUnifiedIdeographsExtensionB(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_HTML_ENABLED) -PyObject * -libxml_htmlCreateMemoryParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - htmlParserCtxtPtr c_retval; - char * buffer; - int py_buffsize0; - int size; - - if (!PyArg_ParseTuple(args, (char *)"t#i:htmlCreateMemoryParserCtxt", &buffer, &py_buffsize0, &size)) - return(NULL); - - c_retval = htmlCreateMemoryParserCtxt(buffer, size); - py_retval = libxml_xmlParserCtxtPtrWrap((xmlParserCtxtPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_HTML_ENABLED) */ -PyObject * -libxml_xmlIsDigit(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - unsigned int ch; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlIsDigit", &ch)) - return(NULL); - - c_retval = xmlIsDigit(ch); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_CATALOG_ENABLED) -PyObject * -libxml_xmlCatalogSetDebug(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int level; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlCatalogSetDebug", &level)) - return(NULL); - - c_retval = xmlCatalogSetDebug(level); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_CATALOG_ENABLED) */ -PyObject * -libxml_xmlParserGetDirectory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - char * c_retval; - char * filename; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlParserGetDirectory", &filename)) - return(NULL); - - c_retval = xmlParserGetDirectory(filename); - py_retval = libxml_charPtrWrap((char *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlSchemaCleanupTypes(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - - xmlSchemaCleanupTypes(); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -PyObject * -libxml_xmlFreeNsList(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlNsPtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlFreeNsList", &pyobj_cur)) - return(NULL); - cur = (xmlNsPtr) PyxmlNode_Get(pyobj_cur); - - xmlFreeNsList(cur); - Py_INCREF(Py_None); - return(Py_None); -} - -PyObject * -libxml_xmlParseEntityDecl(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParseEntityDecl", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - xmlParseEntityDecl(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -PyObject * -libxml_xmlDocCopyNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlNodePtr node; - PyObject *pyobj_node; - xmlDocPtr doc; - PyObject *pyobj_doc; - int extended; - - if (!PyArg_ParseTuple(args, (char *)"OOi:xmlDocCopyNode", &pyobj_node, &pyobj_doc, &extended)) - return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlDocCopyNode(node, doc, extended); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -PyObject * -libxml_nodePop(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:nodePop", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = nodePop(ctxt); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathNextDescendant(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - xmlNodePtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathNextDescendant", &pyobj_ctxt, &pyobj_cur)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - c_retval = xmlXPathNextDescendant(ctxt, cur); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathNewNodeSet(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlXPathObjectPtr c_retval; - xmlNodePtr val; - PyObject *pyobj_val; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathNewNodeSet", &pyobj_val)) - return(NULL); - val = (xmlNodePtr) PyxmlNode_Get(pyobj_val); - - c_retval = xmlXPathNewNodeSet(val); - py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlSchemaNewParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlSchemaParserCtxtPtr c_retval; - char * URL; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlSchemaNewParserCtxt", &URL)) - return(NULL); - - c_retval = xmlSchemaNewParserCtxt(URL); - py_retval = libxml_xmlSchemaParserCtxtPtrWrap((xmlSchemaParserCtxtPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -#if defined(LIBXML_CATALOG_ENABLED) -PyObject * -libxml_xmlInitializeCatalog(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - - xmlInitializeCatalog(); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_CATALOG_ENABLED) */ -#if defined(LIBXML_SAX1_ENABLED) -PyObject * -libxml_xmlParseEntity(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlDocPtr c_retval; - char * filename; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlParseEntity", &filename)) - return(NULL); - - c_retval = xmlParseEntity(filename); - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SAX1_ENABLED) */ -PyObject * -libxml_xmlDocGetRootElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlDocGetRootElement", &pyobj_doc)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlDocGetRootElement(doc); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathPopString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathPopString", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - c_retval = xmlXPathPopString(ctxt); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_HTML_ENABLED) -PyObject * -libxml_htmlCreateFileParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - htmlParserCtxtPtr c_retval; - char * filename; - char * encoding; - - if (!PyArg_ParseTuple(args, (char *)"zz:htmlCreateFileParserCtxt", &filename, &encoding)) - return(NULL); - - c_retval = htmlCreateFileParserCtxt(filename, encoding); - py_retval = libxml_xmlParserCtxtPtrWrap((xmlParserCtxtPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_HTML_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderConstEncoding(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const xmlChar * c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderConstEncoding", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderConstEncoding(reader); - py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_VALID_ENABLED) -PyObject * -libxml_xmlValidateOneAttribute(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlValidCtxtPtr ctxt; - PyObject *pyobj_ctxt; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlNodePtr elem; - PyObject *pyobj_elem; - xmlAttrPtr attr; - PyObject *pyobj_attr; - xmlChar * value; - - if (!PyArg_ParseTuple(args, (char *)"OOOOz:xmlValidateOneAttribute", &pyobj_ctxt, &pyobj_doc, &pyobj_elem, &pyobj_attr, &value)) - return(NULL); - ctxt = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_ctxt); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem); - attr = (xmlAttrPtr) PyxmlNode_Get(pyobj_attr); - - c_retval = xmlValidateOneAttribute(ctxt, doc, elem, attr, value); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_VALID_ENABLED) */ -PyObject * -libxml_xmlAddEncodingAlias(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - char * name; - char * alias; - - if (!PyArg_ParseTuple(args, (char *)"zz:xmlAddEncodingAlias", &name, &alias)) - return(NULL); - - c_retval = xmlAddEncodingAlias(name, alias); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderMoveToAttribute(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - xmlChar * name; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlTextReaderMoveToAttribute", &pyobj_reader, &name)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderMoveToAttribute(reader, name); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCJKCompatibilityForms(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCJKCompatibilityForms", &code)) - return(NULL); - - c_retval = xmlUCSIsCJKCompatibilityForms(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlTextReaderSetSchema(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - xmlSchemaPtr schema; - PyObject *pyobj_schema; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlTextReaderSetSchema", &pyobj_reader, &pyobj_schema)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - schema = (xmlSchemaPtr) PySchema_Get(pyobj_schema); - - c_retval = xmlTextReaderSetSchema(reader, schema); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlUnsetNsProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlNodePtr node; - PyObject *pyobj_node; - xmlNsPtr ns; - PyObject *pyobj_ns; - xmlChar * name; - - if (!PyArg_ParseTuple(args, (char *)"OOz:xmlUnsetNsProp", &pyobj_node, &pyobj_ns, &name)) - return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - ns = (xmlNsPtr) PyxmlNode_Get(pyobj_ns); - - c_retval = xmlUnsetNsProp(node, ns, name); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ -#if defined(LIBXML_OUTPUT_ENABLED) -PyObject * -libxml_xmlElemDump(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - FILE * f; - PyObject *pyobj_f; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlNodePtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"OOO:xmlElemDump", &pyobj_f, &pyobj_doc, &pyobj_cur)) - return(NULL); - f = (FILE *) PyFile_Get(pyobj_f); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - xmlElemDump(f, doc, cur); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_OUTPUT_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathConcatFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - int nargs; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathConcatFunction", &pyobj_ctxt, &nargs)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathConcatFunction(ctxt, nargs); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_DEBUG_ENABLED) -PyObject * -libxml_xmlDebugDumpAttrList(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - FILE * output; - PyObject *pyobj_output; - xmlAttrPtr attr; - PyObject *pyobj_attr; - int depth; - - if (!PyArg_ParseTuple(args, (char *)"OOi:xmlDebugDumpAttrList", &pyobj_output, &pyobj_attr, &depth)) - return(NULL); - output = (FILE *) PyFile_Get(pyobj_output); - attr = (xmlAttrPtr) PyxmlNode_Get(pyobj_attr); - - xmlDebugDumpAttrList(output, attr, depth); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_DEBUG_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderReadString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderReadString", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderReadString(reader); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsLinearBIdeograms(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsLinearBIdeograms", &code)) - return(NULL); - - c_retval = xmlUCSIsLinearBIdeograms(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlParseCharData(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - int cdata; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlParseCharData", &pyobj_ctxt, &cdata)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - xmlParseCharData(ctxt, cdata); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsThai(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsThai", &code)) - return(NULL); - - c_retval = xmlUCSIsThai(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_HTML_ENABLED) -PyObject * -libxml_htmlCtxtReset(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - htmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:htmlCtxtReset", &pyobj_ctxt)) - return(NULL); - ctxt = (htmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - htmlCtxtReset(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_HTML_ENABLED) */ -PyObject * -libxml_xmlCtxtReadFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlDocPtr c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - char * filename; - char * encoding; - int options; - - if (!PyArg_ParseTuple(args, (char *)"Ozzi:xmlCtxtReadFile", &pyobj_ctxt, &filename, &encoding, &options)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlCtxtReadFile(ctxt, filename, encoding, options); - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_CATALOG_ENABLED) -PyObject * -libxml_xmlCatalogResolveSystem(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlChar * sysID; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlCatalogResolveSystem", &sysID)) - return(NULL); - - c_retval = xmlCatalogResolveSystem(sysID); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_CATALOG_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderConstLocalName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const xmlChar * c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderConstLocalName", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderConstLocalName(reader); - py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathLastFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - int nargs; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathLastFunction", &pyobj_ctxt, &nargs)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathLastFunction(ctxt, nargs); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsOpticalCharacterRecognition(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsOpticalCharacterRecognition", &code)) - return(NULL); - - c_retval = xmlUCSIsOpticalCharacterRecognition(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlThrDefSubstituteEntitiesDefaultValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int v; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlThrDefSubstituteEntitiesDefaultValue", &v)) - return(NULL); - - c_retval = xmlThrDefSubstituteEntitiesDefaultValue(v); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlNewNsProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlAttrPtr c_retval; - xmlNodePtr node; - PyObject *pyobj_node; - xmlNsPtr ns; - PyObject *pyobj_ns; - xmlChar * name; - xmlChar * value; - - if (!PyArg_ParseTuple(args, (char *)"OOzz:xmlNewNsProp", &pyobj_node, &pyobj_ns, &name, &value)) - return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - ns = (xmlNsPtr) PyxmlNode_Get(pyobj_ns); - - c_retval = xmlNewNsProp(node, ns, name, value); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlThrDefIndentTreeOutput(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int v; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlThrDefIndentTreeOutput", &v)) - return(NULL); - - c_retval = xmlThrDefIndentTreeOutput(v); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsYijingHexagramSymbols(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsYijingHexagramSymbols", &code)) - return(NULL); - - c_retval = xmlUCSIsYijingHexagramSymbols(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlReaderNewFd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - int fd; - char * URL; - char * encoding; - int options; - - if (!PyArg_ParseTuple(args, (char *)"Oizzi:xmlReaderNewFd", &pyobj_reader, &fd, &URL, &encoding, &options)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlReaderNewFd(reader, fd, URL, encoding, options); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -PyObject * -libxml_xmlCreateMemoryParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlParserCtxtPtr c_retval; - char * buffer; - int py_buffsize0; - int size; - - if (!PyArg_ParseTuple(args, (char *)"t#i:xmlCreateMemoryParserCtxt", &buffer, &py_buffsize0, &size)) - return(NULL); - - c_retval = xmlCreateMemoryParserCtxt(buffer, size); - py_retval = libxml_xmlParserCtxtPtrWrap((xmlParserCtxtPtr) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlParseName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const xmlChar * c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParseName", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlParseName(ctxt); - py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlCopyNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlNodePtr node; - PyObject *pyobj_node; - int extended; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlCopyNode", &pyobj_node, &extended)) - return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - - c_retval = xmlCopyNode(node, extended); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathCastStringToBoolean(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlChar * val; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlXPathCastStringToBoolean", &val)) - return(NULL); - - c_retval = xmlXPathCastStringToBoolean(val); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderMoveToElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderMoveToElement", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderMoveToElement(reader); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_HTML_ENABLED) -PyObject * -libxml_htmlIsAutoClosed(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - htmlDocPtr doc; - PyObject *pyobj_doc; - htmlNodePtr elem; - PyObject *pyobj_elem; - - if (!PyArg_ParseTuple(args, (char *)"OO:htmlIsAutoClosed", &pyobj_doc, &pyobj_elem)) - return(NULL); - doc = (htmlDocPtr) PyxmlNode_Get(pyobj_doc); - elem = (htmlNodePtr) PyxmlNode_Get(pyobj_elem); - - c_retval = htmlIsAutoClosed(doc, elem); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_HTML_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsUgaritic(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsUgaritic", &code)) - return(NULL); - - c_retval = xmlUCSIsUgaritic(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCJKCompatibilityIdeographsSupplement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCJKCompatibilityIdeographsSupplement", &code)) - return(NULL); - - c_retval = xmlUCSIsCJKCompatibilityIdeographsSupplement(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_TREE_ENABLED) -PyObject * -libxml_xmlReconciliateNs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlNodePtr tree; - PyObject *pyobj_tree; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlReconciliateNs", &pyobj_doc, &pyobj_tree)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - tree = (xmlNodePtr) PyxmlNode_Get(pyobj_tree); - - c_retval = xmlReconciliateNs(doc, tree); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_TREE_ENABLED) */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlNewChild(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlNodePtr parent; - PyObject *pyobj_parent; - xmlNsPtr ns; - PyObject *pyobj_ns; - xmlChar * name; - xmlChar * content; - - if (!PyArg_ParseTuple(args, (char *)"OOzz:xmlNewChild", &pyobj_parent, &pyobj_ns, &name, &content)) - return(NULL); - parent = (xmlNodePtr) PyxmlNode_Get(pyobj_parent); - ns = (xmlNsPtr) PyxmlNode_Get(pyobj_ns); - - c_retval = xmlNewChild(parent, ns, name, content); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsKangxiRadicals(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsKangxiRadicals", &code)) - return(NULL); - - c_retval = xmlUCSIsKangxiRadicals(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlCreateIntSubset(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlDtdPtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlChar * name; - xmlChar * ExternalID; - xmlChar * SystemID; - - if (!PyArg_ParseTuple(args, (char *)"Ozzz:xmlCreateIntSubset", &pyobj_doc, &name, &ExternalID, &SystemID)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlCreateIntSubset(doc, name, ExternalID, SystemID); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathSubValues(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathSubValues", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathSubValues(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsArabicPresentationFormsA(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsArabicPresentationFormsA", &code)) - return(NULL); - - c_retval = xmlUCSIsArabicPresentationFormsA(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsArabicPresentationFormsB(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsArabicPresentationFormsB", &code)) - return(NULL); - - c_retval = xmlUCSIsArabicPresentationFormsB(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsGeometricShapes(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsGeometricShapes", &code)) - return(NULL); - - c_retval = xmlUCSIsGeometricShapes(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlGetPredefinedEntity(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlEntityPtr c_retval; - xmlChar * name; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlGetPredefinedEntity", &name)) - return(NULL); - - c_retval = xmlGetPredefinedEntity(name); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_OUTPUT_ENABLED) -PyObject * -libxml_xmlSaveFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - char * filename; - xmlDocPtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"zO:xmlSaveFile", &filename, &pyobj_cur)) - return(NULL); - cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur); - - c_retval = xmlSaveFile(filename, cur); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_OUTPUT_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathNextNamespace(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - xmlNodePtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathNextNamespace", &pyobj_ctxt, &pyobj_cur)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - c_retval = xmlXPathNextNamespace(ctxt, cur); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsBuhid(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsBuhid", &code)) - return(NULL); - - c_retval = xmlUCSIsBuhid(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlSchemaValidateOneElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlSchemaValidCtxtPtr ctxt; - PyObject *pyobj_ctxt; - xmlNodePtr elem; - PyObject *pyobj_elem; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlSchemaValidateOneElement", &pyobj_ctxt, &pyobj_elem)) - return(NULL); - ctxt = (xmlSchemaValidCtxtPtr) PySchemaValidCtxt_Get(pyobj_ctxt); - elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem); - - c_retval = xmlSchemaValidateOneElement(ctxt, elem); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -PyObject * -libxml_xmlReadDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlDocPtr c_retval; - xmlChar * cur; - char * URL; - char * encoding; - int options; - - if (!PyArg_ParseTuple(args, (char *)"zzzi:xmlReadDoc", &cur, &URL, &encoding, &options)) - return(NULL); - - c_retval = xmlReadDoc(cur, URL, encoding, options); - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlReaderNewFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - char * filename; - char * encoding; - int options; - - if (!PyArg_ParseTuple(args, (char *)"Ozzi:xmlReaderNewFile", &pyobj_reader, &filename, &encoding, &options)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlReaderNewFile(reader, filename, encoding, options); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -PyObject * -libxml_xmlFreeDtd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlDtdPtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlFreeDtd", &pyobj_cur)) - return(NULL); - cur = (xmlDtdPtr) PyxmlNode_Get(pyobj_cur); - - xmlFreeDtd(cur); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderSetup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - xmlParserInputBufferPtr input; - PyObject *pyobj_input; - char * URL; - char * encoding; - int options; - - if (!PyArg_ParseTuple(args, (char *)"OOzzi:xmlTextReaderSetup", &pyobj_reader, &pyobj_input, &URL, &encoding, &options)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - input = (xmlParserInputBufferPtr) PyinputBuffer_Get(pyobj_input); - - c_retval = xmlTextReaderSetup(reader, input, URL, encoding, options); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -PyObject * -libxml_xmlSetListDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlNodePtr list; - PyObject *pyobj_list; - xmlDocPtr doc; - PyObject *pyobj_doc; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlSetListDoc", &pyobj_list, &pyobj_doc)) - return(NULL); - list = (xmlNodePtr) PyxmlNode_Get(pyobj_list); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - xmlSetListDoc(list, doc); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_HTML_ENABLED) -PyObject * -libxml_htmlCtxtReadFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - htmlDocPtr c_retval; - htmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - char * filename; - char * encoding; - int options; - - if (!PyArg_ParseTuple(args, (char *)"Ozzi:htmlCtxtReadFile", &pyobj_ctxt, &filename, &encoding, &options)) - return(NULL); - ctxt = (htmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = htmlCtxtReadFile(ctxt, filename, encoding, options); - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_HTML_ENABLED) */ -PyObject * -libxml_xmlThrDefLineNumbersDefaultValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int v; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlThrDefLineNumbersDefaultValue", &v)) - return(NULL); - - c_retval = xmlThrDefLineNumbersDefaultValue(v); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCombiningHalfMarks(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCombiningHalfMarks", &code)) - return(NULL); - - c_retval = xmlUCSIsCombiningHalfMarks(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatSc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatSc", &code)) - return(NULL); - - c_retval = xmlUCSIsCatSc(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatSo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatSo", &code)) - return(NULL); - - c_retval = xmlUCSIsCatSo(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatSk(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatSk", &code)) - return(NULL); - - c_retval = xmlUCSIsCatSk(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathFreeContext(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathFreeContext", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt); - - xmlXPathFreeContext(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -PyObject * -libxml_xmlEncodeSpecialChars(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlChar * input; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlEncodeSpecialChars", &pyobj_doc, &input)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlEncodeSpecialChars(doc, input); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsEthiopic(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsEthiopic", &code)) - return(NULL); - - c_retval = xmlUCSIsEthiopic(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlParseContent(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParseContent", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - xmlParseContent(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -PyObject * -libxml_xmlReadMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlDocPtr c_retval; - char * buffer; - int py_buffsize0; - int size; - char * URL; - char * encoding; - int options; - - if (!PyArg_ParseTuple(args, (char *)"t#izzi:xmlReadMemory", &buffer, &py_buffsize0, &size, &URL, &encoding, &options)) - return(NULL); - - c_retval = xmlReadMemory(buffer, size, URL, encoding, options); - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlThrDefGetWarningsDefaultValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int v; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlThrDefGetWarningsDefaultValue", &v)) - return(NULL); - - c_retval = xmlThrDefGetWarningsDefaultValue(v); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsMongolian(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsMongolian", &code)) - return(NULL); - - c_retval = xmlUCSIsMongolian(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlURIGetFragment(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const char * c_retval; - xmlURIPtr URI; - PyObject *pyobj_URI; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlURIGetFragment", &pyobj_URI)) - return(NULL); - URI = (xmlURIPtr) PyURI_Get(pyobj_URI); - - c_retval = URI->fragment; - py_retval = libxml_charPtrConstWrap((const char *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCJKRadicalsSupplement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCJKRadicalsSupplement", &code)) - return(NULL); - - c_retval = xmlUCSIsCJKRadicalsSupplement(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathSumFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - int nargs; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathSumFunction", &pyobj_ctxt, &nargs)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathSumFunction(ctxt, nargs); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -PyObject * -libxml_xmlCopyNamespace(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNsPtr c_retval; - xmlNsPtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlCopyNamespace", &pyobj_cur)) - return(NULL); - cur = (xmlNsPtr) PyxmlNode_Get(pyobj_cur); - - c_retval = xmlCopyNamespace(cur); - py_retval = libxml_xmlNsPtrWrap((xmlNsPtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCyrillic(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCyrillic", &code)) - return(NULL); - - c_retval = xmlUCSIsCyrillic(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlURISetFragment(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlURIPtr URI; - PyObject *pyobj_URI; - char * fragment; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlURISetFragment", &pyobj_URI, &fragment)) - return(NULL); - URI = (xmlURIPtr) PyURI_Get(pyobj_URI); - - if (URI->fragment != NULL) xmlFree(URI->fragment); - URI->fragment = (char *)xmlStrdup((const xmlChar *)fragment); - Py_INCREF(Py_None); - return(Py_None); -} - -PyObject * -libxml_xmlAddChildList(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlNodePtr parent; - PyObject *pyobj_parent; - xmlNodePtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlAddChildList", &pyobj_parent, &pyobj_cur)) - return(NULL); - parent = (xmlNodePtr) PyxmlNode_Get(pyobj_parent); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - c_retval = xmlAddChildList(parent, cur); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED) -PyObject * -libxml_htmlParseChunk(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - htmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - char * chunk; - int py_buffsize0; - int size; - int terminate; - - if (!PyArg_ParseTuple(args, (char *)"Ot#ii:htmlParseChunk", &pyobj_ctxt, &chunk, &py_buffsize0, &size, &terminate)) - return(NULL); - ctxt = (htmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = htmlParseChunk(ctxt, chunk, size, terminate); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathIdFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - int nargs; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathIdFunction", &pyobj_ctxt, &nargs)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathIdFunction(ctxt, nargs); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -PyObject * -libxml_xmlCreateURLParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlParserCtxtPtr c_retval; - char * filename; - int options; - - if (!PyArg_ParseTuple(args, (char *)"zi:xmlCreateURLParserCtxt", &filename, &options)) - return(NULL); - - c_retval = xmlCreateURLParserCtxt(filename, options); - py_retval = libxml_xmlParserCtxtPtrWrap((xmlParserCtxtPtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderRead(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderRead", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderRead(reader); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -PyObject * -libxml_xmlSaveUri(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlURIPtr uri; - PyObject *pyobj_uri; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlSaveUri", &pyobj_uri)) - return(NULL); - uri = (xmlURIPtr) PyURI_Get(pyobj_uri); - - c_retval = xmlSaveUri(uri); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlIsChar(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - unsigned int ch; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlIsChar", &ch)) - return(NULL); - - c_retval = xmlIsChar(ch); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_HTML_ENABLED) -PyObject * -libxml_htmlCtxtReadFd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - htmlDocPtr c_retval; - htmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - int fd; - char * URL; - char * encoding; - int options; - - if (!PyArg_ParseTuple(args, (char *)"Oizzi:htmlCtxtReadFd", &pyobj_ctxt, &fd, &URL, &encoding, &options)) - return(NULL); - ctxt = (htmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = htmlCtxtReadFd(ctxt, fd, URL, encoding, options); - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_HTML_ENABLED) */ -PyObject * -libxml_xmlPedanticParserDefault(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int val; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlPedanticParserDefault", &val)) - return(NULL); - - c_retval = xmlPedanticParserDefault(val); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_SAX1_ENABLED) -PyObject * -libxml_xmlParseDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlDocPtr c_retval; - xmlChar * cur; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlParseDoc", &cur)) - return(NULL); - - c_retval = xmlParseDoc(cur); - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SAX1_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathParseNCName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathParseNCName", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - c_retval = xmlXPathParseNCName(ctxt); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -PyObject * -libxml_xmlLineNumbersDefault(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int val; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlLineNumbersDefault", &val)) - return(NULL); - - c_retval = xmlLineNumbersDefault(val); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_CATALOG_ENABLED) -PyObject * -libxml_xmlConvertSGMLCatalog(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlCatalogPtr catal; - PyObject *pyobj_catal; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlConvertSGMLCatalog", &pyobj_catal)) - return(NULL); - catal = (xmlCatalogPtr) Pycatalog_Get(pyobj_catal); - - c_retval = xmlConvertSGMLCatalog(catal); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_CATALOG_ENABLED) */ -PyObject * -libxml_xmlNodeAddContent(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlNodePtr cur; - PyObject *pyobj_cur; - xmlChar * content; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlNodeAddContent", &pyobj_cur, &content)) - return(NULL); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - xmlNodeAddContent(cur, content); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathNewParserContext(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlXPathParserContextPtr c_retval; - xmlChar * str; - xmlXPathContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"zO:xmlXPathNewParserContext", &str, &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt); - - c_retval = xmlXPathNewParserContext(str, ctxt); - py_retval = libxml_xmlXPathParserContextPtrWrap((xmlXPathParserContextPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -PyObject * -libxml_xmlParseDocument(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParseDocument", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlParseDocument(ctxt); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlFreeNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlNodePtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlFreeNode", &pyobj_cur)) - return(NULL); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - xmlFreeNode(cur); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlRelaxNGValidatePushElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlRelaxNGValidCtxtPtr ctxt; - PyObject *pyobj_ctxt; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlNodePtr elem; - PyObject *pyobj_elem; - - if (!PyArg_ParseTuple(args, (char *)"OOO:xmlRelaxNGValidatePushElement", &pyobj_ctxt, &pyobj_doc, &pyobj_elem)) - return(NULL); - ctxt = (xmlRelaxNGValidCtxtPtr) PyrelaxNgValidCtxt_Get(pyobj_ctxt); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem); - - c_retval = xmlRelaxNGValidatePushElement(ctxt, doc, elem); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsSinhala(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsSinhala", &code)) - return(NULL); - - c_retval = xmlUCSIsSinhala(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlParserInputBufferPush(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlParserInputBufferPtr in; - PyObject *pyobj_in; - int len; - char * buf; - - if (!PyArg_ParseTuple(args, (char *)"Oiz:xmlParserInputBufferPush", &pyobj_in, &len, &buf)) - return(NULL); - in = (xmlParserInputBufferPtr) PyinputBuffer_Get(pyobj_in); - - c_retval = xmlParserInputBufferPush(in, len, buf); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlFileMatch(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - char * filename; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlFileMatch", &filename)) - return(NULL); - - c_retval = xmlFileMatch(filename); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlStrEqual(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlChar * str1; - xmlChar * str2; - - if (!PyArg_ParseTuple(args, (char *)"zz:xmlStrEqual", &str1, &str2)) - return(NULL); - - c_retval = xmlStrEqual(str1, str2); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderPreserve(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderPreserve", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderPreserve(reader); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsKatakanaPhoneticExtensions(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsKatakanaPhoneticExtensions", &code)) - return(NULL); - - c_retval = xmlUCSIsKatakanaPhoneticExtensions(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlRelaxNGNewParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlRelaxNGParserCtxtPtr c_retval; - char * URL; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlRelaxNGNewParserCtxt", &URL)) - return(NULL); - - c_retval = xmlRelaxNGNewParserCtxt(URL); - py_retval = libxml_xmlRelaxNGParserCtxtPtrWrap((xmlRelaxNGParserCtxtPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathSetContextDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathContextPtr ctxt; - PyObject *pyobj_ctxt; - xmlDocPtr doc; - PyObject *pyobj_doc; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathSetContextDoc", &pyobj_ctxt, &pyobj_doc)) - return(NULL); - ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - ctxt->doc = doc; - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlSchemaIsValid(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlSchemaValidCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlSchemaIsValid", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlSchemaValidCtxtPtr) PySchemaValidCtxt_Get(pyobj_ctxt); - - c_retval = xmlSchemaIsValid(ctxt); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsKanbun(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsKanbun", &code)) - return(NULL); - - c_retval = xmlUCSIsKanbun(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsLatin1Supplement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsLatin1Supplement", &code)) - return(NULL); - - c_retval = xmlUCSIsLatin1Supplement(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_TREE_ENABLED) -PyObject * -libxml_xmlNodeSetName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlNodePtr cur; - PyObject *pyobj_cur; - xmlChar * name; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlNodeSetName", &pyobj_cur, &name)) - return(NULL); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - xmlNodeSetName(cur, name); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_TREE_ENABLED) */ -PyObject * -libxml_xmlUTF8Strloc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlChar * utf; - xmlChar * utfchar; - - if (!PyArg_ParseTuple(args, (char *)"zz:xmlUTF8Strloc", &utf, &utfchar)) - return(NULL); - - c_retval = xmlUTF8Strloc(utf, utfchar); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_HTML_ENABLED) -PyObject * -libxml_htmlReadFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - htmlDocPtr c_retval; - char * filename; - char * encoding; - int options; - - if (!PyArg_ParseTuple(args, (char *)"zzi:htmlReadFile", &filename, &encoding, &options)) - return(NULL); - - c_retval = htmlReadFile(filename, encoding, options); - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_HTML_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathContextSetCache(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlXPathContextPtr ctxt; - PyObject *pyobj_ctxt; - int active; - int value; - int options; - - if (!PyArg_ParseTuple(args, (char *)"Oiii:xmlXPathContextSetCache", &pyobj_ctxt, &active, &value, &options)) - return(NULL); - ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt); - - c_retval = xmlXPathContextSetCache(ctxt, active, value, options); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsDingbats(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsDingbats", &code)) - return(NULL); - - c_retval = xmlUCSIsDingbats(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlSchemaParse(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlSchemaPtr c_retval; - xmlSchemaParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlSchemaParse", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlSchemaParserCtxtPtr) PySchemaParserCtxt_Get(pyobj_ctxt); - - c_retval = xmlSchemaParse(ctxt); - py_retval = libxml_xmlSchemaPtrWrap((xmlSchemaPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -PyObject * -libxml_xmlThrDefDefaultBufferSize(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int v; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlThrDefDefaultBufferSize", &v)) - return(NULL); - - c_retval = xmlThrDefDefaultBufferSize(v); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsPrivateUse(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsPrivateUse", &code)) - return(NULL); - - c_retval = xmlUCSIsPrivateUse(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_SAX1_ENABLED) -PyObject * -libxml_xmlRecoverFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlDocPtr c_retval; - char * filename; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlRecoverFile", &filename)) - return(NULL); - - c_retval = xmlRecoverFile(filename); - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SAX1_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathNextFollowingSibling(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - xmlNodePtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathNextFollowingSibling", &pyobj_ctxt, &pyobj_cur)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - c_retval = xmlXPathNextFollowingSibling(ctxt, cur); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -PyObject * -libxml_xmlIsExtender(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - unsigned int ch; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlIsExtender", &ch)) - return(NULL); - - c_retval = xmlIsExtender(ch); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathCastBooleanToString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - int val; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlXPathCastBooleanToString", &val)) - return(NULL); - - c_retval = xmlXPathCastBooleanToString(val); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -PyObject * -libxml_xmlUTF8Charcmp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlChar * utf1; - xmlChar * utf2; - - if (!PyArg_ParseTuple(args, (char *)"zz:xmlUTF8Charcmp", &utf1, &utf2)) - return(NULL); - - c_retval = xmlUTF8Charcmp(utf1, utf2); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_XPTR_ENABLED) -PyObject * -libxml_xmlXPtrNewRangeNodes(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlXPathObjectPtr c_retval; - xmlNodePtr start; - PyObject *pyobj_start; - xmlNodePtr end; - PyObject *pyobj_end; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPtrNewRangeNodes", &pyobj_start, &pyobj_end)) - return(NULL); - start = (xmlNodePtr) PyxmlNode_Get(pyobj_start); - end = (xmlNodePtr) PyxmlNode_Get(pyobj_end); - - c_retval = xmlXPtrNewRangeNodes(start, end); - py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval); - return(py_retval); -} - -#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; - xmlChar * c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - xmlChar * str; - int what; - xmlChar end; - xmlChar end2; - xmlChar end3; - - if (!PyArg_ParseTuple(args, (char *)"Oziccc:xmlStringDecodeEntities", &pyobj_ctxt, &str, &what, &end, &end2, &end3)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlStringDecodeEntities(ctxt, str, what, end, end2, end3); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathNotEqualValues(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathNotEqualValues", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - c_retval = xmlXPathNotEqualValues(ctxt); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderMoveToAttributeNs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - xmlChar * localName; - xmlChar * namespaceURI; - - if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlTextReaderMoveToAttributeNs", &pyobj_reader, &localName, &namespaceURI)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderMoveToAttributeNs(reader, localName, namespaceURI); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsOgham(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsOgham", &code)) - return(NULL); - - c_retval = xmlUCSIsOgham(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlNewDocComment(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlChar * content; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlNewDocComment", &pyobj_doc, &content)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlNewDocComment(doc, content); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsBopomofoExtended(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsBopomofoExtended", &code)) - return(NULL); - - c_retval = xmlUCSIsBopomofoExtended(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCJKCompatibility(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCJKCompatibility", &code)) - return(NULL); - - c_retval = xmlUCSIsCJKCompatibility(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlRelaxNGValidateFullElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlRelaxNGValidCtxtPtr ctxt; - PyObject *pyobj_ctxt; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlNodePtr elem; - PyObject *pyobj_elem; - - if (!PyArg_ParseTuple(args, (char *)"OOO:xmlRelaxNGValidateFullElement", &pyobj_ctxt, &pyobj_doc, &pyobj_elem)) - return(NULL); - ctxt = (xmlRelaxNGValidCtxtPtr) PyrelaxNgValidCtxt_Get(pyobj_ctxt); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem); - - c_retval = xmlRelaxNGValidateFullElement(ctxt, doc, elem); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -#if defined(LIBXML_VALID_ENABLED) -PyObject * -libxml_xmlValidateDocument(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlValidCtxtPtr ctxt; - PyObject *pyobj_ctxt; - xmlDocPtr doc; - PyObject *pyobj_doc; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlValidateDocument", &pyobj_ctxt, &pyobj_doc)) - return(NULL); - ctxt = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_ctxt); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlValidateDocument(ctxt, doc); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_VALID_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatPc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatPc", &code)) - return(NULL); - - c_retval = xmlUCSIsCatPc(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatPf(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatPf", &code)) - return(NULL); - - c_retval = xmlUCSIsCatPf(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatPd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatPd", &code)) - return(NULL); - - c_retval = xmlUCSIsCatPd(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_HTML_ENABLED) -PyObject * -libxml_htmlCtxtReadMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - htmlDocPtr c_retval; - htmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - char * buffer; - int py_buffsize0; - int size; - char * URL; - char * encoding; - int options; - - if (!PyArg_ParseTuple(args, (char *)"Ot#izzi:htmlCtxtReadMemory", &pyobj_ctxt, &buffer, &py_buffsize0, &size, &URL, &encoding, &options)) - return(NULL); - ctxt = (htmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = htmlCtxtReadMemory(ctxt, buffer, size, URL, encoding, options); - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_HTML_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatPi(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatPi", &code)) - return(NULL); - - c_retval = xmlUCSIsCatPi(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathGetContextNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlXPathContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathGetContextNode", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt); - - c_retval = ctxt->node; - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatPo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatPo", &code)) - return(NULL); - - c_retval = xmlUCSIsCatPo(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatPs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatPs", &code)) - return(NULL); - - c_retval = xmlUCSIsCatPs(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsHighSurrogates(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsHighSurrogates", &code)) - return(NULL); - - c_retval = xmlUCSIsHighSurrogates(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_CATALOG_ENABLED) -PyObject * -libxml_xmlCatalogResolveURI(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlChar * URI; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlCatalogResolveURI", &URI)) - return(NULL); - - c_retval = xmlCatalogResolveURI(URI); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_CATALOG_ENABLED) */ -PyObject * -libxml_xmlURIGetScheme(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const char * c_retval; - xmlURIPtr URI; - PyObject *pyobj_URI; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlURIGetScheme", &pyobj_URI)) - return(NULL); - URI = (xmlURIPtr) PyURI_Get(pyobj_URI); - - c_retval = URI->scheme; - py_retval = libxml_charPtrConstWrap((const char *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderLocatorLineNumber(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderLocatorPtr locator; - PyObject *pyobj_locator; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderLocatorLineNumber", &pyobj_locator)) - return(NULL); - locator = (xmlTextReaderLocatorPtr) PyxmlTextReaderLocator_Get(pyobj_locator); - - c_retval = xmlTextReaderLocatorLineNumber(locator); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlRelaxNGNewMemParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlRelaxNGParserCtxtPtr c_retval; - char * buffer; - int size; - - if (!PyArg_ParseTuple(args, (char *)"zi:xmlRelaxNGNewMemParserCtxt", &buffer, &size)) - return(NULL); - - c_retval = xmlRelaxNGNewMemParserCtxt(buffer, size); - py_retval = libxml_xmlRelaxNGParserCtxtPtrWrap((xmlRelaxNGParserCtxtPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderAttributeCount(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderAttributeCount", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderAttributeCount(reader); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -PyObject * -libxml_xmlCharStrndup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - char * cur; - int len; - - if (!PyArg_ParseTuple(args, (char *)"zi:xmlCharStrndup", &cur, &len)) - return(NULL); - - c_retval = xmlCharStrndup(cur, len); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlParseEncodingDecl(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const xmlChar * c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParseEncodingDecl", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlParseEncodingDecl(ctxt); - py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsUnifiedCanadianAboriginalSyllabics(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsUnifiedCanadianAboriginalSyllabics", &code)) - return(NULL); - - c_retval = xmlUCSIsUnifiedCanadianAboriginalSyllabics(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlCopyPropList(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlAttrPtr c_retval; - xmlNodePtr target; - PyObject *pyobj_target; - xmlAttrPtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlCopyPropList", &pyobj_target, &pyobj_cur)) - return(NULL); - target = (xmlNodePtr) PyxmlNode_Get(pyobj_target); - cur = (xmlAttrPtr) PyxmlNode_Get(pyobj_cur); - - c_retval = xmlCopyPropList(target, cur); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_OUTPUT_ENABLED) -PyObject * -libxml_xmlDocFormatDump(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - FILE * f; - PyObject *pyobj_f; - xmlDocPtr cur; - PyObject *pyobj_cur; - int format; - - if (!PyArg_ParseTuple(args, (char *)"OOi:xmlDocFormatDump", &pyobj_f, &pyobj_cur, &format)) - return(NULL); - f = (FILE *) PyFile_Get(pyobj_f); - cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur); - - c_retval = xmlDocFormatDump(f, cur, format); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_OUTPUT_ENABLED) */ -PyObject * -libxml_xmlCtxtReset(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlCtxtReset", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - xmlCtxtReset(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -PyObject * -libxml_xmlIsRef(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlNodePtr elem; - PyObject *pyobj_elem; - xmlAttrPtr attr; - PyObject *pyobj_attr; - - if (!PyArg_ParseTuple(args, (char *)"OOO:xmlIsRef", &pyobj_doc, &pyobj_elem, &pyobj_attr)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem); - attr = (xmlAttrPtr) PyxmlNode_Get(pyobj_attr); - - c_retval = xmlIsRef(doc, elem, attr); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathGetContextDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlDocPtr c_retval; - xmlXPathContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathGetContextDoc", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt); - - c_retval = ctxt->doc; - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsTaiLe(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsTaiLe", &code)) - return(NULL); - - c_retval = xmlUCSIsTaiLe(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlParseComment(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParseComment", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - xmlParseComment(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathSubstringAfterFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - int nargs; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathSubstringAfterFunction", &pyobj_ctxt, &nargs)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathSubstringAfterFunction(ctxt, nargs); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_OUTPUT_ENABLED) -PyObject * -libxml_xmlSaveFormatFileEnc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - char * filename; - xmlDocPtr cur; - PyObject *pyobj_cur; - char * encoding; - int format; - - if (!PyArg_ParseTuple(args, (char *)"zOzi:xmlSaveFormatFileEnc", &filename, &pyobj_cur, &encoding, &format)) - return(NULL); - cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur); - - c_retval = xmlSaveFormatFileEnc(filename, cur, encoding, format); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_OUTPUT_ENABLED) */ -PyObject * -libxml_xmlParseNmtoken(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParseNmtoken", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlParseNmtoken(ctxt); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlParserGetIsValid(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParserGetIsValid", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = ctxt->valid; - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsMathematicalOperators(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsMathematicalOperators", &code)) - return(NULL); - - c_retval = xmlUCSIsMathematicalOperators(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_DEBUG_ENABLED) -PyObject * -libxml_xmlDebugDumpDTD(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - FILE * output; - PyObject *pyobj_output; - xmlDtdPtr dtd; - PyObject *pyobj_dtd; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlDebugDumpDTD", &pyobj_output, &pyobj_dtd)) - return(NULL); - output = (FILE *) PyFile_Get(pyobj_output); - dtd = (xmlDtdPtr) PyxmlNode_Get(pyobj_dtd); - - xmlDebugDumpDTD(output, dtd); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_DEBUG_ENABLED) */ -#if defined(LIBXML_XPTR_ENABLED) -PyObject * -libxml_xmlXPtrNewCollapsedRange(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlXPathObjectPtr c_retval; - xmlNodePtr start; - PyObject *pyobj_start; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPtrNewCollapsedRange", &pyobj_start)) - return(NULL); - start = (xmlNodePtr) PyxmlNode_Get(pyobj_start); - - c_retval = xmlXPtrNewCollapsedRange(start); - py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPTR_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathNotFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - int nargs; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathNotFunction", &pyobj_ctxt, &nargs)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathNotFunction(ctxt, nargs); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -PyObject * -libxml_xmlTextConcat(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlNodePtr node; - PyObject *pyobj_node; - xmlChar * content; - int len; - - if (!PyArg_ParseTuple(args, (char *)"Ozi:xmlTextConcat", &pyobj_node, &content, &len)) - return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - - c_retval = xmlTextConcat(node, content, len); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlParsePI(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParsePI", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - xmlParsePI(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_CATALOG_ENABLED) -PyObject * -libxml_xmlLoadCatalogs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - char * pathss; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlLoadCatalogs", &pathss)) - return(NULL); - - xmlLoadCatalogs(pathss); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_CATALOG_ENABLED) */ -#if defined(LIBXML_HTML_ENABLED) -PyObject * -libxml_htmlCtxtReadDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - htmlDocPtr c_retval; - htmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - xmlChar * cur; - char * URL; - char * encoding; - int options; - - if (!PyArg_ParseTuple(args, (char *)"Ozzzi:htmlCtxtReadDoc", &pyobj_ctxt, &cur, &URL, &encoding, &options)) - return(NULL); - ctxt = (htmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = htmlCtxtReadDoc(ctxt, cur, URL, encoding, options); - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_HTML_ENABLED) */ -#if defined(LIBXML_PUSH_ENABLED) -PyObject * -libxml_xmlParseChunk(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - char * chunk; - int py_buffsize0; - int size; - int terminate; - - if (!PyArg_ParseTuple(args, (char *)"Ot#ii:xmlParseChunk", &pyobj_ctxt, &chunk, &py_buffsize0, &size, &terminate)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlParseChunk(ctxt, chunk, size, terminate); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_PUSH_ENABLED) */ -#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) -PyObject * -libxml_htmlSaveFileEnc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - char * filename; - xmlDocPtr cur; - PyObject *pyobj_cur; - char * encoding; - - if (!PyArg_ParseTuple(args, (char *)"zOz:htmlSaveFileEnc", &filename, &pyobj_cur, &encoding)) - return(NULL); - cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur); - - c_retval = htmlSaveFileEnc(filename, cur, encoding); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) */ -PyObject * -libxml_xmlParseElementDecl(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParseElementDecl", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlParseElementDecl(ctxt); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlReaderForFd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlTextReaderPtr c_retval; - int fd; - char * URL; - char * encoding; - int options; - - if (!PyArg_ParseTuple(args, (char *)"izzi:xmlReaderForFd", &fd, &URL, &encoding, &options)) - return(NULL); - - c_retval = xmlReaderForFd(fd, URL, encoding, options); - py_retval = libxml_xmlTextReaderPtrWrap((xmlTextReaderPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCJKCompatibilityIdeographs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCJKCompatibilityIdeographs", &code)) - return(NULL); - - c_retval = xmlUCSIsCJKCompatibilityIdeographs(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderMoveToFirstAttribute(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderMoveToFirstAttribute", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderMoveToFirstAttribute(reader); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlNewTextReader(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlTextReaderPtr c_retval; - xmlParserInputBufferPtr input; - PyObject *pyobj_input; - char * URI; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlNewTextReader", &pyobj_input, &URI)) - return(NULL); - input = (xmlParserInputBufferPtr) PyinputBuffer_Get(pyobj_input); - - c_retval = xmlNewTextReader(input, URI); - py_retval = libxml_xmlTextReaderPtrWrap((xmlTextReaderPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderGetAttributeNo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - int no; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlTextReaderGetAttributeNo", &pyobj_reader, &no)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderGetAttributeNo(reader, no); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderGetAttributeNs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - xmlChar * localName; - xmlChar * namespaceURI; - - if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlTextReaderGetAttributeNs", &pyobj_reader, &localName, &namespaceURI)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderGetAttributeNs(reader, localName, namespaceURI); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -PyObject * -libxml_xmlURIGetQuery(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const char * c_retval; - xmlURIPtr URI; - PyObject *pyobj_URI; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlURIGetQuery", &pyobj_URI)) - return(NULL); - URI = (xmlURIPtr) PyURI_Get(pyobj_URI); - - c_retval = URI->query; - py_retval = libxml_charPtrConstWrap((const char *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsGeneralPunctuation(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsGeneralPunctuation", &code)) - return(NULL); - - c_retval = xmlUCSIsGeneralPunctuation(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsControlPictures(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsControlPictures", &code)) - return(NULL); - - c_retval = xmlUCSIsControlPictures(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_HTML_ENABLED) -PyObject * -libxml_htmlIsBooleanAttr(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlChar * name; - - if (!PyArg_ParseTuple(args, (char *)"z:htmlIsBooleanAttr", &name)) - return(NULL); - - c_retval = htmlIsBooleanAttr(name); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_HTML_ENABLED) */ -PyObject * -libxml_xmlNodeListGetString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlNodePtr list; - PyObject *pyobj_list; - int inLine; - - if (!PyArg_ParseTuple(args, (char *)"OOi:xmlNodeListGetString", &pyobj_doc, &pyobj_list, &inLine)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - list = (xmlNodePtr) PyxmlNode_Get(pyobj_list); - - c_retval = xmlNodeListGetString(doc, list, inLine); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsBengali(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsBengali", &code)) - return(NULL); - - c_retval = xmlUCSIsBengali(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlBuildQName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlChar * ncname; - xmlChar * prefix; - xmlChar * memory; - int len; - - if (!PyArg_ParseTuple(args, (char *)"zzzi:xmlBuildQName", &ncname, &prefix, &memory, &len)) - return(NULL); - - c_retval = xmlBuildQName(ncname, prefix, memory, len); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlFreePropList(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlAttrPtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlFreePropList", &pyobj_cur)) - return(NULL); - cur = (xmlAttrPtr) PyxmlNode_Get(pyobj_cur); - - xmlFreePropList(cur); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathStringFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - int nargs; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathStringFunction", &pyobj_ctxt, &nargs)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathStringFunction(ctxt, nargs); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -PyObject * -libxml_xmlInitParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlInitParserCtxt", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlInitParserCtxt(ctxt); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsTagbanwa(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsTagbanwa", &code)) - return(NULL); - - c_retval = xmlUCSIsTagbanwa(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderConstBaseUri(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const xmlChar * c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderConstBaseUri", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderConstBaseUri(reader); - py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsDeseret(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsDeseret", &code)) - return(NULL); - - c_retval = xmlUCSIsDeseret(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathRoundFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - int nargs; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathRoundFunction", &pyobj_ctxt, &nargs)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathRoundFunction(ctxt, nargs); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatSm(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatSm", &code)) - return(NULL); - - c_retval = xmlUCSIsCatSm(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderMoveToAttributeNo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - int no; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlTextReaderMoveToAttributeNo", &pyobj_reader, &no)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderMoveToAttributeNo(reader, no); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -PyObject * -libxml_xmlParserHandlePEReference(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParserHandlePEReference", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - xmlParserHandlePEReference(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathNewBoolean(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlXPathObjectPtr c_retval; - int val; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlXPathNewBoolean", &val)) - return(NULL); - - c_retval = xmlXPathNewBoolean(val); - py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsPrivateUseArea(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsPrivateUseArea", &code)) - return(NULL); - - c_retval = xmlUCSIsPrivateUseArea(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlCtxtReadFd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlDocPtr c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - int fd; - char * URL; - char * encoding; - int options; - - if (!PyArg_ParseTuple(args, (char *)"Oizzi:xmlCtxtReadFd", &pyobj_ctxt, &fd, &URL, &encoding, &options)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlCtxtReadFd(ctxt, fd, URL, encoding, options); - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsAlphabeticPresentationForms(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsAlphabeticPresentationForms", &code)) - return(NULL); - - c_retval = xmlUCSIsAlphabeticPresentationForms(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCypriotSyllabary(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCypriotSyllabary", &code)) - return(NULL); - - c_retval = xmlUCSIsCypriotSyllabary(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlGetNsProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlNodePtr node; - PyObject *pyobj_node; - xmlChar * name; - xmlChar * nameSpace; - - if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlGetNsProp", &pyobj_node, &name, &nameSpace)) - return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - - c_retval = xmlGetNsProp(node, name, nameSpace); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatC(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatC", &code)) - return(NULL); - - c_retval = xmlUCSIsCatC(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatN(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatN", &code)) - return(NULL); - - c_retval = xmlUCSIsCatN(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatL(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatL", &code)) - return(NULL); - - c_retval = xmlUCSIsCatL(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatM(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatM", &code)) - return(NULL); - - c_retval = xmlUCSIsCatM(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlCtxtResetPush(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - char * chunk; - int py_buffsize0; - int size; - char * filename; - char * encoding; - - if (!PyArg_ParseTuple(args, (char *)"Ot#izz:xmlCtxtResetPush", &pyobj_ctxt, &chunk, &py_buffsize0, &size, &filename, &encoding)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlCtxtResetPush(ctxt, chunk, size, filename, encoding); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatS(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatS", &code)) - return(NULL); - - c_retval = xmlUCSIsCatS(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatP(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatP", &code)) - return(NULL); - - c_retval = xmlUCSIsCatP(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_CATALOG_ENABLED) -PyObject * -libxml_xmlCatalogGetSystem(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const xmlChar * c_retval; - xmlChar * sysID; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlCatalogGetSystem", &sysID)) - return(NULL); - - c_retval = xmlCatalogGetSystem(sysID); - py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_CATALOG_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatZ(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatZ", &code)) - return(NULL); - - c_retval = xmlUCSIsCatZ(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsSuperscriptsandSubscripts(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsSuperscriptsandSubscripts", &code)) - return(NULL); - - c_retval = xmlUCSIsSuperscriptsandSubscripts(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsTagalog(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsTagalog", &code)) - return(NULL); - - c_retval = xmlUCSIsTagalog(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlGetDtdElementDesc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlElementPtr c_retval; - xmlDtdPtr dtd; - PyObject *pyobj_dtd; - xmlChar * name; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlGetDtdElementDesc", &pyobj_dtd, &name)) - return(NULL); - dtd = (xmlDtdPtr) PyxmlNode_Get(pyobj_dtd); - - c_retval = xmlGetDtdElementDesc(dtd, name); - py_retval = libxml_xmlElementPtrWrap((xmlElementPtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsPhoneticExtensions(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsPhoneticExtensions", &code)) - return(NULL); - - c_retval = xmlUCSIsPhoneticExtensions(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathCastNodeToString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlNodePtr node; - PyObject *pyobj_node; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathCastNodeToString", &pyobj_node)) - return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - - c_retval = xmlXPathCastNodeToString(node); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -PyObject * -libxml_xmlURISetPort(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlURIPtr URI; - PyObject *pyobj_URI; - int port; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlURISetPort", &pyobj_URI, &port)) - return(NULL); - URI = (xmlURIPtr) PyURI_Get(pyobj_URI); - - URI->port = port; - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_LEGACY_ENABLED) -PyObject * -libxml_xmlNamespaceParseNCName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlNamespaceParseNCName", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlNamespaceParseNCName(ctxt); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_LEGACY_ENABLED) */ -PyObject * -libxml_xmlInitGlobals(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - - xmlInitGlobals(); - Py_INCREF(Py_None); - return(Py_None); -} - -PyObject * -libxml_namePop(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const xmlChar * c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:namePop", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = namePop(ctxt); - py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_HTML_ENABLED) -PyObject * -libxml_htmlParseFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - htmlDocPtr c_retval; - char * filename; - char * encoding; - - if (!PyArg_ParseTuple(args, (char *)"zz:htmlParseFile", &filename, &encoding)) - return(NULL); - - c_retval = htmlParseFile(filename, encoding); - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_HTML_ENABLED) */ -#if defined(LIBXML_DEBUG_ENABLED) -PyObject * -libxml_xmlDebugCheckDocument(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - FILE * output; - PyObject *pyobj_output; - xmlDocPtr doc; - PyObject *pyobj_doc; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlDebugCheckDocument", &pyobj_output, &pyobj_doc)) - return(NULL); - output = (FILE *) PyFile_Get(pyobj_output); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlDebugCheckDocument(output, doc); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_DEBUG_ENABLED) */ -#if defined(LIBXML_HTML_ENABLED) -PyObject * -libxml_htmlReadDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - htmlDocPtr c_retval; - xmlChar * cur; - char * URL; - char * encoding; - int options; - - if (!PyArg_ParseTuple(args, (char *)"zzzi:htmlReadDoc", &cur, &URL, &encoding, &options)) - return(NULL); - - c_retval = htmlReadDoc(cur, URL, encoding, options); - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_HTML_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathGetContextPosition(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlXPathContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathGetContextPosition", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt); - - c_retval = ctxt->proximityPosition; - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) -PyObject * -libxml_htmlNodeDumpFileFormat(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - FILE * out; - PyObject *pyobj_out; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlNodePtr cur; - PyObject *pyobj_cur; - char * encoding; - int format; - - if (!PyArg_ParseTuple(args, (char *)"OOOzi:htmlNodeDumpFileFormat", &pyobj_out, &pyobj_doc, &pyobj_cur, &encoding, &format)) - return(NULL); - out = (FILE *) PyFile_Get(pyobj_out); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - c_retval = htmlNodeDumpFileFormat(out, doc, cur, encoding, format); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderConstXmlLang(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const xmlChar * c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderConstXmlLang", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderConstXmlLang(reader); - py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCherokee(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCherokee", &code)) - return(NULL); - - c_retval = xmlUCSIsCherokee(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlNodeSetContent(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlNodePtr cur; - PyObject *pyobj_cur; - xmlChar * content; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlNodeSetContent", &pyobj_cur, &content)) - return(NULL); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - xmlNodeSetContent(cur, content); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_DEBUG_ENABLED) -PyObject * -libxml_xmlBoolToText(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const char * c_retval; - int boolval; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlBoolToText", &boolval)) - return(NULL); - - c_retval = xmlBoolToText(boolval); - py_retval = libxml_charPtrConstWrap((const char *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_DEBUG_ENABLED) */ -PyObject * -libxml_xmlSetCompressMode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - int mode; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlSetCompressMode", &mode)) - return(NULL); - - xmlSetCompressMode(mode); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_HTML_ENABLED) -PyObject * -libxml_htmlParseDocument(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - htmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:htmlParseDocument", &pyobj_ctxt)) - return(NULL); - ctxt = (htmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = htmlParseDocument(ctxt); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_HTML_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathSubstringFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - int nargs; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathSubstringFunction", &pyobj_ctxt, &nargs)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathSubstringFunction(ctxt, nargs); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_DEBUG_ENABLED) -PyObject * -libxml_xmlDebugDumpNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - FILE * output; - PyObject *pyobj_output; - xmlNodePtr node; - PyObject *pyobj_node; - int depth; - - if (!PyArg_ParseTuple(args, (char *)"OOi:xmlDebugDumpNode", &pyobj_output, &pyobj_node, &depth)) - return(NULL); - output = (FILE *) PyFile_Get(pyobj_output); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - - xmlDebugDumpNode(output, node, depth); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_DEBUG_ENABLED) */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlCopyDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlDocPtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - int recursive; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlCopyDoc", &pyobj_doc, &recursive)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlCopyDoc(doc, recursive); - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ -PyObject * -libxml_xmlCtxtReadMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlDocPtr c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - char * buffer; - int py_buffsize0; - int size; - char * URL; - char * encoding; - int options; - - if (!PyArg_ParseTuple(args, (char *)"Ot#izzi:xmlCtxtReadMemory", &pyobj_ctxt, &buffer, &py_buffsize0, &size, &URL, &encoding, &options)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlCtxtReadMemory(ctxt, buffer, size, URL, encoding, options); - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlCreateFileParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlParserCtxtPtr c_retval; - char * filename; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlCreateFileParserCtxt", &filename)) - return(NULL); - - c_retval = xmlCreateFileParserCtxt(filename); - py_retval = libxml_xmlParserCtxtPtrWrap((xmlParserCtxtPtr) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlParseSystemLiteral(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParseSystemLiteral", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlParseSystemLiteral(ctxt); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlParseAttributeListDecl(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParseAttributeListDecl", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - xmlParseAttributeListDecl(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlSchemaNewDocParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlSchemaParserCtxtPtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlSchemaNewDocParserCtxt", &pyobj_doc)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlSchemaNewDocParserCtxt(doc); - py_retval = libxml_xmlSchemaParserCtxtPtrWrap((xmlSchemaParserCtxtPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -PyObject * -libxml_nodePush(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - xmlNodePtr value; - PyObject *pyobj_value; - - if (!PyArg_ParseTuple(args, (char *)"OO:nodePush", &pyobj_ctxt, &pyobj_value)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - value = (xmlNodePtr) PyxmlNode_Get(pyobj_value); - - c_retval = nodePush(ctxt, value); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_XINCLUDE_ENABLED) -PyObject * -libxml_xmlXIncludeProcess(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXIncludeProcess", &pyobj_doc)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlXIncludeProcess(doc); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XINCLUDE_ENABLED) */ -#if defined(LIBXML_REGEXP_ENABLED) -PyObject * -libxml_xmlRegexpIsDeterminist(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlRegexpPtr comp; - PyObject *pyobj_comp; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlRegexpIsDeterminist", &pyobj_comp)) - return(NULL); - comp = (xmlRegexpPtr) PyxmlReg_Get(pyobj_comp); - - c_retval = xmlRegexpIsDeterminist(comp); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_REGEXP_ENABLED) */ -#if defined(LIBXML_HTML_ENABLED) -PyObject * -libxml_htmlNewDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - htmlDocPtr c_retval; - xmlChar * URI; - xmlChar * ExternalID; - - if (!PyArg_ParseTuple(args, (char *)"zz:htmlNewDoc", &URI, &ExternalID)) - return(NULL); - - c_retval = htmlNewDoc(URI, ExternalID); - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_HTML_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCat(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - char * cat; - - if (!PyArg_ParseTuple(args, (char *)"iz:xmlUCSIsCat", &code, &cat)) - return(NULL); - - c_retval = xmlUCSIsCat(code, cat); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_HTML_ENABLED) -PyObject * -libxml_htmlIsScriptAttribute(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlChar * name; - - if (!PyArg_ParseTuple(args, (char *)"z:htmlIsScriptAttribute", &name)) - return(NULL); - - c_retval = htmlIsScriptAttribute(name); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_HTML_ENABLED) */ -#if defined(LIBXML_LEGACY_ENABLED) -PyObject * -libxml_xmlInitializePredefinedEntities(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - - xmlInitializePredefinedEntities(); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_LEGACY_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsMiscellaneousTechnical(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsMiscellaneousTechnical", &code)) - return(NULL); - - c_retval = xmlUCSIsMiscellaneousTechnical(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) -PyObject * -libxml_xmlShellPrintNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlNodePtr node; - PyObject *pyobj_node; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlShellPrintNode", &pyobj_node)) - return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - - xmlShellPrintNode(node); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlValidateNMToken(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlChar * value; - int space; - - if (!PyArg_ParseTuple(args, (char *)"zi:xmlValidateNMToken", &value, &space)) - return(NULL); - - c_retval = xmlValidateNMToken(value, space); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ -PyObject * -libxml_xmlErrorGetCode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlErrorPtr Error; - PyObject *pyobj_Error; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlErrorGetCode", &pyobj_Error)) - return(NULL); - Error = (xmlErrorPtr) PyError_Get(pyobj_Error); - - c_retval = Error->code; - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_VALID_ENABLED) -PyObject * -libxml_xmlValidateNameValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlChar * value; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlValidateNameValue", &value)) - return(NULL); - - c_retval = xmlValidateNameValue(value); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_VALID_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathNewContext(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlXPathContextPtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathNewContext", &pyobj_doc)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlXPathNewContext(doc); - py_retval = libxml_xmlXPathContextPtrWrap((xmlXPathContextPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlRelaxNGNewDocParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlRelaxNGParserCtxtPtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlRelaxNGNewDocParserCtxt", &pyobj_doc)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlRelaxNGNewDocParserCtxt(doc); - py_retval = libxml_xmlRelaxNGParserCtxtPtrWrap((xmlRelaxNGParserCtxtPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -PyObject * -libxml_xmlBuildRelativeURI(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlChar * URI; - xmlChar * base; - - if (!PyArg_ParseTuple(args, (char *)"zz:xmlBuildRelativeURI", &URI, &base)) - return(NULL); - - c_retval = xmlBuildRelativeURI(URI, base); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlParseURIRaw(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlURIPtr c_retval; - char * str; - int raw; - - if (!PyArg_ParseTuple(args, (char *)"zi:xmlParseURIRaw", &str, &raw)) - return(NULL); - - c_retval = xmlParseURIRaw(str, raw); - py_retval = libxml_xmlURIPtrWrap((xmlURIPtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_CATALOG_ENABLED) -PyObject * -libxml_xmlACatalogResolvePublic(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlCatalogPtr catal; - PyObject *pyobj_catal; - xmlChar * pubID; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlACatalogResolvePublic", &pyobj_catal, &pubID)) - return(NULL); - catal = (xmlCatalogPtr) Pycatalog_Get(pyobj_catal); - - c_retval = xmlACatalogResolvePublic(catal, pubID); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_CATALOG_ENABLED) */ -PyObject * -libxml_xmlThrDefParserDebugEntities(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int v; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlThrDefParserDebugEntities", &v)) - return(NULL); - - c_retval = xmlThrDefParserDebugEntities(v); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_CATALOG_ENABLED) -PyObject * -libxml_xmlCatalogConvert(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - PyObject *py_retval; - int c_retval; - - c_retval = xmlCatalogConvert(); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_CATALOG_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCJKSymbolsandPunctuation(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCJKSymbolsandPunctuation", &code)) - return(NULL); - - c_retval = xmlUCSIsCJKSymbolsandPunctuation(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsMusicalSymbols(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsMusicalSymbols", &code)) - return(NULL); - - c_retval = xmlUCSIsMusicalSymbols(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_FTP_ENABLED) -PyObject * -libxml_xmlNanoFTPInit(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - - xmlNanoFTPInit(); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_FTP_ENABLED) */ -PyObject * -libxml_xmlURIGetUser(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const char * c_retval; - xmlURIPtr URI; - PyObject *pyobj_URI; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlURIGetUser", &pyobj_URI)) - return(NULL); - URI = (xmlURIPtr) PyURI_Get(pyobj_URI); - - c_retval = URI->user; - py_retval = libxml_charPtrConstWrap((const char *) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlGetLastChild(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlNodePtr parent; - PyObject *pyobj_parent; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlGetLastChild", &pyobj_parent)) - return(NULL); - parent = (xmlNodePtr) PyxmlNode_Get(pyobj_parent); - - c_retval = xmlGetLastChild(parent); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlAddDtdEntity(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlEntityPtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlChar * name; - int type; - xmlChar * ExternalID; - xmlChar * SystemID; - xmlChar * content; - - if (!PyArg_ParseTuple(args, (char *)"Ozizzz:xmlAddDtdEntity", &pyobj_doc, &name, &type, &ExternalID, &SystemID, &content)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlAddDtdEntity(doc, name, type, ExternalID, SystemID, content); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlParseNotationDecl(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParseNotationDecl", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - xmlParseNotationDecl(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_TREE_ENABLED) -PyObject * -libxml_xmlNewDocRawNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlNsPtr ns; - PyObject *pyobj_ns; - xmlChar * name; - xmlChar * content; - - if (!PyArg_ParseTuple(args, (char *)"OOzz:xmlNewDocRawNode", &pyobj_doc, &pyobj_ns, &name, &content)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - ns = (xmlNsPtr) PyxmlNode_Get(pyobj_ns); - - c_retval = xmlNewDocRawNode(doc, ns, name, content); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_TREE_ENABLED) */ -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlSchemaCollapseString(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlChar * value; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlSchemaCollapseString", &value)) - return(NULL); - - c_retval = xmlSchemaCollapseString(value); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderConstNamespaceUri(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const xmlChar * c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderConstNamespaceUri", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderConstNamespaceUri(reader); - py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsBasicLatin(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsBasicLatin", &code)) - return(NULL); - - c_retval = xmlUCSIsBasicLatin(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlParseMisc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParseMisc", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - xmlParseMisc(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -PyObject * -libxml_xmlParserInputBufferGrow(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlParserInputBufferPtr in; - PyObject *pyobj_in; - int len; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlParserInputBufferGrow", &pyobj_in, &len)) - return(NULL); - in = (xmlParserInputBufferPtr) PyinputBuffer_Get(pyobj_in); - - c_retval = xmlParserInputBufferGrow(in, len); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathNextChild(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - xmlNodePtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathNextChild", &pyobj_ctxt, &pyobj_cur)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - c_retval = xmlXPathNextChild(ctxt, cur); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderGetParserProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - int prop; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlTextReaderGetParserProp", &pyobj_reader, &prop)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderGetParserProp(reader, prop); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -PyObject * -libxml_xmlStrncat(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlChar * cur; - xmlChar * add; - int len; - - if (!PyArg_ParseTuple(args, (char *)"zzi:xmlStrncat", &cur, &add, &len)) - return(NULL); - - c_retval = xmlStrncat(cur, add, len); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_XPATH_ENABLED) -#endif -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPatherror(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - char * file; - int line; - int no; - - if (!PyArg_ParseTuple(args, (char *)"Ozii:xmlXPatherror", &pyobj_ctxt, &file, &line, &no)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPatherror(ctxt, file, line, no); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_SAX1_ENABLED) -PyObject * -libxml_xmlParseMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlDocPtr c_retval; - char * buffer; - int py_buffsize0; - int size; - - if (!PyArg_ParseTuple(args, (char *)"t#i:xmlParseMemory", &buffer, &py_buffsize0, &size)) - return(NULL); - - c_retval = xmlParseMemory(buffer, size); - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SAX1_ENABLED) */ -PyObject * -libxml_xmlCleanupEncodingAliases(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - - xmlCleanupEncodingAliases(); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathCeilingFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - int nargs; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathCeilingFunction", &pyobj_ctxt, &nargs)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathCeilingFunction(ctxt, nargs); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsSmallFormVariants(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsSmallFormVariants", &code)) - return(NULL); - - c_retval = xmlUCSIsSmallFormVariants(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlInitParser(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - - xmlInitParser(); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathStartsWithFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - int nargs; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathStartsWithFunction", &pyobj_ctxt, &nargs)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathStartsWithFunction(ctxt, nargs); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -PyObject * -libxml_xmlSearchNsByHref(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNsPtr c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlNodePtr node; - PyObject *pyobj_node; - xmlChar * href; - - if (!PyArg_ParseTuple(args, (char *)"OOz:xmlSearchNsByHref", &pyobj_doc, &pyobj_node, &href)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - - c_retval = xmlSearchNsByHref(doc, node, href); - py_retval = libxml_xmlNsPtrWrap((xmlNsPtr) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlParseTextDecl(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParseTextDecl", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - xmlParseTextDecl(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathNextPreceding(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - xmlNodePtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathNextPreceding", &pyobj_ctxt, &pyobj_cur)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - c_retval = xmlXPathNextPreceding(ctxt, cur); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathRegisterAllFunctions(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathRegisterAllFunctions", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt); - - xmlXPathRegisterAllFunctions(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathRegisteredVariablesCleanup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathRegisteredVariablesCleanup", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt); - - xmlXPathRegisteredVariablesCleanup(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_LEGACY_ENABLED) -PyObject * -libxml_xmlHandleEntity(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - xmlEntityPtr entity; - PyObject *pyobj_entity; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlHandleEntity", &pyobj_ctxt, &pyobj_entity)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - entity = (xmlEntityPtr) PyxmlNode_Get(pyobj_entity); - - xmlHandleEntity(ctxt, entity); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_LEGACY_ENABLED) */ -#if defined(LIBXML_CATALOG_ENABLED) -PyObject * -libxml_xmlACatalogResolve(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlCatalogPtr catal; - PyObject *pyobj_catal; - xmlChar * pubID; - xmlChar * sysID; - - if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlACatalogResolve", &pyobj_catal, &pubID, &sysID)) - return(NULL); - catal = (xmlCatalogPtr) Pycatalog_Get(pyobj_catal); - - c_retval = xmlACatalogResolve(catal, pubID, sysID); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_CATALOG_ENABLED) */ -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlSchemaValidCtxtGetOptions(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlSchemaValidCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlSchemaValidCtxtGetOptions", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlSchemaValidCtxtPtr) PySchemaValidCtxt_Get(pyobj_ctxt); - - c_retval = xmlSchemaValidCtxtGetOptions(ctxt); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -#if defined(LIBXML_VALID_ENABLED) -PyObject * -libxml_xmlParseDTD(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlDtdPtr c_retval; - xmlChar * ExternalID; - xmlChar * SystemID; - - if (!PyArg_ParseTuple(args, (char *)"zz:xmlParseDTD", &ExternalID, &SystemID)) - return(NULL); - - c_retval = xmlParseDTD(ExternalID, SystemID); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_VALID_ENABLED) */ -#if defined(LIBXML_VALID_ENABLED) -PyObject * -libxml_xmlValidateDocumentFinal(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlValidCtxtPtr ctxt; - PyObject *pyobj_ctxt; - xmlDocPtr doc; - PyObject *pyobj_doc; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlValidateDocumentFinal", &pyobj_ctxt, &pyobj_doc)) - return(NULL); - ctxt = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_ctxt); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlValidateDocumentFinal(ctxt, doc); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_VALID_ENABLED) */ -PyObject * -libxml_xmlIsLetter(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int c; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlIsLetter", &c)) - return(NULL); - - c_retval = xmlIsLetter(c); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlTextMerge(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlNodePtr first; - PyObject *pyobj_first; - xmlNodePtr second; - PyObject *pyobj_second; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlTextMerge", &pyobj_first, &pyobj_second)) - return(NULL); - first = (xmlNodePtr) PyxmlNode_Get(pyobj_first); - second = (xmlNodePtr) PyxmlNode_Get(pyobj_second); - - c_retval = xmlTextMerge(first, second); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlPrintURI(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - FILE * stream; - PyObject *pyobj_stream; - xmlURIPtr uri; - PyObject *pyobj_uri; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlPrintURI", &pyobj_stream, &pyobj_uri)) - return(NULL); - stream = (FILE *) PyFile_Get(pyobj_stream); - uri = (xmlURIPtr) PyURI_Get(pyobj_uri); - - xmlPrintURI(stream, uri); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathValueFlipSign(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathValueFlipSign", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathValueFlipSign(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlRelaxParserSetFlag(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlRelaxNGParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - int flags; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlRelaxParserSetFlag", &pyobj_ctxt, &flags)) - return(NULL); - ctxt = (xmlRelaxNGParserCtxtPtr) PyrelaxNgParserCtxt_Get(pyobj_ctxt); - - c_retval = xmlRelaxParserSetFlag(ctxt, flags); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -PyObject * -libxml_xmlParserSetLoadSubset(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - int loadsubset; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlParserSetLoadSubset", &pyobj_ctxt, &loadsubset)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - ctxt->loadsubset = loadsubset; - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_VALID_ENABLED) -PyObject * -libxml_xmlValidateOneNamespace(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlValidCtxtPtr ctxt; - PyObject *pyobj_ctxt; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlNodePtr elem; - PyObject *pyobj_elem; - xmlChar * prefix; - xmlNsPtr ns; - PyObject *pyobj_ns; - xmlChar * value; - - if (!PyArg_ParseTuple(args, (char *)"OOOzOz:xmlValidateOneNamespace", &pyobj_ctxt, &pyobj_doc, &pyobj_elem, &prefix, &pyobj_ns, &value)) - return(NULL); - ctxt = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_ctxt); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem); - ns = (xmlNsPtr) PyxmlNode_Get(pyobj_ns); - - c_retval = xmlValidateOneNamespace(ctxt, doc, elem, prefix, ns, value); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_VALID_ENABLED) */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) -PyObject * -libxml_xmlReplaceNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlNodePtr old; - PyObject *pyobj_old; - xmlNodePtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlReplaceNode", &pyobj_old, &pyobj_cur)) - return(NULL); - old = (xmlNodePtr) PyxmlNode_Get(pyobj_old); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - c_retval = xmlReplaceNode(old, cur); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */ -PyObject * -libxml_xmlSetDocCompressMode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlDocPtr doc; - PyObject *pyobj_doc; - int mode; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlSetDocCompressMode", &pyobj_doc, &mode)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - xmlSetDocCompressMode(doc, mode); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_XPTR_ENABLED) -PyObject * -libxml_xmlXPtrNewRange(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlXPathObjectPtr c_retval; - xmlNodePtr start; - PyObject *pyobj_start; - int startindex; - xmlNodePtr end; - PyObject *pyobj_end; - int endindex; - - if (!PyArg_ParseTuple(args, (char *)"OiOi:xmlXPtrNewRange", &pyobj_start, &startindex, &pyobj_end, &endindex)) - return(NULL); - start = (xmlNodePtr) PyxmlNode_Get(pyobj_start); - end = (xmlNodePtr) PyxmlNode_Get(pyobj_end); - - c_retval = xmlXPtrNewRange(start, startindex, end, endindex); - py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPTR_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathMultValues(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathMultValues", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathMultValues(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) -PyObject * -libxml_xmlSchemaDump(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - FILE * output; - PyObject *pyobj_output; - xmlSchemaPtr schema; - PyObject *pyobj_schema; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlSchemaDump", &pyobj_output, &pyobj_schema)) - return(NULL); - output = (FILE *) PyFile_Get(pyobj_output); - schema = (xmlSchemaPtr) PySchema_Get(pyobj_schema); - - xmlSchemaDump(output, schema); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) */ -#if defined(LIBXML_SAX1_ENABLED) -PyObject * -libxml_xmlParseFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlDocPtr c_retval; - char * filename; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlParseFile", &filename)) - return(NULL); - - c_retval = xmlParseFile(filename); - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_SAX1_ENABLED) */ -#if defined(LIBXML_SAX1_ENABLED) -PyObject * -libxml_xmlParseEndTag(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParseEndTag", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - xmlParseEndTag(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_SAX1_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsHanunoo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsHanunoo", &code)) - return(NULL); - - c_retval = xmlUCSIsHanunoo(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlParserSetLineNumbers(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - int linenumbers; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlParserSetLineNumbers", &pyobj_ctxt, &linenumbers)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - ctxt->linenumbers = linenumbers; - Py_INCREF(Py_None); - return(Py_None); -} - -PyObject * -libxml_xmlParsePEReference(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParsePEReference", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - xmlParsePEReference(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -PyObject * -libxml_xmlDelEncodingAlias(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - char * alias; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlDelEncodingAlias", &alias)) - return(NULL); - - c_retval = xmlDelEncodingAlias(alias); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_TREE_ENABLED) -PyObject * -libxml_xmlNodeSetContentLen(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlNodePtr cur; - PyObject *pyobj_cur; - xmlChar * content; - int len; - - if (!PyArg_ParseTuple(args, (char *)"Ozi:xmlNodeSetContentLen", &pyobj_cur, &content, &len)) - return(NULL); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - xmlNodeSetContentLen(cur, content, len); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_TREE_ENABLED) */ -PyObject * -libxml_xmlThrDefPedanticParserDefaultValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int v; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlThrDefPedanticParserDefaultValue", &v)) - return(NULL); - - c_retval = xmlThrDefPedanticParserDefaultValue(v); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlUTF8Strpos(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const xmlChar * c_retval; - xmlChar * utf; - int pos; - - if (!PyArg_ParseTuple(args, (char *)"zi:xmlUTF8Strpos", &utf, &pos)) - return(NULL); - - c_retval = xmlUTF8Strpos(utf, pos); - py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlCharStrdup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - char * cur; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlCharStrdup", &cur)) - return(NULL); - - c_retval = xmlCharStrdup(cur); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathRegisterNs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlXPathContextPtr ctxt; - PyObject *pyobj_ctxt; - xmlChar * prefix; - xmlChar * ns_uri; - - if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlXPathRegisterNs", &pyobj_ctxt, &prefix, &ns_uri)) - return(NULL); - ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt); - - c_retval = xmlXPathRegisterNs(ctxt, prefix, ns_uri); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCurrencySymbols(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCurrencySymbols", &code)) - return(NULL); - - c_retval = xmlUCSIsCurrencySymbols(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathCmpNodes(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlNodePtr node1; - PyObject *pyobj_node1; - xmlNodePtr node2; - PyObject *pyobj_node2; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlXPathCmpNodes", &pyobj_node1, &pyobj_node2)) - return(NULL); - node1 = (xmlNodePtr) PyxmlNode_Get(pyobj_node1); - node2 = (xmlNodePtr) PyxmlNode_Get(pyobj_node2); - - c_retval = xmlXPathCmpNodes(node1, node2); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathVariableLookupNS(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlXPathObjectPtr c_retval; - xmlXPathContextPtr ctxt; - PyObject *pyobj_ctxt; - xmlChar * name; - xmlChar * ns_uri; - - if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlXPathVariableLookupNS", &pyobj_ctxt, &name, &ns_uri)) - return(NULL); - ctxt = (xmlXPathContextPtr) PyxmlXPathContext_Get(pyobj_ctxt); - - c_retval = xmlXPathVariableLookupNS(ctxt, name, ns_uri); - py_retval = libxml_xmlXPathObjectPtrWrap((xmlXPathObjectPtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_XINCLUDE_ENABLED) -PyObject * -libxml_xmlXIncludeProcessFlags(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - int flags; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXIncludeProcessFlags", &pyobj_doc, &flags)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlXIncludeProcessFlags(doc, flags); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XINCLUDE_ENABLED) */ -PyObject * -libxml_xmlUTF8Strsub(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlChar * utf; - int start; - int len; - - if (!PyArg_ParseTuple(args, (char *)"zii:xmlUTF8Strsub", &utf, &start, &len)) - return(NULL); - - c_retval = xmlUTF8Strsub(utf, start, len); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlIsMixedElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlChar * name; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlIsMixedElement", &pyobj_doc, &name)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlIsMixedElement(doc, name); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsMiscellaneousSymbolsandArrows(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsMiscellaneousSymbolsandArrows", &code)) - return(NULL); - - c_retval = xmlUCSIsMiscellaneousSymbolsandArrows(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) -PyObject * -libxml_htmlNodeDumpFormatOutput(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlOutputBufferPtr buf; - PyObject *pyobj_buf; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlNodePtr cur; - PyObject *pyobj_cur; - char * encoding; - int format; - - if (!PyArg_ParseTuple(args, (char *)"OOOzi:htmlNodeDumpFormatOutput", &pyobj_buf, &pyobj_doc, &pyobj_cur, &encoding, &format)) - return(NULL); - buf = (xmlOutputBufferPtr) PyoutputBuffer_Get(pyobj_buf); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - htmlNodeDumpFormatOutput(buf, doc, cur, encoding, format); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) */ -PyObject * -libxml_xmlParseExternalSubset(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - xmlChar * ExternalID; - xmlChar * SystemID; - - if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlParseExternalSubset", &pyobj_ctxt, &ExternalID, &SystemID)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - xmlParseExternalSubset(ctxt, ExternalID, SystemID); - Py_INCREF(Py_None); - return(Py_None); -} - -PyObject * -libxml_xmlURIGetOpaque(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - const char * c_retval; - xmlURIPtr URI; - PyObject *pyobj_URI; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlURIGetOpaque", &pyobj_URI)) - return(NULL); - URI = (xmlURIPtr) PyURI_Get(pyobj_URI); - - c_retval = URI->opaque; - py_retval = libxml_charPtrConstWrap((const char *) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlDictCleanup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - - xmlDictCleanup(); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_WRITER_ENABLED) -PyObject * -libxml_xmlTextReaderReadInnerXml(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderReadInnerXml", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderReadInnerXml(reader); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) && defined(LIBXML_WRITER_ENABLED) */ -PyObject * -libxml_xmlThrDefKeepBlanksDefaultValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int v; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlThrDefKeepBlanksDefaultValue", &v)) - return(NULL); - - c_retval = xmlThrDefKeepBlanksDefaultValue(v); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_VALID_ENABLED) -PyObject * -libxml_xmlValidateNmtokensValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlChar * value; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlValidateNmtokensValue", &value)) - return(NULL); - - c_retval = xmlValidateNmtokensValue(value); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_VALID_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsThaana(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsThaana", &code)) - return(NULL); - - c_retval = xmlUCSIsThaana(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlStrsub(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlChar * str; - int start; - int len; - - if (!PyArg_ParseTuple(args, (char *)"zii:xmlStrsub", &str, &start, &len)) - return(NULL); - - c_retval = xmlStrsub(str, start, len); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsYiRadicals(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsYiRadicals", &code)) - return(NULL); - - c_retval = xmlUCSIsYiRadicals(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_LEGACY_ENABLED) -PyObject * -libxml_xmlCleanupPredefinedEntities(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - - xmlCleanupPredefinedEntities(); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_LEGACY_ENABLED) */ -#if defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlSchemaInitTypes(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - - xmlSchemaInitTypes(); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_SCHEMAS_ENABLED) */ -PyObject * -libxml_xmlParseElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParseElement", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - xmlParseElement(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsOriya(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsOriya", &code)) - return(NULL); - - c_retval = xmlUCSIsOriya(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlParseVersionInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParseVersionInfo", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = xmlParseVersionInfo(ctxt); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathSubstringBeforeFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - int nargs; - - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathSubstringBeforeFunction", &pyobj_ctxt, &nargs)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathSubstringBeforeFunction(ctxt, nargs); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_OUTPUT_ENABLED) && defined(LIBXML_HTTP_ENABLED) -PyObject * -libxml_xmlRegisterHTTPPostCallbacks(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { - - xmlRegisterHTTPPostCallbacks(); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_OUTPUT_ENABLED) && defined(LIBXML_HTTP_ENABLED) */ -PyObject * -libxml_xmlSetTreeDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlNodePtr tree; - PyObject *pyobj_tree; - xmlDocPtr doc; - PyObject *pyobj_doc; - - if (!PyArg_ParseTuple(args, (char *)"OO:xmlSetTreeDoc", &pyobj_tree, &pyobj_doc)) - return(NULL); - tree = (xmlNodePtr) PyxmlNode_Get(pyobj_tree); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - xmlSetTreeDoc(tree, doc); - Py_INCREF(Py_None); - return(Py_None); -} - -PyObject * -libxml_xmlCopyNodeList(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlNodePtr node; - PyObject *pyobj_node; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlCopyNodeList", &pyobj_node)) - return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - - c_retval = xmlCopyNodeList(node); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_HTML_ENABLED) -PyObject * -libxml_htmlParseCharRef(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - htmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:htmlParseCharRef", &pyobj_ctxt)) - return(NULL); - ctxt = (htmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - c_retval = htmlParseCharRef(ctxt); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_HTML_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsAegeanNumbers(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsAegeanNumbers", &code)) - return(NULL); - - c_retval = xmlUCSIsAegeanNumbers(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlErrorGetLevel(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlErrorPtr Error; - PyObject *pyobj_Error; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlErrorGetLevel", &pyobj_Error)) - return(NULL); - Error = (xmlErrorPtr) PyError_Get(pyobj_Error); - - c_retval = Error->level; - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlCheckUTF8(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - unsigned char * utf; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlCheckUTF8", &utf)) - return(NULL); - - c_retval = xmlCheckUTF8(utf); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsOldItalic(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsOldItalic", &code)) - return(NULL); - - c_retval = xmlUCSIsOldItalic(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#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) { - PyObject *py_retval; - double c_retval; - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathPopNumber", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - c_retval = xmlXPathPopNumber(ctxt); - py_retval = libxml_doubleWrap((double) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsEnclosedAlphanumerics(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsEnclosedAlphanumerics", &code)) - return(NULL); - - c_retval = xmlUCSIsEnclosedAlphanumerics(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathCastBooleanToNumber(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - double c_retval; - int val; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlXPathCastBooleanToNumber", &val)) - return(NULL); - - c_retval = xmlXPathCastBooleanToNumber(val); - py_retval = libxml_doubleWrap((double) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsIdeographicDescriptionCharacters(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsIdeographicDescriptionCharacters", &code)) - return(NULL); - - c_retval = xmlUCSIsIdeographicDescriptionCharacters(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlGetLineNo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - long c_retval; - xmlNodePtr node; - PyObject *pyobj_node; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlGetLineNo", &pyobj_node)) - return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - - c_retval = xmlGetLineNo(node); - py_retval = libxml_longWrap((long) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlURISetUser(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlURIPtr URI; - PyObject *pyobj_URI; - char * user; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlURISetUser", &pyobj_URI, &user)) - return(NULL); - URI = (xmlURIPtr) PyURI_Get(pyobj_URI); - - if (URI->user != NULL) xmlFree(URI->user); - URI->user = (char *)xmlStrdup((const xmlChar *)user); - Py_INCREF(Py_None); - return(Py_None); -} - -PyObject * -libxml_xmlUnlinkNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlNodePtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlUnlinkNode", &pyobj_cur)) - return(NULL); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - xmlUnlinkNode(cur); - Py_INCREF(Py_None); - return(Py_None); -} - -PyObject * -libxml_xmlCreateEntityParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlParserCtxtPtr c_retval; - xmlChar * URL; - xmlChar * ID; - xmlChar * base; - - if (!PyArg_ParseTuple(args, (char *)"zzz:xmlCreateEntityParserCtxt", &URL, &ID, &base)) - return(NULL); - - c_retval = xmlCreateEntityParserCtxt(URL, ID, base); - py_retval = libxml_xmlParserCtxtPtrWrap((xmlParserCtxtPtr) c_retval); - return(py_retval); -} - -PyObject * -libxml_xmlThrDefSaveNoEmptyTags(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int v; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlThrDefSaveNoEmptyTags", &v)) - return(NULL); - - c_retval = xmlThrDefSaveNoEmptyTags(v); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderGetAttribute(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - xmlChar * name; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlTextReaderGetAttribute", &pyobj_reader, &name)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderGetAttribute(reader, name); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -PyObject * -libxml_xmlKeepBlanksDefault(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int val; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlKeepBlanksDefault", &val)) - return(NULL); - - c_retval = xmlKeepBlanksDefault(val); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsSupplementaryPrivateUseAreaB(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsSupplementaryPrivateUseAreaB", &code)) - return(NULL); - - c_retval = xmlUCSIsSupplementaryPrivateUseAreaB(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsSupplementaryPrivateUseAreaA(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsSupplementaryPrivateUseAreaA", &code)) - return(NULL); - - c_retval = xmlUCSIsSupplementaryPrivateUseAreaA(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_READER_ENABLED) -PyObject * -libxml_xmlTextReaderCurrentNode(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlNodePtr c_retval; - xmlTextReaderPtr reader; - PyObject *pyobj_reader; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlTextReaderCurrentNode", &pyobj_reader)) - return(NULL); - reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); - - c_retval = xmlTextReaderCurrentNode(reader); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_READER_ENABLED) */ -PyObject * -libxml_xmlNewDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlDocPtr c_retval; - xmlChar * version; - - if (!PyArg_ParseTuple(args, (char *)"z:xmlNewDoc", &version)) - return(NULL); - - c_retval = xmlNewDoc(version); - py_retval = libxml_xmlDocPtrWrap((xmlDocPtr) c_retval); - return(py_retval); -} - -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsLetterlikeSymbols(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsLetterlikeSymbols", &code)) - return(NULL); - - c_retval = xmlUCSIsLetterlikeSymbols(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatZp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatZp", &code)) - return(NULL); - - c_retval = xmlUCSIsCatZp(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatZs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatZs", &code)) - return(NULL); - - c_retval = xmlUCSIsCatZs(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsCatZl(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsCatZl", &code)) - return(NULL); - - c_retval = xmlUCSIsCatZl(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_CATALOG_ENABLED) -PyObject * -libxml_xmlACatalogRemove(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlCatalogPtr catal; - PyObject *pyobj_catal; - xmlChar * value; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlACatalogRemove", &pyobj_catal, &value)) - return(NULL); - catal = (xmlCatalogPtr) Pycatalog_Get(pyobj_catal); - - c_retval = xmlACatalogRemove(catal, value); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_CATALOG_ENABLED) */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -PyObject * -libxml_xmlUnsetProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - xmlNodePtr node; - PyObject *pyobj_node; - xmlChar * name; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlUnsetProp", &pyobj_node, &name)) - return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - - c_retval = xmlUnsetProp(node, name); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ -#if defined(LIBXML_HTML_ENABLED) -PyObject * -libxml_htmlFreeParserCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - htmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:htmlFreeParserCtxt", &pyobj_ctxt)) - return(NULL); - ctxt = (htmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - htmlFreeParserCtxt(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_HTML_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsVariationSelectorsSupplement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsVariationSelectorsSupplement", &code)) - return(NULL); - - c_retval = xmlUCSIsVariationSelectorsSupplement(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) -PyObject * -libxml_xmlSetProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlAttrPtr c_retval; - xmlNodePtr node; - PyObject *pyobj_node; - xmlChar * name; - xmlChar * value; - - if (!PyArg_ParseTuple(args, (char *)"Ozz:xmlSetProp", &pyobj_node, &name, &value)) - return(NULL); - node = (xmlNodePtr) PyxmlNode_Get(pyobj_node); - - c_retval = xmlSetProp(node, name, value); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) */ -#if defined(LIBXML_TREE_ENABLED) -PyObject * -libxml_xmlNodeSetLang(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlNodePtr cur; - PyObject *pyobj_cur; - xmlChar * lang; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlNodeSetLang", &pyobj_cur, &lang)) - return(NULL); - cur = (xmlNodePtr) PyxmlNode_Get(pyobj_cur); - - xmlNodeSetLang(cur, lang); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_TREE_ENABLED) */ -PyObject * -libxml_xmlFreeDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlDocPtr cur; - PyObject *pyobj_cur; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlFreeDoc", &pyobj_cur)) - return(NULL); - cur = (xmlDocPtr) PyxmlNode_Get(pyobj_cur); - - xmlFreeDoc(cur); - Py_INCREF(Py_None); - return(Py_None); -} - -#if defined(LIBXML_XPATH_ENABLED) -PyObject * -libxml_xmlXPathEvalExpr(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlXPathEvalExpr", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - - xmlXPathEvalExpr(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -#endif /* defined(LIBXML_XPATH_ENABLED) */ -#if defined(LIBXML_UNICODE_ENABLED) -PyObject * -libxml_xmlUCSIsLinearBSyllabary(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsLinearBSyllabary", &code)) - return(NULL); - - c_retval = xmlUCSIsLinearBSyllabary(code); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - -#endif /* defined(LIBXML_UNICODE_ENABLED) */ -PyObject * -libxml_xmlParseDocTypeDecl(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlParserCtxtPtr ctxt; - PyObject *pyobj_ctxt; - - if (!PyArg_ParseTuple(args, (char *)"O:xmlParseDocTypeDecl", &pyobj_ctxt)) - return(NULL); - ctxt = (xmlParserCtxtPtr) PyparserCtxt_Get(pyobj_ctxt); - - xmlParseDocTypeDecl(ctxt); - Py_INCREF(Py_None); - return(Py_None); -} - -PyObject * -libxml_xmlIsBaseChar(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - int c_retval; - unsigned int ch; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlIsBaseChar", &ch)) - return(NULL); - - c_retval = xmlIsBaseChar(ch); - py_retval = libxml_intWrap((int) c_retval); - return(py_retval); -} - diff --git a/python/setup.py b/python/setup.py index 342c6ab..b54da49 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.31", + version = "2.6.32", description = descr, author = "Daniel Veillard", author_email = "veillard@redhat.com", diff --git a/python/tests/Makefile.am b/python/tests/Makefile.am index 5ba503a..8a85075 100644 --- a/python/tests/Makefile.am +++ b/python/tests/Makefile.am @@ -1,4 +1,5 @@ -EXAMPLE_DIR = $(datadir)/doc/libxml2-python-$(LIBXML_VERSION)/examples +exampledir = $(datadir)/doc/libxml2-python-$(LIBXML_VERSION)/examples +dist_example_DATA = $(PYTESTS) $(XMLS) PYTESTS= \ build.py \ @@ -44,7 +45,8 @@ PYTESTS= \ validDTD.py \ validSchemas.py \ validRNG.py \ - compareNodes.py + compareNodes.py \ + xpathns.py XMLS= \ tst.xml \ @@ -52,8 +54,6 @@ XMLS= \ invalid.xml \ test.dtd -EXTRA_DIST = $(PYTESTS) $(XMLS) - if WITH_PYTHON tests: $(PYTESTS) @echo "## running Python regression tests" @@ -71,13 +71,3 @@ endif clean: rm -f *.pyc core - -install-data-local: - $(mkinstalldirs) $(DESTDIR)$(EXAMPLE_DIR) - -(for test in $(PYTESTS) $(XMLS); \ - do @INSTALL@ -m 0644 $(srcdir)/$$test $(DESTDIR)$(EXAMPLE_DIR) ; done) - -uninstall-local: - @(for test in $(PYTESTS) $(XMLS) ; \ - do rm $(DESTDIR)$(EXAMPLE_DIR)/`basename $$test` ; done) - diff --git a/python/tests/Makefile.in b/python/tests/Makefile.in index d477970..914e222 100644 --- a/python/tests/Makefile.in +++ b/python/tests/Makefile.in @@ -13,6 +13,7 @@ # PARTICULAR PURPOSE. @SET_MAKE@ + VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -32,7 +33,8 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = python/tests -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +DIST_COMMON = $(dist_example_DATA) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.in @@ -43,6 +45,15 @@ CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(exampledir)" +dist_exampleDATA_INSTALL = $(INSTALL_DATA) +DATA = $(dist_example_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -259,7 +270,8 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -EXAMPLE_DIR = $(datadir)/doc/libxml2-python-$(LIBXML_VERSION)/examples +exampledir = $(datadir)/doc/libxml2-python-$(LIBXML_VERSION)/examples +dist_example_DATA = $(PYTESTS) $(XMLS) PYTESTS = \ build.py \ attribs.py \ @@ -304,7 +316,8 @@ PYTESTS = \ validDTD.py \ validSchemas.py \ validRNG.py \ - compareNodes.py + compareNodes.py \ + xpathns.py XMLS = \ tst.xml \ @@ -312,7 +325,6 @@ XMLS = \ invalid.xml \ test.dtd -EXTRA_DIST = $(PYTESTS) $(XMLS) all: all-am .SUFFIXES: @@ -351,6 +363,23 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs +install-dist_exampleDATA: $(dist_example_DATA) + @$(NORMAL_INSTALL) + test -z "$(exampledir)" || $(MKDIR_P) "$(DESTDIR)$(exampledir)" + @list='$(dist_example_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(dist_exampleDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(exampledir)/$$f'"; \ + $(dist_exampleDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(exampledir)/$$f"; \ + done + +uninstall-dist_exampleDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_example_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(exampledir)/$$f'"; \ + rm -f "$(DESTDIR)$(exampledir)/$$f"; \ + done tags: TAGS TAGS: @@ -386,8 +415,11 @@ distdir: $(DISTFILES) done check-am: all-am check: check-am -all-am: Makefile +all-am: Makefile $(DATA) installdirs: + for dir in "$(DESTDIR)$(exampledir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done install: install-am install-exec: install-exec-am install-data: install-data-am @@ -428,7 +460,7 @@ info: info-am info-am: -install-data-am: install-data-local +install-data-am: install-dist_exampleDATA install-dvi: install-dvi-am @@ -462,21 +494,21 @@ ps: ps-am ps-am: -uninstall-am: uninstall-local +uninstall-am: uninstall-dist_exampleDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-data-local install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - uninstall uninstall-am uninstall-local + install-data install-data-am install-dist_exampleDATA \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am uninstall uninstall-am uninstall-dist_exampleDATA @WITH_PYTHON_TRUE@tests: $(PYTESTS) @@ -493,15 +525,6 @@ uninstall-am: uninstall-local clean: rm -f *.pyc core - -install-data-local: - $(mkinstalldirs) $(DESTDIR)$(EXAMPLE_DIR) - -(for test in $(PYTESTS) $(XMLS); \ - do @INSTALL@ -m 0644 $(srcdir)/$$test $(DESTDIR)$(EXAMPLE_DIR) ; done) - -uninstall-local: - @(for test in $(PYTESTS) $(XMLS) ; \ - do rm $(DESTDIR)$(EXAMPLE_DIR)/`basename $$test` ; done) # 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/python/tests/xpathns.py b/python/tests/xpathns.py new file mode 100755 index 0000000..e67e550 --- /dev/null +++ b/python/tests/xpathns.py @@ -0,0 +1,29 @@ +#!/usr/bin/python -u +# +import libxml2 + +expect=' xmlns:a="urn:whatevar"' + +# Memory debug specific +libxml2.debugMemory(1) + +d = libxml2.parseDoc("") +res="" +for n in d.xpathEval("//namespace::*"): + res = res + n.serialize() +d.freeDoc() + +if res != expect: + print "test5 failed: unexpected output" + print res +del res +del d +del n +# 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 9a17749..80e4304 100644 --- a/python/types.c +++ b/python/types.c @@ -7,6 +7,7 @@ * daniel@veillard.com */ #include "libxml_wrap.h" +#include PyObject * libxml_intWrap(int val) @@ -330,6 +331,24 @@ libxml_xmlParserCtxtPtrWrap(xmlParserCtxtPtr ctxt) return (ret); } +/** + * libxml_xmlXPathDestructNsNode: + * cobj: xmlNsPtr namespace node + * desc: ignored string + * + * This function is called if and when a namespace node returned in + * an XPath node set is to be destroyed. That's the only kind of + * object returned in node set not directly linked to the original + * xmlDoc document, see xmlXPathNodeSetDupNs. + */ +static void +libxml_xmlXPathDestructNsNode(void *cobj, void *desc ATTRIBUTE_UNUSED) { +#ifdef DEBUG + fprintf(stderr, "libxml_xmlXPathDestructNsNode called %p\n", cobj); +#endif + xmlXPathNodeSetFreeNs((xmlNsPtr) cobj); +} + PyObject * libxml_xmlXPathObjectPtrWrap(xmlXPathObjectPtr obj) { @@ -380,8 +399,17 @@ libxml_xmlXPathObjectPtrWrap(xmlXPathObjectPtr obj) ret = PyList_New(obj->nodesetval->nodeNr); for (i = 0; i < obj->nodesetval->nodeNr; i++) { node = obj->nodesetval->nodeTab[i]; - /* TODO: try to cast directly to the proper node type */ - PyList_SetItem(ret, i, libxml_xmlNodePtrWrap(node)); + if (node->type == XML_NAMESPACE_DECL) { + PyObject *ns = + PyCObject_FromVoidPtrAndDesc((void *) node, + (char *) "xmlNsPtr", + libxml_xmlXPathDestructNsNode); + PyList_SetItem(ret, i, ns); + /* make sure the xmlNsPtr is not destroyed now */ + obj->nodesetval->nodeTab[i] = NULL; + } else { + PyList_SetItem(ret, i, libxml_xmlNodePtrWrap(node)); + } } } break; diff --git a/schematron.c b/schematron.c index 146ffc9..81f4704 100644 --- a/schematron.c +++ b/schematron.c @@ -168,6 +168,12 @@ struct _xmlSchematronValidCtxt { xmlOutputWriteCallback iowrite; /* if using XML_SCHEMATRON_OUT_IO */ xmlOutputCloseCallback ioclose; void *ioctx; + + /* error reporting data */ + void *userData; /* user specific data block */ + xmlSchematronValidityErrorFunc error;/* the callback in case of errors */ + xmlSchematronValidityWarningFunc warning;/* callback in case of warning */ + xmlStructuredErrorFunc serror; /* the structured function */ }; struct _xmlSchematronParserCtxt { @@ -193,12 +199,11 @@ struct _xmlSchematronParserCtxt { int maxIncludes; /* size of the array */ xmlNodePtr *includes; /* the array of includes */ - /* error rreporting data */ + /* error reporting data */ void *userData; /* user specific data block */ xmlSchematronValidityErrorFunc error;/* the callback in case of errors */ xmlSchematronValidityWarningFunc warning;/* callback in case of warning */ xmlStructuredErrorFunc serror; /* the structured function */ - }; #define XML_STRON_CTXT_PARSER 1 @@ -1361,7 +1366,7 @@ xmlSchematronFormatReport(xmlSchematronValidCtxtPtr ctxt, */ static void xmlSchematronReportSuccess(xmlSchematronValidCtxtPtr ctxt, - xmlSchematronTestPtr test, xmlNodePtr cur, int success) { + xmlSchematronTestPtr test, xmlNodePtr cur, xmlSchematronPatternPtr pattern, int success) { if ((ctxt == NULL) || (cur == NULL) || (test == NULL)) return; /* if quiet and not SVRL report only failures */ @@ -1392,18 +1397,41 @@ xmlSchematronReportSuccess(xmlSchematronValidCtxtPtr ctxt, report = xmlSchematronFormatReport(ctxt, test->node, cur); if (report == NULL) { if (test->type == XML_SCHEMATRON_ASSERT) { - snprintf(msg, 999, "%s line %ld: node failed assert\n", - (const char *) path, line); + report = xmlStrdup((const xmlChar *) "node failed assert"); } else { - snprintf(msg, 999, "%s line %ld: node failed report\n", - (const char *) path, line); + report = xmlStrdup((const xmlChar *) "node failed report"); + } } - } else { snprintf(msg, 999, "%s line %ld: %s\n", (const char *) path, line, (const char *) report); - xmlFree((char *) report); + + if (ctxt->flags & XML_SCHEMATRON_OUT_ERROR) { + xmlStructuredErrorFunc schannel = NULL; + xmlGenericErrorFunc channel = NULL; + void *data = NULL; + + if (ctxt != NULL) { + if (ctxt->serror != NULL) + schannel = ctxt->serror; + else + channel = ctxt->error; + data = ctxt->userData; } + + __xmlRaiseError(schannel, channel, data, + NULL, cur, XML_FROM_SCHEMATRONV, + (test->type == XML_SCHEMATRON_ASSERT)?XML_SCHEMATRONV_ASSERT:XML_SCHEMATRONV_REPORT, + XML_ERR_ERROR, NULL, line, + (pattern == NULL)?NULL:((const char *) pattern->name), + (const char *) path, + (const char *) report, 0, 0, + msg); + } else { xmlSchematronReportOutput(ctxt, cur, &msg[0]); + } + + xmlFree((char *) report); + if ((path != NULL) && (path != (xmlChar *) cur->name)) xmlFree(path); } @@ -1421,7 +1449,7 @@ xmlSchematronReportPattern(xmlSchematronValidCtxtPtr ctxt, xmlSchematronPatternPtr pattern) { if ((ctxt == NULL) || (pattern == NULL)) return; - if (ctxt->flags & XML_SCHEMATRON_OUT_QUIET) + if ((ctxt->flags & XML_SCHEMATRON_OUT_QUIET) || (ctxt->flags & XML_SCHEMATRON_OUT_ERROR)) /* Error gives pattern name as part of error */ return; if (ctxt->flags & XML_SCHEMATRON_OUT_XML) { TODO @@ -1442,6 +1470,26 @@ xmlSchematronReportPattern(xmlSchematronValidCtxtPtr ctxt, * * ************************************************************************/ +/** + * xmlSchematronSetValidStructuredErrors: + * @ctxt: a Schematron validation context + * @serror: the structured error function + * @ctx: the functions context + * + * Set the structured error callback + */ +void +xmlSchematronSetValidStructuredErrors(xmlSchematronValidCtxtPtr ctxt, + xmlStructuredErrorFunc serror, void *ctx) +{ + if (ctxt == NULL) + return; + ctxt->serror = serror; + ctxt->error = NULL; + ctxt->warning = NULL; + ctxt->userData = ctx; +} + /** * xmlSchematronNewValidCtxt: * @schema: a precompiled XML Schematrons @@ -1550,7 +1598,7 @@ xmlSchematronNextNode(xmlNodePtr cur) { */ static int xmlSchematronRunTest(xmlSchematronValidCtxtPtr ctxt, - xmlSchematronTestPtr test, xmlDocPtr instance, xmlNodePtr cur) + xmlSchematronTestPtr test, xmlDocPtr instance, xmlNodePtr cur, xmlSchematronPatternPtr pattern) { xmlXPathObjectPtr ret; int failed; @@ -1597,7 +1645,7 @@ xmlSchematronRunTest(xmlSchematronValidCtxtPtr ctxt, else if ((!failed) && (test->type == XML_SCHEMATRON_REPORT)) ctxt->nberrors++; - xmlSchematronReportSuccess(ctxt, test, cur, !failed); + xmlSchematronReportSuccess(ctxt, test, cur, pattern, !failed); return(!failed); } @@ -1643,7 +1691,7 @@ xmlSchematronValidateDoc(xmlSchematronValidCtxtPtr ctxt, xmlDocPtr instance) if (xmlPatternMatch(rule->pattern, cur) == 1) { test = rule->tests; while (test != NULL) { - xmlSchematronRunTest(ctxt, test, instance, cur); + xmlSchematronRunTest(ctxt, test, instance, cur, rule->pattern); test = test->next; } } @@ -1674,7 +1722,7 @@ xmlSchematronValidateDoc(xmlSchematronValidCtxtPtr ctxt, xmlDocPtr instance) if (xmlPatternMatch(rule->pattern, cur) == 1) { test = rule->tests; while (test != NULL) { - xmlSchematronRunTest(ctxt, test, instance, cur); + xmlSchematronRunTest(ctxt, test, instance, cur, pattern); test = test->next; } } diff --git a/testModule.c b/testModule.c index fecc852..8293c45 100644 --- a/testModule.c +++ b/testModule.c @@ -29,6 +29,15 @@ #define MODULE_PATH ".libs" #endif +/* Used for SCO Openserver*/ +#ifndef PATH_MAX +#ifdef _POSIX_PATH_MAX +#define PATH_MAX _POSIX_PATH_MAX +#else +#define PATH_MAX 4096 +#endif +#endif + typedef int (*hello_world_t)(void); int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { diff --git a/testRegexp.c b/testRegexp.c index d5228b3..626536e 100644 --- a/testRegexp.c +++ b/testRegexp.c @@ -290,6 +290,9 @@ int main(int argc, char **argv) { if (argv[i][0] != '-') continue; + if (!strcmp(argv[i], "--")) + break; + if ((!strcmp(argv[i], "-debug")) || (!strcmp(argv[i], "--debug"))) { debug++; } else if ((!strcmp(argv[i], "-repeat")) || @@ -322,10 +325,15 @@ int main(int argc, char **argv) { #endif testRegexpFile(filename); } else { + int data = 0; #ifdef LIBXML_EXPR_ENABLED + if (use_exp) { for (i = 1; i < argc ; i++) { - if ((argv[i][0] != '-') || (strcmp(argv[i], "-") == 0)) { + if (strcmp(argv[i], "--") == 0) + data = 1; + else if ((argv[i][0] != '-') || (strcmp(argv[i], "-") == 0) || + (data == 1)) { if (pattern == NULL) { pattern = argv[i]; printf("Testing expr %s:\n", pattern); @@ -342,13 +350,18 @@ int main(int argc, char **argv) { } } } - if (expr != NULL) + if (expr != NULL) { xmlExpFree(ctxt, expr); + expr = NULL; + } } else #endif { for (i = 1; i < argc ; i++) { - if ((argv[i][0] != '-') || (strcmp(argv[i], "-") == 0)) { + if (strcmp(argv[i], "--") == 0) + data = 1; + else if ((argv[i][0] != '-') || (strcmp(argv[i], "-") == 0) || + (data == 1)) { if (pattern == NULL) { pattern = argv[i]; printf("Testing %s:\n", pattern); diff --git a/testapi.c b/testapi.c index af71ac2..8a50e88 100644 --- a/testapi.c +++ b/testapi.c @@ -18023,6 +18023,16 @@ static void des_xmlSchematronValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchematron #endif +static int +test_xmlSchematronSetValidStructuredErrors(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + static int test_xmlSchematronValidateDoc(void) { int test_ret = 0; @@ -18067,12 +18077,13 @@ static int test_schematron(void) { int test_ret = 0; - if (quiet == 0) printf("Testing schematron : 1 of 9 functions ...\n"); + if (quiet == 0) printf("Testing schematron : 1 of 10 functions ...\n"); test_ret += test_xmlSchematronNewDocParserCtxt(); test_ret += test_xmlSchematronNewMemParserCtxt(); test_ret += test_xmlSchematronNewParserCtxt(); test_ret += test_xmlSchematronNewValidCtxt(); test_ret += test_xmlSchematronParse(); + test_ret += test_xmlSchematronSetValidStructuredErrors(); test_ret += test_xmlSchematronValidateDoc(); if (test_ret != 0) diff --git a/threads.c b/threads.c index d5a177d..6481b40 100644 --- a/threads.c +++ b/threads.c @@ -101,8 +101,8 @@ struct _xmlMutex { #elif defined HAVE_WIN32_THREADS HANDLE mutex; #elif defined HAVE_BEOS_THREADS - sem_id sem; - thread_id tid; + sem_id sem; + thread_id tid; #else int empty; #endif @@ -114,21 +114,22 @@ struct _xmlMutex { struct _xmlRMutex { #ifdef HAVE_PTHREAD_H pthread_mutex_t lock; - unsigned int held; - unsigned int waiters; - pthread_t tid; - pthread_cond_t cv; + unsigned int held; + unsigned int waiters; + pthread_t tid; + pthread_cond_t cv; #elif defined HAVE_WIN32_THREADS CRITICAL_SECTION cs; unsigned int count; #elif defined HAVE_BEOS_THREADS - xmlMutexPtr lock; - thread_id tid; - int32 count; + xmlMutexPtr lock; + thread_id tid; + int32 count; #else int empty; #endif }; + /* * This module still has some internal static data. * - xmlLibraryLock a global lock @@ -136,8 +137,8 @@ struct _xmlRMutex { */ #ifdef HAVE_PTHREAD_H -static pthread_key_t globalkey; -static pthread_t mainthread; +static pthread_key_t globalkey; +static pthread_t mainthread; static pthread_once_t once_control = PTHREAD_ONCE_INIT; static pthread_mutex_t global_init_lock = PTHREAD_MUTEX_INITIALIZER; #elif defined HAVE_WIN32_THREADS @@ -148,12 +149,12 @@ static __declspec(thread) int tlstate_inited = 0; static DWORD globalkey = TLS_OUT_OF_INDEXES; #endif /* HAVE_COMPILER_TLS */ static DWORD mainthread; -static struct -{ +static struct { DWORD done; DWORD control; -} run_once = { 0, 0 }; +} run_once = { 0, 0}; static volatile LPCRITICAL_SECTION global_init_lock = NULL; + /* endif HAVE_WIN32_THREADS */ #elif defined HAVE_BEOS_THREADS int32 globalkey = 0; @@ -163,7 +164,8 @@ static int32 global_init_lock = -1; static vint32 global_init_count = 0; #endif -static xmlRMutexPtr xmlLibraryLock = NULL; +static xmlRMutexPtr xmlLibraryLock = NULL; + #ifdef LIBXML_THREAD_ENABLED static void xmlOnceInit(void); #endif @@ -185,15 +187,15 @@ xmlNewMutex(void) return (NULL); #ifdef HAVE_PTHREAD_H if (libxml_is_threaded != 0) - pthread_mutex_init(&tok->lock, NULL); + pthread_mutex_init(&tok->lock, NULL); #elif defined HAVE_WIN32_THREADS tok->mutex = CreateMutex(NULL, FALSE, NULL); #elif defined HAVE_BEOS_THREADS - if ((tok->sem = create_sem(1, "xmlMutex")) < B_OK) { - free(tok); - return NULL; - } - tok->tid = -1; + if ((tok->sem = create_sem(1, "xmlMutex")) < B_OK) { + free(tok); + return NULL; + } + tok->tid = -1; #endif return (tok); } @@ -208,15 +210,16 @@ xmlNewMutex(void) void xmlFreeMutex(xmlMutexPtr tok) { - if (tok == NULL) return; + if (tok == NULL) + return; #ifdef HAVE_PTHREAD_H if (libxml_is_threaded != 0) - pthread_mutex_destroy(&tok->lock); + pthread_mutex_destroy(&tok->lock); #elif defined HAVE_WIN32_THREADS CloseHandle(tok->mutex); #elif defined HAVE_BEOS_THREADS - delete_sem(tok->sem); + delete_sem(tok->sem); #endif free(tok); } @@ -234,17 +237,18 @@ xmlMutexLock(xmlMutexPtr tok) return; #ifdef HAVE_PTHREAD_H if (libxml_is_threaded != 0) - pthread_mutex_lock(&tok->lock); + pthread_mutex_lock(&tok->lock); #elif defined HAVE_WIN32_THREADS WaitForSingleObject(tok->mutex, INFINITE); #elif defined HAVE_BEOS_THREADS - if (acquire_sem(tok->sem) != B_NO_ERROR) { + if (acquire_sem(tok->sem) != B_NO_ERROR) { #ifdef DEBUG_THREADS - xmlGenericError(xmlGenericErrorContext, "xmlMutexLock():BeOS:Couldn't aquire semaphore\n"); - exit(); + xmlGenericError(xmlGenericErrorContext, + "xmlMutexLock():BeOS:Couldn't aquire semaphore\n"); + exit(); #endif - } - tok->tid = find_thread(NULL); + } + tok->tid = find_thread(NULL); #endif } @@ -262,14 +266,14 @@ xmlMutexUnlock(xmlMutexPtr tok) return; #ifdef HAVE_PTHREAD_H if (libxml_is_threaded != 0) - pthread_mutex_unlock(&tok->lock); + pthread_mutex_unlock(&tok->lock); #elif defined HAVE_WIN32_THREADS ReleaseMutex(tok->mutex); #elif defined HAVE_BEOS_THREADS - if (tok->tid == find_thread(NULL)) { - tok->tid = -1; - release_sem(tok->sem); - } + if (tok->tid == find_thread(NULL)) { + tok->tid = -1; + release_sem(tok->sem); + } #endif } @@ -292,20 +296,20 @@ xmlNewRMutex(void) return (NULL); #ifdef HAVE_PTHREAD_H if (libxml_is_threaded != 0) { - pthread_mutex_init(&tok->lock, NULL); - tok->held = 0; - tok->waiters = 0; - pthread_cond_init(&tok->cv, NULL); + pthread_mutex_init(&tok->lock, NULL); + tok->held = 0; + tok->waiters = 0; + pthread_cond_init(&tok->cv, NULL); } #elif defined HAVE_WIN32_THREADS InitializeCriticalSection(&tok->cs); tok->count = 0; #elif defined HAVE_BEOS_THREADS - if ((tok->lock = xmlNewMutex()) == NULL) { - free(tok); - return NULL; - } - tok->count = 0; + if ((tok->lock = xmlNewMutex()) == NULL) { + free(tok); + return NULL; + } + tok->count = 0; #endif return (tok); } @@ -324,13 +328,13 @@ xmlFreeRMutex(xmlRMutexPtr tok ATTRIBUTE_UNUSED) return; #ifdef HAVE_PTHREAD_H if (libxml_is_threaded != 0) { - pthread_mutex_destroy(&tok->lock); - pthread_cond_destroy(&tok->cv); + pthread_mutex_destroy(&tok->lock); + pthread_cond_destroy(&tok->cv); } #elif defined HAVE_WIN32_THREADS DeleteCriticalSection(&tok->cs); #elif defined HAVE_BEOS_THREADS - xmlFreeMutex(tok->lock); + xmlFreeMutex(tok->lock); #endif free(tok); } @@ -370,13 +374,13 @@ xmlRMutexLock(xmlRMutexPtr tok) EnterCriticalSection(&tok->cs); ++tok->count; #elif defined HAVE_BEOS_THREADS - if (tok->lock->tid == find_thread(NULL)) { - tok->count++; - return; - } else { - xmlMutexLock(tok->lock); - tok->count = 1; - } + if (tok->lock->tid == find_thread(NULL)) { + tok->count++; + return; + } else { + xmlMutexLock(tok->lock); + tok->count = 1; + } #endif } @@ -394,7 +398,7 @@ xmlRMutexUnlock(xmlRMutexPtr tok ATTRIBUTE_UNUSED) #ifdef HAVE_PTHREAD_H if (libxml_is_threaded == 0) return; - + pthread_mutex_lock(&tok->lock); tok->held--; if (tok->held == 0) { @@ -404,16 +408,16 @@ xmlRMutexUnlock(xmlRMutexPtr tok ATTRIBUTE_UNUSED) } pthread_mutex_unlock(&tok->lock); #elif defined HAVE_WIN32_THREADS - if (!--tok->count) - LeaveCriticalSection(&tok->cs); + if (!--tok->count) + LeaveCriticalSection(&tok->cs); #elif defined HAVE_BEOS_THREADS - if (tok->lock->tid == find_thread(NULL)) { - tok->count--; - if (tok->count == 0) { - xmlMutexUnlock(tok->lock); - } - return; - } + if (tok->lock->tid == find_thread(NULL)) { + tok->count--; + if (tok->count == 0) { + xmlMutexUnlock(tok->lock); + } + return; + } #endif } @@ -435,23 +439,29 @@ __xmlGlobalInitMutexLock(void) /* Create a new critical section */ if (global_init_lock == NULL) { - cs = malloc(sizeof(CRITICAL_SECTION)); - InitializeCriticalSection(cs); + cs = malloc(sizeof(CRITICAL_SECTION)); + if (cs == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xmlGlobalInitMutexLock: out of memory\n"); + return; + } + InitializeCriticalSection(cs); - /* Swap it into the global_init_lock */ + /* 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); + 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 - * allocated by this thread. */ - if (global_init_lock != cs) { - DeleteCriticalSection(cs); - free(cs); - } + /* If another thread successfully recorded its critical + * section in the global_init_lock then discard the one + * allocated by this thread. */ + if (global_init_lock != cs) { + DeleteCriticalSection(cs); + free(cs); + } } /* Lock the chosen critical section */ @@ -463,25 +473,26 @@ __xmlGlobalInitMutexLock(void) sem = create_sem(1, "xmlGlobalinitMutex"); while (global_init_lock == -1) { - if (atomic_add(&global_init_count, 1) == 0) { - global_init_lock = sem; - } else { - snooze(1); - atomic_add(&global_init_count, -1); - } + if (atomic_add(&global_init_count, 1) == 0) { + global_init_lock = sem; + } else { + snooze(1); + atomic_add(&global_init_count, -1); + } } /* If another thread successfully recorded its critical * section in the global_init_lock then discard the one * allocated by this thread. */ if (global_init_lock != sem) - delete_sem(sem); + delete_sem(sem); /* Acquire the chosen semaphore */ if (acquire_sem(global_init_lock) != B_NO_ERROR) { #ifdef DEBUG_THREADS - xmlGenericError(xmlGenericErrorContext, "xmlGlobalInitMutexLock():BeOS:Couldn't acquire semaphore\n"); - exit(); + xmlGenericError(xmlGenericErrorContext, + "xmlGlobalInitMutexLock():BeOS:Couldn't acquire semaphore\n"); + exit(); #endif } #endif @@ -493,7 +504,9 @@ __xmlGlobalInitMutexUnlock(void) #ifdef HAVE_PTHREAD_H pthread_mutex_unlock(&global_init_lock); #elif defined HAVE_WIN32_THREADS - LeaveCriticalSection(global_init_lock); + if (global_init_lock != NULL) { + LeaveCriticalSection(global_init_lock); + } #elif defined HAVE_BEOS_THREADS release_sem(global_init_lock); #endif @@ -505,14 +518,14 @@ __xmlGlobalInitMutexUnlock(void) * Makes sure that the global initialization mutex is destroyed before * application termination. */ -void __xmlGlobalInitMutexDestroy(void) +void +__xmlGlobalInitMutexDestroy(void) { #if defined HAVE_WIN32_THREADS - if (global_init_lock != NULL) - { - DeleteCriticalSection(global_init_lock); - free(global_init_lock); - global_init_lock = NULL; + if (global_init_lock != NULL) { + DeleteCriticalSection(global_init_lock); + free(global_init_lock); + global_init_lock = NULL; } #endif } @@ -527,6 +540,7 @@ void __xmlGlobalInitMutexDestroy(void) #ifdef xmlLastError #undef xmlLastError #endif + /** * xmlFreeGlobalState: * @state: a thread global state @@ -557,10 +571,13 @@ static xmlGlobalStatePtr xmlNewGlobalState(void) { xmlGlobalState *gs; - + gs = malloc(sizeof(xmlGlobalState)); - if (gs == NULL) - return(NULL); + if (gs == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xmlGetGlobalState: out of memory\n"); + return (NULL); + } memset(gs, 0, sizeof(xmlGlobalState)); xmlInitializeGlobalState(gs); @@ -572,15 +589,16 @@ xmlNewGlobalState(void) #ifdef HAVE_WIN32_THREADS #if !defined(HAVE_COMPILER_TLS) #if defined(LIBXML_STATIC) && !defined(LIBXML_STATIC_FOR_DLL) -typedef struct _xmlGlobalStateCleanupHelperParams -{ +typedef struct _xmlGlobalStateCleanupHelperParams { HANDLE thread; void *memory; } xmlGlobalStateCleanupHelperParams; -static void XMLCDECL xmlGlobalStateCleanupHelper (void *p) +static void XMLCDECL +xmlGlobalStateCleanupHelper(void *p) { - xmlGlobalStateCleanupHelperParams *params = (xmlGlobalStateCleanupHelperParams *) p; + xmlGlobalStateCleanupHelperParams *params = + (xmlGlobalStateCleanupHelperParams *) p; WaitForSingleObject(params->thread, INFINITE); CloseHandle(params->thread); xmlFreeGlobalState(params->memory); @@ -589,14 +607,13 @@ static void XMLCDECL xmlGlobalStateCleanupHelper (void *p) } #else /* LIBXML_STATIC && !LIBXML_STATIC_FOR_DLL */ -typedef struct _xmlGlobalStateCleanupHelperParams -{ +typedef struct _xmlGlobalStateCleanupHelperParams { void *memory; - struct _xmlGlobalStateCleanupHelperParams * prev; - struct _xmlGlobalStateCleanupHelperParams * next; + struct _xmlGlobalStateCleanupHelperParams *prev; + struct _xmlGlobalStateCleanupHelperParams *next; } xmlGlobalStateCleanupHelperParams; -static xmlGlobalStateCleanupHelperParams * cleanup_helpers_head = NULL; +static xmlGlobalStateCleanupHelperParams *cleanup_helpers_head = NULL; static CRITICAL_SECTION cleanup_helpers_cs; #endif /* LIBXMLSTATIC && !LIBXML_STATIC_FOR_DLL */ @@ -604,17 +621,20 @@ static CRITICAL_SECTION cleanup_helpers_cs; #endif /* HAVE_WIN32_THREADS */ #if defined HAVE_BEOS_THREADS + /** * xmlGlobalStateCleanup: * @data: unused parameter * * Used for Beos only */ -void xmlGlobalStateCleanup(void *data) +void +xmlGlobalStateCleanup(void *data) { - void *globalval = tls_get(globalkey); - if (globalval != NULL) - xmlFreeGlobalState(globalval); + void *globalval = tls_get(globalkey); + + if (globalval != NULL) + xmlFreeGlobalState(globalval); } #endif @@ -632,13 +652,15 @@ xmlGetGlobalState(void) xmlGlobalState *globalval; if (libxml_is_threaded == 0) - return(NULL); + return (NULL); pthread_once(&once_control, xmlOnceInit); if ((globalval = (xmlGlobalState *) - pthread_getspecific(globalkey)) == NULL) { + pthread_getspecific(globalkey)) == NULL) { xmlGlobalState *tsd = xmlNewGlobalState(); + if (tsd == NULL) + return(NULL); pthread_setspecific(globalkey, tsd); return (tsd); @@ -647,43 +669,53 @@ xmlGetGlobalState(void) #elif defined HAVE_WIN32_THREADS #if defined(HAVE_COMPILER_TLS) if (!tlstate_inited) { - tlstate_inited = 1; - xmlInitializeGlobalState(&tlstate); + tlstate_inited = 1; + xmlInitializeGlobalState(&tlstate); } return &tlstate; #else /* HAVE_COMPILER_TLS */ xmlGlobalState *globalval; - xmlGlobalStateCleanupHelperParams * p; + xmlGlobalStateCleanupHelperParams *p; xmlOnceInit(); #if defined(LIBXML_STATIC) && !defined(LIBXML_STATIC_FOR_DLL) - globalval = (xmlGlobalState *)TlsGetValue(globalkey); + globalval = (xmlGlobalState *) TlsGetValue(globalkey); #else - p = (xmlGlobalStateCleanupHelperParams*)TlsGetValue(globalkey); - globalval = (xmlGlobalState *)(p ? p->memory : NULL); + p = (xmlGlobalStateCleanupHelperParams *) TlsGetValue(globalkey); + globalval = (xmlGlobalState *) (p ? p->memory : NULL); #endif if (globalval == NULL) { - xmlGlobalState *tsd = xmlNewGlobalState(); - p = (xmlGlobalStateCleanupHelperParams *) malloc(sizeof(xmlGlobalStateCleanupHelperParams)); - p->memory = tsd; + xmlGlobalState *tsd = xmlNewGlobalState(); + + if (tsd == NULL) + return(NULL); + p = (xmlGlobalStateCleanupHelperParams *) + malloc(sizeof(xmlGlobalStateCleanupHelperParams)); + if (p == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xmlGetGlobalState: out of memory\n"); + return(NULL); + } + p->memory = tsd; #if defined(LIBXML_STATIC) && !defined(LIBXML_STATIC_FOR_DLL) - DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), - GetCurrentProcess(), &p->thread, 0, TRUE, DUPLICATE_SAME_ACCESS); - TlsSetValue(globalkey, tsd); - _beginthread(xmlGlobalStateCleanupHelper, 0, p); + DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), + GetCurrentProcess(), &p->thread, 0, TRUE, + DUPLICATE_SAME_ACCESS); + TlsSetValue(globalkey, tsd); + _beginthread(xmlGlobalStateCleanupHelper, 0, p); #else - EnterCriticalSection(&cleanup_helpers_cs); + EnterCriticalSection(&cleanup_helpers_cs); if (cleanup_helpers_head != NULL) { cleanup_helpers_head->prev = p; } - p->next = cleanup_helpers_head; - p->prev = NULL; - cleanup_helpers_head = p; - TlsSetValue(globalkey, p); - LeaveCriticalSection(&cleanup_helpers_cs); + p->next = cleanup_helpers_head; + p->prev = NULL; + cleanup_helpers_head = p; + TlsSetValue(globalkey, p); + LeaveCriticalSection(&cleanup_helpers_cs); #endif - return (tsd); + return (tsd); } return (globalval); #endif /* HAVE_COMPILER_TLS */ @@ -692,9 +724,10 @@ xmlGetGlobalState(void) xmlOnceInit(); - if ((globalval = (xmlGlobalState *) - tls_get(globalkey)) == NULL) { + if ((globalval = (xmlGlobalState *) tls_get(globalkey)) == NULL) { xmlGlobalState *tsd = xmlNewGlobalState(); + if (tsd == NULL) + return (NULL); tls_set(globalkey, tsd); on_exit_thread(xmlGlobalStateCleanup, NULL); @@ -702,7 +735,7 @@ xmlGetGlobalState(void) } return (globalval); #else - return(NULL); + return (NULL); #endif } @@ -724,14 +757,14 @@ xmlGetThreadId(void) { #ifdef HAVE_PTHREAD_H if (libxml_is_threaded == 0) - return(0); - return((int) pthread_self()); + return (0); + return ((int) pthread_self()); #elif defined HAVE_WIN32_THREADS return GetCurrentThreadId(); #elif defined HAVE_BEOS_THREADS - return find_thread(NULL); + return find_thread(NULL); #else - return((int) 0); + return ((int) 0); #endif } @@ -749,25 +782,25 @@ xmlIsMainThread(void) if (libxml_is_threaded == -1) xmlInitThreads(); if (libxml_is_threaded == 0) - return(1); + return (1); pthread_once(&once_control, xmlOnceInit); #elif defined HAVE_WIN32_THREADS - xmlOnceInit (); + xmlOnceInit(); #elif defined HAVE_BEOS_THREADS xmlOnceInit(); #endif - + #ifdef DEBUG_THREADS xmlGenericError(xmlGenericErrorContext, "xmlIsMainThread()\n"); #endif #ifdef HAVE_PTHREAD_H - return(mainthread == pthread_self()); + return (mainthread == pthread_self()); #elif defined HAVE_WIN32_THREADS - return(mainthread == GetCurrentThreadId ()); + return (mainthread == GetCurrentThreadId()); #elif defined HAVE_BEOS_THREADS - return(mainthread == find_thread(NULL)); + return (mainthread == find_thread(NULL)); #else - return(1); + return (1); #endif } @@ -819,24 +852,25 @@ xmlInitThreads(void) #ifdef HAVE_PTHREAD_H if (libxml_is_threaded == -1) { if ((pthread_once != NULL) && - (pthread_getspecific != NULL) && - (pthread_setspecific != NULL) && - (pthread_key_create != NULL) && - (pthread_mutex_init != NULL) && - (pthread_mutex_destroy != NULL) && - (pthread_mutex_lock != NULL) && - (pthread_mutex_unlock != NULL) && - (pthread_cond_init != NULL) && - (pthread_equal != NULL) && - (pthread_self != NULL) && - (pthread_key_create != NULL) && - (pthread_cond_signal != NULL)) { - libxml_is_threaded = 1; + (pthread_getspecific != NULL) && + (pthread_setspecific != NULL) && + (pthread_key_create != NULL) && + (pthread_mutex_init != NULL) && + (pthread_mutex_destroy != NULL) && + (pthread_mutex_lock != NULL) && + (pthread_mutex_unlock != NULL) && + (pthread_cond_init != NULL) && + (pthread_equal != NULL) && + (pthread_self != NULL) && + (pthread_cond_signal != NULL)) { + libxml_is_threaded = 1; + /* fprintf(stderr, "Running multithreaded\n"); */ - } else { + } else { + /* fprintf(stderr, "Running without multithread\n"); */ - libxml_is_threaded = 0; - } + libxml_is_threaded = 0; + } } #endif } @@ -855,25 +889,28 @@ xmlCleanupThreads(void) #endif #if defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL)) if (globalkey != TLS_OUT_OF_INDEXES) { - xmlGlobalStateCleanupHelperParams * p; - EnterCriticalSection(&cleanup_helpers_cs); - p = cleanup_helpers_head; - while (p != NULL) { - xmlGlobalStateCleanupHelperParams * temp = p; - p = p->next; - xmlFreeGlobalState(temp->memory); - free(temp); - } - cleanup_helpers_head = 0; - LeaveCriticalSection(&cleanup_helpers_cs); - TlsFree(globalkey); - globalkey = TLS_OUT_OF_INDEXES; + xmlGlobalStateCleanupHelperParams *p; + + EnterCriticalSection(&cleanup_helpers_cs); + p = cleanup_helpers_head; + while (p != NULL) { + xmlGlobalStateCleanupHelperParams *temp = p; + + p = p->next; + xmlFreeGlobalState(temp->memory); + free(temp); + } + cleanup_helpers_head = 0; + LeaveCriticalSection(&cleanup_helpers_cs); + TlsFree(globalkey); + globalkey = TLS_OUT_OF_INDEXES; } DeleteCriticalSection(&cleanup_helpers_cs); #endif } #ifdef LIBXML_THREAD_ENABLED + /** * xmlOnceInit * @@ -884,7 +921,8 @@ xmlCleanupThreads(void) * details. */ static void -xmlOnceInit(void) { +xmlOnceInit(void) +{ #ifdef HAVE_PTHREAD_H (void) pthread_key_create(&globalkey, xmlFreeGlobalState); mainthread = pthread_self(); @@ -892,15 +930,13 @@ xmlOnceInit(void) { #if defined(HAVE_WIN32_THREADS) if (!run_once.done) { - if (InterlockedIncrement(&run_once.control) == 1) - { + if (InterlockedIncrement(&run_once.control) == 1) { #if !defined(HAVE_COMPILER_TLS) globalkey = TlsAlloc(); #endif mainthread = GetCurrentThreadId(); run_once.done = 1; - } - else { + } else { /* Another thread is working; give up our slice and * wait until they're done. */ while (!run_once.done) @@ -910,12 +946,12 @@ xmlOnceInit(void) { #endif #ifdef HAVE_BEOS_THREADS - if (atomic_add(&run_once_init, 1) == 0) { - globalkey = tls_allocate(); - tls_set(globalkey, NULL); - mainthread = find_thread(NULL); - } else - atomic_add(&run_once_init, -1); + if (atomic_add(&run_once_init, 1) == 0) { + globalkey = tls_allocate(); + tls_set(globalkey, NULL); + mainthread = find_thread(NULL); + } else + atomic_add(&run_once_init, -1); #endif } #endif @@ -933,36 +969,38 @@ 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 XMLCALL 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) +BOOL WINAPI +DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) #endif { - switch(fdwReason) { - case DLL_THREAD_DETACH: - if (globalkey != TLS_OUT_OF_INDEXES) { - xmlGlobalState *globalval = NULL; - xmlGlobalStateCleanupHelperParams * p = - (xmlGlobalStateCleanupHelperParams*)TlsGetValue(globalkey); - globalval = (xmlGlobalState *)(p ? p->memory : NULL); - if (globalval) { - xmlFreeGlobalState(globalval); - TlsSetValue(globalkey,NULL); + switch (fdwReason) { + case DLL_THREAD_DETACH: + if (globalkey != TLS_OUT_OF_INDEXES) { + xmlGlobalState *globalval = NULL; + xmlGlobalStateCleanupHelperParams *p = + (xmlGlobalStateCleanupHelperParams *) + TlsGetValue(globalkey); + globalval = (xmlGlobalState *) (p ? p->memory : NULL); + if (globalval) { + xmlFreeGlobalState(globalval); + TlsSetValue(globalkey, NULL); + } + if (p) { + EnterCriticalSection(&cleanup_helpers_cs); + if (p == cleanup_helpers_head) + cleanup_helpers_head = p->next; + else + p->prev->next = p->next; + if (p->next != NULL) + p->next->prev = p->prev; + LeaveCriticalSection(&cleanup_helpers_cs); + free(p); + } } - if (p) - { - EnterCriticalSection(&cleanup_helpers_cs); - if (p == cleanup_helpers_head) - cleanup_helpers_head = p->next; - else - p->prev->next = p->next; - if (p->next != NULL) - p->next->prev = p->prev; - LeaveCriticalSection(&cleanup_helpers_cs); - free(p); - } - } - break; + break; } return TRUE; } diff --git a/tree.c b/tree.c index 432007e..763381b 100644 --- a/tree.c +++ b/tree.c @@ -92,6 +92,9 @@ xmlTreeErr(int code, xmlNodePtr node, const char *extra) case XML_TREE_UNTERMINATED_ENTITY: msg = "unterminated entity reference %15s\n"; break; + case XML_TREE_NOT_UTF8: + msg = "string is not in UTF-8\n"; + break; default: msg = "unexpected error number\n"; } @@ -1780,7 +1783,9 @@ xmlNewPropInternal(xmlNodePtr node, xmlNsPtr ns, xmlDocPtr doc = NULL; if ((node != NULL) && (node->type != XML_ELEMENT_NODE)) { - if (eatname == 1) + if ((eatname == 1) && + ((node->doc == NULL) || + (!(xmlDictOwns(node->doc->dict, name))))) xmlFree((xmlChar *) name); return (NULL); } @@ -1790,7 +1795,9 @@ xmlNewPropInternal(xmlNodePtr node, xmlNsPtr ns, */ cur = (xmlAttrPtr) xmlMalloc(sizeof(xmlAttr)); if (cur == NULL) { - if (eatname == 1) + if ((eatname == 1) && + ((node->doc == NULL) || + (!(xmlDictOwns(node->doc->dict, name))))) xmlFree((xmlChar *) name); xmlTreeErrMemory("building attribute"); return (NULL); @@ -1814,11 +1821,15 @@ xmlNewPropInternal(xmlNodePtr node, xmlNsPtr ns, cur->name = name; if (value != NULL) { - xmlChar *buffer; xmlNodePtr tmp; - buffer = xmlEncodeEntitiesReentrant(doc, value); - cur->children = xmlStringGetNodeList(doc, buffer); + if(!xmlCheckUTF8(value)) { + xmlTreeErr(XML_TREE_NOT_UTF8, (xmlNodePtr) doc, + NULL); + if (doc != NULL) + doc->encoding = xmlStrdup(BAD_CAST "ISO-8859-1"); + } + cur->children = xmlNewDocText(doc, value); cur->last = NULL; tmp = cur->children; while (tmp != NULL) { @@ -1827,7 +1838,6 @@ xmlNewPropInternal(xmlNodePtr node, xmlNsPtr ns, cur->last = tmp; tmp = tmp->next; } - xmlFree(buffer); } /* @@ -1927,7 +1937,7 @@ xmlNewNsPropEatName(xmlNodePtr node, xmlNsPtr ns, xmlChar *name, return(NULL); } - return xmlNewPropInternal(node, ns, name, value, 1); + return xmlNewPropInternal(node, ns, name, value, 1); } /** @@ -2210,8 +2220,8 @@ xmlNewNodeEatName(xmlNsPtr ns, xmlChar *name) { */ cur = (xmlNodePtr) xmlMalloc(sizeof(xmlNode)); if (cur == NULL) { - xmlFree(name); xmlTreeErrMemory("building node"); + /* we can't check here that name comes from the doc dictionnary */ return(NULL); } memset(cur, 0, sizeof(xmlNode)); @@ -2290,6 +2300,11 @@ xmlNewDocNodeEatName(xmlDocPtr doc, xmlNsPtr ns, cur->children = xmlStringGetNodeList(doc, content); UPDATE_LAST_CHILD_AND_PARENT(cur) } + } else { + /* if name don't come from the doc dictionnary free it here */ + if ((name != NULL) && (doc != NULL) && + (!(xmlDictOwns(doc->dict, name)))) + xmlFree(name); } return(cur); } @@ -6466,11 +6481,15 @@ xmlSetNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name, prop->last = NULL; prop->ns = ns; if (value != NULL) { - xmlChar *buffer; xmlNodePtr tmp; - buffer = xmlEncodeEntitiesReentrant(node->doc, value); - prop->children = xmlStringGetNodeList(node->doc, buffer); + if(!xmlCheckUTF8(value)) { + xmlTreeErr(XML_TREE_NOT_UTF8, (xmlNodePtr) node->doc, + NULL); + if (node->doc != NULL) + node->doc->encoding = xmlStrdup(BAD_CAST "ISO-8859-1"); + } + prop->children = xmlNewDocText(node->doc, value); prop->last = NULL; tmp = prop->children; while (tmp != NULL) { @@ -6479,7 +6498,6 @@ xmlSetNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name, prop->last = tmp; tmp = tmp->next; } - xmlFree(buffer); } if (prop->atype == XML_ATTRIBUTE_ID) xmlAddID(NULL, node->doc, value, prop); diff --git a/uri.c b/uri.c index 34841af..fafd112 100644 --- a/uri.c +++ b/uri.c @@ -421,6 +421,30 @@ xmlSaveUri(xmlURIPtr uri) { } 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; @@ -2418,6 +2442,11 @@ xmlCanonicPath(const xmlChar *path) if (path == NULL) return(NULL); + + /* sanitize filename starting with // so it can be used as URI */ + if ((path[0] == '/') && (path[1] == '/') && (path[2] != '/')) + path++; + if ((uri = xmlParseURI((const char *) path)) != NULL) { xmlFreeURI(uri); return xmlStrdup(path); diff --git a/vms/build_libxml.com b/vms/build_libxml.com index ed5107b..816e64d 100755 --- a/vms/build_libxml.com +++ b/vms/build_libxml.com @@ -6,16 +6,20 @@ $! Arguments: $! $! "DEBUG" - build everything in debug $! -$! This procedure creates an object library XML_LIBDIR:LIBXML.OLB directory. +$! This procedure creates an object library XML_LIBDIR:LIBXML.OLB directory. $! After the library is built, you can link LIBXML routines into -$! your code with the command +$! your code with the command $! $! $ LINK your_modules,XML_LIBDIR:LIBXML.OLB/LIBRARY -$! +$! $! Change History $! -------------- $! Command file author : John A Fotheringham (jaf@jafsoft.com) -$! Update history : 13 October 2003 Craig Berry (craigberry@mac.com) +$! Update history : 19 March 2008 Tycho Hilhorst +$! - added module schematron.c (prevent xmllint errors) +$! - added /DEF and /INCLUDE options to cc_opts to tell +$! config.h is available, and where to find it +$! : 13 October 2003 Craig Berry (craigberry@mac.com) $! more new module additions $! : 25 April 2003 Craig Berry (craigberry@mac.com) $! added xmlreader.c and relaxng.c to source list @@ -27,7 +31,7 @@ $!- configuration ------------------------------------------------------------- $! $!- compile command. If p1="nowarn" suppress the expected warning types $! -$ cc_opts = "/NAMES=(SHORTENED)/FLOAT=IEEE/IEEE_MODE=DENORM_RESULTS" +$ cc_opts = "/DEF=HAVE_CONFIG_H/NAMES=(SHORTENED)/FLOAT=IEEE/IEEE_MODE=DENORM_RESULTS/INCLUDE=xml_srcdir" $! $ if p1.eqs."DEBUG" .or. p2.eqs."DEBUG" $ then @@ -50,6 +54,7 @@ $ sources = sources + " catalog.c globals.c threads.c c14n.c xmlstring.c" $ sources = sources + " xmlregexp.c xmlschemas.c xmlschemastypes.c xmlunicode.c" $ sources = sources + " triostr.c trio.c xmlreader.c relaxng.c dict.c SAX2.c" $ sources = sources + " xmlwriter.c legacy.c chvalid.c pattern.c xmlsave.c" +$ sources = sources + " schematron.c" $! $!- list of main modules to compile and link. Compare this list to the $! definition of bin_PROGRAMS in MAKEFILE.IN @@ -98,8 +103,8 @@ $ endif $! $ copy/log config.vms xml_srcdir:config.h $! -$ if f$trnlnm("libxml").eqs."" -$ then +$ if f$trnlnm("libxml").eqs."" +$ then $ globfile = f$search("[-...]globals.h") $ if globfile.eqs."" $ then @@ -116,16 +121,16 @@ $!- set up error handling (such as it is) ------------------------------------- $! $ exit_status = 1 $ saved_default = f$environment("default") -$ on error then goto ERROR_OUT -$ on control_y then goto ERROR_OUT +$ on error then goto ERROR_OUT +$ on control_y then goto ERROR_OUT $! -$!- move to the source directory and create any necessary subdirs and the +$!- move to the source directory and create any necessary subdirs and the $! object library $! $ set default xml_srcdir $ if f$search("DEBUG.DIR").eqs."" then create/dir [.DEBUG] -$ if f$search("XML_LIBDIR:LIBXML.OLB").eqs."" -$ then +$ if f$search("XML_LIBDIR:LIBXML.OLB").eqs."" +$ then $ write sys$output "Creating new object library XML_LIBDIR:LIBXML.OLB" $ library/create XML_LIBDIR:LIBXML.OLB $ endif @@ -151,8 +156,8 @@ $ next_source = f$element (S_no," ",sources) $ if next_source.nes."" .and. next_source.nes." " $ then $! -$ on error then goto ERROR_OUT -$ on control_y then goto ERROR_OUT +$ on error then goto ERROR_OUT +$ on control_y then goto ERROR_OUT $ call build 'next_source' $ s_no = s_no + 1 $ goto source_loop @@ -164,7 +169,7 @@ $! $! these programs are built as ordinary modules into XML_LIBDIR:LIBXML.OLB. Here they $! are built a second time with /DEFINE=(STANDALONE) in which case a main() $! is also compiled into the module -$ +$ $ lib_command = "" $ link_command = "LINK" $! @@ -199,8 +204,8 @@ $ next_prog = f$element (p_no," ",all_progs) $ if next_prog.nes."" .and. next_prog.nes." " $ then $! -$ on error then goto ERROR_OUT -$ on control_y then goto ERROR_OUT +$ on error then goto ERROR_OUT +$ on control_y then goto ERROR_OUT $ call build 'next_prog'.c $ p_no = p_no + 1 $ goto prog_loop @@ -210,9 +215,9 @@ $! $!- Th-th-th-th-th-that's all folks! ------------------------------------------ $! $ goto exit_here ! move this line to avoid parts of this command file -$ exit_here: +$ exit_here: $! -$ exit +$ exit $ goto exit_out $! $! @@ -246,7 +251,7 @@ $! $ if lib_command.nes."" then lib_command 'object_file' $! $!- link module if command defined -$ if link_command.nes."" +$ if link_command.nes."" $ then $ opts = "" $ if debug then opts = "/DEBUG" diff --git a/win32/Makefile.msvc b/win32/Makefile.msvc index 9046ff3..2409905 100644 --- a/win32/Makefile.msvc +++ b/win32/Makefile.msvc @@ -66,7 +66,7 @@ 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 +LIBS = $(LIBS) wsock32.lib ws2_32.lib !endif !if "$(WITH_ICONV)" == "1" LIBS = $(LIBS) iconv.lib @@ -254,12 +254,12 @@ UTILS = $(UTILS) $(BINDIR)\testThreadsWin32.exe 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= +!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 diff --git a/win32/Makefile.msvc.orig b/win32/Makefile.msvc.orig new file mode 100644 index 0000000..ec1950c --- /dev/null +++ b/win32/Makefile.msvc.orig @@ -0,0 +1,462 @@ +# 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 e37cfe0..db05ad4 100644 --- a/win32/libxml2.def.src +++ b/win32/libxml2.def.src @@ -768,6 +768,7 @@ xmlDictOwns xmlDictQLookup xmlDictReference xmlDictSize +xmlDllMain xmlDocCopyNode xmlDocCopyNodeList xmlDocDump @@ -1783,6 +1784,7 @@ xmlSchematronNewMemParserCtxt xmlSchematronNewParserCtxt xmlSchematronNewValidCtxt xmlSchematronParse +xmlSchematronSetValidStructuredErrors xmlSchematronValidateDoc xmlSearchNs xmlSearchNsByHref diff --git a/xinclude.c b/xinclude.c index 31ea026..bb41180 100644 --- a/xinclude.c +++ b/xinclude.c @@ -419,7 +419,6 @@ static xmlDocPtr xmlXIncludeParseFile(xmlXIncludeCtxtPtr ctxt, const char *URL) { xmlDocPtr ret; xmlParserCtxtPtr pctxt; - char *directory = NULL; xmlParserInputPtr inputStream; xmlInitParser(); @@ -456,10 +455,8 @@ xmlXIncludeParseFile(xmlXIncludeCtxtPtr ctxt, const char *URL) { inputPush(pctxt, inputStream); - if ((pctxt->directory == NULL) && (directory == NULL)) - directory = xmlParserGetDirectory(URL); - if ((pctxt->directory == NULL) && (directory != NULL)) - pctxt->directory = (char *) xmlStrdup((xmlChar *) directory); + if (pctxt->directory == NULL) + pctxt->directory = xmlParserGetDirectory(URL); pctxt->loadsubset |= XML_DETECT_IDS; @@ -516,9 +513,8 @@ xmlXIncludeAddNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr cur) { href = xmlStrdup(BAD_CAST ""); /* @@@@ href is now optional */ if (href == NULL) return(-1); - local = 1; } - if (href[0] == '#') + if ((href[0] == '#') || (href[0] == 0)) local = 1; parse = xmlXIncludeGetProp(ctxt, cur, XINCLUDE_PARSE); if (parse != NULL) { @@ -616,6 +612,19 @@ xmlXIncludeAddNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr cur) { return(-1); } + /* + * If local and xml then we need a fragment + */ + if ((local == 1) && (xml == 1) && + ((fragment == NULL) || (fragment[0] == 0))) { + xmlXIncludeErr(ctxt, cur, XML_XINCLUDE_RECURSION, + "detected a local recursion with no xpointer in %s\n", + URL); + if (fragment != NULL) + xmlFree(fragment); + return(-1); + } + /* * Check the URL against the stack for recursions */ diff --git a/xmlIO.c b/xmlIO.c index 7782776..dd4f7e7 100644 --- a/xmlIO.c +++ b/xmlIO.c @@ -3315,6 +3315,16 @@ xmlOutputBufferWriteEscape(xmlOutputBufferPtr out, const xmlChar *str, cons = len; chunk = (out->buffer->size - out->buffer->use) - 1; + /* + * make sure we have enough room to save first, if this is + * not the case force a flush, but make sure we stay in the loop + */ + if (chunk < 40) { + nbchars = 0; + oldwritten = -1; + goto flush; + } + /* * first handle encoding stuff. */ @@ -3360,6 +3370,7 @@ 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/xmlmodule.c b/xmlmodule.c index 15bcf07..9ffd610 100644 --- a/xmlmodule.c +++ b/xmlmodule.c @@ -190,7 +190,7 @@ xmlModuleFree(xmlModulePtr module) return (0); } -#ifdef HAVE_DLOPEN +#if defined(HAVE_DLOPEN) && !defined(_WIN32) #ifdef HAVE_DLFCN_H #include #endif diff --git a/xmlreader.c b/xmlreader.c index d7bddec..92b053e 100644 --- a/xmlreader.c +++ b/xmlreader.c @@ -234,8 +234,6 @@ xmlTextReaderRemoveID(xmlDocPtr doc, xmlAttrPtr attr) { if (table == NULL) return(-1); - if (attr == NULL) - return(-1); ID = xmlNodeListGetString(doc, attr->children, 1); if (ID == NULL) return(-1); @@ -2936,7 +2934,7 @@ xmlTextReaderAttributeCount(xmlTextReaderPtr reader) { * * Get the node type of the current node * Reference: - * http://dotgnu.org/pnetlib-doc/System/Xml/XmlNodeType.html + * http://www.gnu.org/software/dotgnu/pnetlib-doc/System/Xml/XmlNodeType.html * * Returns the xmlNodeType of the current node or -1 in case of error */ @@ -3960,8 +3958,7 @@ xmlTextReaderCurrentDoc(xmlTextReaderPtr reader) { return(NULL); if (reader->doc != NULL) return(reader->doc); - if ((reader == NULL) || (reader->ctxt == NULL) || - (reader->ctxt->myDoc == NULL)) + if ((reader->ctxt == NULL) || (reader->ctxt->myDoc == NULL)) return(NULL); reader->preserve = 1; diff --git a/xmlregexp.c b/xmlregexp.c index a3e16c5..389453b 100644 --- a/xmlregexp.c +++ b/xmlregexp.c @@ -1532,6 +1532,8 @@ xmlFAGenerateCountedTransition(xmlRegParserCtxtPtr ctxt, static int xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from, xmlRegStatePtr to, xmlRegAtomPtr atom) { + xmlRegStatePtr end; + if (atom == NULL) { ERROR("genrate transition: atom == NULL"); return(-1); @@ -1689,12 +1691,31 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from, else { return(-1); } + } + end = to; + if ((atom->quant == XML_REGEXP_QUANT_MULT) || + (atom->quant == XML_REGEXP_QUANT_PLUS)) { + /* + * Do not pollute the target state by adding transitions from + * it as it is likely to be the shared target of multiple branches. + * So isolate with an epsilon transition. + */ + xmlRegStatePtr tmp; + + tmp = xmlRegNewState(ctxt); + if (tmp != NULL) + xmlRegStatePush(ctxt, tmp); + else { + return(-1); + } + xmlFAGenerateEpsilonTransition(ctxt, tmp, to); + to = tmp; } if (xmlRegAtomPush(ctxt, atom) < 0) { return(-1); } xmlRegStateAddTrans(ctxt, from, atom, to, -1, -1); - ctxt->state = to; + ctxt->state = end; switch (atom->quant) { case XML_REGEXP_QUANT_OPT: atom->quant = XML_REGEXP_QUANT_ONCE; @@ -5052,7 +5073,7 @@ xmlFAParseCharRange(xmlRegParserCtxtPtr ctxt) { static void xmlFAParsePosCharGroup(xmlRegParserCtxtPtr ctxt) { do { - if ((CUR == '\\') || (CUR == '.')) { + if (CUR == '\\') { xmlFAParseCharClassEsc(ctxt); } else { xmlFAParseCharRange(ctxt); diff --git a/xmlsave.c b/xmlsave.c index cbabd78..2a61577 100644 --- a/xmlsave.c +++ b/xmlsave.c @@ -727,8 +727,8 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) { return; } if (cur->type == XML_CDATA_SECTION_NODE) { - if (cur->content == NULL) { - xmlOutputBufferWrite(buf, 12, ""); + if (cur->content == NULL || *cur->content == '\0') { + xmlOutputBufferWrite(buf, 12, ""); } else { start = end = cur->content; while (*end != '\0') { @@ -1236,21 +1236,25 @@ xhtmlNodeDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) { return; } if (cur->type == XML_CDATA_SECTION_NODE) { - start = end = cur->content; - while (*end != '\0') { - if (*end == ']' && *(end + 1) == ']' && *(end + 2) == '>') { - end = end + 2; + if (cur->content == NULL || *cur->content == '\0') { + xmlOutputBufferWrite(buf, 12, ""); + } else { + start = end = cur->content; + while (*end != '\0') { + if (*end == ']' && *(end + 1) == ']' && *(end + 2) == '>') { + end = end + 2; + xmlOutputBufferWrite(buf, 9, ""); + start = end; + } + end++; + } + if (start != end) { xmlOutputBufferWrite(buf, 9, ""); - start = end; } - end++; - } - if (start != end) { - xmlOutputBufferWrite(buf, 9, ""); } return; } diff --git a/xmlschemas.c b/xmlschemas.c index f6b86dd..d57ba9f 100644 --- a/xmlschemas.c +++ b/xmlschemas.c @@ -21808,9 +21808,9 @@ xmlSchemaValidateNotation(xmlSchemaValidCtxtPtr vctxt, return (1); } if (xmlSchemaGetNotation(schema, localName, nsName) != NULL) { - if (valNeeded && (val != NULL)) { - (*val) = xmlSchemaNewNOTATIONValue(BAD_CAST localName, - BAD_CAST xmlStrdup(nsName)); + if ((valNeeded) && (val != NULL)) { + (*val) = xmlSchemaNewNOTATIONValue(xmlStrdup(localName), + xmlStrdup(nsName)); if (*val == NULL) ret = -1; } @@ -28108,8 +28108,8 @@ externalSubsetSplit(void *ctx, const xmlChar *name, { xmlSchemaSAXPlugPtr ctxt = (xmlSchemaSAXPlugPtr) ctx; if ((ctxt != NULL) && (ctxt->user_sax != NULL) && - (ctxt->user_sax->internalSubset != NULL)) - ctxt->user_sax->internalSubset(ctxt->user_data, name, ExternalID, + (ctxt->user_sax->externalSubset != NULL)) + ctxt->user_sax->externalSubset(ctxt->user_data, name, ExternalID, SystemID); } @@ -28315,8 +28315,8 @@ cdataBlockSplit(void *ctx, const xmlChar *value, int len) if (ctxt == NULL) return; if ((ctxt->user_sax != NULL) && - (ctxt->user_sax->ignorableWhitespace != NULL)) - ctxt->user_sax->ignorableWhitespace(ctxt->user_data, value, len); + (ctxt->user_sax->cdataBlock != NULL)) + ctxt->user_sax->cdataBlock(ctxt->user_data, value, len); if (ctxt->ctxt != NULL) xmlSchemaSAXHandleCDataSection(ctxt->ctxt, value, len); } diff --git a/xmlschemastypes.c b/xmlschemastypes.c index a35c539..0d967d0 100644 --- a/xmlschemastypes.c +++ b/xmlschemastypes.c @@ -2063,7 +2063,7 @@ xmlSchemaValAtomicListNode(xmlSchemaTypePtr type, const xmlChar *value, * Parse an unsigned long into 3 fields. * * Returns the number of significant digits in the number or - * -1 if overflow of the capacity + * -1 if overflow of the capacity and -2 if it's not a number. */ static int xmlSchemaParseUInt(const xmlChar **str, unsigned long *llo, @@ -2072,6 +2072,9 @@ xmlSchemaParseUInt(const xmlChar **str, unsigned long *llo, const xmlChar *tmp, *cur = *str; int ret = 0, i = 0; + if (!((*cur >= '0') && (*cur <= '9'))) + return(-2); + while (*cur == '0') { /* ignore leading zeroes */ cur++; } @@ -2342,9 +2345,9 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value, * Terminate the (preparsed) string. */ if (len != 0) { - *cptr = 0; + *cptr = 0; cptr = cval; - + xmlSchemaParseUInt((const xmlChar **)&cptr, &v->value.decimal.lo, &v->value.decimal.mi, @@ -3116,7 +3119,7 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value, } else if (*cur == '+') cur++; ret = xmlSchemaParseUInt(&cur, &lo, &mi, &hi); - if (ret == -1) + if (ret < 0) goto return1; if (normOnTheFly) while IS_WSP_BLANK_CH(*cur) cur++; @@ -3161,7 +3164,7 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value, case XML_SCHEMAS_BYTE: case XML_SCHEMAS_SHORT: case XML_SCHEMAS_INT:{ - const xmlChar *cur = value; + const xmlChar *cur = value; unsigned long lo, mi, hi; int sign = 0; diff --git a/xmlwriter.c b/xmlwriter.c index 2d9d109..69d4b85 100644 --- a/xmlwriter.c +++ b/xmlwriter.c @@ -626,9 +626,10 @@ xmlTextWriterStartDocument(xmlTextWriterPtr writer, const char *version, * xmlTextWriterEndDocument: * @writer: the xmlTextWriterPtr * - * End an xml document. All open elements are closed + * End an xml document. All open elements are closed, and + * the content is flushed to the output. * - * Returns the bytes written (may be 0 because of buffering) or -1 in case of error + * Returns the bytes written or -1 in case of error */ int xmlTextWriterEndDocument(xmlTextWriterPtr writer) @@ -702,6 +703,9 @@ xmlTextWriterEndDocument(xmlTextWriterPtr writer) return -1; sum += count; } + + sum += xmlTextWriterFlush(writer); + return sum; } @@ -2610,6 +2614,7 @@ xmlTextWriterStartCDATA(xmlTextWriterPtr writer) if (p != 0) { switch (p->state) { case XML_TEXTWRITER_NONE: + case XML_TEXTWRITER_TEXT: case XML_TEXTWRITER_PI: case XML_TEXTWRITER_PI_TEXT: break; diff --git a/xpath.c b/xpath.c index 22a3f9d..a52c44a 100644 --- a/xpath.c +++ b/xpath.c @@ -3663,6 +3663,8 @@ xmlXPathNodeSetMerge(xmlNodeSetPtr val1, xmlNodeSetPtr val2) { if (val2 == NULL) return(val1); if (val1 == NULL) { val1 = xmlXPathNodeSetCreate(NULL); + if (val1 == NULL) + return (NULL); #if 0 /* * TODO: The optimization won't work in every case, since @@ -3776,6 +3778,8 @@ xmlXPathNodeSetMergeUnique(xmlNodeSetPtr val1, xmlNodeSetPtr val2) { if (val1 == NULL) { val1 = xmlXPathNodeSetCreate(NULL); } + if (val1 == NULL) + return (NULL); /* @@ with_ns to check whether namespace nodes should be looked at @@ */ @@ -3852,7 +3856,9 @@ xmlXPathNodeSetMergeAndClear(xmlNodeSetPtr set1, xmlNodeSetPtr set2, xmlNodePtr n1, n2; if (set1 == NULL) - set1 = xmlXPathNodeSetCreate(NULL); + set1 = xmlXPathNodeSetCreate(NULL); + if (set1 == NULL) + return (NULL); initNbSet1 = set1->nodeNr; for (i = 0;i < set2->nodeNr;i++) { @@ -3962,6 +3968,8 @@ xmlXPathNodeSetMergeAndClearNoDupls(xmlNodeSetPtr set1, xmlNodeSetPtr set2, if (set1 == NULL) set1 = xmlXPathNodeSetCreate(NULL); + if (set1 == NULL) + return (NULL); for (i = 0;i < set2->nodeNr;i++) { n2 = set2->nodeTab[i]; @@ -4281,8 +4289,9 @@ xmlXPathNewNodeSetList(xmlNodeSetPtr val) ret = xmlXPathNewNodeSet(NULL); else { ret = xmlXPathNewNodeSet(val->nodeTab[0]); - for (i = 1; i < val->nodeNr; ++i) - xmlXPathNodeSetAddUnique(ret->nodesetval, val->nodeTab[i]); + if (ret) + for (i = 1; i < val->nodeNr; ++i) + xmlXPathNodeSetAddUnique(ret->nodesetval, val->nodeTab[i]); } return (ret); @@ -4381,6 +4390,8 @@ xmlXPathIntersection (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) { int i, l1; xmlNodePtr cur; + if (ret == NULL) + return(ret); if (xmlXPathNodeSetIsEmpty(nodes1)) return(ret); if (xmlXPathNodeSetIsEmpty(nodes2)) @@ -4418,6 +4429,8 @@ xmlXPathDistinctSorted (xmlNodeSetPtr nodes) { return(nodes); ret = xmlXPathNodeSetCreate(NULL); + if (ret == NULL) + return(ret); l = xmlXPathNodeSetGetLength(nodes); hash = xmlHashCreate (l); for (i = 0; i < l; i++) { @@ -4506,6 +4519,8 @@ xmlXPathNodeLeadingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) { return(nodes); ret = xmlXPathNodeSetCreate(NULL); + if (ret == NULL) + return(ret); if (xmlXPathNodeSetIsEmpty(nodes) || (!xmlXPathNodeSetContains(nodes, node))) return(ret); @@ -4608,6 +4623,8 @@ xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) { return(nodes); ret = xmlXPathNodeSetCreate(NULL); + if (ret == NULL) + return(ret); if (xmlXPathNodeSetIsEmpty(nodes) || (!xmlXPathNodeSetContains(nodes, node))) return(ret); @@ -8432,6 +8449,8 @@ xmlXPathGetElementsByIds (xmlDocPtr doc, const xmlChar *ids) { if (ids == NULL) return(NULL); ret = xmlXPathNodeSetCreate(NULL); + if (ret == NULL) + return(ret); while (IS_BLANK_CH(*cur)) cur++; while (*cur != 0) { @@ -8499,6 +8518,11 @@ xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, int nargs) { int i; ret = xmlXPathNodeSetCreate(NULL); + /* + * FIXME -- in an out-of-memory condition this will behave badly. + * The solution is not clear -- we already popped an item from + * ctxt, so the object is in a corrupt state. + */ if (obj->nodesetval != NULL) { for (i = 0; i < obj->nodesetval->nodeNr; i++) { @@ -12481,6 +12505,7 @@ error: outSeq = seq; else outSeq = xmlXPathNodeSetCreate(NULL); + /* XXX what if xmlXPathNodeSetCreate returned NULL here? */ } if ((seq != NULL) && (seq != outSeq)) { xmlXPathFreeNodeSet(seq); @@ -12976,6 +13001,7 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, * key() evaluation are attempted on the predicate */ newset = xmlXPathNodeSetCreate(NULL); + /* XXX what if xmlXPathNodeSetCreate returned NULL? */ for (i = 0; i < oldset->nodeNr; i++) { /* diff --git a/xstc/Makefile.am b/xstc/Makefile.am index 2d24f02..966a8de 100644 --- a/xstc/Makefile.am +++ b/xstc/Makefile.am @@ -128,8 +128,5 @@ valgrind: echo '## Running the regression tests under Valgrind' ; \ $(MAKE) CHECKER='valgrind -q' MAKEFLAGS+=--silent pytests ; fi); -clean: - rm -f $(PYSCRIPTS) test.log +CLEANFILES=$(PYSCRIPTS) test.log -distclean: - rm -rf $(PYSCRIPTS) test.log # TESTDIRS diff --git a/xstc/Makefile.in b/xstc/Makefile.in index 054ea8b..26048e6 100644 --- a/xstc/Makefile.in +++ b/xstc/Makefile.in @@ -281,6 +281,7 @@ NISTTESTDEF_2 = NISTXMLSchemaDatatypes.testSet # The local data and scripts # EXTRA_DIST = xstc.py xstc-to-python.xsl +CLEANFILES = $(PYSCRIPTS) test.log all: all-am .SUFFIXES: @@ -373,6 +374,7 @@ install-strip: mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) @@ -380,8 +382,12 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + clean-am: clean-generic clean-libtool mostlyclean-am +distclean: distclean-am + -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am @@ -551,12 +557,6 @@ valgrind: -@(if [ -x $(PYTHON) ] ; then \ echo '## Running the regression tests under Valgrind' ; \ $(MAKE) CHECKER='valgrind -q' MAKEFLAGS+=--silent pytests ; fi); - -clean: - rm -f $(PYSCRIPTS) test.log - -distclean: - rm -rf $(PYSCRIPTS) test.log # TESTDIRS # 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: -- 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-schematron.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

-
  • 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 @@ -235,16 +237,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 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

  • -
  • 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

  • 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