From e356c280069914f0052891861a55fdfaff6dcf65 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Sat, 10 Mar 2001 12:32:04 +0000 Subject: [PATCH] Preparing for 2.3.4 release: - configure.in: bumped to 2.3.4 - error.c: fixed bug #51860 - tree.c: fixed bug #51861 - valid.c: cleanup, more debug, failed to fix one bug crap ... - tree.[ch] : added xmlDefaultBufferSize - nanoftp.c: typo in function name header block - doc/xml.html : updated, added link to XML::LibXSLT - doc/html/* : rebuilt the docs Daniel --- ChangeLog | 11 + configure.in | 2 +- doc/html/index.sgml | 5 + doc/html/libxml-debugxml.html | 40 +- doc/html/libxml-encoding.html | 52 +-- doc/html/libxml-entities.html | 48 +-- doc/html/libxml-htmlparser.html | 72 ++-- doc/html/libxml-htmltree.html | 36 +- doc/html/libxml-nanoftp.html | 56 +-- doc/html/libxml-nanohttp.html | 30 +- doc/html/libxml-parser.html | 1 + doc/html/libxml-parserinternals.html | 230 +++++------ doc/html/libxml-tree.html | 352 +++++++++-------- doc/html/libxml-uri.html | 32 +- doc/html/libxml-valid.html | 134 +++---- doc/html/libxml-xinclude.html | 10 +- doc/html/libxml-xmlio.html | 88 ++--- doc/html/libxml-xmlmemory.html | 125 ++++-- doc/html/libxml-xpath.html | 76 ++-- doc/html/libxml-xpathinternals.html | 548 ++++++++++++++++++++++----- doc/html/libxml-xpointer.html | 26 +- doc/xml.html | 31 +- error.c | 56 ++- include/libxml/tree.h | 3 +- nanoftp.c | 3 +- tree.c | 33 +- tree.h | 3 +- valid.c | 116 ++++-- 28 files changed, 1420 insertions(+), 799 deletions(-) diff --git a/ChangeLog b/ChangeLog index 83c07618..5dac6b29 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Sat Mar 10 13:09:53 CET 2001 Daniel Veillard + + * configure.in: bumped to 2.3.4 + * error.c: fixed bug #51860 + * tree.c: fixed bug #51861 + * valid.c: cleanup, more debug, failed to fix one bug crap ... + * tree.[ch] : added xmlDefaultBufferSize + * nanoftp.c: typo in function name header block + * doc/xml.html : updated, added link to XML::LibXSLT + * doc/html/* : rebuilt the docs + Wed Mar 7 20:43:47 CET 2001 Daniel Veillard * parser.c SAX.c: the new content parsing code raised an diff --git a/configure.in b/configure.in index bad0f2c1..c0ea92bd 100644 --- a/configure.in +++ b/configure.in @@ -6,7 +6,7 @@ AC_CANONICAL_HOST LIBXML_MAJOR_VERSION=2 LIBXML_MINOR_VERSION=3 -LIBXML_MICRO_VERSION=3 +LIBXML_MICRO_VERSION=4 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 diff --git a/doc/html/index.sgml b/doc/html/index.sgml index d672ff31..b8e26454 100644 --- a/doc/html/index.sgml +++ b/doc/html/index.sgml @@ -148,6 +148,7 @@ + @@ -552,6 +553,9 @@ + + + @@ -820,6 +824,7 @@ + diff --git a/doc/html/libxml-debugxml.html b/doc/html/libxml-debugxml.html index 7742e48e..68d3e003 100644 --- a/doc/html/libxml-debugxml.html +++ b/doc/html/libxml-debugxml.html @@ -121,7 +121,7 @@ NAME="LIBXML-DEBUGXML" >

Name

Synopsis

Description

Details
















Name

Synopsis

Description

Details






















Name

Synopsis

Description

Details




















Name

Synopsis

Description

Details
































Name

Synopsis

Description

Details














Name

Synopsis

Description

Details























Name

Synopsis

Description

Details











Name

Synopsis

Description

Details















































































































+#define XML_XML_NAMESPACE enum xmlElementType

Description

Details

XML_XML_NAMESPACE

#define     XML_XML_NAMESPACE





















































the buffer to resize the buffer




the external ID the external (PUBLIC) ID























































the namespace string the namespace prefix













































Name

Synopsis

Description

Details












Name

Synopsis

Description

Details































































Name

Synopsis

Description

Details

Name

Synopsis

Description

Details








































Name

Synopsis

MEM_LIST +#define MEM_CLEANUP (p,l) void (*xmlFreeFunc

Description

Details



MEM_CLEANUP()

#define     MEM_CLEANUP(p,l)

p : 
l :


















Name

Synopsis

Description

Details


































Name

Synopsis

xmlXPathParserContextPtr ctxt); +xmlNodePtr xmlXPathNextPreceding (xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +xmlNodePtr xmlXPathNextAncestor (xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +xmlNodePtr xmlXPathNextPrecedingSibling (xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); void xmlXPathLastFunction

Description

Details



































































xmlXPathNextPreceding ()

xmlNodePtr  xmlXPathNextPreceding           (xmlXPathParserContextPtr ctxt,
+                                             xmlNodePtr cur);

Traversal function for the "preceding" direction +the preceding axis contains all nodes in the same document as the context +node that are before the context node in document order, excluding any +ancestors and excluding attribute nodes and namespace nodes; the nodes are +ordered in reverse document order

ctxt : the XPath Parser context
cur : the current node in the traversal
Returns :the next element following that axis


xmlXPathNextAncestor ()

xmlNodePtr  xmlXPathNextAncestor            (xmlXPathParserContextPtr ctxt,
+                                             xmlNodePtr cur);

Traversal function for the "ancestor" direction +the ancestor axis contains the ancestors of the context node; the ancestors +of the context node consist of the parent of context node and the parent's +parent and so on; the nodes are ordered in reverse document order; thus the +parent is the first node on the axis, and the parent's parent is the second +node on the axis

ctxt : the XPath Parser context
cur : the current node in the traversal
Returns :the next element following that axis


xmlXPathNextPrecedingSibling ()

xmlNodePtr  xmlXPathNextPrecedingSibling    (xmlXPathParserContextPtr ctxt,
+                                             xmlNodePtr cur);

Traversal function for the "preceding-sibling" direction +The preceding-sibling axis contains the preceding siblings of the context +node in reverse document order; the first preceding sibling is first on the +axis; the sibling preceding that node is the second on the axis and so on.

ctxt : the XPath Parser context
cur : the current node in the traversal
Returns :the next element following that axis

























Name

Synopsis

Description

Details









The XML C library for Gnome @@ -241,6 +239,22 @@ you want to test those

docs +

2.3.4: Mar 10 2001

+
    +
  • Fixed bugs #51860 and #51861
  • +
  • Added a global variable xmlDefaultBufferSize to allow default buffer + size to be application tunable.
  • +
  • Some cleanup in the validation code, still a bug left and this part + should probably be rewritten to support ambiguous content model :-\
  • +
  • Fix a couple of serious bugs introduced or raised by changes in 2.3.3 + parser
  • +
  • Fixed another bug in xmlNodeGetContent()
  • +
  • Bjorn fixed XPath node collection and Number formatting
  • +
  • Fixed a loop reported in the HTML parsing
  • +
  • blank space are reported even if the Dtd content model proves that they + are formatting spaces, this is for XmL conformance
  • +
+

2.3.3: Mar 1 2001

  • small change in XPath for XSLT
  • @@ -465,8 +479,9 @@ you want to test those

    2.0.0beta: Mar 14 2000

    • This is a first Beta release of libxml version 2
    • -
    • It's available only fromxmlsoft.org FTP, it's packaged as libxml2-2.0.0beta and available as - tar and RPMs
    • +
    • It's available only fromxmlsoft.org + FTP, it's packaged as libxml2-2.0.0beta and available as tar and + RPMs
    • This version is now the head in the Gnome CVS base, the old one is available under the tag LIB_XML_1_X
    • This includes a very large set of changes. Froma programmatic point of @@ -1441,6 +1456,12 @@ Gnome CVS base under gnome-xml/example

      http://www.ce.berkeley.edu/~doolin/code/libxmlwin32/

    • +
    • Matt + Sergeant developped XML::LibXSLT, a perl wrapper for + libxml2/libxslt as part of the AxKit XML + application server
    • Felix Natter provided an emacs module to lookup libxml functions documentation
    • @@ -1453,6 +1474,6 @@ Gnome CVS base under gnome-xml/example

      Daniel Veillard

      -

      $Id: xml.html,v 1.72 2001/03/07 09:31:47 veillard Exp $

      +

      $Id: xml.html,v 1.73 2001/03/07 09:44:02 veillard Exp $

      diff --git a/error.c b/error.c index cf76016f..26747382 100644 --- a/error.c +++ b/error.c @@ -16,6 +16,7 @@ #include #include #include +#include /************************************************************************ * * @@ -136,6 +137,50 @@ xmlParserPrintFileContext(xmlParserInputPtr input) { xmlGenericError(xmlGenericErrorContext,"^\n"); } +/** + * xmlGetVarStr: + * @msg: the message format + * @args: a va_list argument list + * + * SGS contribution + * Get an arbitrary-sized string for an error argument + * The caller must free() the returned string + */ +char * +xmlGetVarStr(const char * msg, va_list args) { + int size; + int length; + int chars, left; + char *str, *larger; + + str = (char *) xmlMalloc(100); + if (str == NULL) + return(NULL); + + size = 100; + length = 0; + + while (1) { // From the man page for vsnprintf .... + left = size - length; + /* Try to print in the allocated space. */ + chars = vsnprintf(str + length, left, msg, args); + /* If that worked, we're done. */ + if ((chars > -1) && (chars < left )) + break; + /* Else try again with more space. */ + if (chars > -1) /* glibc 2.1 */ + size += chars + 1; /* precisely what is needed */ + else /* glibc 2.0 */ + size += 100; + if ((larger = (char *) xmlRealloc(str, size)) == NULL) { + xmlFree(str); + return(NULL); + } + str = larger; + } + return(str); +} + /** * xmlParserError: * @ctx: an XML parser context @@ -151,6 +196,7 @@ xmlParserError(void *ctx, const char *msg, ...) xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlParserInputPtr input = NULL; xmlParserInputPtr cur = NULL; + char * str; va_list args; if (ctxt != NULL) { @@ -165,8 +211,10 @@ xmlParserError(void *ctx, const char *msg, ...) xmlGenericError(xmlGenericErrorContext, "error: "); va_start(args, msg); - vfprintf(xmlGenericErrorContext, msg, args); + str = xmlGetVarStr(msg, args); va_end(args); + xmlGenericError(xmlGenericErrorContext, str); + xmlFree(str); if (ctxt != NULL) { xmlParserPrintFileContext(input); @@ -193,6 +241,7 @@ xmlParserWarning(void *ctx, const char *msg, ...) xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlParserInputPtr input = NULL; xmlParserInputPtr cur = NULL; + char * str; va_list args; if (ctxt != NULL) { @@ -207,9 +256,10 @@ xmlParserWarning(void *ctx, const char *msg, ...) xmlGenericError(xmlGenericErrorContext, "warning: "); va_start(args, msg); - vfprintf(xmlGenericErrorContext, msg, args); + str = xmlGetVarStr(msg, args); va_end(args); - + xmlGenericError(xmlGenericErrorContext, str); + xmlFree(str); if (ctxt != NULL) { xmlParserPrintFileContext(input); diff --git a/include/libxml/tree.h b/include/libxml/tree.h index 648817d0..84dbe448 100644 --- a/include/libxml/tree.h +++ b/include/libxml/tree.h @@ -387,7 +387,8 @@ LIBXML_DLL_IMPORT extern xmlNsPtr baseDTD; LIBXML_DLL_IMPORT extern int oldXMLWDcompatibility;/* maintain compatibility with old WD */ LIBXML_DLL_IMPORT extern int xmlIndentTreeOutput; /* try to indent the tree dumps */ LIBXML_DLL_IMPORT extern xmlBufferAllocationScheme xmlBufferAllocScheme; /* alloc scheme to use */ -LIBXML_DLL_IMPORT extern int xmlSaveNoEmptyTags; /* save empty tags as */ +LIBXML_DLL_IMPORT extern int xmlSaveNoEmptyTags; /* save empty tags as */ +LIBXML_DLL_IMPORT extern int xmlDefaultBufferSize; /* default buffer size */ /* * Handling Buffers. diff --git a/nanoftp.c b/nanoftp.c index c7ea79af..3d7ce53a 100644 --- a/nanoftp.c +++ b/nanoftp.c @@ -164,7 +164,7 @@ xmlNanoFTPInit(void) { } /** - * xmlNanoFTPClenup: + * xmlNanoFTPCleanup: * * Cleanup the FTP protocol layer. This cleanup proxy informations. */ @@ -189,7 +189,6 @@ xmlNanoFTPCleanup(void) { WSACleanup(); #endif initialized = 0; - return; } /** diff --git a/tree.c b/tree.c index 709fe22b..a30bc0e1 100644 --- a/tree.c +++ b/tree.c @@ -311,7 +311,7 @@ xmlGetIntSubset(xmlDocPtr doc) { * xmlCreateIntSubset: * @doc: the document pointer * @name: the DTD name - * @ExternalID: the external ID + * @ExternalID: the external (PUBLIC) ID * @SystemID: the system ID * * Create the internal subset of a document @@ -358,18 +358,33 @@ xmlCreateIntSubset(xmlDocPtr doc, const xmlChar *name, doc->children = (xmlNodePtr) cur; doc->last = (xmlNodePtr) cur; } else { - xmlNodePtr prev; - if (doc->type == XML_HTML_DOCUMENT_NODE) { + xmlNodePtr prev; + prev = doc->children; prev->prev = (xmlNodePtr) cur; cur->next = prev; doc->children = (xmlNodePtr) cur; } else { - prev = doc->last; - prev->next = (xmlNodePtr) cur; - cur->prev = prev; - doc->last = (xmlNodePtr) cur; + xmlNodePtr next; + + next = doc->children; + while ((next != NULL) && (next->type != XML_ELEMENT_NODE)) + next = next->next; + if (next == NULL) { + cur->prev = doc->last; + cur->prev->next = (xmlNodePtr) cur; + cur->next = NULL; + doc->last = (xmlNodePtr) cur; + } else { + cur->next = next; + cur->prev = next->prev; + if (cur->prev == NULL) + doc->children = (xmlNodePtr) cur; + else + cur->prev->next = (xmlNodePtr) cur; + next->prev = (xmlNodePtr) cur; + } } } } @@ -4412,6 +4427,8 @@ xmlTextConcat(xmlNodePtr node, const xmlChar *content, int len) { #define BASE_BUFFER_SIZE 4000 +int xmlDefaultBufferSize = BASE_BUFFER_SIZE; + /** * xmlBufferCreate: * @@ -4429,7 +4446,7 @@ xmlBufferCreate(void) { return(NULL); } ret->use = 0; - ret->size = BASE_BUFFER_SIZE; + ret->size = xmlDefaultBufferSize; ret->alloc = xmlBufferAllocScheme; ret->content = (xmlChar *) xmlMalloc(ret->size * sizeof(xmlChar)); if (ret->content == NULL) { diff --git a/tree.h b/tree.h index 648817d0..84dbe448 100644 --- a/tree.h +++ b/tree.h @@ -387,7 +387,8 @@ LIBXML_DLL_IMPORT extern xmlNsPtr baseDTD; LIBXML_DLL_IMPORT extern int oldXMLWDcompatibility;/* maintain compatibility with old WD */ LIBXML_DLL_IMPORT extern int xmlIndentTreeOutput; /* try to indent the tree dumps */ LIBXML_DLL_IMPORT extern xmlBufferAllocationScheme xmlBufferAllocScheme; /* alloc scheme to use */ -LIBXML_DLL_IMPORT extern int xmlSaveNoEmptyTags; /* save empty tags as */ +LIBXML_DLL_IMPORT extern int xmlSaveNoEmptyTags; /* save empty tags as */ +LIBXML_DLL_IMPORT extern int xmlDefaultBufferSize; /* default buffer size */ /* * Handling Buffers. diff --git a/valid.c b/valid.c index f29db620..79387094 100644 --- a/valid.c +++ b/valid.c @@ -139,8 +139,12 @@ void xmlValidDebug(xmlNodePtr cur, xmlElementContentPtr cont) { } #define DEBUG_VALID_STATE(n,c) xmlValidDebug(n,c); +#define DEBUG_VALID_MSG(m) \ + xmlGenericError(xmlGenericErrorContext, "%s\n", m); + #else #define DEBUG_VALID_STATE(n,c) +#define DEBUG_VALID_MSG(m) #endif /* TODO: use hash table for accesses to elem and attribute dedinitions */ @@ -2997,44 +3001,53 @@ static int xmlValidateFindNextElement(xmlValidCtxtPtr ctxt, xmlNodePtr *child, xmlElementContentPtr cont) { - while (*child && (*child)->type != XML_ELEMENT_NODE) { - switch ((*child)->type) { - /* - * If there is an entity declared and it's not empty - * Push the current node on the stack and process with the - * entity content. - */ - case XML_ENTITY_REF_NODE: - if (((*child)->children != NULL) && - ((*child)->children->children != NULL)) { - nodeVPush(ctxt, *child); - *child = (*child)->children->children; - continue; - } - break; + DEBUG_VALID_MSG("skipping to next element"); + while (*child && (*child)->type != XML_ELEMENT_NODE) { + switch ((*child)->type) { + /* + * If there is an entity declared and it's not empty + * Push the current node on the stack and process with the + * entity content. + */ + case XML_ENTITY_REF_NODE: + if (((*child)->children != NULL) && + ((*child)->children->children != NULL)) { + nodeVPush(ctxt, *child); + *child = (*child)->children->children; + continue; + } + break; - /* These things are ignored (skipped) during validation. */ - case XML_PI_NODE: - case XML_COMMENT_NODE: - case XML_XINCLUDE_START: - case XML_XINCLUDE_END: - break; + /* These things are ignored (skipped) during validation. */ + case XML_PI_NODE: + case XML_COMMENT_NODE: + case XML_XINCLUDE_START: + case XML_XINCLUDE_END: + break; - case XML_TEXT_NODE: - if (xmlIsBlankNode(*child) - && (cont->type == XML_ELEMENT_CONTENT_ELEMENT - || cont->type == XML_ELEMENT_CONTENT_SEQ - || cont->type == XML_ELEMENT_CONTENT_OR)) - break; - return -1; + case XML_TEXT_NODE: + if (xmlIsBlankNode(*child) + && (cont->type == XML_ELEMENT_CONTENT_ELEMENT + || cont->type == XML_ELEMENT_CONTENT_SEQ + || cont->type == XML_ELEMENT_CONTENT_OR)) + break; + DEBUG_VALID_MSG("failed non-blank"); + return(-1); - default: - return -1; + default: + DEBUG_VALID_MSG("failed unknown type"); + return(-1); + } + *child = (*child)->next; } - *child = (*child)->next; - } +#ifdef DEBUG_VALID_ALGO + if (*child != NULL) { + DEBUG_VALID_MSG((*child)->name); + } + DEBUG_VALID_MSG("found ..."); +#endif - return 1; + return(1); } int xmlValidateElementTypeElement(xmlValidCtxtPtr ctxt, xmlNodePtr *child, @@ -3068,12 +3081,16 @@ xmlValidateElementTypeExpr(xmlValidCtxtPtr ctxt, xmlNodePtr *child, switch (cont->type) { case XML_ELEMENT_CONTENT_PCDATA: if (*child == NULL) return(0); - if ((*child)->type == XML_TEXT_NODE) return(1); + if ((*child)->type == XML_TEXT_NODE) { + DEBUG_VALID_MSG("pcdata found"); + return(1); + } return(0); case XML_ELEMENT_CONTENT_ELEMENT: if (*child == NULL) return(0); ret = (xmlStrEqual((*child)->name, cont->name)); if (ret == 1) { + DEBUG_VALID_MSG("element found, skip to next"); while ((*child)->next == NULL) { if (((*child)->parent != NULL) && ((*child)->parent->type == XML_ENTITY_DECL)) { @@ -3089,22 +3106,26 @@ xmlValidateElementTypeExpr(xmlValidCtxtPtr ctxt, xmlNodePtr *child, ret = xmlValidateElementTypeElement(ctxt, child, cont->c1); if (ret == -1) return(-1); if (ret == 1) { - return(1); + DEBUG_VALID_MSG("or succeeded first branch"); + return(1); } /* rollback and retry the other path */ *child = cur; ret = xmlValidateElementTypeElement(ctxt, child, cont->c2); if (ret == -1) return(-1); if (ret == 0) { + DEBUG_VALID_MSG("or failed both branches"); *child = cur; return(0); } + DEBUG_VALID_MSG("or succeeded second branch"); return(1); case XML_ELEMENT_CONTENT_SEQ: cur = *child; ret = xmlValidateElementTypeElement(ctxt, child, cont->c1); if (ret == -1) return(-1); if (ret == 0) { + DEBUG_VALID_MSG("sequence failed"); *child = cur; return(0); } @@ -3114,6 +3135,7 @@ xmlValidateElementTypeExpr(xmlValidCtxtPtr ctxt, xmlNodePtr *child, *child = cur; return(0); } + DEBUG_VALID_MSG("sequence succeeded"); return(1); } return(ret); @@ -3151,6 +3173,7 @@ xmlValidateElementTypeElement(xmlValidCtxtPtr ctxt, xmlNodePtr *child, switch (cont->ocur) { case XML_ELEMENT_CONTENT_ONCE: if (ret == 1) { + DEBUG_VALID_MSG("once found, skip to next"); /* skip ignorable elems */ while ((*child != NULL) && ((*child)->type == XML_PI_NODE @@ -3175,6 +3198,25 @@ xmlValidateElementTypeElement(xmlValidCtxtPtr ctxt, xmlNodePtr *child, *child = cur; return(1); } + if (ret == 1) { + DEBUG_VALID_MSG("optional found, skip to next"); + /* skip ignorable elems */ + while ((*child != NULL) && + ((*child)->type == XML_PI_NODE + || (*child)->type == XML_COMMENT_NODE + || (*child)->type == XML_XINCLUDE_START + || (*child)->type == XML_XINCLUDE_END)) { + while ((*child)->next == NULL) { + if (((*child)->parent != NULL) && + ((*child)->parent->type == XML_ENTITY_REF_NODE)) { + *child = (*child)->parent; + } else + break; + } + *child = (*child)->next; + } + return(1); + } break; case XML_ELEMENT_CONTENT_MULT: if (ret == 0) { @@ -3187,6 +3229,7 @@ xmlValidateElementTypeElement(xmlValidCtxtPtr ctxt, xmlNodePtr *child, *child = cur; return(0); } + DEBUG_VALID_MSG("mult/plus found"); if (ret == -1) return(-1); cur = *child; do { @@ -3205,8 +3248,9 @@ xmlValidateElementTypeElement(xmlValidCtxtPtr ctxt, xmlNodePtr *child, *child = cur; break; } + if (ret == -1) return(-1); - return xmlValidateFindNextElement(ctxt, child, cont); + return(xmlValidateFindNextElement(ctxt, child, cont)); } /**