From 6077d03d0ee4774446e30a1b4017e9fffa020923 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Sat, 9 Oct 1999 09:11:45 +0000 Subject: [PATCH] Various small bugfixes, Daniel. --- ChangeLog | 7 +++++++ Makefile.am | 1 + include/libxml/tree.h | 44 +++++++++++++++++++++---------------------- parser.c | 11 ++++------- tester.c | 3 ++- tree.h | 44 +++++++++++++++++++++---------------------- 6 files changed, 58 insertions(+), 52 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3ead3d8b..02075e73 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Sat Oct 9 11:02:57 CEST 1999 Daniel Veillard + + * Makefile.am: Arturo patch for xmlConf.sh version info + * parser.c: Tim Josling patch for single quoted items + * tester.c: Tim Josling patch for tester options usage + * tree.h: indent cleanup + Fri Oct 8 16:35:37 CEST 1999 Daniel Veillard * HTMLparser.c parser.h : Fixed problems with HTML parsing diff --git a/Makefile.am b/Makefile.am index 83a5c20d..52dd27b8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -259,5 +259,6 @@ xmlConf.sh: xmlConf.sh.in Makefile sed -e 's?\@XML_LIBDIR\@?$(XML_LIBDIR)?g' \ -e 's?\@XML_INCLUDEDIR\@?$(XML_INCLUDEDIR)?g' \ -e 's?\@XML_LIBS\@?$(XML_LIBS)?g' \ + -e 's?\@VERSION\@?$(VERSION)?g' \ < $(srcdir)/xmlConf.sh.in > xmlConf.tmp \ && mv xmlConf.tmp xmlConf.sh diff --git a/include/libxml/tree.h b/include/libxml/tree.h index bd29083e..6c7e795a 100644 --- a/include/libxml/tree.h +++ b/include/libxml/tree.h @@ -99,17 +99,17 @@ typedef enum { typedef struct xmlEnumeration { struct xmlEnumeration *next; /* next one */ - const xmlChar *name; /* Enumeration name */ + const xmlChar *name; /* Enumeration name */ } xmlEnumeration; typedef xmlEnumeration *xmlEnumerationPtr; typedef struct xmlAttribute { - const xmlChar *elem; /* Element holding the attribute */ - const xmlChar *name; /* Attribute name */ + const xmlChar *elem; /* Element holding the attribute */ + const xmlChar *name; /* Attribute name */ struct xmlAttribute *next; /* list of attributes of an element */ xmlAttributeType type; /* The type */ xmlAttributeDefault def; /* the default */ - const xmlChar *defaultValue;/* or the default value */ + const xmlChar *defaultValue;/* or the default value */ xmlEnumerationPtr tree; /* or the enumeration tree if any */ } xmlAttribute; typedef xmlAttribute *xmlAttributePtr; @@ -134,7 +134,7 @@ typedef enum { typedef struct xmlElementContent { xmlElementContentType type; /* PCDATA, ELEMENT, SEQ or OR */ xmlElementContentOccur ocur; /* ONCE, OPT, MULT or PLUS */ - const xmlChar *name; /* Element name */ + const xmlChar *name; /* Element name */ struct xmlElementContent *c1; /* first child */ struct xmlElementContent *c2; /* second child */ } xmlElementContent; @@ -148,7 +148,7 @@ typedef enum { } xmlElementTypeVal; typedef struct xmlElement { - const xmlChar *name; /* Element name */ + const xmlChar *name; /* Element name */ xmlElementTypeVal type; /* The type */ xmlElementContentPtr content; /* the allowed element content */ xmlAttributePtr attributes; /* List of the declared attributes */ @@ -169,8 +169,8 @@ typedef enum { typedef struct xmlNs { struct xmlNs *next; /* next Ns link for this node */ xmlNsType type; /* global or local */ - const xmlChar *href; /* URL for the namespace */ - const xmlChar *prefix; /* prefix for the namespace */ + const xmlChar *href; /* URL for the namespace */ + const xmlChar *prefix; /* prefix for the namespace */ } xmlNs; typedef xmlNs *xmlNsPtr; @@ -178,9 +178,9 @@ typedef xmlNs *xmlNsPtr; * An XML DtD, as defined by node link */ struct xmlAttr *next; /* attribute list link */ - const xmlChar *name; /* the name of the property */ + const xmlChar *name; /* the name of the property */ struct xmlNode *val; /* the value of the property */ xmlNs *ns; /* pointer to the associated namespace */ } xmlAttr; @@ -212,7 +212,7 @@ typedef xmlAttr *xmlAttrPtr; typedef struct xmlID { struct xmlID *next; /* next ID */ - const xmlChar *value; /* The ID name */ + const xmlChar *value; /* The ID name */ xmlAttrPtr attr; /* The attribut holding it */ } xmlID; typedef xmlID *xmlIDPtr; @@ -223,7 +223,7 @@ typedef xmlID *xmlIDPtr; typedef struct xmlRef { struct xmlRef *next; /* next Ref */ - const xmlChar *value; /* The Ref name */ + const xmlChar *value; /* The Ref name */ xmlAttrPtr attr; /* The attribut holding it */ } xmlRef; typedef xmlRef *xmlRefPtr; @@ -244,10 +244,10 @@ typedef struct xmlNode { struct xmlNode *childs; /* parent->childs link */ struct xmlNode *last; /* last child link */ struct xmlAttr *properties; /* properties list */ - const xmlChar *name; /* the name of the node, or the entity */ + const xmlChar *name; /* the name of the node, or the entity */ xmlNs *ns; /* pointer to the associated namespace */ xmlNs *nsDef; /* namespace definitions on this node */ - xmlChar *content; /* the content */ + xmlChar *content; /* the content */ } _xmlNode; typedef _xmlNode xmlNode; typedef _xmlNode *xmlNodePtr; @@ -262,8 +262,8 @@ typedef struct xmlDoc { #endif xmlElementType type; /* XML_DOCUMENT_NODE, must be second ! */ char *name; /* name/filename/URI of the document */ - const xmlChar *version; /* the XML version string */ - const xmlChar *encoding; /* encoding, if any */ + const xmlChar *version; /* the XML version string */ + const xmlChar *encoding; /* encoding, if any */ int compression;/* level of zlib compression */ int standalone; /* standalone document (no external refs) */ struct xmlDtd *intSubset; /* the document internal subset */ @@ -333,7 +333,7 @@ xmlNsPtr xmlNewNs (xmlNodePtr node, const xmlChar *href, const xmlChar *prefix); void xmlFreeNs (xmlNsPtr cur); -xmlDocPtr xmlNewDoc (const xmlChar *version); +xmlDocPtr xmlNewDoc (const xmlChar *version); void xmlFreeDoc (xmlDocPtr cur); xmlAttrPtr xmlNewDocProp (xmlDocPtr doc, const xmlChar *name, @@ -434,14 +434,14 @@ xmlNsPtr xmlCopyNamespaceList (xmlNsPtr cur); xmlAttrPtr xmlSetProp (xmlNodePtr node, const xmlChar *name, const xmlChar *value); -xmlChar * xmlGetProp (xmlNodePtr node, +xmlChar * xmlGetProp (xmlNodePtr node, const xmlChar *name); xmlNodePtr xmlStringGetNodeList (xmlDocPtr doc, const xmlChar *value); xmlNodePtr xmlStringLenGetNodeList (xmlDocPtr doc, const xmlChar *value, int len); -xmlChar * xmlNodeListGetString (xmlDocPtr doc, +xmlChar * xmlNodeListGetString (xmlDocPtr doc, xmlNodePtr list, int inLine); void xmlNodeSetContent (xmlNodePtr cur, @@ -454,7 +454,7 @@ void xmlNodeAddContent (xmlNodePtr cur, void xmlNodeAddContentLen (xmlNodePtr cur, const xmlChar *content, int len); -xmlChar * xmlNodeGetContent (xmlNodePtr cur); +xmlChar * xmlNodeGetContent (xmlNodePtr cur); const xmlChar * xmlNodeGetLang (xmlNodePtr cur); void xmlNodeSetLang (xmlNodePtr cur, const xmlChar *lang); diff --git a/parser.c b/parser.c index 774a9935..ce1d1fa7 100644 --- a/parser.c +++ b/parser.c @@ -2615,9 +2615,7 @@ xmlChar * xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) { const xmlChar *q; xmlChar *ret = NULL; - /* - * Name ::= (Letter | '_') (NameChar)* - */ + SHRINK; if (CUR == '"') { NEXT; @@ -2635,10 +2633,9 @@ xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) { } else if (CUR == '\'') { NEXT; q = CUR_PTR; - while ((IS_LETTER(CUR)) && (CUR != '\'')) - NEXT; - if (!IS_LETTER(CUR)) { - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) + while (IS_PUBIDCHAR(CUR)) NEXT; + 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; diff --git a/tester.c b/tester.c index 1357eca6..cff492c8 100644 --- a/tester.c +++ b/tester.c @@ -228,7 +228,7 @@ int main(int argc, char **argv) { } } if (files == 0) { - printf("Usage : %s [--debug] [--copy] [--recover] [--noent] [--noout] XMLfiles ...\n", + printf("Usage : %s [--debug] [--copy] [--recover] [--noent] [--noout] [--valid] [--repeat] XMLfiles ...\n", argv[0]); printf("\tParse the XML files and output the result of the parsing\n"); printf("\t--debug : dump a debug tree of the in-memory document\n"); @@ -236,6 +236,7 @@ int main(int argc, char **argv) { printf("\t--recover : output what is parsable on broken XmL documents\n"); printf("\t--noent : substitute entity references by their value\n"); printf("\t--noout : don't output the result\n"); + printf("\t--valid : validate the document in addition to std well-formed check\n"); printf("\t--repeat : parse the file 100 times, for timing or profiling\n"); } xmlMemoryDump(); diff --git a/tree.h b/tree.h index bd29083e..6c7e795a 100644 --- a/tree.h +++ b/tree.h @@ -99,17 +99,17 @@ typedef enum { typedef struct xmlEnumeration { struct xmlEnumeration *next; /* next one */ - const xmlChar *name; /* Enumeration name */ + const xmlChar *name; /* Enumeration name */ } xmlEnumeration; typedef xmlEnumeration *xmlEnumerationPtr; typedef struct xmlAttribute { - const xmlChar *elem; /* Element holding the attribute */ - const xmlChar *name; /* Attribute name */ + const xmlChar *elem; /* Element holding the attribute */ + const xmlChar *name; /* Attribute name */ struct xmlAttribute *next; /* list of attributes of an element */ xmlAttributeType type; /* The type */ xmlAttributeDefault def; /* the default */ - const xmlChar *defaultValue;/* or the default value */ + const xmlChar *defaultValue;/* or the default value */ xmlEnumerationPtr tree; /* or the enumeration tree if any */ } xmlAttribute; typedef xmlAttribute *xmlAttributePtr; @@ -134,7 +134,7 @@ typedef enum { typedef struct xmlElementContent { xmlElementContentType type; /* PCDATA, ELEMENT, SEQ or OR */ xmlElementContentOccur ocur; /* ONCE, OPT, MULT or PLUS */ - const xmlChar *name; /* Element name */ + const xmlChar *name; /* Element name */ struct xmlElementContent *c1; /* first child */ struct xmlElementContent *c2; /* second child */ } xmlElementContent; @@ -148,7 +148,7 @@ typedef enum { } xmlElementTypeVal; typedef struct xmlElement { - const xmlChar *name; /* Element name */ + const xmlChar *name; /* Element name */ xmlElementTypeVal type; /* The type */ xmlElementContentPtr content; /* the allowed element content */ xmlAttributePtr attributes; /* List of the declared attributes */ @@ -169,8 +169,8 @@ typedef enum { typedef struct xmlNs { struct xmlNs *next; /* next Ns link for this node */ xmlNsType type; /* global or local */ - const xmlChar *href; /* URL for the namespace */ - const xmlChar *prefix; /* prefix for the namespace */ + const xmlChar *href; /* URL for the namespace */ + const xmlChar *prefix; /* prefix for the namespace */ } xmlNs; typedef xmlNs *xmlNsPtr; @@ -178,9 +178,9 @@ typedef xmlNs *xmlNsPtr; * An XML DtD, as defined by node link */ struct xmlAttr *next; /* attribute list link */ - const xmlChar *name; /* the name of the property */ + const xmlChar *name; /* the name of the property */ struct xmlNode *val; /* the value of the property */ xmlNs *ns; /* pointer to the associated namespace */ } xmlAttr; @@ -212,7 +212,7 @@ typedef xmlAttr *xmlAttrPtr; typedef struct xmlID { struct xmlID *next; /* next ID */ - const xmlChar *value; /* The ID name */ + const xmlChar *value; /* The ID name */ xmlAttrPtr attr; /* The attribut holding it */ } xmlID; typedef xmlID *xmlIDPtr; @@ -223,7 +223,7 @@ typedef xmlID *xmlIDPtr; typedef struct xmlRef { struct xmlRef *next; /* next Ref */ - const xmlChar *value; /* The Ref name */ + const xmlChar *value; /* The Ref name */ xmlAttrPtr attr; /* The attribut holding it */ } xmlRef; typedef xmlRef *xmlRefPtr; @@ -244,10 +244,10 @@ typedef struct xmlNode { struct xmlNode *childs; /* parent->childs link */ struct xmlNode *last; /* last child link */ struct xmlAttr *properties; /* properties list */ - const xmlChar *name; /* the name of the node, or the entity */ + const xmlChar *name; /* the name of the node, or the entity */ xmlNs *ns; /* pointer to the associated namespace */ xmlNs *nsDef; /* namespace definitions on this node */ - xmlChar *content; /* the content */ + xmlChar *content; /* the content */ } _xmlNode; typedef _xmlNode xmlNode; typedef _xmlNode *xmlNodePtr; @@ -262,8 +262,8 @@ typedef struct xmlDoc { #endif xmlElementType type; /* XML_DOCUMENT_NODE, must be second ! */ char *name; /* name/filename/URI of the document */ - const xmlChar *version; /* the XML version string */ - const xmlChar *encoding; /* encoding, if any */ + const xmlChar *version; /* the XML version string */ + const xmlChar *encoding; /* encoding, if any */ int compression;/* level of zlib compression */ int standalone; /* standalone document (no external refs) */ struct xmlDtd *intSubset; /* the document internal subset */ @@ -333,7 +333,7 @@ xmlNsPtr xmlNewNs (xmlNodePtr node, const xmlChar *href, const xmlChar *prefix); void xmlFreeNs (xmlNsPtr cur); -xmlDocPtr xmlNewDoc (const xmlChar *version); +xmlDocPtr xmlNewDoc (const xmlChar *version); void xmlFreeDoc (xmlDocPtr cur); xmlAttrPtr xmlNewDocProp (xmlDocPtr doc, const xmlChar *name, @@ -434,14 +434,14 @@ xmlNsPtr xmlCopyNamespaceList (xmlNsPtr cur); xmlAttrPtr xmlSetProp (xmlNodePtr node, const xmlChar *name, const xmlChar *value); -xmlChar * xmlGetProp (xmlNodePtr node, +xmlChar * xmlGetProp (xmlNodePtr node, const xmlChar *name); xmlNodePtr xmlStringGetNodeList (xmlDocPtr doc, const xmlChar *value); xmlNodePtr xmlStringLenGetNodeList (xmlDocPtr doc, const xmlChar *value, int len); -xmlChar * xmlNodeListGetString (xmlDocPtr doc, +xmlChar * xmlNodeListGetString (xmlDocPtr doc, xmlNodePtr list, int inLine); void xmlNodeSetContent (xmlNodePtr cur, @@ -454,7 +454,7 @@ void xmlNodeAddContent (xmlNodePtr cur, void xmlNodeAddContentLen (xmlNodePtr cur, const xmlChar *content, int len); -xmlChar * xmlNodeGetContent (xmlNodePtr cur); +xmlChar * xmlNodeGetContent (xmlNodePtr cur); const xmlChar * xmlNodeGetLang (xmlNodePtr cur); void xmlNodeSetLang (xmlNodePtr cur, const xmlChar *lang);