diff --git a/ChangeLog b/ChangeLog index 2a3d035a..f9ea27d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +Fri Oct 6 12:58:04 CEST 2000 Daniel Veillard + + * configure.in Makefile.am: 2.2.5, ship the include in an + include/libxml subdirectory, use symlinks when using CVS + * testSAX.c: fixed small bug + * testXPath.c: changed the way testfiles are parsed + * debugXML.c: same kind of cleanup when parsing an argument expression + XPath/XPointers can have blanks embedded + * xpath.[ch]: more cleanup, reorgs for XPointer work + * parserInternals.c parser.c HTMLparser.c: fixed wrong include + * win32/README.MSDev win32/libxml2/libxml2.dsp: Windows stuff + Thu Oct 5 18:13:15 CEST 2000 Daniel Veillard * debugXML.c testXPath.c xpath.[ch]: got pissed by some nastyness diff --git a/HTMLparser.c b/HTMLparser.c index acb13b43..3212ce5f 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -45,7 +45,7 @@ #include #include #include -#include "xml-error.h" +#include #define HTML_MAX_NAMELEN 1000 #define HTML_PARSER_BIG_BUFFER_SIZE 1000 diff --git a/Makefile.am b/Makefile.am index cecc284a..13a0fd8f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,7 +2,7 @@ SUBDIRS = doc -INCLUDES = -I@srcdir@ @Z_CFLAGS@ @CORBA_CFLAGS@ +INCLUDES = -I@srcdir@/include @Z_CFLAGS@ @CORBA_CFLAGS@ noinst_PROGRAMS=testSAX testHTML testXPath testURI @@ -35,27 +35,28 @@ libxml_la_SOURCES = \ nanohttp.c \ nanoftp.c -xmlincdir = $(includedir)/libxml +xmlincdir = $(srcdir)/include/libxml + xmlinc_HEADERS = \ - SAX.h \ - entities.h \ - encoding.h \ - parser.h \ - parserInternals.h \ - xml-error.h \ - HTMLparser.h \ - HTMLtree.h \ - debugXML.h \ - tree.h \ - xpath.h \ - xmlIO.h \ - xmlmemory.h \ - nanohttp.h \ - nanoftp.h \ - uri.h \ - valid.h \ - xlink.h \ - xmlversion.h + $(xmlincdir)/SAX.h \ + $(xmlincdir)/entities.h \ + $(xmlincdir)/encoding.h \ + $(xmlincdir)/parser.h \ + $(xmlincdir)/parserInternals.h \ + $(xmlincdir)/xml-error.h \ + $(xmlincdir)/HTMLparser.h \ + $(xmlincdir)/HTMLtree.h \ + $(xmlincdir)/debugXML.h \ + $(xmlincdir)/tree.h \ + $(xmlincdir)/xpath.h \ + $(xmlincdir)/xmlIO.h \ + $(xmlincdir)/xmlmemory.h \ + $(xmlincdir)/nanohttp.h \ + $(xmlincdir)/nanoftp.h \ + $(xmlincdir)/uri.h \ + $(xmlincdir)/valid.h \ + $(xmlincdir)/xlink.h \ + $(xmlincdir)/xmlversion.h DEPS = $(top_builddir)/libxml.la LDADDS = $(top_builddir)/libxml.la @Z_LIBS@ @M_LIBS@ @@ -356,7 +357,8 @@ confexecdir=$(libdir) confexec_DATA = xmlConf.sh EXTRA_DIST = xmlConf.sh.in libxml.spec.in libxml.spec libxml.m4 \ example/Makefile.am example/gjobread.c example/gjobs.xml \ - $(man_MANS) libxml-2.0.pc.in + $(man_MANS) libxml-2.0.pc.in include/libxml/*.h.in \ + win32/README.MSDev win32/libxml2/libxml2.dsp pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libxml-2.0.pc diff --git a/configure.in b/configure.in index 1473ad05..22e98d97 100644 --- a/configure.in +++ b/configure.in @@ -1,12 +1,12 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.2) -AC_INIT(entities.h) +AC_INIT(entities.c) AM_CONFIG_HEADER(config.h) AC_CANONICAL_HOST LIBXML_MAJOR_VERSION=2 LIBXML_MINOR_VERSION=2 -LIBXML_MICRO_VERSION=4 +LIBXML_MICRO_VERSION=5 LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION @@ -116,7 +116,7 @@ AC_CHECK_FUNC(isinf, , AC_CHECK_LIB(m, isinf, [M_LIBS="-lm"; AC_DEFINE(HAVE_ISINF)])) XML_LIBDIR='-L${libdir}' -XML_INCLUDEDIR='-I${includedir}/libxml -I${includedir}' +XML_INCLUDEDIR='-I${srcdir}/include -I${includedir}/libxml -I${includedir}' XML_LIBS="-lxml $Z_LIBS $M_LIBS $LIBS" dnl @@ -295,16 +295,22 @@ AC_SUBST(M_LIBS) AC_SUBST(RDL_LIBS) dnl -dnl create the libxml link needed to get dependencies right +dnl create the libxml and include links needed to get dependencies right dnl -if test -f $srcdir/libxml +if test ! -d $srcdir/include/libxml then - rm -f $srcdir/libxml libxml + rm -f $srcdir/include + rm -f $srcdir/libxml + (cd $srcdir ; ln -s . include) (cd $srcdir ; ln -s . libxml) - (ln -s . libxml) -else - (cd $srcdir ; rm -f libxml ; ln -s . libxml) - (rm -f libxml ; ln -s . libxml) fi -AC_OUTPUT(libxml.spec Makefile doc/Makefile example/Makefile xmlversion.h xml-config win32config.h libxml-2.0.pc) +if test ! -e include/libxml +then + rm -f include + rm -f libxml + (ln -s $srcdir/include include) + (ln -s $srcdir/include/libxml libxml) +fi + +AC_OUTPUT(libxml.spec Makefile doc/Makefile example/Makefile include/libxml/xmlversion.h xml-config include/libxml/win32config.h libxml-2.0.pc) diff --git a/debugXML.c b/debugXML.c index 13180a71..3b34c3e2 100644 --- a/debugXML.c +++ b/debugXML.c @@ -572,7 +572,8 @@ void xmlDebugDumpOneNode(FILE *output, xmlNodePtr node, int depth) { return; default: fprintf(output, shift); - fprintf(output, "NODE_%d\n", node->type); + fprintf(output, "NODE_%d !!!\n", node->type); + return; } if (node->doc == NULL) { fprintf(output, shift); diff --git a/doc/Makefile.am b/doc/Makefile.am index dcb86ac8..aaf65302 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -18,6 +18,7 @@ TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE) scan: @(if [ -L $(DOC_SOURCE_DIR)/libxml ] ; then rm -f $(DOC_SOURCE_DIR)/libxml ; fi) + @(if [ -L $(DOC_SOURCE_DIR)/include ] ; then rm -f $(DOC_SOURCE_DIR)/libxml ; fi) gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="acconfig.h config.h" templates: scan diff --git a/doc/html/gnome-xml-debugxml.html b/doc/html/gnome-xml-debugxml.html index 8c14c187..d950dabf 100644 --- a/doc/html/gnome-xml-debugxml.html +++ b/doc/html/gnome-xml-debugxml.html @@ -115,7 +115,7 @@ SIZE="3" >

Name

Synopsis

Description

Details














xmlShellCtxtPtr

typedef xmlShellCtxt *xmlShellCtxtPtr;



the initial document  the output buffer  the line reading function  the output FILE* 

Name

Synopsis

Description

Details





xmlCharEncodingHandlerPtr

typedef xmlCharEncodingHandler *xmlCharEncodingHandlerPtr;




the xmlCharEncodingHandlerPtr handler block 


a string describing the char encoding. the handler or NULL if not found 



the encoding name as parsed, in UTF-8 format (ASCII actually)  the alias name as parsed, in UTF-8 format (ASCII actually) 0 in case of success, -1 in case of error 


the alias name as parsed, in UTF-8 format (ASCII actually) 0 in case of success, -1 in case of error 


the alias name as parsed, in UTF-8 format (ASCII actually) NULL if not found the original name otherwise 



the encoding name as parsed, in UTF-8 format (ASCII actually) one of the XML_CHAR_ENCODING_... values or XML_CHAR_ENCODING_NONE -if not recognized. 


the encoding the canonical name for the given encoding 


a pointer to the first bytes of the XML entity, must be at least -4 bytes long.  pointer to the length of the buffer one of the XML_CHAR_ENCODING_... values. 


Pointer to putative utf-8 encoded string.  true if utf is valid. 


char enconding transformation data structure  an xmlBuffer for the output.  an xmlBuffer for the input the number of byte written if success, or --1 general error --2 if the transcoding fails (for *in is not valid utf8 string or -the result of transformation can't fit into the encoding we want), or 


char enconding transformation data structure  an xmlBuffer for the output.  an xmlBuffer for the input the number of byte written if success, or --1 general error --2 if the transcoding fails (for *in is not valid utf8 string or -the result of transformation can't fit into the encoding we want), or 


char enconding transformation data structure  an xmlBuffer for the output.  an xmlBuffer for the input the number of byte written if success, or --1 general error --2 if the transcoding fails (for *in is not valid utf8 string or -the result of transformation can't fit into the encoding we want), or 


char enconding transformation data structure 0 if success, or -1 in case of error 

Name

Synopsis

Description

Details



xmlEntityPtr

typedef xmlEntity *xmlEntityPtr;


#define XML_MIN_ENTITIES_TABLE	32
#define XML_MIN_ENTITIES_TABLE


xmlEntitiesTablePtr

typedef xmlEntitiesTable *xmlEntitiesTablePtr;



the document  the entity name  the entity type XML_xxx_yyy_ENTITY  the entity external ID if available  the entity system ID if available  the entity content a pointer to the entity or NULL in case of error 


the document  the entity name  the entity type XML_xxx_yyy_ENTITY  the entity external ID if available  the entity system ID if available  the entity content a pointer to the entity or NULL in case of error 


the entity name NULL if not, othervise the entity 


the document referencing the entity  the entity name A pointer to the entity structure or NULL if not found. 


the document referencing the entity  the entity name A pointer to the entity structure or NULL if not found. 


the document referencing the entity  the entity name A pointer to the entity structure or NULL if not found. 


the document containing the string  A string to convert to XML. A newly allocated string with the substitution done. 


the document containing the string  A string to convert to XML. A newly allocated string with the substitution done. 


the document containing the string  A string to convert to XML. A newly allocated string with the substitution done. 


the xmlEntitiesTablePtr just created or NULL in case of error. 


An entity table the new xmlEntitiesTablePtr or NULL in case of error. 


An entity table 


An XML buffer.  An entity table 


An XML buffer.  An entity table 



an existing entity  the entity name it's referencing  0 if Okay, -1 in case of general error, 1 in case of loop -detection. 

Name

Synopsis

Description

Details

htmlParserCtxt

typedef xmlParserCtxt htmlParserCtxt;


htmlParserCtxtPtr

typedef xmlParserCtxtPtr htmlParserCtxtPtr;


htmlParserNodeInfo

typedef xmlParserNodeInfo htmlParserNodeInfo;


htmlSAXHandler

typedef xmlSAXHandler htmlSAXHandler;


htmlSAXHandlerPtr

typedef xmlSAXHandlerPtr htmlSAXHandlerPtr;


htmlParserInput

typedef xmlParserInput htmlParserInput;


htmlParserInputPtr

typedef xmlParserInputPtr htmlParserInputPtr;


htmlDocPtr

typedef xmlDocPtr htmlDocPtr;


htmlNodePtr

typedef xmlNodePtr htmlNodePtr;



htmlElemDescPtr

typedef htmlElemDesc *htmlElemDescPtr;



htmlEntityDescPtr

typedef htmlEntityDesc *htmlEntityDescPtr;


The tag name in lowercase the related htmlElemDescPtr or NULL if not found. 


the entity name the associated htmlEntityDescPtr if found, NULL otherwise. 


the entity's unicode value the associated htmlEntityDescPtr if found, NULL otherwise. 


the HTML document  the HTML element 1 if autoclosed, 0 otherwise 


the HTML document  The tag name  the HTML element 1 if autoclose, 0 otherwise 


an HTML parser context  location to store the entity name the associated htmlEntityDescPtr if found, or NULL otherwise, -if non-NULL *str will have to be freed by the caller. 


an HTML parser context the value parsed (as an int) 


an HTML parser context 


a pointer to an array of xmlChar  a free form C string describing the HTML document encoding, or NULL  the SAX handler block  if using SAX, this pointer will be provided on callbacks.  the resulting document tree 


a pointer to an array of xmlChar  a free form C string describing the HTML document encoding, or NULL the resulting document tree 


the filename  a free form C string describing the HTML document encoding, or NULL  the SAX handler block  if using SAX, this pointer will be provided on callbacks.  the resulting document tree 


the filename  a free form C string describing the HTML document encoding, or NULL the resulting document tree 


a pointer to an array of bytes to store the result  the length of out  a pointer to an array of UTF-8 chars  the length of in 0 if success, -2 if the transcoding fails, or -1 otherwise -The value of inlen after return is the number of octets consumed -as the return value is positive, else unpredictiable. -The value of outlen after return is the number of octets consumed. 


a pointer to an array of bytes to store the result  the length of out  a pointer to an array of UTF-8 chars  the length of in  the quote character to escape (' or ") or zero. 0 if success, -2 if the transcoding fails, or -1 otherwise -The value of inlen after return is the number of octets consumed -as the return value is positive, else unpredictiable. -The value of outlen after return is the number of octets consumed. 


an HTML parser context 


a SAX handler  The user data returned on SAX callbacks  a pointer to an array of chars  number of chars in the array  an optional file name or URI  an optional encoding the new parser context or NULL 


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

Name

Synopsis

Description

Details

#define HTML_TEXT_NODE		XML_TEXT_NODE
#define HTML_TEXT_NODE

#define HTML_ENTITY_REF_NODE	XML_ENTITY_REF_NODE
#define HTML_ENTITY_REF_NODE

#define HTML_COMMENT_NODE	XML_COMMENT_NODE
#define HTML_COMMENT_NODE

URI for the dtd, or NULL  the external ID of the DTD, or NULL a new document 


URI for the dtd, or NULL  the external ID of the DTD, or NULL a new document, do not intialize the DTD if not provided 


the document the current encoding as flagged in the HTML source 


the document  the encoding string 0 in case of success and -1 in case of error 


the document  OUT: the memory pointer  OUT: the memory lenght 


the FILE*  the document  the number of byte written or -1 in case of failure. 


the filename (or URL)  the document  the number of byte written or -1 in case of failure. 


the HTML buffer output  the document  the current node 


the FILE pointer  the document  the current node 


the filename  the document  the number of byte written or -1 in case of failure. 

Name

Synopsis

Description

Details





The URL used to initialize the context 


an FTP context 


an FTP server name  the port (use 21 if 0) 


the URL to the resource 


an FTP context -1 in case of error, 0 otherwise 


an FTP context -1 incase of error, 0 otherwise 


an FTP context -1 in case of error, 0 otherwise 


The proxy URL used to initialize the proxy context 


the proxy host name  the proxy port  the proxy user name  the proxy password  the type of proxy 1 for using SITE, 2 for USER ab 


an FTP context  The URL used to update the context 0 if Ok, -1 in case of error (other host). 


an FTP context the code number 


an FTP context the code number, or 0 


an FTP context  a directory on the server -1 incase of error, 1 if CWD worked, 0 if it failed 


an FTP context -1 incase of error, 0 otherwise 


an FTP context -1 incase of error, 0 otherwise 


an FTP context  the user callback  the user callback data  optional files to list -1 incase of error, 0 otherwise 


an FTP context  the file to retrieve (or NULL if path is in context). the socket for the data connection, or <0 in case of error 


an FTP context  the user callback  the user callback data  the file to retrieve -1 incase of error, 0 otherwise 


the FTP context  a buffer  the buffer length the number of byte read. 0 is an indication of an end of connection. --1 indicates a parameter error. 

Name

Synopsis

Description

Details



The proxy URL used to initialize the proxy context 


The URL to load  the filename where the content should be saved  if available the Content-Type information will be -returned at that location -1 in case of failure, 0 incase of success. The contentType, -if provided must be freed by the caller 


The URL to load  the HTTP method to use  the input string if any  the Content-Type information IN and OUT  the extra headers 


The URL to load  if available the Content-Type information will be -returned at that location 


the HTTP context the HTTP return code for the request. 


the HTTP context  a buffer  the buffer length the number of byte read. 0 is an indication of an end of connection. --1 indicates a parameter error. 


the HTTP context  the filename where the content should be saved -1 in case of failure, 0 incase of success. 


the HTTP context 

#define XML_DEFAULT_VERSION	"1.0"
#define XML_DEFAULT_VERSION
xmlParserInputPtr

typedef xmlParserInput *xmlParserInputPtr;



xmlParserNodeInfoPtr

typedef xmlParserNodeInfo *xmlParserNodeInfoPtr;



xmlParserNodeInfoSeqPtr

typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr;




xmlParserCtxtPtr

typedef xmlParserCtxt *xmlParserCtxtPtr;



xmlSAXLocatorPtr

typedef xmlSAXLocator *xmlSAXLocatorPtr;































xmlSAXHandlerPtr

typedef xmlSAXHandler *xmlSAXHandlerPtr;












an XML parser input  an indicative size for the lookahead the number of xmlChars read, or -1 in case of error, 0 indicate the -end of this entity 


an XML parser input  an indicative size for the lookahead the number of xmlChars read, or -1 in case of error, 0 indicate the -end of this entity 


the input xmlChar * a new xmlChar * or NULL 


the input xmlChar *  the len of cur a new xmlChar * or NULL 


the xmlChar * array (haystack)  the index of the first char (zero based)  the length of the substring the xmlChar * for the first occurence or NULL. 


the xmlChar * array  the xmlChar to search the xmlChar * for the first occurence or NULL. 


the xmlChar * array (haystack)  the xmlChar to search (needle) the xmlChar * for the first occurence or NULL. 


the xmlChar * array (haystack)  the xmlChar to search (needle) the xmlChar * for the first occurence or NULL. 


the first xmlChar *  the second xmlChar * the integer result of the comparison 


the first xmlChar *  the second xmlChar *  the max comparison length the integer result of the comparison 


the first xmlChar *  the second xmlChar * the integer result of the comparison 


the first xmlChar *  the second xmlChar *  the max comparison length the integer result of the comparison 


the first xmlChar *  the second xmlChar * 1 if they are equal, 0 if they are different 


the xmlChar * array the number of xmlChar contained in the ARRAY. 


the original xmlChar * array  the xmlChar * array added a new xmlChar * containing the concatenated string. 


the original xmlChar * array  the xmlChar * array added  the length of add a new xmlChar * containing the concatenated string. 


a pointer to an array of xmlChar the resulting document tree 


an pointer to a char array  the size of the array the resulting document tree 


the filename the resulting document tree 


int 0 or 1  the last value for 0 for no substitution, 1 for substitution. 


int 0 or 1  the last value for 0 for no substitution, 1 for substitution. 


an XML parser context 


int 0 or 1  the last value for 0 for no substitution, 1 for substitution. 


a pointer to an array of xmlChar the resulting document tree 


an pointer to a char array  the size of the array the resulting document tree 


the filename the resulting document tree 


an XML parser context 0, -1 in case of error. the parser context is augmented -as a result of the parsing. 


an XML parser context 0, -1 in case of error. the parser context is augmented -as a result of the parsing. 


the SAX handler block  a pointer to an array of xmlChar  work in recovery mode, i.e. tries to read no Well Formed -documents the resulting document tree 


a SAX handler  The user data returned on SAX callbacks  a file name 0 in case of success or a error number otherwise 


a SAX handler  The user data returned on SAX callbacks  an in-memory XML document input  the length of the XML document in bytes 0 in case of success or a error number otherwise 


the SAX handler block  an pointer to a char array  the size of the array  work in recovery mode, i.e. tries to read not Well Formed -documents the resulting document tree 


the SAX handler block  the filename  work in recovery mode, i.e. tries to read no Well Formed -documents the resulting document tree 


the SAX handler block  the filename the resulting document tree 


the filename the resulting document tree 


a NAME* containing the External ID of the DTD  a NAME* containing the URL to the DTD the resulting xmlDtdPtr or NULL in case of error. 


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



the document the chunk pertains to  the SAX handler bloc (possibly NULL)  The user data returned on SAX callbacks (possibly NULL)  Used for loop detection, use 0  the URL for the entity to load  the System ID for the entity to load  the return value for the set of parsed nodes 0 if the entity is well formed, -1 in case of args problem and -the parser error code otherwise 


the existing parsing context  the URL for the entity to load  the System ID for the entity to load  the return value for the set of parsed nodes 0 if the entity is well formed, -1 in case of args problem and -the parser error code otherwise 




an XML parser context 


an XML parser context 


an XML parser context 


an XML parser context  a xmlChar * buffer  a file name 


a pointer to an array of xmlChar the new parser context or NULL 





a SAX handler  The user data returned on SAX callbacks  a pointer to an array of chars  number of chars in the array  an optional file name or URI the new parser context or NULL 


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


a SAX handler  The user data returned on SAX callbacks  an I/O read function  an I/O close function  an I/O handler  the charset encoding if known the new parser context or NULL 


an XML parser context  an I/O Input  the charset encoding if known the new input stream or NULL 


an XML parser context  an XML node within the tree an xmlParserNodeInfo block pointer or NULL 


a node info sequence pointer 


a node info sequence pointer 


a node info sequence pointer  an XML node pointer a long indicating the position of the record 


an XML parser context  a node info sequence pointer 




Name

Synopsis

Description

Details

#define XML_MAX_NAMELEN 100
#define XML_MAX_NAMELEN

#define INPUT_CHUNK	250
#define INPUT_CHUNK



#define IS_BASECHAR(c) xmlIsBaseChar(c)
#define IS_BASECHAR(c)

#define IS_DIGIT(c) xmlIsDigit(c)
#define IS_DIGIT(c)

#define IS_COMBINING(c) xmlIsCombining(c)
#define IS_COMBINING(c)

#define IS_EXTENDER(c) xmlIsExtender(c)
#define IS_EXTENDER(c)

#define IS_IDEOGRAPHIC(c) xmlIsIdeographic(c)
#define IS_IDEOGRAPHIC(c)

#define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c))
#define IS_LETTER(c)

#define IS_PUBIDCHAR(c)	xmlIsPubidChar(c)
#define IS_PUBIDCHAR(c)










an unicode character (int) 0 if not, non-zero otherwise 


an unicode character (int) 0 if not, non-zero otherwise 


an unicode character (int) 0 if not, non-zero otherwise 


an unicode character (int) 0 if not, non-zero otherwise 


an unicode character (int) 0 if not, non-zero otherwise 


an unicode character (int) 0 if not, non-zero otherwise 


an unicode character (int) 0 if not, non-zero otherwise 


an unicode character (int) 0 if not, non-zero otherwise 


an unicode character (int) 0 if not, non-zero otherwise 



the filename the new parser context or NULL 


a pointer to a char array  the size of the array the new parser context or NULL 


the xmlParserCtxtPtr or NULL 


the entity URL  the entity PUBLIC ID  a posible base for the target URI the new parser context or NULL 


the parser context  the encoding value (number) 0 in case of success, -1 otherwise 


the parser context  the encoding handler 0 in case of success, -1 otherwise 



an XML parser context  an XML entity pointer. 


an XML parser context  an Entity pointer the new input stream or NULL 


an XML parser context  an XML parser input fragment (entity, XML fragment ...). 


an XML parser context the current xmlChar in the parser context 


an xmlParserInputPtr 


an XML parser context  the filename to use as entity the new input stream or NULL in case of error 


an XML parser context the new input stream or NULL 


an XML parser context  an XML parser context  a xmlChar **  the local part, and prefix is updated -to get the Prefix if any. 


an XML parser context the namespace name or NULL 


an XML parser context  a xmlChar **  the local part, and prefix is updated -to get the Prefix if any. 


an XML parser context the namespace name 


an XML parser context the string parser or NULL. 


an XML parser context 


an XML parser context the Name parsed or NULL 


an XML parser context the Name parsed or NULL 


an XML parser context the Nmtoken parsed or NULL 


an XML parser context  if non-NULL store a copy of the original entity value the EntityValue parsed with reference substitued or NULL 


an XML parser context the AttValue parsed or NULL. The value has to be freed by the caller. 


an XML parser context the SystemLiteral parsed or NULL 


an XML parser context the PubidLiteral parsed or NULL. 


an XML parser context  int indicating whether we are within a CDATA section 


an XML parser context  a xmlChar** receiving PubidLiteral  indicate whether we should restrict parsing to only -production [75], see NOTE below the function returns SystemLiteral and in the second -case publicID receives PubidLiteral, is strict is off -it is possible to return NULL and have publicID set. 


an XML parser context 


an XML parser context the PITarget name or NULL 


an XML parser context 


an XML parser context 


an XML parser context 


an XML parser context  Receive a possible fixed default value for the attribute  XML_ATTRIBUTE_NONE, XML_ATTRIBUTE_REQUIRED, XML_ATTRIBUTE_IMPLIED -or XML_ATTRIBUTE_FIXED.  


an XML parser context  the notation attribute tree built while parsing 


an XML parser context  the enumeration attribute tree built while parsing 


an XML parser context  the enumeration tree built while parsing  XML_ATTRIBUTE_ENUMERATION or XML_ATTRIBUTE_NOTATION 


an XML parser context  the enumeration tree built while parsing the attribute type 


an XML parser context 


an XML parser context  the list of the xmlElementContentPtr describing the element choices 


an XML parser context  the tree of xmlElementContentPtr describing the element -hierarchy. 


an XML parser context  the name of the element being defined.  the Element Content pointer will be stored here if any  the type of element content XML_ELEMENT_TYPE_xxx 


an XML parser context the type of the element, or -1 in case of error 


an XML parser context 


an XML parser context the value parsed (as an int), 0 in case of error 


an XML parser context the xmlEntityPtr if found, or NULL otherwise. 


an XML parser context 


an XML parser context 


an XML parser context 


an XML parser context  a xmlChar ** used to store the value of the attribute the attribute name, and the value in *value. 


an XML parser context the element name parsed 


an XML parser context 


an XML parser context 


an XML parser context 


an XML parser context 


an XML parser context the string giving the XML version number, or NULL 


an XML parser context the version string, e.g. "1.0" 


an XML parser context the encoding name value or NULL 


an XML parser context the encoding value or NULL 


an XML parser context 1 if standalone, 0 otherwise 


an XML parser context 


an XML parser context 


an XML parser context 


an XML parser context  the external identifier  the system identifier (or URL) 


#define XML_SUBSTITUTE_NONE	0
#define XML_SUBSTITUTE_NONE

#define XML_SUBSTITUTE_REF	1
#define XML_SUBSTITUTE_REF

#define XML_SUBSTITUTE_PEREF	2
#define XML_SUBSTITUTE_PEREF

#define XML_SUBSTITUTE_BOTH 	3
#define XML_SUBSTITUTE_BOTH

the parser context  the len to decode (in bytes !), -1 for no size limit  combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF  an end marker xmlChar, 0 if none  an end marker xmlChar, 0 if none  an end marker xmlChar, 0 if none A newly allocated string with the substitution done. The caller -must deallocate it ! 


the parser context  the input string  combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF  an end marker xmlChar, 0 if none  an end marker xmlChar, 0 if none  an end marker xmlChar, 0 if none A newly allocated string with the substitution done. The caller -must deallocate it ! 






the XML parser context the number of space chars skipped 


the XML parser context  pointer to the beginning of the char  pointer to the length of the char read the current char value and its lenght 


the parser context 


the parser context 




the XML parser context  pointer to the length of the char read the current char value and its lenght 


pointer to the length of the char read (or zero)  the char value the number of xmlChar written 


the XML parser context 


an XML parser input 


Name

Synopsis

Description

Details

the user data (XML parser context) a xmlChar * 


the user data (XML parser context) a xmlChar * 


the user data (XML parser context)  A SAX Locator 


the user data (XML parser context) an int 


the user data (XML parser context) an int 


the user data (XML parser context) 1 if true 


the user data (XML parser context) 1 if true 


the user data (XML parser context) 1 if true 


the user data (XML parser context)  the root element name  the external ID  the SYSTEM ID (e.g. filename or URL) 


the user data (XML parser context)  The entity name the xmlEntityPtr if found. 


the user data (XML parser context)  The entity name the xmlEntityPtr if found. 


the user data (XML parser context)  The public ID of the entity  The system ID of the entity the xmlParserInputPtr if inlined or NULL for DOM behaviour. 


the user data (XML parser context)  the entity name   the entity type   The public ID of the entity  The system ID of the entity  the entity value (without processing). 


the user data (XML parser context)  the name of the element  the attribute type   the type of default value  the attribute default value  the tree of enumerated value set 


the user data (XML parser context)  the element name   the element type   the element value tree 


the user data (XML parser context)  The name of the notation  The public ID of the entity  The system ID of the entity 


the user data (XML parser context)  The name of the entity  The public ID of the entity  The system ID of the entity  the name of the notation 


the user data (XML parser context) 


the user data (XML parser context) 


the user data (XML parser context)  The attribute name, including namespace prefix  The attribute value 


the user data (XML parser context)  The element name, including namespace prefix  An array of name/value attributes pairs, NULL terminated 


the user data (XML parser context)  The element name 


the user data (XML parser context)  The entity name 


the user data (XML parser context)  a xmlChar string  the number of xmlChar 


the user data (XML parser context)  a xmlChar string  the number of xmlChar 


the user data (XML parser context)  the target name  the PI data's 


the user data (XML parser context)  the namespace associated URN  the namespace prefix 


the user data (XML parser context)  the namespace prefix 


the user data (XML parser context) the xmlNsPtr or NULL if none 


the user data (XML parser context)  the namespace to check against 1 if true 0 otherwise 


the user data (XML parser context)  the namespace associated URN  the namespace prefix 


the user data (XML parser context)  the comment content 


the user data (XML parser context)  The pcdata content  the block length 




Name

Synopsis

Description

Details


xmlChar

typedef unsigned char xmlChar;


#define CHAR xmlChar
#define CHAR

#define BAD_CAST (xmlChar *)
#define BAD_CAST


xmlNotationPtr

typedef xmlNotation *xmlNotationPtr;





xmlEnumerationPtr

typedef xmlEnumeration *xmlEnumerationPtr;



xmlAttributePtr

typedef xmlAttribute *xmlAttributePtr;





xmlElementContentPtr

typedef xmlElementContent *xmlElementContentPtr;




xmlElementPtr

typedef xmlElement *xmlElementPtr;




xmlNsPtr

typedef xmlNs *xmlNsPtr;



xmlDtdPtr

typedef xmlDtd *xmlDtdPtr;



xmlAttrPtr

typedef xmlAttr *xmlAttrPtr;



xmlIDPtr

typedef xmlID *xmlIDPtr;



xmlRefPtr

typedef xmlRef *xmlRefPtr;




xmlBufferPtr

typedef xmlBuffer *xmlBufferPtr;



xmlNodePtr

typedef xmlNode *xmlNodePtr;



xmlDocPtr

typedef xmlDoc *xmlDocPtr;


#define xmlChildrenNode children
#define xmlChildrenNode

#define xmlRootNode children
#define xmlRootNode






the new structure. 


initial size of buffer the new structure. 


the buffer to free 


the file output  the buffer to dump the number of xmlChar written 


the buffer to dump  the xmlChar string  the number of xmlChar to add 


the buffer  the xmlChar string  the number of xmlChar to add 


the buffer to dump  the xmlChar string 


the buffer to dump  the C char string 


the buffer to dump  the number of xmlChar to remove the number of xmlChar removed, or -1 in case of failure. 


the buffer  the minimum free sie to allocate the new available space or -1 in case of error 


the buffer 


the buffer to resize the internal content 



the buffer to free  allocation scheme to use 


the buffer  the length of data in the internal content 


the document pointer  the DTD name  the external ID  the system ID a pointer to the new DTD structure 


the document pointer  the DTD name  the external ID  the system ID a pointer to the new DTD structure 


the document pointer a pointer to the DTD structure or NULL if not found 


the DTD structure to free up 


the document carrying the namespace  the URI associated  the prefix for the namespace NULL this functionnality had been removed 


the element carrying the namespace  the URI associated  the prefix for the namespace returns a new namespace pointer or NULL 


the namespace pointer 


xmlChar string giving the version of XML "1.0" a new document 


pointer to the document -@:  


the document  the name of the attribute  the value of the attribute a pointer to the attribute 


the holding node  the name of the attribute  the value of the attribute a pointer to the attribute 


the holding node  the namespace  the name of the attribute  the value of the attribute a pointer to the attribute 


the first property in the list 


an attribute 


the element where the attribute will be grafted  the attribute  a new xmlAttrPtr, or NULL in case of error. 


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


the dtd  a new xmlDtdPtr, or NULL in case of error. 


the document  if 1 do a recursive copy.  a new xmlDocPtr, or NULL in case of error. 


the document  namespace if any  the node name  the XML text content if any a pointer to the new node object. 


the document  namespace if any  the node name  the text content if any a pointer to the new node object. 


namespace if any  the node name a pointer to the new node object. 


the parent node  a namespace if any  the name of the child  the XML content of the child if any. a pointer to the new node object. 


the parent node  a namespace if any  the name of the child  the text content of the child if any. a pointer to the new node object. 


the document  the text content a pointer to the new node object. 


the text content a pointer to the new node object. 


the processing instruction name  the PI content a pointer to the new node object. 


the document  the text content  the text len. a pointer to the new node object. 


the text content  the text len. a pointer to the new node object. 


the document  the comment content a pointer to the new node object. 


the comment content a pointer to the new node object. 


the document  the CData block content content  the length of the block a pointer to the new node object. 


the document  the char ref string, starting with # or "&# ... ;" a pointer to the new node object. 


the document  the reference name, or the reference string with & and ; a pointer to the new node object. 


the node  if 1 do a recursive copy.  a new xmlNodePtr, or NULL in case of error. 


the first node in the list.  a new xmlNodePtr, or NULL in case of error. 


the document owning the fragment a pointer to the new node object. 


the document the xmlNodePtr for the root or NULL 


the parent node the last child or NULL if none. 


the node 1 yes, 0 no 


the node 1 yes, 0 no 


the document  the new document root element the old root element if any was found 


the node being changed  the new tag name 


the parent node  the child node the child or NULL in case of error. 


the parent node  the first node in the list the last child or NULL in case of error. 


the old node  the node the old node 


the child node  the new node the new element or NULL in case of error. 


the child node  the new node the new element or NULL in case of error. 


the child node  the new node the new element or NULL in case of error. 


the node 


the first text node  the second text node being merged the first text node augmented 


the node  the content  content lenght 


the first node in the list 


the node 


the document  the current node  the namespace string the namespace pointer or NULL. 


the document  the current node  the namespace value the namespace pointer or NULL. 


the document  the current node an NULL terminated array of all the xmlNsPtr found -that need to be freed by the caller or NULL if no -namespace if defined 


a node in the document  a namespace pointer 


the namespace  a new xmlNsPtr, or NULL in case of error. 


the first namespace  a new xmlNsPtr, or NULL in case of error. 


the node  the attribute name  the attribute value the attribute pointer. 


the node  the attribute name the attribute value or NULL if not found. -It's up to the caller to free the memory. 


the node  the attribute name the attribute or the attribute declaration or NULL if -neither was found. 


the node  the attribute name  the URI of the namespace the attribute value or NULL if not found. -It's up to the caller to free the memory. 


the document  the value of the attribute a pointer to the first child 


the document  the value of the text  the length of the string value a pointer to the first child 


the document  a Node list  should we replace entity contents or show their external form a pointer to the string copy, the calller must free it. 


the document  a Node list  should we replace entity contents or show their external form a pointer to the string copy, the calller must free it. 


the node being modified  the new value of the content 


the node being modified  the new value of the content  the size of content 


the node being modified  extra content 


the node being modified  extra content  the size of content 


the node being read a new xmlChar * or NULL if no content is available. -It's up to the caller to free the memory. 


the node being checked a pointer to the lang value, or NULL if not found -It's up to the caller to free the memory. 


the node being changed  the langage description 


the node being checked -1 if xml:space is not inheried, 0 if "default", 1 if "preserve" 


the document the node pertains to  the node being checked a pointer to the base URL, or NULL if not found -It's up to the caller to free the memory. 


0 if success and -1 in case of error. 



the XML buffer  the string to add 


the XML buffer output  the string to add 


the XML buffer output  the string to add 


the document  a node defining the subtree to reconciliate the number of namespace declarations created or -1 in case of error. 


the document  OUT: the memory pointer  OUT: the memory lenght 


the FILE*  the document  the number of byte written or -1 in case of failure. 


the FILE * for the output  the document  the current node 


the filename (or URL)  the document  the number of byte written or -1 in case of failure. 


the XML buffer output  the document  the current node  the imbrication level for indenting  is formatting allowed 


the filename (or URL)  the document  the name of an encoding (or NULL)  the number of byte written or -1 in case of failure. 


the document 0 (uncompressed) to 9 (max compression) 


the document  the compression ratio 


0 (uncompressed) to 9 (max compression) 


the compression ratio 

Name

Synopsis

Description

Details




xmlValidCtxtPtr

typedef xmlValidCtxt *xmlValidCtxtPtr;


#define XML_MIN_NOTATION_TABLE	32
#define XML_MIN_NOTATION_TABLE


xmlNotationTablePtr

typedef xmlNotationTable *xmlNotationTablePtr;


#define XML_MIN_ELEMENT_TABLE	32
#define XML_MIN_ELEMENT_TABLE


xmlElementTablePtr

typedef xmlElementTable *xmlElementTablePtr;


#define XML_MIN_ATTRIBUTE_TABLE	32
#define XML_MIN_ATTRIBUTE_TABLE


xmlAttributeTablePtr

typedef xmlAttributeTable *xmlAttributeTablePtr;


#define XML_MIN_ID_TABLE	32
#define XML_MIN_ID_TABLE


xmlIDTablePtr

typedef xmlIDTable *xmlIDTablePtr;


#define XML_MIN_REF_TABLE	32
#define XML_MIN_REF_TABLE


xmlRefTablePtr

typedef xmlRefTable *xmlRefTablePtr;


the validation context  pointer to the DTD  the entity name  the public identifier or NULL  the system identifier or NULL NULL if not, othervise the entity 


A notation table the new xmlNotationTablePtr or NULL in case of error. 


An notation table 


the XML buffer output  A notation declaration 


the XML buffer output  A notation table 


the subelement name or NULL  the type of element content decl NULL if not, othervise the new element content structure 


An element content pointer. the new xmlElementContentPtr or NULL in case of error. 


the element content tree to free 


an output buffer  An element table  1 if one must print the englobing parenthesis, 0 otherwise 


the validation context  pointer to the DTD  the entity name  the element type  the element content tree or NULL NULL if not, othervise the entity 


An element table the new xmlElementTablePtr or NULL in case of error. 


An element table 


the XML buffer output  An element table 


the XML buffer output  An element table 


the enumeration name or NULL the xmlEnumerationPtr just created or NULL in case -of error. 


the tree to free. 


the tree to copy. the xmlEnumerationPtr just created or NULL in case -of error. 


the validation context  pointer to the DTD  the element name  the attribute name  the attribute namespace prefix  the attribute type  the attribute default type  the attribute default value  if it's an enumeration, the associated list NULL if not new, othervise the attribute decl 


An attribute table the new xmlAttributeTablePtr or NULL in case of error. 


An attribute table 


the XML buffer output  An attribute table 


the XML buffer output  An attribute declaration 


the validation context  pointer to the document  the value name  the attribute holding the ID NULL if not, othervise the new xmlIDPtr 



An id table 


pointer to the document  the ID value NULL if not found, otherwise the xmlAttrPtr defining the ID 


the document  the element carrying the attribute  the attribute 0 or 1 depending on the lookup result 


the document  the attribute -1 if the lookup failed and 0 otherwise 


the validation context  pointer to the document  the value name  the attribute holding the Ref NULL if not, othervise the new xmlRefPtr 



An ref table 


the document  the element carrying the attribute  the attribute 0 or 1 depending on the lookup result 


the document  the attribute -1 if the lookup failed and 0 otherwise 


the validation context  a document instance 1 if valid or 0 otherwise 


the validation context  a document instance  an element definition 1 if valid or 0 otherwise 


the document  the parent  the attribute name  the attribute value a new normalized string if normalization is needed, NULL otherwise -the caller must free the returned value. 


the validation context  a document instance  an attribute definition 1 if valid or 0 otherwise 


an attribute type  an attribute value 1 if valid or 0 otherwise 


the validation context  a document instance  a notation definition 1 if valid or 0 otherwise 


the validation context  a document instance  a dtd instance 1 if valid or 0 otherwise 


the validation context  a document instance 1 if valid or 0 otherwise 


the validation context  a document instance 1 if valid or 0 otherwise 


the validation context  a document instance  an element instance 1 if valid or 0 otherwise 


the validation context  a document instance  an element instance 1 if valid or 0 otherwise 


the validation context  a document instance  an element instance  an attribute instance  the attribute value (without entities processing) 1 if valid or 0 otherwise 


the validation context  a document instance 1 if valid or 0 otherwise 


the validation context  the document  the notation name to check 1 if valid or 0 otherwise 


the document  the element name 0 if no, 1 if yes, and -1 if no element description is available 


a pointer to the DtD to search  the element name  the attribute name the xmlAttributePtr if found or NULL 


a pointer to the DtD to search  the notation name the xmlNotationPtr if found or NULL 


a pointer to the DtD to search  the element name the xmlElementPtr if found or NULL 


an element to insert after  an element to insert next  an array to store the list of child names  the size of the array the number of element in the list, or -1 in case of error. If -the function returns the value max the caller is invited to grow the -receiving array and retry. 


an element content tree  an array to store the list of child names  a pointer to the number of element in the list  the size of the array the number of element in the list, or -1 in case of error. 

Name

Synopsis

Description

Details


an XML parser context  the message to display/transmit  extra parameters for the message display 


an XML parser context  the message to display/transmit  extra parameters for the message display 


an XML parser context  the message to display/transmit  extra parameters for the message display 


an XML parser context  the message to display/transmit  extra parameters for the message display 


an xmlParserInputPtr input 


an xmlParserInputPtr input 

Name

Synopsis

xmlOutputBufferPtr; +void xmlRegisterDefaultInputCallbacks + (void); xmlParserInputBufferPtrxmlInputCloseCallback close); +void xmlRegisterDefaultOutputCallbacks + (void); xmlOutputBufferPtr

Description

Details






xmlParserInputBufferPtr

typedef xmlParserInputBuffer *xmlParserInputBufferPtr;







xmlOutputBufferPtr


xmlRegisterDefaultInputCallbacks ()

typedef xmlOutputBuffer *xmlOutputBufferPtr;
void xmlRegisterDefaultInputCallbacks + (void);

Registers the default compiled-in I/O handlers.


the charset encoding if known the new parser input or NULL 


a C string containing the URI or filename  the charset encoding if known the new parser input or NULL 


a FILE*   the charset encoding if known the new parser input or NULL 


a file descriptor number  the charset encoding if known the new parser input or NULL 


the memory input  the length of the memory block  the charset encoding if known the new parser input or NULL 


an I/O read function  an I/O close function  an I/O handler  the charset encoding if known the new parser input or NULL 


a buffered parser input  indicative value of the amount of chars to read the number of chars read and stored in the buffer, or -1 -in case of error. 


a buffered parser input  indicative value of the amount of chars to read the number of chars read and stored in the buffer, or -1 -in case of error. 


a buffered parser input  the size in bytes of the array.  an char array the number of chars read and stored in the buffer, or -1 -in case of error. 


a buffered parser input 



the xmlInputMatchCallback  the xmlInputOpenCallback  the xmlInputReadCallback  the xmlInputCloseCallback the registered handler number or -1 in case of error 


xmlRegisterDefaultOutputCallbacks ()

void        xmlRegisterDefaultOutputCallbacks
+                                            (void);

Registers the default compiled-in I/O handlers.


the encoding converter or NULL the new parser output or NULL 


a C string containing the URI or filename  the encoding converter or NULL  the compression ration (0 none, 9 max). the new output or NULL 


a FILE*   the encoding converter or NULL the new parser output or NULL 


a file descriptor number  the encoding converter or NULL the new parser output or NULL 


an I/O write function  an I/O close function  an I/O handler the new parser output or NULL 


a buffered parser output  the size in bytes of the array.  an char array the number of chars immediately written, or -1 -in case of error. 


a buffered parser output  a zero terminated C string the number of chars immediately written, or -1 -in case of error. 


a buffered output the number of byte written or -1 in case of error. 


a buffered output the number of byte written or -1 in case of error. 


the xmlOutputMatchCallback  the xmlOutputOpenCallback  the xmlOutputWriteCallback  the xmlOutputCloseCallback the registered handler number or -1 in case of error 


an output I/O buffer  the document  the encoding if any assuming the i/O layer handles the trancoding  the number of byte written or -1 in case of failure. 


the XML buffer output  the document  the current node  the imbrication level for indenting  is formatting allowed  an optional encoding string 

Name

Synopsis

Description

Details

#define DEBUG_MEMORY
#define DEBUG_MEMORY

#define MEM_LIST /* keep a list of all the allocated memory blocks */
#define MEM_LIST









the free() function to use  the malloc() function to use  the realloc() function to use  the strdup() function to use 0 on success 


the free() function in use  the malloc() function in use  the realloc() function in use  the strdup() function in use 0 on success 


0 on success 


an int representing the amount of memory allocated. 


a FILE descriptor used as the output file, if NULL, the result is -written to the file .memorylist 


a FILE descriptor used as the output file  number of entries to dump 



an int specifying the size in byte to allocate.  the file name or NULL  the line number 


the initial memory block pointer  an int specifying the size in byte to allocate.  the file name or NULL  the line number 


the file name or NULL  the line number a pointer to the new string or NULL if allocation error occured. 

Name

Synopsis

xmlXPathParserContextPtr; +enum xmlXPathError; struct xmlNodeSetxmlXPathParserContextPtr ctxt, int nargs); +#define CHECK_ERROR +#define CHECK_ERROR0 +#define XP_ERROR (X) +#define XP_ERROR0 (X) +#define CHECK_TYPE (typeval) +xmlXPathObjectPtr valuePop (xmlXPathParserContextPtr ctxt); +int valuePush (xmlXPathParserContextPtr ctxt, + xmlXPathObjectPtr value); +xmlXPathObjectPtr xmlXPathNewString (const xmlChar *val); +xmlXPathObjectPtr xmlXPathNewNodeSet (xmlNodePtr val); +void xmlXPathNodeSetAdd (xmlNodeSetPtr cur, + xmlNodePtr val); +void xmlXPathIdFunction (xmlXPathParserContextPtr ctxt, + int nargs); +void xmlXPathRoot (xmlXPathParserContextPtr ctxt); +void xmlXPathEvalExpr (xmlXPathParserContextPtr ctxt); +void xmlXPathInit (void); xmlXPathContextPtrxmlXPathContextPtr ctxt); +xmlXPathObjectPtr xmlXPathEvalXPtrExpr (const xmlChar *str, + xmlXPathContextPtr ctxt); void xmlXPathFreeObject

Description

Details

struct xmlXPathContext { xmlDocPtr doc; /* The current document */ xmlNodePtr node; /* The current node */ - xmlNodeSetPtr nodelist; /* The current node list */ int nb_variables; /* number of defined variables */ int max_variables; /* max number of variables */ @@ -389,6 +504,11 @@ CLASS="PROGRAMLISTING" /* extra variables */ int contextSize; /* the context size */ int proximityPosition; /* the proximity position */ + + /* extra stuff for XPointer */ + int xptr; /* it this an XPointer context */ + xmlNodePtr here; /* for here() */ + xmlNodePtr origin; /* for origin() */ };

xmlXPathContextPtr

typedef xmlXPathContext *xmlXPathContextPtr;



xmlXPathParserContextPtr


enum xmlXPathError

typedef xmlXPathParserContext *xmlXPathParserContextPtr;
typedef enum { + XPATH_EXPRESSION_OK = 0, + XPATH_NUMBER_ERROR, + XPATH_UNFINISHED_LITERAL_ERROR, + XPATH_START_LITERAL_ERROR, + XPATH_VARIABLE_REF_ERROR, + XPATH_UNDEF_VARIABLE_ERROR, + XPATH_INVALID_PREDICATE_ERROR, + XPATH_EXPR_ERROR, + XPATH_UNCLOSED_ERROR, + XPATH_UNKNOWN_FUNC_ERROR, + XPATH_INVALID_OPERAND, + XPATH_INVALID_TYPE, + XPATH_INVALID_ARITY, + XPATH_INVALID_CTXT_SIZE, + XPATH_INVALID_CTXT_POSITION +} xmlXPathError;

Create a new xmlNodeSetPtr of type double and of value val



xmlNodeSetPtr

typedef xmlNodeSet *xmlNodeSetPtr;




xmlXPathObjectPtr

typedef xmlXPathObject *xmlXPathObjectPtr;




xmlXPathTypePtr

typedef xmlXPathType *xmlXPathTypePtr;



xmlXPathVariablePtr

typedef xmlXPathVariable *xmlXPathVariablePtr;




xmlXPathFuncPtr

typedef xmlXPathFunct *xmlXPathFuncPtr;




xmlXPathAxisPtr

typedef xmlXPathAxis *xmlXPathAxisPtr;



CHECK_ERROR

#define     CHECK_ERROR


CHECK_ERROR0

#define     CHECK_ERROR0


XP_ERROR()

#define     XP_ERROR(X)

X : 


XP_ERROR0()

#define     XP_ERROR0(X)

X : 


CHECK_TYPE()

#define     CHECK_TYPE(typeval)

typeval : 


valuePop ()

xmlXPathObjectPtr valuePop                  (xmlXPathParserContextPtr ctxt);

ctxt : 
Returns : 


valuePush ()

int         valuePush                       (xmlXPathParserContextPtr ctxt,
+                                             xmlXPathObjectPtr value);

ctxt : 
value : 
Returns : 


xmlXPathNewString ()

xmlXPathObjectPtr xmlXPathNewString         (const xmlChar *val);

Create a new xmlXPathObjectPtr of type string and of value val

val : 
Returns : 


xmlXPathNewNodeSet ()

xmlXPathObjectPtr xmlXPathNewNodeSet        (xmlNodePtr val);

Create a new xmlXPathObjectPtr of type NodeSet and initialize +it with the single Node val

val : 
Returns : 


xmlXPathNodeSetAdd ()

void        xmlXPathNodeSetAdd              (xmlNodeSetPtr cur,
+                                             xmlNodePtr val);

add a new xmlNodePtr ot an existing NodeSet

cur : 
val : 


xmlXPathIdFunction ()

void        xmlXPathIdFunction              (xmlXPathParserContextPtr ctxt,
+                                             int nargs);

Implement the id() XPath function +The id function selects elements by their unique ID +(see [5.2.1 Unique IDs]). When the argument to id is of type node-set, +then the result is the union of the result of applying id to the +string value of each of the nodes in the argument node-set. When the +argument to id is of any other type, the argument is converted to a +string as if by a call to the string function; the string is split +into a whitespace-separated list of tokens (whitespace is any sequence +of characters matching the production S); the result is a node-set +containing the elements in the same document as the context node that +have a unique ID equal to any of the tokens in the list.

ctxt : 
nargs : 


xmlXPathRoot ()

void        xmlXPathRoot                    (xmlXPathParserContextPtr ctxt);

Initialize the context to the root of the document

ctxt : 


xmlXPathEvalExpr ()

void        xmlXPathEvalExpr                (xmlXPathParserContextPtr ctxt);

[14] Expr ::= OrExpr +[21] OrExpr ::= AndExpr +| OrExpr 'or' AndExpr

Parse and evaluate an expression, then push the result on the stack

ctxt : 


xmlXPathInit ()

void        xmlXPathInit                    (void);

Initialize the XPath environment


the XML document the xmlXPathContext just allocated. 


the context to free 


the XPath expression  the XPath context the xmlXPathObjectPtr resulting from the eveluation or NULL. -the caller has to free the object. 


xmlXPathEvalXPtrExpr ()

xmlXPathObjectPtr xmlXPathEvalXPtrExpr      (const xmlChar *str,
+                                             xmlXPathContextPtr ctxt);

Evaluate the location set corresponding to this expression.

str : 
ctxt : 
Returns : 


the object to free 


the XPath expression  the XPath context the xmlXPathObjectPtr resulting from the evaluation or NULL. -the caller has to free the object. 


an initial xmlNodePtr, or NULL the newly created object. 


an existing NodeSetList object 


the xmlNodeSetPtr to free 

+ @@ -487,9 +488,24 @@ + + + + + + + + + + + + + + + @@ -543,6 +559,7 @@ + @@ -555,6 +572,7 @@ + diff --git a/include/libxml/xpath.h b/include/libxml/xpath.h index 496acc08..7031c578 100644 --- a/include/libxml/xpath.h +++ b/include/libxml/xpath.h @@ -267,7 +267,18 @@ void xmlXPatherror (xmlXPathParserContextPtr ctxt, */ xmlXPathObjectPtr valuePop (xmlXPathParserContextPtr ctxt); int valuePush (xmlXPathParserContextPtr ctxt, - xmlXPathObjectPtr value); + xmlXPathObjectPtr value); + +xmlXPathObjectPtr xmlXPathNewString (const xmlChar *val); +xmlXPathObjectPtr xmlXPathNewNodeSet (xmlNodePtr val); +void xmlXPathNodeSetAdd (xmlNodeSetPtr cur, + xmlNodePtr val); + + +void xmlXPathIdFunction (xmlXPathParserContextPtr ctxt, + int nargs); +void xmlXPathRoot (xmlXPathParserContextPtr ctxt); +void xmlXPathEvalExpr (xmlXPathParserContextPtr ctxt); /************************************************************************ * * diff --git a/parser.c b/parser.c index ff0c4f7a..1d68e5f4 100644 --- a/parser.c +++ b/parser.c @@ -68,7 +68,7 @@ #include #include #include -#include "xml-error.h" +#include #define XML_PARSER_BIG_BUFFER_SIZE 1000 #define XML_PARSER_BUFFER_SIZE 100 diff --git a/parserInternals.c b/parserInternals.c index ec5c7eae..98e49cd4 100644 --- a/parserInternals.c +++ b/parserInternals.c @@ -45,7 +45,7 @@ #include #include #include -#include "xml-error.h" +#include /************************************************************************ diff --git a/testSAX.c b/testSAX.c index 7f3870ab..5d5a1896 100644 --- a/testSAX.c +++ b/testSAX.c @@ -255,7 +255,11 @@ attributeDeclDebug(void *ctx, const xmlChar *elem, const xmlChar *name, int type, int def, const xmlChar *defaultValue, xmlEnumerationPtr tree) { - fprintf(stdout, "SAX.attributeDecl(%s, %s, %d, %d, %s, ...)\n", + if (defaultValue == NULL) + fprintf(stdout, "SAX.attributeDecl(%s, %s, %d, %d, NULL, ...)\n", + elem, name, type, def); + else + fprintf(stdout, "SAX.attributeDecl(%s, %s, %d, %d, %s, ...)\n", elem, name, type, def, defaultValue); } diff --git a/testXPath.c b/testXPath.c index 4e0fc6cf..dc0a3471 100644 --- a/testXPath.c +++ b/testXPath.c @@ -84,28 +84,40 @@ static xmlChar buffer[] = \n\ "; -void xmlXPAthDebugDumpNode(FILE *output, xmlNodePtr cur) { +void xmlXPAthDebugDumpNode(FILE *output, xmlNodePtr cur, int depth) { + int i; + char shift[100]; + + for (i = 0;((i < depth) && (i < 25));i++) + shift[2 * i] = shift[2 * i + 1] = ' '; + shift[2 * i] = shift[2 * i + 1] = 0; if (cur == NULL) { + fprintf(output, shift); fprintf(output, "Node is NULL !\n"); return; } - if (cur == NULL) - fprintf(output, " NULL\n"); - else if ((cur->type == XML_DOCUMENT_NODE) || - (cur->type == XML_HTML_DOCUMENT_NODE)) + if ((cur->type == XML_DOCUMENT_NODE) || + (cur->type == XML_HTML_DOCUMENT_NODE)) { + fprintf(output, shift); fprintf(output, " /\n"); - else if (cur->type == XML_ATTRIBUTE_NODE) - xmlDebugDumpAttr(output, (xmlAttrPtr)cur, 2); + } else if (cur->type == XML_ATTRIBUTE_NODE) + xmlDebugDumpAttr(output, (xmlAttrPtr)cur, depth); else - xmlDebugDumpOneNode(output, cur, 2); + xmlDebugDumpOneNode(output, cur, depth); } -void xmlXPAthDebugDumpNodeSet(FILE *output, xmlNodeSetPtr cur) { +void xmlXPAthDebugDumpNodeSet(FILE *output, xmlNodeSetPtr cur, int depth) { int i; + char shift[100]; + + for (i = 0;((i < depth) && (i < 25));i++) + shift[2 * i] = shift[2 * i + 1] = ' '; + shift[2 * i] = shift[2 * i + 1] = 0; if (cur == NULL) { + fprintf(output, shift); fprintf(output, "NodeSet is NULL !\n"); return; @@ -113,31 +125,47 @@ void xmlXPAthDebugDumpNodeSet(FILE *output, xmlNodeSetPtr cur) { fprintf(output, "Set contains %d nodes:\n", cur->nodeNr); for (i = 0;i < cur->nodeNr;i++) { + fprintf(output, shift); fprintf(output, "%d", i + 1); - xmlXPAthDebugDumpNode(output, cur->nodeTab[i]); + xmlXPAthDebugDumpNode(output, cur->nodeTab[i], depth + 1); } } #if defined(LIBXML_XPTR_ENABLED) -void xmlXPAthDebugDumpObject(FILE *output, xmlXPathObjectPtr cur); -void xmlXPAthDebugDumpLocationSet(FILE *output, xmlLocationSetPtr cur) { +void xmlXPAthDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth); +void xmlXPAthDebugDumpLocationSet(FILE *output, xmlLocationSetPtr cur, int depth) { int i; + char shift[100]; + + for (i = 0;((i < depth) && (i < 25));i++) + shift[2 * i] = shift[2 * i + 1] = ' '; + shift[2 * i] = shift[2 * i + 1] = 0; if (cur == NULL) { + fprintf(output, shift); fprintf(output, "LocationSet is NULL !\n"); return; } - fprintf(output, "Set contains %d ranges:\n", cur->locNr); for (i = 0;i < cur->locNr;i++) { - fprintf(output, "%d", i + 1); - xmlXPAthDebugDumpObject(output, cur->locTab[i]); + fprintf(output, shift); + fprintf(output, "%d :\n", i + 1); + xmlXPAthDebugDumpObject(output, cur->locTab[i], depth + 1); } } #endif -void xmlXPAthDebugDumpObject(FILE *output, xmlXPathObjectPtr cur) { +void xmlXPAthDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth) { + int i; + char shift[100]; + + for (i = 0;((i < depth) && (i < 25));i++) + shift[2 * i] = shift[2 * i + 1] = ' '; + shift[2 * i] = shift[2 * i + 1] = 0; + + fprintf(output, shift); + if (cur == NULL) { fprintf(output, "Object is empty (NULL)\n"); return; @@ -148,7 +176,7 @@ void xmlXPAthDebugDumpObject(FILE *output, xmlXPathObjectPtr cur) { break; case XPATH_NODESET: fprintf(output, "Object is a Node Set :\n"); - xmlXPAthDebugDumpNodeSet(output, cur->nodesetval); + xmlXPAthDebugDumpNodeSet(output, cur->nodesetval, depth); break; case XPATH_BOOLEAN: fprintf(output, "Object is a Boolean : "); @@ -165,28 +193,33 @@ void xmlXPAthDebugDumpObject(FILE *output, xmlXPathObjectPtr cur) { break; case XPATH_POINT: fprintf(output, "Object is a point : index %d in node", cur->index); - xmlXPAthDebugDumpNode(output, (xmlNodePtr) cur->user); + xmlXPAthDebugDumpNode(output, (xmlNodePtr) cur->user, depth + 1); fprintf(output, "\n"); break; case XPATH_RANGE: - fprintf(output, "Object is a range : from"); + fprintf(output, "Object is a range : from "); if (cur->index >= 0) fprintf(output, "index %d in ", cur->index); fprintf(output, "node"); - xmlXPAthDebugDumpNode(output, (xmlNodePtr) cur->user); - fprintf(output, " to "); + xmlXPAthDebugDumpNode(output, (xmlNodePtr) cur->user, depth + 1); + fprintf(output, shift); + fprintf(output, " to "); if (cur->index2 >= 0) fprintf(output, "index %d in ", cur->index2); fprintf(output, "node"); - xmlXPAthDebugDumpNode(output, (xmlNodePtr) cur->user2); + xmlXPAthDebugDumpNode(output, (xmlNodePtr) cur->user2, depth + 1); fprintf(output, "\n"); + break; case XPATH_LOCATIONSET: #if defined(LIBXML_XPTR_ENABLED) - fprintf(output, "Object is a location set containing :"); - xmlXPAthDebugDumpLocationSet(output, (xmlLocationSetPtr) cur->user); + fprintf(output, "Object is a Location Set:\n"); + xmlXPAthDebugDumpLocationSet(output, + (xmlLocationSetPtr) cur->user, depth); #endif + break; case XPATH_USERS: fprintf(output, "Object is user defined\n"); + break; } } @@ -208,7 +241,7 @@ void testXPath(const char *str) { #if defined(LIBXML_XPTR_ENABLED) } #endif - xmlXPAthDebugDumpObject(stdout, res); + xmlXPAthDebugDumpObject(stdout, res, 0); xmlXPathFreeObject(res); xmlXPathFreeContext(ctxt); } @@ -216,15 +249,24 @@ void testXPath(const char *str) { void testXPathFile(const char *filename) { FILE *input; char expr[5000]; + int len; input = fopen(filename, "r"); if (input == NULL) { fprintf(stderr, "Cannot open %s for reading\n", filename); return; } - while (fscanf(input, "%s", expr) != EOF) { - printf("\n========================\nExpression: %s\n", expr) ; - testXPath(expr); + while (fgets(expr, 4500, input) != NULL) { + len = strlen(expr); + len--; + while ((len >= 0) && + ((expr[len] == '\n') || (expr[len] == '\t') || + (expr[len] == '\r') || (expr[len] == ' '))) len--; + expr[len + 1] = 0; + if (len >= 0) { + printf("\n========================\nExpression: %s\n", expr) ; + testXPath(expr); + } } fclose(input); diff --git a/win32/README.MSDev b/win32/README.MSDev new file mode 100644 index 00000000..47b8dd8c --- /dev/null +++ b/win32/README.MSDev @@ -0,0 +1,63 @@ +The configuration stuff (i.e. what should be enabled/disabled) is in xmlversion.h +I only tested it compiled fine with the current settings +(that is nearly everything disabled, I didn't need many features) + +---------------------------- + +How did I get everything in place so the MSDev project works from the original archive? + +from the cygwin prompt (http://sources.redhat.com/cygwin) : +$ ./configure --disable-corba --without-ftp --without-http --without-html --wit +hout-xpath --without-iconv --without-debug + +created a libxml directory and copied the following headers in: +HTMLparser.h entities.h tree.h xmlIO.h +HTMLtree.h nanoftp.h uri.h xmlmemory.h +SAX.h nanohttp.h valid.h xmlversion.h +debugXML.h parser.h xlink.h xpath.h +encoding.h parserInternals.h xml-error.h + +modified win32config.h to comment out +#define LIBXML_VERSION 20204 +#define LIBXML_VERSION_STRING "2.2.4" +(is already in xmlversion.h) + +built the project file for the static library + +---------------------------- + +diff after doing the changes and cleaning up the generated stuff: + +Only in libxml2-2.2.4: MSDev +Common subdirectories: libxml2-2.2.4/SAXresult and libxml2-2.2.4-reference/SAXresult +Common subdirectories: libxml2-2.2.4/doc and libxml2-2.2.4-reference/doc +Common subdirectories: libxml2-2.2.4/example and libxml2-2.2.4-reference/example +Only in libxml2-2.2.4: libxml +Common subdirectories: libxml2-2.2.4/result and libxml2-2.2.4-reference/result +Common subdirectories: libxml2-2.2.4/test and libxml2-2.2.4-reference/test +Only in libxml2-2.2.4: win32config.h +diff libxml2-2.2.4/xmlversion.h libxml2-2.2.4-reference/xmlversion.h +38c38 +< #if 0 +--- +> #if 1 +47c47 +< #if 0 +--- +> #if 1 +56c56 +< #if 0 +--- +> #if 1 +74c74 +< #if 0 +--- +> #if 1 +83c83 +< #if 0 +--- +> #if 1 +92c92 +< #if 0 +--- +> #if 1 diff --git a/win32/libxml2/libxml2.dsp b/win32/libxml2/libxml2.dsp new file mode 100644 index 00000000..286b250a --- /dev/null +++ b/win32/libxml2/libxml2.dsp @@ -0,0 +1,166 @@ +# Microsoft Developer Studio Project File - Name="libxml2" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=libxml2 - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "libxml2.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "libxml2.mak" CFG="libxml2 - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "libxml2 - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "libxml2 - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "libxml2 - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\.." /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "libxml2 - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +F90=df.exe +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\.." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ENDIF + +# Begin Target + +# Name "libxml2 - Win32 Release" +# Name "libxml2 - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\debugXML.c +# End Source File +# Begin Source File + +SOURCE=..\..\encoding.c +# End Source File +# Begin Source File + +SOURCE=..\..\entities.c +# End Source File +# Begin Source File + +SOURCE=..\..\error.c +# End Source File +# Begin Source File + +SOURCE=..\..\HTMLparser.c +# End Source File +# Begin Source File + +SOURCE=..\..\HTMLtree.c +# End Source File +# Begin Source File + +SOURCE=..\..\nanoftp.c +# End Source File +# Begin Source File + +SOURCE=..\..\nanohttp.c +# End Source File +# Begin Source File + +SOURCE=..\..\parser.c +# End Source File +# Begin Source File + +SOURCE=..\..\parserInternals.c +# End Source File +# Begin Source File + +SOURCE=..\..\SAX.c +# End Source File +# Begin Source File + +SOURCE=..\..\tree.c +# End Source File +# Begin Source File + +SOURCE=..\..\uri.c +# End Source File +# Begin Source File + +SOURCE=..\..\valid.c +# End Source File +# Begin Source File + +SOURCE=..\..\xlink.c +# End Source File +# Begin Source File + +SOURCE=..\..\xmlIO.c +# End Source File +# Begin Source File + +SOURCE=..\..\xmlmemory.c +# End Source File +# Begin Source File + +SOURCE=..\..\xpath.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# End Group +# End Target +# End Project diff --git a/xpath.c b/xpath.c index 358e22ee..a67a2f6d 100644 --- a/xpath.c +++ b/xpath.c @@ -161,14 +161,6 @@ xmlXPathInit(void) { FILE *xmlXPathDebug = NULL; -#define TODO \ - fprintf(xmlXPathDebug, "Unimplemented block at %s:%d\n", \ - __FILE__, __LINE__); - -#define STRANGE \ - fprintf(xmlXPathDebug, "Internal error at %s:%d\n", \ - __FILE__, __LINE__); - double xmlXPathStringEvalNumber(const xmlChar *str); void xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs); @@ -178,6 +170,14 @@ void xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs); * * ************************************************************************/ +#define TODO \ + fprintf(xmlXPathDebug, "Unimplemented block at %s:%d\n", \ + __FILE__, __LINE__); + +#define STRANGE \ + fprintf(xmlXPathDebug, "Internal error at %s:%d\n", \ + __FILE__, __LINE__); + /* * Generic function for accessing stacks in the Parser Context */ @@ -547,6 +547,97 @@ xmlXPathDebugNodeSet(FILE *output, xmlNodeSetPtr obj) { } #endif +/** + * xmlXPathNewNodeSet: + * @val: the NodePtr value + * + * Create a new xmlXPathObjectPtr of type NodeSet and initialize + * it with the single Node @val + * + * Returns the newly created object. + */ +xmlXPathObjectPtr +xmlXPathNewNodeSet(xmlNodePtr val) { + xmlXPathObjectPtr ret; + + ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject)); + if (ret == NULL) { + fprintf(xmlXPathDebug, "xmlXPathNewNodeSet: out of memory\n"); + return(NULL); + } + memset(ret, 0 , (size_t) sizeof(xmlXPathObject)); + ret->type = XPATH_NODESET; + ret->nodesetval = xmlXPathNodeSetCreate(val); + return(ret); +} + +/** + * xmlXPathNewNodeSetList: + * @val: an existing NodeSet + * + * Create a new xmlXPathObjectPtr of type NodeSet and initialize + * it with the Nodeset @val + * + * Returns the newly created object. + */ +xmlXPathObjectPtr +xmlXPathNewNodeSetList(xmlNodeSetPtr val) { + xmlXPathObjectPtr ret; + int i; + + if (val == NULL) + ret = NULL; + else if (val->nodeTab == NULL) + ret = xmlXPathNewNodeSet(NULL); + else + { + ret = xmlXPathNewNodeSet(val->nodeTab[0]); + for (i = 1; i < val->nodeNr; ++i) + xmlXPathNodeSetAdd(ret->nodesetval, val->nodeTab[i]); + } + + return(ret); +} + +/** + * xmlXPathWrapNodeSet: + * @val: the NodePtr value + * + * Wrap the Nodeset @val in a new xmlXPathObjectPtr + * + * Returns the newly created object. + */ +xmlXPathObjectPtr +xmlXPathWrapNodeSet(xmlNodeSetPtr val) { + xmlXPathObjectPtr ret; + + ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject)); + if (ret == NULL) { + fprintf(xmlXPathDebug, "xmlXPathWrapNodeSet: out of memory\n"); + return(NULL); + } + memset(ret, 0 , (size_t) sizeof(xmlXPathObject)); + ret->type = XPATH_NODESET; + ret->nodesetval = val; + return(ret); +} + +/** + * xmlXPathFreeNodeSetList: + * @obj: an existing NodeSetList object + * + * Free up the xmlXPathObjectPtr @obj but don't deallocate the objects in + * the list contrary to xmlXPathFreeObject(). + */ +void +xmlXPathFreeNodeSetList(xmlXPathObjectPtr obj) { + if (obj == NULL) return; +#ifdef DEBUG + memset(obj, 0xB , (size_t) sizeof(xmlXPathObject)); +#endif + xmlFree(obj); +} + /************************************************************************ * * * Routines to handle Variable * @@ -674,600 +765,6 @@ xmlXPathNewCString(const char *val) { return(ret); } -/** - * xmlXPathNewNodeSet: - * @val: the NodePtr value - * - * Create a new xmlXPathObjectPtr of type NodeSet and initialize - * it with the single Node @val - * - * Returns the newly created object. - */ -xmlXPathObjectPtr -xmlXPathNewNodeSet(xmlNodePtr val) { - xmlXPathObjectPtr ret; - - ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject)); - if (ret == NULL) { - fprintf(xmlXPathDebug, "xmlXPathNewNodeSet: out of memory\n"); - return(NULL); - } - memset(ret, 0 , (size_t) sizeof(xmlXPathObject)); - ret->type = XPATH_NODESET; - ret->nodesetval = xmlXPathNodeSetCreate(val); - return(ret); -} - -/** - * xmlXPathNewNodeSetList: - * @val: an existing NodeSet - * - * Create a new xmlXPathObjectPtr of type NodeSet and initialize - * it with the Nodeset @val - * - * Returns the newly created object. - */ -xmlXPathObjectPtr -xmlXPathNewNodeSetList(xmlNodeSetPtr val) { - xmlXPathObjectPtr ret; - int i; - - if (val == NULL) - ret = NULL; - else if (val->nodeTab == NULL) - ret = xmlXPathNewNodeSet(NULL); - else - { - ret = xmlXPathNewNodeSet(val->nodeTab[0]); - for (i = 1; i < val->nodeNr; ++i) - xmlXPathNodeSetAdd(ret->nodesetval, val->nodeTab[i]); - } - - return(ret); -} - -/** - * xmlXPathWrapNodeSet: - * @val: the NodePtr value - * - * Wrap the Nodeset @val in a new xmlXPathObjectPtr - * - * Returns the newly created object. - */ -xmlXPathObjectPtr -xmlXPathWrapNodeSet(xmlNodeSetPtr val) { - xmlXPathObjectPtr ret; - - ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject)); - if (ret == NULL) { - fprintf(xmlXPathDebug, "xmlXPathWrapNodeSet: out of memory\n"); - return(NULL); - } - memset(ret, 0 , (size_t) sizeof(xmlXPathObject)); - ret->type = XPATH_NODESET; - ret->nodesetval = val; - return(ret); -} - -/** - * xmlXPathFreeNodeSetList: - * @obj: an existing NodeSetList object - * - * Free up the xmlXPathObjectPtr @obj but don't deallocate the objects in - * the list contrary to xmlXPathFreeObject(). - */ -void -xmlXPathFreeNodeSetList(xmlXPathObjectPtr obj) { - if (obj == NULL) return; -#ifdef DEBUG - memset(obj, 0xB , (size_t) sizeof(xmlXPathObject)); -#endif - xmlFree(obj); -} - -#ifdef LIBXML_XPTR_ENABLED -/** - * xmlXPathNewPoint: - * @node: the xmlNodePtr - * @index: the index within the node - * - * Create a new xmlXPathObjectPtr of type point - * - * Returns the newly created object. - */ -xmlXPathObjectPtr -xmlXPathNewPoint(xmlNodePtr node, int index) { - xmlXPathObjectPtr ret; - - if (node == NULL) - return(NULL); - if (index < 0) - return(NULL); - - ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject)); - if (ret == NULL) { - fprintf(xmlXPathDebug, "xmlXPathNewPoint: out of memory\n"); - return(NULL); - } - memset(ret, 0 , (size_t) sizeof(xmlXPathObject)); - ret->type = XPATH_POINT; - ret->user = (void *) node; - ret->index = index; - return(ret); -} - -/** - * xmlXPathNewRangePoints: - * @start: the starting point - * @end: the ending point - * - * Create a new xmlXPathObjectPtr of type range using 2 Points - * - * Returns the newly created object. - */ -xmlXPathObjectPtr -xmlXPathNewRangePoints(xmlXPathObjectPtr start, xmlXPathObjectPtr end) { - xmlXPathObjectPtr ret; - - if (start == NULL) - return(NULL); - if (end == NULL) - return(NULL); - if (start->type != XPATH_POINT) - return(NULL); - if (end->type != XPATH_POINT) - return(NULL); - - ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject)); - if (ret == NULL) { - fprintf(xmlXPathDebug, "xmlXPathNewRangePoints: out of memory\n"); - return(NULL); - } - memset(ret, 0 , (size_t) sizeof(xmlXPathObject)); - ret->type = XPATH_RANGE; - ret->user = start->user; - ret->index = start->index; - ret->user2 = end->user; - ret->index2 = end->index; - return(ret); -} - -/** - * xmlXPathNewRangePointNode: - * @start: the starting point - * @end: the ending node - * - * Create a new xmlXPathObjectPtr of type range from a point to a node - * - * Returns the newly created object. - */ -xmlXPathObjectPtr -xmlXPathNewRangePointNode(xmlXPathObjectPtr start, xmlNodePtr end) { - xmlXPathObjectPtr ret; - - if (start == NULL) - return(NULL); - if (end == NULL) - return(NULL); - if (start->type != XPATH_POINT) - return(NULL); - - ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject)); - if (ret == NULL) { - fprintf(xmlXPathDebug, "xmlXPathNewRangePointNode: out of memory\n"); - return(NULL); - } - memset(ret, 0 , (size_t) sizeof(xmlXPathObject)); - ret->type = XPATH_RANGE; - ret->user = start->user; - ret->index = start->index; - ret->user2 = end; - ret->index2 = -1; - return(ret); -} - -/** - * xmlXPathNewRangeNodePoint: - * @start: the starting node - * @end: the ending point - * - * Create a new xmlXPathObjectPtr of type range from a node to a point - * - * Returns the newly created object. - */ -xmlXPathObjectPtr -xmlXPathNewRangeNodePoint(xmlNodePtr start, xmlXPathObjectPtr end) { - xmlXPathObjectPtr ret; - - if (start == NULL) - return(NULL); - if (end == NULL) - return(NULL); - if (start->type != XPATH_POINT) - return(NULL); - if (end->type != XPATH_POINT) - return(NULL); - - ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject)); - if (ret == NULL) { - fprintf(xmlXPathDebug, "xmlXPathNewRangeNodePoint: out of memory\n"); - return(NULL); - } - memset(ret, 0 , (size_t) sizeof(xmlXPathObject)); - ret->type = XPATH_RANGE; - ret->user = start; - ret->index = -1; - ret->user2 = end->user; - ret->index2 = end->index; - return(ret); -} - -/** - * xmlXPathNewRangeNodes: - * @start: the starting node - * @end: the ending node - * - * Create a new xmlXPathObjectPtr of type range using 2 nodes - * - * Returns the newly created object. - */ -xmlXPathObjectPtr -xmlXPathNewRangeNodes(xmlNodePtr start, xmlNodePtr end) { - xmlXPathObjectPtr ret; - - if (start == NULL) - return(NULL); - if (end == NULL) - return(NULL); - - ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject)); - if (ret == NULL) { - fprintf(xmlXPathDebug, "xmlXPathNewRangeNodes: out of memory\n"); - return(NULL); - } - memset(ret, 0 , (size_t) sizeof(xmlXPathObject)); - ret->type = XPATH_RANGE; - ret->user = start; - ret->index = -1; - ret->user2 = end; - ret->index2 = -1; - return(ret); -} - -/** - * xmlXPathNewRangeNodeObject: - * @start: the starting node - * @end: the ending object - * - * Create a new xmlXPathObjectPtr of type range from a not to an object - * - * Returns the newly created object. - */ -xmlXPathObjectPtr -xmlXPathNewRangeNodeObject(xmlNodePtr start, xmlXPathObjectPtr end) { - xmlXPathObjectPtr ret; - - if (start == NULL) - return(NULL); - if (end == NULL) - return(NULL); - switch (end->type) { - case XPATH_POINT: - break; - case XPATH_NODESET: - /* - * Empty set ... - */ - if (end->nodesetval->nodeNr <= 0) - return(NULL); - break; - default: - TODO - return(NULL); - } - - ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject)); - if (ret == NULL) { - fprintf(xmlXPathDebug, "xmlXPathNewRangeNodeObject: out of memory\n"); - return(NULL); - } - memset(ret, 0 , (size_t) sizeof(xmlXPathObject)); - ret->type = XPATH_RANGE; - ret->user = start; - ret->index = -1; - switch (end->type) { - case XPATH_POINT: - ret->user2 = end->user; - ret->index2 = end->index; - case XPATH_NODESET: { - ret->user2 = end->nodesetval->nodeTab[end->nodesetval->nodeNr - -1]; - ret->index2 = -1; - break; - } - default: - STRANGE - return(NULL); - } - ret->user2 = end; - ret->index2 = -1; - return(ret); -} - -#define XML_RANGESET_DEFAULT 10 - -/** - * xmlXPathLocationSetCreate: - * @val: an initial xmlXPathObjectPtr, or NULL - * - * Create a new xmlLocationSetPtr of type double and of value @val - * - * Returns the newly created object. - */ -xmlLocationSetPtr -xmlXPathLocationSetCreate(xmlXPathObjectPtr val) { - xmlLocationSetPtr ret; - - ret = (xmlLocationSetPtr) xmlMalloc(sizeof(xmlLocationSet)); - if (ret == NULL) { - fprintf(xmlXPathDebug, "xmlXPathNewLocationSet: out of memory\n"); - return(NULL); - } - memset(ret, 0 , (size_t) sizeof(xmlLocationSet)); - if (val != NULL) { - ret->locTab = (xmlXPathObjectPtr *) xmlMalloc(XML_RANGESET_DEFAULT * - sizeof(xmlXPathObjectPtr)); - if (ret->locTab == NULL) { - fprintf(xmlXPathDebug, "xmlXPathNewLocationSet: out of memory\n"); - return(NULL); - } - memset(ret->locTab, 0 , - XML_RANGESET_DEFAULT * (size_t) sizeof(xmlXPathObjectPtr)); - ret->locMax = XML_RANGESET_DEFAULT; - ret->locTab[ret->locNr++] = val; - } - return(ret); -} - -/** - * xmlXPathLocationSetAdd: - * @cur: the initial range set - * @val: a new xmlXPathObjectPtr - * - * add a new xmlXPathObjectPtr ot an existing LocationSet - */ -void -xmlXPathLocationSetAdd(xmlLocationSetPtr cur, xmlXPathObjectPtr val) { - int i; - - if (val == NULL) return; - - /* - * check against doublons - */ - for (i = 0;i < cur->locNr;i++) - if (cur->locTab[i] == val) return; - - /* - * grow the locTab if needed - */ - if (cur->locMax == 0) { - cur->locTab = (xmlXPathObjectPtr *) xmlMalloc(XML_RANGESET_DEFAULT * - sizeof(xmlXPathObjectPtr)); - if (cur->locTab == NULL) { - fprintf(xmlXPathDebug, "xmlXPathLocationSetAdd: out of memory\n"); - return; - } - memset(cur->locTab, 0 , - XML_RANGESET_DEFAULT * (size_t) sizeof(xmlXPathObjectPtr)); - cur->locMax = XML_RANGESET_DEFAULT; - } else if (cur->locNr == cur->locMax) { - xmlXPathObjectPtr *temp; - - cur->locMax *= 2; - temp = (xmlXPathObjectPtr *) xmlRealloc(cur->locTab, cur->locMax * - sizeof(xmlXPathObjectPtr)); - if (temp == NULL) { - fprintf(xmlXPathDebug, "xmlXPathLocationSetAdd: out of memory\n"); - return; - } - cur->locTab = temp; - } - cur->locTab[cur->locNr++] = val; -} - -/** - * xmlXPathLocationSetMerge: - * @val1: the first LocationSet - * @val2: the second LocationSet - * - * Merges two rangesets, all ranges from @val2 are added to @val1 - * - * Returns val1 once extended or NULL in case of error. - */ -xmlLocationSetPtr -xmlXPathLocationSetMerge(xmlLocationSetPtr val1, xmlLocationSetPtr val2) { - int i; - - if (val1 == NULL) return(NULL); - if (val2 == NULL) return(val1); - - /* - * !!!!! this can be optimized a lot, knowing that both - * val1 and val2 already have unicity of their values. - */ - - for (i = 0;i < val2->locNr;i++) - xmlXPathLocationSetAdd(val1, val2->locTab[i]); - - return(val1); -} - -/** - * xmlXPathLocationSetDel: - * @cur: the initial range set - * @val: an xmlXPathObjectPtr - * - * Removes an xmlXPathObjectPtr from an existing LocationSet - */ -void -xmlXPathLocationSetDel(xmlLocationSetPtr cur, xmlXPathObjectPtr val) { - int i; - - if (cur == NULL) return; - if (val == NULL) return; - - /* - * check against doublons - */ - for (i = 0;i < cur->locNr;i++) - if (cur->locTab[i] == val) break; - - if (i >= cur->locNr) { -#ifdef DEBUG - fprintf(xmlXPathDebug, - "xmlXPathLocationSetDel: Range %s wasn't found in RangeList\n", - val->name); -#endif - return; - } - cur->locNr--; - for (;i < cur->locNr;i++) - cur->locTab[i] = cur->locTab[i + 1]; - cur->locTab[cur->locNr] = NULL; -} - -/** - * xmlXPathLocationSetRemove: - * @cur: the initial range set - * @val: the index to remove - * - * Removes an entry from an existing LocationSet list. - */ -void -xmlXPathLocationSetRemove(xmlLocationSetPtr cur, int val) { - if (cur == NULL) return; - if (val >= cur->locNr) return; - cur->locNr--; - for (;val < cur->locNr;val++) - cur->locTab[val] = cur->locTab[val + 1]; - cur->locTab[cur->locNr] = NULL; -} - -/** - * xmlXPathFreeLocationSet: - * @obj: the xmlLocationSetPtr to free - * - * Free the LocationSet compound (not the actual ranges !). - */ -void -xmlXPathFreeLocationSet(xmlLocationSetPtr obj) { - if (obj == NULL) return; - if (obj->locTab != NULL) { -#ifdef DEBUG - memset(obj->locTab, 0xB , - (size_t) sizeof(xmlXPathObjectPtr) * obj->locMax); -#endif - xmlFree(obj->locTab); - } -#ifdef DEBUG - memset(obj, 0xB , (size_t) sizeof(xmlLocationSet)); -#endif - xmlFree(obj); -} - -#if defined(DEBUG) || defined(DEBUG_STEP) -/** - * xmlXPathDebugLocationSet: - * @output: a FILE * for the output - * @obj: the xmlLocationSetPtr to free - * - * Quick display of a LocationSet - */ -void -xmlXPathDebugLocationSet(FILE *output, xmlLocationSetPtr obj) { - int i; - - if (output == NULL) output = xmlXPathDebug; - if (obj == NULL) { - fprintf(output, "LocationSet == NULL !\n"); - return; - } - if (obj->locNr == 0) { - fprintf(output, "LocationSet is empty\n"); - return; - } - if (obj->locTab == NULL) { - fprintf(output, " locTab == NULL !\n"); - return; - } - for (i = 0; i < obj->locNr; i++) { - if (obj->locTab[i] == NULL) { - fprintf(output, " NULL !\n"); - return; - } - if ((obj->locTab[i]->type == XML_DOCUMENT_NODE) || - (obj->locTab[i]->type == XML_HTML_DOCUMENT_NODE)) - fprintf(output, " /"); - /******* TODO - else if (obj->locTab[i]->name == NULL) - fprintf(output, " noname!"); - else fprintf(output, " %s", obj->locTab[i]->name); - ********/ - } - fprintf(output, "\n"); -} -#endif - -/** - * xmlXPathNewLocationSetNodes: - * @start: the NodePtr value - * @end: the NodePtr value - * - * Create a new xmlXPathObjectPtr of type LocationSet and initialize - * it with the single range made of the two nodes @start and @end - * - * Returns the newly created object. - */ -xmlXPathObjectPtr -xmlXPathNewLocationSetNodes(xmlNodePtr start, xmlNodePtr end) { - xmlXPathObjectPtr ret; - - ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject)); - if (ret == NULL) { - fprintf(xmlXPathDebug, "xmlXPathNewLocationSet: out of memory\n"); - return(NULL); - } - memset(ret, 0 , (size_t) sizeof(xmlXPathObject)); - ret->type = XPATH_LOCATIONSET; - ret->user = xmlXPathLocationSetCreate(xmlXPathNewRangeNodes(start, end)); - return(ret); -} - -/** - * xmlXPathWrapLocationSet: - * @val: the LocationSet value - * - * Wrap the LocationSet @val in a new xmlXPathObjectPtr - * - * Returns the newly created object. - */ -xmlXPathObjectPtr -xmlXPathWrapLocationSet(xmlLocationSetPtr val) { - xmlXPathObjectPtr ret; - - ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject)); - if (ret == NULL) { - fprintf(xmlXPathDebug, "xmlXPathWrapLocationSet: out of memory\n"); - return(NULL); - } - memset(ret, 0 , (size_t) sizeof(xmlXPathObject)); - ret->type = XPATH_LOCATIONSET; - ret->user = (void *) val; - return(ret); -} - -#endif /* LIBXML_XPTR_ENABLED */ - /** * xmlXPathFreeObject: * @obj: the object to free @@ -1280,6 +777,9 @@ xmlXPathFreeObject(xmlXPathObjectPtr obj) { if (obj->type == XPATH_NODESET) { if (obj->nodesetval != NULL) xmlXPathFreeNodeSet(obj->nodesetval); + } else if (obj->type == XPATH_LOCATIONSET) { + if (obj->user != NULL) + xmlXPathFreeLocationSet(obj->user); } else if (obj->type == XPATH_STRING) { if (obj->stringval != NULL) xmlFree(obj->stringval); diff --git a/xpath.h b/xpath.h index 496acc08..7031c578 100644 --- a/xpath.h +++ b/xpath.h @@ -267,7 +267,18 @@ void xmlXPatherror (xmlXPathParserContextPtr ctxt, */ xmlXPathObjectPtr valuePop (xmlXPathParserContextPtr ctxt); int valuePush (xmlXPathParserContextPtr ctxt, - xmlXPathObjectPtr value); + xmlXPathObjectPtr value); + +xmlXPathObjectPtr xmlXPathNewString (const xmlChar *val); +xmlXPathObjectPtr xmlXPathNewNodeSet (xmlNodePtr val); +void xmlXPathNodeSetAdd (xmlNodeSetPtr cur, + xmlNodePtr val); + + +void xmlXPathIdFunction (xmlXPathParserContextPtr ctxt, + int nargs); +void xmlXPathRoot (xmlXPathParserContextPtr ctxt); +void xmlXPathEvalExpr (xmlXPathParserContextPtr ctxt); /************************************************************************ * *