diff --git a/ChangeLog b/ChangeLog index e939c0c7..cb19b698 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +Wed Sep 22 11:40:31 CEST 1999 Daniel Veillard + + * parser.h: modified the parser context struct to regain 1.4.0 + binary compatibility + * parser.c, xml-error.h: added errno ot teh context and defined + a set of errors values with update of errno + * nanohttp.[ch]: minimalist HTTP front-end for fetching remote + DTDs and entities + * *.h, *.c: complete cleanup of the use of config.h and include + protection depending on the current setup. + * overalll debugging, maintenance and bug-fixing on all modules + * updated the documentation + * ready for 1.7.0 + Wed Sep 8 22:46:14 CEST 1999 Daniel Veillard * HTMLparser.c : cleanup diff --git a/HTMLparser.c b/HTMLparser.c index a559d9b7..a63bf98e 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -10,13 +10,20 @@ #define HAVE_FCNTL_H #include #else -#include +#include "config.h" #endif + #include -#include #include /* for memset() only */ +#ifdef HAVE_CTYPE_H +#include +#endif +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_SYS_STAT_H #include +#endif #ifdef HAVE_FCNTL_H #include #endif diff --git a/HTMLtree.c b/HTMLtree.c index 87363ec4..b00c300f 100644 --- a/HTMLtree.c +++ b/HTMLtree.c @@ -6,12 +6,20 @@ * Daniel.Veillard@w3.org */ + +#ifndef WIN32 #include "config.h" +#endif #include -#include -#include #include /* for memset() only ! */ +#ifdef HAVE_CTYPE_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include +#endif + #include "xmlmemory.h" #include "HTMLparser.h" #include "HTMLtree.h" diff --git a/Makefile.am b/Makefile.am index 3ba96efe..3a0105cd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -27,6 +27,7 @@ libxml_la_SOURCES = \ xpath.c \ xmlIO.c \ xmlmemory.c \ + nanohttp.c \ valid.c xmlincdir = $(includedir)/gnome-xml @@ -43,6 +44,7 @@ xmlinc_HEADERS = \ xpath.h \ xmlIO.h \ xmlmemory.h \ + nanohttp.h \ valid.h DEPS = $(top_builddir)/libxml.la diff --git a/SAX.c b/SAX.c index d0c08fed..7d1da40d 100644 --- a/SAX.c +++ b/SAX.c @@ -6,6 +6,7 @@ * Daniel Veillard */ + #include #include #include "xmlmemory.h" @@ -236,15 +237,8 @@ resolveEntity(void *ctx, const CHAR *publicId, const CHAR *systemId) fprintf(stderr, "SAX.resolveEntity(%s, %s)\n", publicId, systemId); #endif - /* - * TODO : resolveEntity, handling of http://.. or ftp://.. - */ if (systemId != NULL) { - if (!xmlStrncmp(systemId, BAD_CAST "http://", 7)) { - } else if (!xmlStrncmp(systemId, BAD_CAST "ftp://", 6)) { - } else { - return(xmlNewInputFromFile(ctxt, (char *) systemId)); - } + return(xmlNewInputFromFile(ctxt, (char *) systemId)); } return(NULL); } @@ -604,12 +598,29 @@ startElement(void *ctx, const CHAR *fullname, const CHAR **atts) CHAR *prefix; const CHAR *att; const CHAR *value; - int i; #ifdef DEBUG_SAX fprintf(stderr, "SAX.startElement(%s)\n", fullname); #endif + + /* + * First check on validity: + */ + if (ctxt->validate && (ctxt->myDoc->extSubset == NULL) && + ((ctxt->myDoc->intSubset == NULL) || + ((ctxt->myDoc->intSubset->notations == NULL) && + (ctxt->myDoc->intSubset->elements == NULL) && + (ctxt->myDoc->intSubset->attributes == NULL) && + (ctxt->myDoc->intSubset->entities == NULL)))) { + if (ctxt->vctxt.error != NULL) { + ctxt->vctxt.error(ctxt->vctxt.userData, + "Validation failed: no DTD found !\n"); + } + ctxt->validate = 0; + } + + /* * Split the full name into a namespace prefix and the tag name */ diff --git a/config.h.in b/config.h.in index 97a7bd12..32c79e21 100644 --- a/config.h.in +++ b/config.h.in @@ -34,6 +34,9 @@ /* Define if you have the isnand function. */ #undef HAVE_ISNAND +/* Define if you have the localtime function. */ +#undef HAVE_LOCALTIME + /* Define if you have the snprintf function. */ #undef HAVE_SNPRINTF @@ -43,9 +46,15 @@ /* Define if you have the strerror function. */ #undef HAVE_STRERROR +/* Define if you have the strftime function. */ +#undef HAVE_STRFTIME + /* Define if you have the strndup function. */ #undef HAVE_STRNDUP +/* Define if you have the header file. */ +#undef HAVE_ARPA_INET_H + /* Define if you have the header file. */ #undef HAVE_CTYPE_H @@ -79,18 +88,36 @@ /* Define if you have the header file. */ #undef HAVE_NDIR_H +/* Define if you have the header file. */ +#undef HAVE_NETDB_H + +/* Define if you have the header file. */ +#undef HAVE_NETINET_IN_H + /* Define if you have the header file. */ #undef HAVE_STDARG_H +/* Define if you have the header file. */ +#undef HAVE_STDLIB_H + /* Define if you have the header file. */ #undef HAVE_SYS_DIR_H /* Define if you have the header file. */ #undef HAVE_SYS_NDIR_H +/* Define if you have the header file. */ +#undef HAVE_SYS_SELECT_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_SOCKET_H + /* Define if you have the header file. */ #undef HAVE_SYS_STAT_H +/* Define if you have the header file. */ +#undef HAVE_SYS_TIME_H + /* Define if you have the header file. */ #undef HAVE_SYS_TYPES_H @@ -103,6 +130,15 @@ /* Define if you have the header file. */ #undef HAVE_ZLIB_H +/* Define if you have the inet library (-linet). */ +#undef HAVE_LIBINET + +/* Define if you have the nsl library (-lnsl). */ +#undef HAVE_LIBNSL + +/* Define if you have the socket library (-lsocket). */ +#undef HAVE_LIBSOCKET + /* Name of package */ #undef PACKAGE diff --git a/configure.in b/configure.in index 49d57083..4c7a3f5e 100644 --- a/configure.in +++ b/configure.in @@ -4,8 +4,8 @@ AC_INIT(entities.h) AM_CONFIG_HEADER(config.h) LIBXML_MAJOR_VERSION=1 -LIBXML_MINOR_VERSION=6 -LIBXML_MICRO_VERSION=2 +LIBXML_MINOR_VERSION=7 +LIBXML_MICRO_VERSION=0 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 @@ -46,6 +46,8 @@ AC_HEADER_STDC AC_CHECK_HEADERS(fcntl.h unistd.h ctype.h dirent.h errno.h malloc.h) AC_CHECK_HEADERS(stdarg.h sys/stat.h sys/types.h time.h zlib.h) AC_CHECK_HEADERS(ieeefp.h nan.h math.h fp_class.h float.h) +AC_CHECK_HEADERS(stdlib.h sys/socket.h netinet/in.h arpa/inet.h) +AC_CHECK_HEADERS(netdb.h sys/time.h sys/select.h) dnl Specific dir for HTML output ? if test "x$with_html_dir" = "x" ; then @@ -70,6 +72,12 @@ dnl Checks for library functions. AC_FUNC_STRFTIME AC_CHECK_FUNCS(strdup strndup strerror snprintf) AC_CHECK_FUNCS(finite isinf isnan isnand fp_class class fpclass finite) +AC_CHECK_FUNCS(strftime localtime) + +dnl Checks for inet libraries: +AC_CHECK_LIB(socket, socket) +AC_CHECK_LIB(inet, connect) +AC_CHECK_LIB(nsl, t_accept) dnl Checks for isnan in libm if not in libc M_LIBS= @@ -93,7 +101,7 @@ fi XML_LIBDIR='-L${libdir}' XML_INCLUDEDIR='-I${includedir}/gnome-xml' -XML_LIBS="-lxml $Z_LIBS $M_LIBS" +XML_LIBS="-lxml $Z_LIBS $M_LIBS $LIBS" AC_SUBST(XML_LIBDIR) AC_SUBST(XML_LIBS) diff --git a/doc/gnome-xml.sgml b/doc/gnome-xml.sgml index d1c21de9..c39e959b 100644 --- a/doc/gnome-xml.sgml +++ b/doc/gnome-xml.sgml @@ -10,6 +10,7 @@ + ]> @@ -30,6 +31,7 @@ &xpath; &parserInternals; &xmlmemory; + &nanohttp; diff --git a/doc/html/book1.html b/doc/html/book1.html index 3ebd0f2c..77bdef75 100644 --- a/doc/html/book1.html +++ b/doc/html/book1.html @@ -103,6 +103,11 @@ HREF="gnome-xml-parserinternals.html" HREF="gnome-xml-xmlmemory.html" >xmlmemory —
nanohttp

Name

Synopsis

Description

Details

#define XML_INTERNAL_GENERAL_ENTITY		1
#define XML_INTERNAL_GENERAL_ENTITY

#define XML_EXTERNAL_GENERAL_PARSED_ENTITY	2
#define XML_EXTERNAL_GENERAL_PARSED_ENTITY

#define XML_EXTERNAL_GENERAL_UNPARSED_ENTITY	3
#define XML_EXTERNAL_GENERAL_UNPARSED_ENTITY

#define XML_INTERNAL_PARAMETER_ENTITY		4
#define XML_INTERNAL_PARAMETER_ENTITY

#define XML_EXTERNAL_PARAMETER_ENTITY		5
#define XML_EXTERNAL_PARAMETER_ENTITY

#define XML_INTERNAL_PREDEFINED_ENTITY		6
#define XML_INTERNAL_PREDEFINED_ENTITY

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 


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 


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

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;


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


the entity name the associated htmlEntityDescPtr if found, NULL 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 CHAR  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 CHAR  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 

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

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


the FILE*  the document 




xmlParserNodeInfo

typedef _xmlParserNodeInfo xmlParserNodeInfo;


xmlParserNodeInfoSeq

typedef _xmlParserNodeInfoSeq xmlParserNodeInfoSeq;


xmlParserNodeInfoSeqPtr

typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr;



xmlParserCtxt

typedef _xmlParserCtxt xmlParserCtxt;


xmlParserCtxtPtr

typedef xmlParserCtxt *xmlParserCtxtPtr;


xmlSAXLocator

typedef _xmlSAXLocator xmlSAXLocator;


xmlSAXLocatorPtr

typedef xmlSAXLocator *xmlSAXLocatorPtr;





























xmlSAXHandlerPtr

typedef xmlSAXHandler *xmlSAXHandlerPtr;







an XML parser input  an indicative size for the lookahead the number of CHARs 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 CHARs read, or -1 in case of error, 0 indicate the -end of this entity 


the input CHAR * a new CHAR * or NULL 


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


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


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


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


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


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


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


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


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


a pointer to an array of CHAR 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. 


a pointer to an array of CHAR 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. 


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


the SAX handler block  an pointer to a char array  the siwe of the array  work in recovery mode, i.e. tries to read no 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 


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. 


an HTML parser context 


an XML parser context 


an XML parser context  a CHAR * buffer  a file name 




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 1000
#define XML_MAX_NAMELEN



#define SKIPCHARVAL(p) (p)++;
#define SKIPCHARVAL(p)













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


the filename the new parser context or NULL 


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


an XML parser context 


the xmlParserCtxtPtr or NULL 


the parser context 

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 CHAR in the parser context 


an xmlP arserInputPtr 


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


an XML parser context  a CHAR **  the function returns 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 CHAR **  the function returns 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. 


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 CHAR** 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) 


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 CHAR ** 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  the tag name as parsed in the opening tag. 


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 

#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 CHAR, 0 if none  an end marker CHAR, 0 if none  an end marker CHAR, 0 if none A newly allocated string with the substitution done. The caller -must deallocate it ! 





Name

Synopsis

xmlIDPtr; typedef xmlRefPtr; +typedef xmlNode; @@ -1071,6 +1075,20 @@ HREF="gnome-xml-tree.html#XMLNODEPTR" HREF="gnome-xml-tree.html#CHAR" >CHAR *lang); +int xmlRemoveProp (xmlAttrPtr attr); +int xmlRemoveNode (xmlNodePtr node); void xmlBufferWriteCHAR

Description

Details



#define BAD_CAST (CHAR *)
#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


xmlAttrPtr


xmlIDPtr

xmlDtdPtr

typedef xmlDtd *xmlDtdPtr;
xmlRefPtr


xmlAttrPtr

typedef xmlAttr *xmlAttrPtr;


xmlIDPtr

typedef xmlID *xmlIDPtr;


xmlNode

typedef _xmlNode xmlNode;


xmlNodePtr


xmlDoc


xmlDocPtr

xmlNodePtr

typedef _xmlNode *xmlNodePtr;


xmlDoc

typedef _xmlDoc xmlDoc;


xmlDocPtr

typedef xmlDoc *xmlDocPtr;


xmlBuffer

typedef _xmlBuffer xmlBuffer;


xmlBufferPtr

typedef xmlBuffer *xmlBufferPtr;





the new structure. 


the buffer to free 


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


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


the buffer to dump  the CHAR string 


the buffer to dump  the C char string 


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


the buffer 


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 DTD structure to free up 


the document carrying the namespace  the URI associated  the prefix for the namespace returns a new namespace pointer 


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


the namespace pointer 


CHAR 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 


the first property in the list 


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 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 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 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 parent node the last child or NULL if none. 


the node 1 yes, 0 no 


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


the child node  the new node the 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. 


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 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 CHAR * 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 


the node being changed  the langage description 


xmlRemoveProp ()

int         xmlRemoveProp                   (xmlAttrPtr attr);

attr : 
Returns : 


xmlRemoveNode ()

int         xmlRemoveNode                   (xmlNodePtr node);

node : 
Returns : 


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  OUT: the memory pointer  OUT: the memory lenght 


the FILE*  the document 


the filename  the document  the number of file 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

xmlIDTablePtr; +#define XML_MIN_REF_TABLE +typedef xmlRefTablePtr; xmlNotationPtrxmlAttrPtr attr); +xmlRefPtr xmlAddRef (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + const CHAR *value, + xmlAttrPtr attr); +xmlRefTablePtr xmlCopyRefTable (xmlRefTablePtr table); +void xmlFreeRefTable (xmlRefTablePtr table); +int xmlIsRef (xmlDocPtr doc, + xmlNodePtr elem, + xmlAttrPtr attr); int xmlValidateRootCHAR *value); int xmlValidateDocumentFinal (xmlValidCtxtPtr ctxt, + xmlDocPtr doc); +int xmlValidateNotationUse (

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 


#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


XML_MIN_REF_TABLE

typedef xmlIDTable *xmlIDTablePtr;
#define XML_MIN_REF_TABLE

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


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 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 type  the attribute default type  the attribute default value  if it's an enumeration, the associated list NULL if not, othervise the entity 


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


An attribute table 


the XML buffer output  An attribute table 


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 


xmlAddRef ()

xmlRefPtr   xmlAddRef                       (xmlValidCtxtPtr ctxt,
+                                             xmlDocPtr doc,
+                                             const CHAR *value,
+                                             xmlAttrPtr attr);

Register a new ref declaration

ctxt : 
doc : 
value : 
attr : 
Returns : 


xmlCopyRefTable ()

xmlRefTablePtr xmlCopyRefTable              (xmlRefTablePtr table);

table : 
Returns : 


xmlFreeRefTable ()

void        xmlFreeRefTable                 (xmlRefTablePtr table);

Deallocate the memory used by an Ref hash table.

table : 


xmlIsRef ()

int         xmlIsRef                        (xmlDocPtr doc,
+                                             xmlNodePtr elem,
+                                             xmlAttrPtr attr);

Determine whether an attribute is of type Ref. In case we have Dtd(s) +then this is simple, otherwise we use an heuristic: name Ref (upper +or lowercase).

doc : 
elem : 
attr : 
Returns : 


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


Try to validate the document instance

basically it does the all the checks described by the +>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.

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 1 if valid or 0 otherwise 


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

ctxt : 
doc : 
Returns : 


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 

Name

Synopsis

+enum xmlParserErrors; void xmlParserError

Description

Details

enum xmlParserErrors

typedef enum {
+    XML_ERR_OK = 0,
+    XML_ERR_INTERNAL_ERROR,
+    XML_ERR_NO_MEMORY,
+    
+    XML_ERR_DOCUMENT_START,
+    XML_ERR_DOCUMENT_EMPTY,
+    XML_ERR_DOCUMENT_END,
+
+    XML_ERR_INVALID_HEX_CHARREF,
+    XML_ERR_INVALID_DEC_CHARREF,
+    XML_ERR_INVALID_CHARREF,
+    XML_ERR_INVALID_CHAR,
+
+    XML_ERR_CHARREF_AT_EOF,
+    XML_ERR_CHARREF_IN_PROLOG,
+    XML_ERR_CHARREF_IN_EPILOG,
+    XML_ERR_CHARREF_IN_DTD,
+    XML_ERR_ENTITYREF_AT_EOF,
+    XML_ERR_ENTITYREF_IN_PROLOG,
+    XML_ERR_ENTITYREF_IN_EPILOG,
+    XML_ERR_ENTITYREF_IN_DTD,
+    XML_ERR_PEREF_AT_EOF,
+    XML_ERR_PEREF_IN_PROLOG,
+    XML_ERR_PEREF_IN_EPILOG,
+    XML_ERR_PEREF_IN_INT_SUBSET,
+
+    XML_ERR_ENTITYREF_NO_NAME,
+    XML_ERR_ENTITYREF_SEMICOL_MISSING,
+
+    XML_ERR_PEREF_NO_NAME,
+    XML_ERR_PEREF_SEMICOL_MISSING,
+
+    XML_ERR_UNDECLARED_ENTITY,
+    XML_WAR_UNDECLARED_ENTITY,
+    XML_ERR_UNPARSED_ENTITY,
+    XML_ERR_ENTITY_IS_EXTERNAL,
+    XML_ERR_ENTITY_IS_PARAMETER,
+
+    XML_ERR_UNKNOWN_ENCODING,
+    XML_ERR_UNSUPPORTED_ENCODING,
+
+    XML_ERR_STRING_NOT_STARTED,
+    XML_ERR_STRING_NOT_CLOSED,
+    XML_ERR_NS_DECL_ERROR,
+
+    XML_ERR_ENTITY_NOT_STARTED,
+    XML_ERR_ENTITY_NOT_FINISHED,
+    
+    XML_ERR_LT_IN_ATTRIBUTE,
+    XML_ERR_ATTRIBUTE_NOT_STARTED,
+    XML_ERR_ATTRIBUTE_NOT_FINISHED,
+    XML_ERR_ATTRIBUTE_WITHOUT_VALUE,
+    XML_ERR_ATTRIBUTE_REDEFINED,
+
+    XML_ERR_LITERAL_NOT_STARTED,
+    XML_ERR_LITERAL_NOT_FINISHED,
+    
+    XML_ERR_COMMENT_NOT_FINISHED,
+
+    XML_ERR_PI_NOT_STARTED,
+    XML_ERR_PI_NOT_FINISHED,
+
+    XML_ERR_NOTATION_NOT_STARTED,
+    XML_ERR_NOTATION_NOT_FINISHED,
+
+    XML_ERR_ATTLIST_NOT_STARTED,
+    XML_ERR_ATTLIST_NOT_FINISHED,
+
+    XML_ERR_MIXED_NOT_STARTED,
+    XML_ERR_MIXED_NOT_FINISHED,
+
+    XML_ERR_ELEMCONTENT_NOT_STARTED,
+    XML_ERR_ELEMCONTENT_NOT_FINISHED,
+
+    XML_ERR_XMLDECL_NOT_STARTED,
+    XML_ERR_XMLDECL_NOT_FINISHED,
+
+    XML_ERR_CONDSEC_NOT_STARTED,
+    XML_ERR_CONDSEC_NOT_FINISHED,
+
+    XML_ERR_EXT_SUBSET_NOT_FINISHED,
+
+    XML_ERR_DOCTYPE_NOT_FINISHED,
+
+    XML_ERR_MISPLACED_CDATA_END,
+    XML_ERR_CDATA_NOT_FINISHED,
+
+    XML_ERR_RESERVED_XML_NAME,
+
+    XML_ERR_SPACE_REQUIRED,
+    XML_ERR_SEPARATOR_REQUIRED,
+    XML_ERR_NMTOKEN_REQUIRED,
+    XML_ERR_NAME_REQUIRED,
+    XML_ERR_PCDATA_REQUIRED,
+    XML_ERR_URI_REQUIRED,
+    XML_ERR_PUBID_REQUIRED,
+    XML_ERR_LT_REQUIRED,
+    XML_ERR_GT_REQUIRED,
+    XML_ERR_LTSLASH_REQUIRED,
+    XML_ERR_EQUAL_REQUIRED,
+
+    XML_ERR_TAG_NAME_MISMATCH,
+    XML_ERR_TAG_NOT_FINISED,
+
+    XML_ERR_STANDALONE_VALUE,
+
+    XML_ERR_ENCODING_NAME,
+
+    XML_ERR_HYPHEN_IN_COMMENT
+
+}xmlParserErrors;


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

XPATH_STRING +#define XPATH_USERS +int (*xmlXPathConvertFunc) (xmlXPathObjectPtr obj, + int type); +void (*xmlXPathEvalFunc) (xmlXPathParserContextPtr ctxt, + int nargs); +xmlXPathObjectPtr (*xmlXPathAxisFunc) (xmlXPathParserContextPtr ctxt, + xmlXPathObjectPtr cur); void (*xmlXPathFunction (xmlDocPtr doc, - void *variables, - void *functions); +> doc); void xmlXPathFreeContext

Description

Details

#define XPATH_UNDEFINED	0
#define XPATH_UNDEFINED

#define XPATH_NODESET	1
#define XPATH_NODESET

#define XPATH_BOOLEAN	2
#define XPATH_BOOLEAN

#define XPATH_NUMBER	3
#define XPATH_NUMBER

#define XPATH_STRING	4
#define XPATH_STRING

XPATH_USERS

#define     XPATH_USERS


xmlXPathConvertFunc ()

int         (*xmlXPathConvertFunc)          (xmlXPathObjectPtr obj,
+                                             int type);

obj : 
type : 
Returns : 


xmlXPathEvalFunc ()

void        (*xmlXPathEvalFunc)             (xmlXPathParserContextPtr ctxt,
+                                             int nargs);

ctxt : 
nargs : 


xmlXPathAxisFunc ()

xmlXPathObjectPtr (*xmlXPathAxisFunc)       (xmlXPathParserContextPtr ctxt,
+                                             xmlXPathObjectPtr cur);

ctxt : 
cur : 
Returns : 



xmlXPathNewContext (xmlDocPtr doc, - void *variables, - void *functions); doc); the XML documentvariables : the variable listfunctions : the function list 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. 


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. 

+ @@ -176,6 +177,8 @@ + + @@ -221,6 +224,8 @@ + + @@ -244,6 +249,10 @@ + + + + @@ -254,12 +263,14 @@ + + @@ -298,6 +309,10 @@ + + + + @@ -393,7 +408,6 @@ - @@ -408,3 +422,11 @@ + + + + + + + + diff --git a/encoding.c b/encoding.c index e72577ed..5169cdea 100644 --- a/encoding.c +++ b/encoding.c @@ -19,10 +19,16 @@ * Daniel.Veillard@w3.org */ +#ifndef WIN32 #include "config.h" -#include -#include +#endif + #include +#include + +#ifdef HAVE_CTYPE_H +#include +#endif #include "encoding.h" #ifdef HAVE_UNICODE_H #include diff --git a/entities.c b/entities.c index 24c770c0..fe706ea7 100644 --- a/entities.c +++ b/entities.c @@ -6,9 +6,15 @@ * Daniel.Veillard@w3.org */ +#ifndef WIN32 +#include "config.h" +#endif + #include -#include #include +#ifdef HAVE_STDLIB_H +#include +#endif #include "xmlmemory.h" #include "entities.h" diff --git a/include/libxml/parser.h b/include/libxml/parser.h index aab35530..06db1413 100644 --- a/include/libxml/parser.h +++ b/include/libxml/parser.h @@ -105,25 +105,13 @@ typedef struct _xmlParserCtxt { struct xmlSAXHandler *sax; /* The SAX handler */ void *userData; /* the document being built */ xmlDocPtr myDoc; /* the document being built */ + int wellFormed; /* is the document well formed */ int replaceEntities; /* shall we replace entities ? */ const CHAR *version; /* the XML version string */ const CHAR *encoding; /* encoding, if any */ int standalone; /* standalone document */ - int hasExternalSubset; /* reference and external subset */ - int hasPErefs; /* the internal subset has PE refs */ int html; /* are we parsing an HTML document */ - int external; /* are we parsing an external entity */ - int wellFormed; /* is the document well formed */ - int valid; /* is the document valid */ - int validate; /* shall we try to validate ? */ - xmlValidCtxt vctxt; /* The validity context */ - - xmlParserInputState instate; /* current type of input */ - int token; /* next char look-ahead */ - - char *directory; /* the data directory */ - /* Input stream stack */ xmlParserInputPtr input; /* Current input stream */ int inputNr; /* Number of current input streams */ @@ -138,6 +126,21 @@ typedef struct _xmlParserCtxt { int record_info; /* Whether node info should be kept */ xmlParserNodeInfoSeq node_seq; /* info about each node parsed */ + + int errno; /* error code */ + + int hasExternalSubset; /* reference and external subset */ + int hasPErefs; /* the internal subset has PE refs */ + int external; /* are we parsing an external entity */ + + int valid; /* is the document valid */ + int validate; /* shall we try to validate ? */ + xmlValidCtxt vctxt; /* The validity context */ + + xmlParserInputState instate; /* current type of input */ + int token; /* next char look-ahead */ + + char *directory; /* the data directory */ } _xmlParserCtxt; typedef _xmlParserCtxt xmlParserCtxt; typedef xmlParserCtxt *xmlParserCtxtPtr; diff --git a/include/libxml/xmlIO.h b/include/libxml/xmlIO.h index 01bf14c7..a99ab23d 100644 --- a/include/libxml/xmlIO.h +++ b/include/libxml/xmlIO.h @@ -23,6 +23,7 @@ typedef struct xmlParserInputBuffer { FILE *file; /* Input on file handler */ void* gzfile; /* Input on a compressed stream */ int fd; /* Input on a file descriptor */ + void *netIO; /* Input from a network stream */ xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */ diff --git a/include/libxml/xmlmemory.h b/include/libxml/xmlmemory.h index d28b526c..78ff392f 100644 --- a/include/libxml/xmlmemory.h +++ b/include/libxml/xmlmemory.h @@ -8,7 +8,7 @@ #ifndef _DEBUG_MEMORY_ALLOC_ #define _DEBUG_MEMORY_ALLOC_ -#define NO_DEBUG_MEMORY +/* #define NO_DEBUG_MEMORY */ #ifdef NO_DEBUG_MEMORY #ifdef HAVE_MALLOC_H diff --git a/parser.c b/parser.c index 1b353fb0..e01f162d 100644 --- a/parser.c +++ b/parser.c @@ -10,13 +10,20 @@ #define HAVE_FCNTL_H #include #else -#include +#include "config.h" #endif + #include -#include #include /* for memset() only */ +#ifdef HAVE_CTYPE_H +#include +#endif +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_SYS_STAT_H #include +#endif #ifdef HAVE_FCNTL_H #include #endif @@ -35,6 +42,7 @@ #include "valid.h" #include "parserInternals.h" #include "xmlIO.h" +#include "xml-error.h" const char *xmlParserVersion = LIBXML_VERSION; @@ -402,8 +410,11 @@ xmlNewInputStream(xmlParserCtxtPtr ctxt) { input = (xmlParserInputPtr) xmlMalloc(sizeof(xmlParserInput)); if (input == NULL) { + ctxt->errno = XML_ERR_NO_MEMORY; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, "malloc: couldn't allocate a new input stream\n"); + ctxt->sax->error(ctxt->userData, + "malloc: couldn't allocate a new input stream\n"); + ctxt->errno = XML_ERR_NO_MEMORY; return(NULL); } input->filename = NULL; @@ -433,14 +444,17 @@ xmlNewEntityInputStream(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) { xmlParserInputPtr input; if (entity == NULL) { + ctxt->errno = XML_ERR_INTERNAL_ERROR; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "internal: xmlNewEntityInputStream entity = NULL\n"); + ctxt->errno = XML_ERR_INTERNAL_ERROR; return(NULL); } if (entity->content == NULL) { switch (entity->type) { case XML_EXTERNAL_GENERAL_UNPARSED_ENTITY: + ctxt->errno = XML_ERR_UNPARSED_ENTITY; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "xmlNewEntityInputStream unparsed entity !\n"); @@ -455,11 +469,13 @@ xmlNewEntityInputStream(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) { "Internal entity %s without content !\n", entity->name); break; case XML_INTERNAL_PARAMETER_ENTITY: + ctxt->errno = XML_ERR_INTERNAL_ERROR; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Internal parameter entity %s without content !\n", entity->name); break; case XML_INTERNAL_PREDEFINED_ENTITY: + ctxt->errno = XML_ERR_INTERNAL_ERROR; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Predefined entity %s without content !\n", entity->name); @@ -490,6 +506,7 @@ xmlNewStringInputStream(xmlParserCtxtPtr ctxt, const CHAR *buffer) { xmlParserInputPtr input; if (buffer == NULL) { + ctxt->errno = XML_ERR_INTERNAL_ERROR; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "internal: xmlNewStringInputStream string = NULL\n"); @@ -742,6 +759,7 @@ xmlParseCharRef(xmlParserCtxtPtr ctxt) { else if ((CUR >= 'A') && (CUR <= 'F')) val = val * 16 + (CUR - 'A') + 10; else { + ctxt->errno = XML_ERR_INVALID_HEX_CHARREF; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "xmlParseCharRef: invalid hexadecimal value\n"); @@ -759,6 +777,7 @@ xmlParseCharRef(xmlParserCtxtPtr ctxt) { if ((CUR >= '0') && (CUR <= '9')) val = val * 10 + (CUR - '0'); else { + ctxt->errno = XML_ERR_INVALID_DEC_CHARREF; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "xmlParseCharRef: invalid decimal value\n"); @@ -771,6 +790,7 @@ xmlParseCharRef(xmlParserCtxtPtr ctxt) { if (CUR == ';') NEXT; } else { + ctxt->errno = XML_ERR_INVALID_CHARREF; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "xmlParseCharRef: invalid value\n"); @@ -785,6 +805,7 @@ xmlParseCharRef(xmlParserCtxtPtr ctxt) { if (IS_CHAR(val)) { return(val); } else { + ctxt->errno = XML_ERR_INVALID_CHAR; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "CharRef: invalid CHAR value %d\n", val); @@ -832,21 +853,25 @@ xmlParserHandleReference(xmlParserCtxtPtr ctxt) { case XML_PARSER_COMMENT: return; case XML_PARSER_EOF: + ctxt->errno = XML_ERR_CHARREF_AT_EOF; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "CharRef at EOF\n"); ctxt->wellFormed = 0; return; case XML_PARSER_PROLOG: + ctxt->errno = XML_ERR_CHARREF_IN_PROLOG; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "CharRef in prolog!\n"); ctxt->wellFormed = 0; return; case XML_PARSER_EPILOG: + ctxt->errno = XML_ERR_CHARREF_IN_EPILOG; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "CharRef in epilog!\n"); ctxt->wellFormed = 0; return; case XML_PARSER_DTD: + ctxt->errno = XML_ERR_CHARREF_IN_DTD; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "CharRef are forbiden in DTDs!\n"); @@ -879,16 +904,19 @@ xmlParserHandleReference(xmlParserCtxtPtr ctxt) { case XML_PARSER_COMMENT: return; case XML_PARSER_EOF: + ctxt->errno = XML_ERR_ENTITYREF_AT_EOF; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Reference at EOF\n"); ctxt->wellFormed = 0; return; case XML_PARSER_PROLOG: + ctxt->errno = XML_ERR_ENTITYREF_IN_PROLOG; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Reference in prolog!\n"); ctxt->wellFormed = 0; return; case XML_PARSER_EPILOG: + ctxt->errno = XML_ERR_ENTITYREF_IN_EPILOG; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Reference in epilog!\n"); ctxt->wellFormed = 0; @@ -919,6 +947,7 @@ xmlParserHandleReference(xmlParserCtxtPtr ctxt) { */ return; case XML_PARSER_DTD: + ctxt->errno = XML_ERR_ENTITYREF_IN_DTD; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Entity references are forbiden in DTDs!\n"); @@ -931,6 +960,7 @@ xmlParserHandleReference(xmlParserCtxtPtr ctxt) { NEXT; name = xmlScanName(ctxt); if (name == NULL) { + ctxt->errno = XML_ERR_ENTITYREF_NO_NAME; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Entity reference: no name\n"); ctxt->wellFormed = 0; @@ -938,6 +968,7 @@ xmlParserHandleReference(xmlParserCtxtPtr ctxt) { return; } if (NXT(xmlStrlen(name)) != ';') { + ctxt->errno = XML_ERR_ENTITYREF_SEMICOL_MISSING; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Entity reference: ';' expected\n"); @@ -961,6 +992,7 @@ xmlParserHandleReference(xmlParserCtxtPtr ctxt) { if (ent == NULL) ent = xmlGetPredefinedEntity(name); if (ent == NULL) { + ctxt->errno = XML_ERR_UNDECLARED_ENTITY; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Entity reference: entity %s not declared\n", @@ -975,6 +1007,7 @@ xmlParserHandleReference(xmlParserCtxtPtr ctxt) { * An entity reference must not contain the name of an unparsed entity */ if (ent->type == XML_EXTERNAL_GENERAL_UNPARSED_ENTITY) { + ctxt->errno = XML_ERR_UNPARSED_ENTITY; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Entity reference to unparsed entity %s\n", name); @@ -1038,11 +1071,13 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) { case XML_PARSER_COMMENT: return; case XML_PARSER_EOF: + ctxt->errno = XML_ERR_PEREF_AT_EOF; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "PEReference at EOF\n"); ctxt->wellFormed = 0; return; case XML_PARSER_PROLOG: + ctxt->errno = XML_ERR_PEREF_IN_PROLOG; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "PEReference in prolog!\n"); ctxt->wellFormed = 0; @@ -1053,6 +1088,7 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) { /* we just ignore it there */ return; case XML_PARSER_EPILOG: + ctxt->errno = XML_ERR_PEREF_IN_EPILOG; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "PEReference in epilog!\n"); ctxt->wellFormed = 0; @@ -1081,6 +1117,7 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) { NEXT; name = xmlParseName(ctxt); if (name == NULL) { + ctxt->errno = XML_ERR_PEREF_NO_NAME; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "xmlHandlePEReference: no name\n"); ctxt->wellFormed = 0; @@ -1139,6 +1176,7 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) { } } } else { + ctxt->errno = XML_ERR_PEREF_SEMICOL_MISSING; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "xmlHandlePEReference: expecting ';'\n"); @@ -1299,6 +1337,7 @@ xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc) { switch (enc) { case XML_CHAR_ENCODING_ERROR: + ctxt->errno = XML_ERR_UNKNOWN_ENCODING; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "encoding unknown\n"); ctxt->wellFormed = 0; @@ -1310,101 +1349,121 @@ xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc) /* default encoding, no conversion should be needed */ return; case XML_CHAR_ENCODING_UTF16LE: + ctxt->errno = XML_ERR_UNSUPPORTED_ENCODING; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "char encoding UTF16 little endian not supported\n"); break; case XML_CHAR_ENCODING_UTF16BE: + ctxt->errno = XML_ERR_UNSUPPORTED_ENCODING; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "char encoding UTF16 big endian not supported\n"); break; case XML_CHAR_ENCODING_UCS4LE: + ctxt->errno = XML_ERR_UNSUPPORTED_ENCODING; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "char encoding USC4 little endian not supported\n"); break; case XML_CHAR_ENCODING_UCS4BE: + ctxt->errno = XML_ERR_UNSUPPORTED_ENCODING; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "char encoding USC4 big endian not supported\n"); break; case XML_CHAR_ENCODING_EBCDIC: + ctxt->errno = XML_ERR_UNSUPPORTED_ENCODING; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "char encoding EBCDIC not supported\n"); break; case XML_CHAR_ENCODING_UCS4_2143: + ctxt->errno = XML_ERR_UNSUPPORTED_ENCODING; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "char encoding UCS4 2143 not supported\n"); break; case XML_CHAR_ENCODING_UCS4_3412: + ctxt->errno = XML_ERR_UNSUPPORTED_ENCODING; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "char encoding UCS4 3412 not supported\n"); break; case XML_CHAR_ENCODING_UCS2: + ctxt->errno = XML_ERR_UNSUPPORTED_ENCODING; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "char encoding UCS2 not supported\n"); break; case XML_CHAR_ENCODING_8859_1: + ctxt->errno = XML_ERR_UNSUPPORTED_ENCODING; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "char encoding ISO_8859_1 ISO Latin 1 not supported\n"); break; case XML_CHAR_ENCODING_8859_2: + ctxt->errno = XML_ERR_UNSUPPORTED_ENCODING; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "char encoding ISO_8859_2 ISO Latin 2 not supported\n"); break; case XML_CHAR_ENCODING_8859_3: + ctxt->errno = XML_ERR_UNSUPPORTED_ENCODING; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "char encoding ISO_8859_3 not supported\n"); break; case XML_CHAR_ENCODING_8859_4: + ctxt->errno = XML_ERR_UNSUPPORTED_ENCODING; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "char encoding ISO_8859_4 not supported\n"); break; case XML_CHAR_ENCODING_8859_5: + ctxt->errno = XML_ERR_UNSUPPORTED_ENCODING; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "char encoding ISO_8859_5 not supported\n"); break; case XML_CHAR_ENCODING_8859_6: + ctxt->errno = XML_ERR_UNSUPPORTED_ENCODING; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "char encoding ISO_8859_6 not supported\n"); break; case XML_CHAR_ENCODING_8859_7: + ctxt->errno = XML_ERR_UNSUPPORTED_ENCODING; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "char encoding ISO_8859_7 not supported\n"); break; case XML_CHAR_ENCODING_8859_8: + ctxt->errno = XML_ERR_UNSUPPORTED_ENCODING; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "char encoding ISO_8859_8 not supported\n"); break; case XML_CHAR_ENCODING_8859_9: + ctxt->errno = XML_ERR_UNSUPPORTED_ENCODING; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "char encoding ISO_8859_9 not supported\n"); break; case XML_CHAR_ENCODING_2022_JP: + ctxt->errno = XML_ERR_UNSUPPORTED_ENCODING; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "char encoding ISO-2022-JPnot supported\n"); break; case XML_CHAR_ENCODING_SHIFT_JIS: + ctxt->errno = XML_ERR_UNSUPPORTED_ENCODING; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "char encoding Shift_JISnot supported\n"); break; case XML_CHAR_ENCODING_EUC_JP: + ctxt->errno = XML_ERR_UNSUPPORTED_ENCODING; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "char encoding EUC-JPnot supported\n"); @@ -1761,6 +1820,7 @@ xmlHandleEntity(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) { xmlParserInputPtr input; if (entity->content == NULL) { + ctxt->errno = XML_ERR_INTERNAL_ERROR; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "xmlHandleEntity %s: content == NULL\n", entity->name); @@ -1983,6 +2043,7 @@ xmlParseQuotedString(xmlParserCtxtPtr ctxt) { q = CUR_PTR; while (IS_CHAR(CUR) && (CUR != '"')) NEXT; if (CUR != '"') { + ctxt->errno = XML_ERR_STRING_NOT_CLOSED; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "String not closed \"%.50s\"\n", q); ctxt->wellFormed = 0; @@ -1995,6 +2056,7 @@ xmlParseQuotedString(xmlParserCtxtPtr ctxt) { q = CUR_PTR; while (IS_CHAR(CUR) && (CUR != '\'')) NEXT; if (CUR != '\'') { + ctxt->errno = XML_ERR_STRING_NOT_CLOSED; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "String not closed \"%.50s\"\n", q); ctxt->wellFormed = 0; @@ -2089,9 +2151,12 @@ xmlParseNamespace(xmlParserCtxtPtr ctxt) { /* * Found garbage when parsing the namespace */ - if (!garbage) + if (!garbage) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, "xmlParseNamespace found garbage\n"); + ctxt->sax->error(ctxt->userData, + "xmlParseNamespace found garbage\n"); + } + ctxt->errno = XML_ERR_NS_DECL_ERROR; ctxt->wellFormed = 0; NEXT; } @@ -2334,6 +2399,7 @@ xmlParseEntityValue(xmlParserCtxtPtr ctxt, CHAR **orig) { GROW; } if (CUR != '"') { + ctxt->errno = XML_ERR_ENTITY_NOT_FINISHED; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "EntityValue: \" expected\n"); ctxt->wellFormed = 0; @@ -2393,6 +2459,7 @@ xmlParseEntityValue(xmlParserCtxtPtr ctxt, CHAR **orig) { GROW; } if (CUR != '\'') { + ctxt->errno = XML_ERR_ENTITY_NOT_FINISHED; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "EntityValue: ' expected\n"); ctxt->wellFormed = 0; @@ -2404,6 +2471,7 @@ xmlParseEntityValue(xmlParserCtxtPtr ctxt, CHAR **orig) { NEXT; } } else { + ctxt->errno = XML_ERR_ENTITY_NOT_STARTED; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "EntityValue: \" or ' expected\n"); ctxt->wellFormed = 0; @@ -2439,11 +2507,13 @@ xmlParseAttValue(xmlParserCtxtPtr ctxt) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Unescaped '<' not allowed in attributes values\n"); + ctxt->errno = XML_ERR_LT_IN_ATTRIBUTE; ctxt->wellFormed = 0; } if (CUR != '"') { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "AttValue: ' expected\n"); + ctxt->errno = XML_ERR_ATTRIBUTE_NOT_FINISHED; ctxt->wellFormed = 0; } else NEXT; @@ -2455,15 +2525,18 @@ xmlParseAttValue(xmlParserCtxtPtr ctxt) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Unescaped '<' not allowed in attributes values\n"); + ctxt->errno = XML_ERR_LT_IN_ATTRIBUTE; ctxt->wellFormed = 0; } if (CUR != '\'') { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "AttValue: ' expected\n"); + ctxt->errno = XML_ERR_ATTRIBUTE_NOT_FINISHED; ctxt->wellFormed = 0; } else NEXT; } else { + ctxt->errno = XML_ERR_ATTRIBUTE_NOT_STARTED; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "AttValue: \" or ' expected\n"); ctxt->wellFormed = 0; @@ -2497,6 +2570,7 @@ xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) { if (!IS_CHAR(CUR)) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Unfinished SystemLiteral\n"); + ctxt->errno = XML_ERR_LITERAL_NOT_FINISHED; ctxt->wellFormed = 0; } else { ret = xmlStrndup(q, CUR_PTR - q); @@ -2510,6 +2584,7 @@ xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) { if (!IS_CHAR(CUR)) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Unfinished SystemLiteral\n"); + ctxt->errno = XML_ERR_LITERAL_NOT_FINISHED; ctxt->wellFormed = 0; } else { ret = xmlStrndup(q, CUR_PTR - q); @@ -2517,7 +2592,9 @@ xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) { } } else { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, "SystemLiteral \" or ' expected\n"); + ctxt->sax->error(ctxt->userData, + "SystemLiteral \" or ' expected\n"); + ctxt->errno = XML_ERR_LITERAL_NOT_STARTED; ctxt->wellFormed = 0; } @@ -2550,6 +2627,7 @@ xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) { if (CUR != '"') { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Unfinished PubidLiteral\n"); + ctxt->errno = XML_ERR_LITERAL_NOT_FINISHED; ctxt->wellFormed = 0; } else { ret = xmlStrndup(q, CUR_PTR - q); @@ -2563,6 +2641,7 @@ xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) { if (!IS_LETTER(CUR)) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Unfinished PubidLiteral\n"); + ctxt->errno = XML_ERR_LITERAL_NOT_FINISHED; ctxt->wellFormed = 0; } else { ret = xmlStrndup(q, CUR_PTR - q); @@ -2570,7 +2649,9 @@ xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) { } } else { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, "SystemLiteral \" or ' expected\n"); + ctxt->sax->error(ctxt->userData, + "SystemLiteral \" or ' expected\n"); + ctxt->errno = XML_ERR_LITERAL_NOT_STARTED; ctxt->wellFormed = 0; } @@ -2610,6 +2691,7 @@ xmlParseCharData(xmlParserCtxtPtr ctxt, int cdata) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Sequence ']]>' not allowed in content\n"); + ctxt->errno = XML_ERR_MISPLACED_CDATA_END; ctxt->wellFormed = 0; } } @@ -2684,6 +2766,7 @@ xmlParseExternalID(xmlParserCtxtPtr ctxt, CHAR **publicID, int strict) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Space required after 'SYSTEM'\n"); + ctxt->errno = XML_ERR_SPACE_REQUIRED; ctxt->wellFormed = 0; } SKIP_BLANKS; @@ -2692,6 +2775,7 @@ xmlParseExternalID(xmlParserCtxtPtr ctxt, CHAR **publicID, int strict) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "xmlParseExternalID: SYSTEM, no URI\n"); + ctxt->errno = XML_ERR_URI_REQUIRED; ctxt->wellFormed = 0; } } else if ((CUR == 'P') && (NXT(1) == 'U') && @@ -2702,6 +2786,7 @@ xmlParseExternalID(xmlParserCtxtPtr ctxt, CHAR **publicID, int strict) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Space required after 'PUBLIC'\n"); + ctxt->errno = XML_ERR_SPACE_REQUIRED; ctxt->wellFormed = 0; } SKIP_BLANKS; @@ -2710,6 +2795,7 @@ xmlParseExternalID(xmlParserCtxtPtr ctxt, CHAR **publicID, int strict) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "xmlParseExternalID: PUBLIC, no Public Identifier\n"); + ctxt->errno = XML_ERR_PUBID_REQUIRED; ctxt->wellFormed = 0; } if (strict) { @@ -2720,6 +2806,7 @@ xmlParseExternalID(xmlParserCtxtPtr ctxt, CHAR **publicID, int strict) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Space required after the Public Identifier\n"); + ctxt->errno = XML_ERR_SPACE_REQUIRED; ctxt->wellFormed = 0; } } else { @@ -2740,6 +2827,7 @@ xmlParseExternalID(xmlParserCtxtPtr ctxt, CHAR **publicID, int strict) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "xmlParseExternalID: PUBLIC, no URI\n"); + ctxt->errno = XML_ERR_URI_REQUIRED; ctxt->wellFormed = 0; } } @@ -2782,13 +2870,16 @@ xmlParseComment(xmlParserCtxtPtr ctxt) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Comment must not contain '--' (double-hyphen)`\n"); + ctxt->errno = XML_ERR_HYPHEN_IN_COMMENT; ctxt->wellFormed = 0; } NEXT;r++;q++; } if (!IS_CHAR(CUR)) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, "Comment not terminated \n