From a37aab845c29de6c8292ffd502f6719da60efca0 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Mon, 9 Jun 2003 09:10:36 +0000 Subject: [PATCH] applied a patch from Gman for building docs applied a patch from Gary * doc/*: applied a patch from Gman for building docs * valid.c xmllint.c include/libxml/valid.h: applied a patch from Gary Pennington to provide an allocator for xmlValidCtxt * xmlreader.c: applied patch from Jacek Konieczny fixing bug #113580 about data not being passed immediately. Daniel --- ChangeLog | 8 + doc/Makefile.am | 8 +- doc/bugs.html | 12 +- doc/libxml2-api.xml | 727 +++++++++++++++++------------------------ doc/xml.html | 12 +- include/libxml/valid.h | 4 + valid.c | 30 ++ xmllint.c | 36 +- xmlreader.c | 2 + 9 files changed, 382 insertions(+), 457 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2b194a50..c03b92a6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Mon Jun 9 11:06:09 CEST 2003 Daniel Veillard + + * doc/*: applied a patch from Gman for building docs + * valid.c xmllint.c include/libxml/valid.h: applied a patch from + Gary Pennington to provide an allocator for xmlValidCtxt + * xmlreader.c: applied patch from Jacek Konieczny fixing bug + #113580 about data not being passed immediately. + Thu Jun 5 11:31:02 CEST 2003 Daniel Veillard * tree.c: applied a couple of patches from Mark Itzcovitz diff --git a/doc/Makefile.am b/doc/Makefile.am index 77c68453..b791d5c5 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -56,14 +56,14 @@ xmlcatalog.1: xmlcatalog_man.xml -@(xsltproc --nonet xmlcatalog_man.xml) scan: - -gtkdoc-scan --module=libxml --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="acconfig.h config.h win32config.h trio.h triostr.h triop.h config-mac.h XMLTestPrefix2.h XMLTestPrefix.h triodef.h trionan.h xlink.h libxml.h libxml2-py.h libxml_wrap.h" + -gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="acconfig.h config.h win32config.h trio.h triostr.h triop.h config-mac.h XMLTestPrefix2.h XMLTestPrefix.h triodef.h trionan.h xlink.h libxml.h libxml2-py.h libxml_wrap.h" templates: scan - -gtkdoc-mktmpl --module=libxml + -gtkdoc-mktmpl --module=$(DOC_MODULE) xml: templates if test -d xml ; then rm xml/* ; else mkdir xml ; fi - -gtkdoc-mkdb --module=libxml --source-dir=$(DOC_SOURCE_DIR) --output-format=xml --main-sgml-file=$(DOC_MAIN_XML_FILE) + -gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --output-format=xml --main-sgml-file=$(DOC_MAIN_XML_FILE) libxml2-api.xml: apibuild.py ../include/libxml/*.h @@ -93,7 +93,7 @@ install-data-local: -@INSTALL@ -m 0644 $(srcdir)/xml.html $(srcdir)/encoding.html $(srcdir)/FAQ.html $(srcdir)/structure.gif $(srcdir)/DOM.gif $(srcdir)/smallfootonly.gif $(srcdir)/redhat.gif $(srcdir)/libxml.gif $(srcdir)/w3c.png $(srcdir)/Libxml2-Logo-180x168.gif $(srcdir)/Libxml2-Logo-90x34.gif $(DESTDIR)$(TARGET_DIR) -@INSTALL@ -m 0644 $(srcdir)/html/*.html $(DESTDIR)$(TARGET_DIR) -@INSTALL@ -m 0644 $(srcdir)/html/index.sgml $(DESTDIR)$(TARGET_DIR) - -(cd $(DESTDIR); gtkdoc-fixxref --module=libxml --html-dir=$(HTML_DIR)) + -(cd $(DESTDIR); gtkdoc-fixxref --module=$(DOC_MODULE) --html-dir=$(HTML_DIR)) -@(tar cf - tutorial | (cd $(DESTDIR)$(TARGET_DIR) && tar xvf -)) .PHONY : html xml templates scan diff --git a/doc/bugs.html b/doc/bugs.html index 5dc68501..533fd4c0 100644 --- a/doc/bugs.html +++ b/doc/bugs.html @@ -17,7 +17,7 @@ please visit the associated follow the instructions. Do not send code, I won't debug it (but patches are really appreciated!).

Check the following before posting:

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

To be really clear about support:

  • Support or help request MUST be sent to +answer a given question, ask on the list.

    To be really clear about support:

    • Support or help requests MUST be sent to the list or on bugzilla in case of problems, so that the Question and Answers can be shared publicly. Failing to do so carries the implicit message "I want free support but I don't want to share the benefits with others" and is not welcome. I will automatically Carbon-Copy the xml@gnome.org mailing list for any technical reply made about libxml2 or libxslt.
    • -
    • There is no garantee for support, +
    • There is no garantee of support, if your question remains unanswered after a week, repost it, making sure - you gave all the detail needed and the informations requested.
    • -
    • Failing to provide informations as requested or double checking first + you gave all the detail needed and the information requested.
    • +
    • Failing to provide information as requested or double checking first for prior feedback also carries the implicit message "the time of the library maintainers is less valuable than my time" and might not be welcome.
    • diff --git a/doc/libxml2-api.xml b/doc/libxml2-api.xml index 16ac1508..d9e080f5 100644 --- a/doc/libxml2-api.xml +++ b/doc/libxml2-api.xml @@ -61,141 +61,47 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -736,142 +642,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1504,6 +1274,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1588,166 +1476,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -2202,6 +1930,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3545,6 +3409,7 @@ actually an xmlCharEncoding'/> + diff --git a/doc/xml.html b/doc/xml.html index 43b49cb8..ad288ef8 100644 --- a/doc/xml.html +++ b/doc/xml.html @@ -501,7 +501,7 @@ follow the instructions. Do not send code, I won't debug it posting:

      -

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

      To be really clear about support:

        -
      • Support or help request MUST be sent to +
      • Support or help requests MUST be sent to the list or on bugzilla in case of problems, so that the Question and Answers can be shared publicly. Failing to do so carries the implicit message "I want free support but I don't want to share the benefits with others" and is not welcome. I will automatically Carbon-Copy the xml@gnome.org mailing list for any technical reply made about libxml2 or libxslt.
      • -
      • There is no garantee for support, +
      • There is no garantee of support, if your question remains unanswered after a week, repost it, making sure - you gave all the detail needed and the informations requested.
      • -
      • Failing to provide informations as requested or double checking first + you gave all the detail needed and the information requested.
      • +
      • Failing to provide information as requested or double checking first for prior feedback also carries the implicit message "the time of the library maintainers is less valuable than my time" and might not be welcome.
      • diff --git a/include/libxml/valid.h b/include/libxml/valid.h index 4b4f40d2..14234e8a 100644 --- a/include/libxml/valid.h +++ b/include/libxml/valid.h @@ -127,6 +127,10 @@ typedef xmlIDTable *xmlIDTablePtr; typedef struct _xmlHashTable xmlRefTable; typedef xmlRefTable *xmlRefTablePtr; +/* Allocate/Release Validation Contexts */ +xmlValidCtxtPtr xmlNewValidCtxt(void); +void xmlFreeValidCtxt(xmlValidCtxtPtr); + /* Notation */ xmlNotationPtr xmlAddNotationDecl (xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, diff --git a/valid.c b/valid.c index 77e7b874..b99e8c5a 100644 --- a/valid.c +++ b/valid.c @@ -680,6 +680,36 @@ xmlValidBuildContentModel(xmlValidCtxtPtr ctxt, xmlElementPtr elem) { * * ****************************************************************/ +/** + * xmlNewValidCtxt: + * + * Allocate a validation context structure. + * + * Returns NULL if not, otherwise the new validation context structure + */ +xmlValidCtxtPtr +xmlNewValidCtxt(void) { + xmlValidCtxtPtr ret; + + if ((ret = xmlMalloc(sizeof (xmlValidCtxt))) == NULL) + return (NULL); + + (void) memset(ret, 0, sizeof (xmlValidCtxt)); + + return (ret); +} + +/** + * xmlFreeValidCtxt: + * @cur: the validation context to free + * + * Free a validation context structure. + */ +void +xmlFreeValidCtxt(xmlValidCtxtPtr cur) { + xmlFree(cur); +} + /** * xmlNewElementContent: * @name: the subelement name or NULL diff --git a/xmllint.c b/xmllint.c index 1a871155..df5e51fa 100644 --- a/xmllint.c +++ b/xmllint.c @@ -1081,14 +1081,21 @@ static void parseAndPrintFile(char *filename) { "Could not parse DTD %s\n", dtdvalid); progresult = 2; } else { - xmlValidCtxt cvp; + xmlValidCtxtPtr cvp; + + if ((cvp = xmlNewValidCtxt()) == NULL) { + xmlGenericError(xmlGenericErrorContext, + "Couldn't allocate validation context\n"); + exit(-1); + } + cvp->userData = (void *) stderr; + cvp->error = (xmlValidityErrorFunc) fprintf; + cvp->warning = (xmlValidityWarningFunc) fprintf; + if ((timing) && (!repeat)) { startTimer(); } - cvp.userData = (void *) stderr; - cvp.error = (xmlValidityErrorFunc) fprintf; - cvp.warning = (xmlValidityWarningFunc) fprintf; - if (!xmlValidateDtd(&cvp, doc, dtd)) { + if (!xmlValidateDtd(cvp, doc, dtd)) { xmlGenericError(xmlGenericErrorContext, "Document %s does not validate against %s\n", filename, dtdvalid); @@ -1097,17 +1104,25 @@ static void parseAndPrintFile(char *filename) { if ((timing) && (!repeat)) { endTimer("Validating against DTD"); } + xmlFreeValidCtxt(cvp); xmlFreeDtd(dtd); } } else if (postvalid) { - xmlValidCtxt cvp; + xmlValidCtxtPtr cvp; + + if ((cvp = xmlNewValidCtxt()) == NULL) { + xmlGenericError(xmlGenericErrorContext, + "Couldn't allocate validation context\n"); + exit(-1); + } + if ((timing) && (!repeat)) { startTimer(); } - cvp.userData = (void *) stderr; - cvp.error = (xmlValidityErrorFunc) fprintf; - cvp.warning = (xmlValidityWarningFunc) fprintf; - if (!xmlValidateDocument(&cvp, doc)) { + cvp->userData = (void *) stderr; + cvp->error = (xmlValidityErrorFunc) fprintf; + cvp->warning = (xmlValidityWarningFunc) fprintf; + if (!xmlValidateDocument(cvp, doc)) { xmlGenericError(xmlGenericErrorContext, "Document %s does not validate\n", filename); progresult = 3; @@ -1115,6 +1130,7 @@ static void parseAndPrintFile(char *filename) { if ((timing) && (!repeat)) { endTimer("Validating"); } + xmlFreeValidCtxt(cvp); #ifdef LIBXML_SCHEMAS_ENABLED } else if (relaxngschemas != NULL) { xmlRelaxNGValidCtxtPtr ctxt; diff --git a/xmlreader.c b/xmlreader.c index 4d371650..20ff7530 100644 --- a/xmlreader.c +++ b/xmlreader.c @@ -688,6 +688,8 @@ xmlTextReaderDoExpand(xmlTextReaderPtr reader) { do { if (xmlTextReaderGetSuccessor(reader->node) != NULL) return(1); + if (reader->ctxt->nodeNr <= reader->depth) + return(1); if (reader->mode == XML_TEXTREADER_MODE_EOF) return(1); val = xmlTextReaderPushData(reader);