diff --git a/ChangeLog b/ChangeLog index 701ef312..5fe0eede 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,10 @@ -Thu Nov 18 14:57:18 CET 1999 +Fri Nov 19 18:41:28 CET 1999 Daniel Veillard + + * HTMLparser.c: bugfixing, the damn thing MUST not crash even + if given /proc/kcore as input ! + * doc/xml.html doc/*: updated and rebuilt the documentation + +Thu Nov 18 14:57:18 CET 1999 Daniel Veillard * parser.c: Fixed some wrongly space collapsing code due to a misreading of the spec. diff --git a/HTMLparser.c b/HTMLparser.c index 40b4cf9b..ee7b0f70 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -455,8 +455,7 @@ htmlAutoClose(htmlParserCtxtPtr ctxt, const xmlChar *new) { #endif if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) ctxt->sax->endElement(ctxt->userData, ctxt->name); - oldname = ctxt->name; - htmlnamePop(ctxt); + oldname = htmlnamePop(ctxt); if (oldname != NULL) { #ifdef DEBUG fprintf(stderr,"htmlAutoClose: popped %s\n", oldname); @@ -505,8 +504,7 @@ htmlAutoCloseOnClose(htmlParserCtxtPtr ctxt, const xmlChar *new) { } if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) ctxt->sax->endElement(ctxt->userData, ctxt->name); - oldname = ctxt->name; - htmlnamePop(ctxt); + oldname = htmlnamePop(ctxt); if (oldname != NULL) { #ifdef DEBUG fprintf(stderr,"htmlAutoCloseOnClose: popped %s\n", oldname); @@ -1698,10 +1696,11 @@ htmlParseComment(htmlParserCtxtPtr ctxt, int create) { } else { NEXT; if (create) { - val = xmlStrndup(start, q - start); - if ((ctxt->sax != NULL) && (ctxt->sax->comment != NULL)) + if ((ctxt->sax != NULL) && (ctxt->sax->comment != NULL)) { + val = xmlStrndup(start, q - start); ctxt->sax->comment(ctxt->userData, val); - xmlFree(val); + xmlFree(val); + } } } } @@ -2065,6 +2064,7 @@ htmlParseEndTag(htmlParserCtxtPtr ctxt) { SKIP(2); name = htmlParseHTMLName(ctxt); + if (name == NULL) return; /* * We should definitely be at the ending "S? '>'" part @@ -2123,10 +2123,10 @@ htmlParseEndTag(htmlParserCtxtPtr ctxt) { * SAX: End of Tag */ oldname = ctxt->name; - if (!xmlStrcmp(oldname, name)) { + if ((oldname != NULL) && (!xmlStrcmp(oldname, name))) { if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) ctxt->sax->endElement(ctxt->userData, name); - htmlnamePop(ctxt); + oldname = htmlnamePop(ctxt); if (oldname != NULL) { #ifdef DEBUG fprintf(stderr,"End of tag %s: popping out %s\n", name, oldname); @@ -2338,11 +2338,10 @@ htmlParseElement(htmlParserCtxtPtr ctxt) { SKIP(2); if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) ctxt->sax->endElement(ctxt->userData, name); - oldname = ctxt->name; + oldname = htmlnamePop(ctxt); #ifdef DEBUG fprintf(stderr,"End of tag the XML way: popping out %s\n", oldname); #endif - htmlnamePop(ctxt); if (oldname != NULL) xmlFree(oldname); return; @@ -2361,12 +2360,10 @@ htmlParseElement(htmlParserCtxtPtr ctxt) { */ if (!xmlStrcmp(name, ctxt->name)) { nodePop(ctxt); - xmlFree(name); - oldname = ctxt->name; + oldname = htmlnamePop(ctxt); #ifdef DEBUG fprintf(stderr,"End of start tag problem: popping out %s\n", oldname); #endif - htmlnamePop(ctxt); if (oldname != NULL) xmlFree(oldname); } @@ -2390,11 +2387,10 @@ htmlParseElement(htmlParserCtxtPtr ctxt) { if ((info != NULL) && (info->empty)) { if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL)) ctxt->sax->endElement(ctxt->userData, name); - oldname = ctxt->name; + oldname = htmlnamePop(ctxt); #ifdef DEBUG fprintf(stderr,"End of empty tag %s : popping out %s\n", name, oldname); #endif - htmlnamePop(ctxt); if (oldname != NULL) xmlFree(oldname); return; @@ -2420,11 +2416,10 @@ htmlParseElement(htmlParserCtxtPtr ctxt) { * end of parsing of this node. */ nodePop(ctxt); - oldname = ctxt->name; + oldname = htmlnamePop(ctxt); #ifdef DEBUG fprintf(stderr,"Premature end of tag %s : popping out %s\n", name, oldname); #endif - htmlnamePop(ctxt); if (oldname != NULL) xmlFree(oldname); return; @@ -2609,10 +2604,8 @@ htmlFreeParserCtxt(htmlParserCtxtPtr ctxt) } if (ctxt->nodeTab != NULL) xmlFree(ctxt->nodeTab); - while ((oldname = ctxt->name) != NULL) { - htmlnamePop(ctxt); - if (oldname != NULL) - xmlFree(oldname); + while ((oldname = htmlnamePop(ctxt)) != NULL) { + xmlFree(oldname); } if (ctxt->nameTab != NULL) xmlFree(ctxt->nameTab); if (ctxt->inputTab != NULL) xmlFree(ctxt->inputTab); diff --git a/doc/html/gnome-xml-parser.html b/doc/html/gnome-xml-parser.html index 393b88cb..80998090 100644 --- a/doc/html/gnome-xml-parser.html +++ b/doc/html/gnome-xml-parser.html @@ -5149,7 +5149,7 @@ HREF="gnome-xml-tree.html#XMLCHAR" >

lenght of a xmlChar's string

length of a xmlChar's string

the lenght of the XML document in bytes the length of the XML document in bytes the siwe of the array the size of the array work in recovery mode, i.e. tries to read no Well Formed +> work in recovery mode, i.e. tries to read not Well Formed documents the siwe of the array the size of the array an xmlP arserInputPtr an xmlParserInputPtr

the function returns the local part, and prefix is updated +>the local part, and prefix is updated to get the Prefix if any.the function returns the local part, and prefix is updated +>the local part, and prefix is updated to get the Prefix if any.

This is what the older xml-name Working Draft specified, a bunch of other stuff may still rely on it, so support is still here as -if ot was declared on the root of the Tree:-(

To be removed at next drop of binary compatibility

[10] AttValue ::= '"' ([^<&"] | Reference)* '"' | "'" ([^<&'] | Reference)* "'"

3.3.3 Attribute-Value Normalization: +Before the value of an attribute is passed to the application or +checked for validity, the XML processor must normalize it as follows: +- a character reference is processed by appending the referenced +character to the attribute value +- an entity reference is processed by recursively processing the +replacement text of the entity +- a whitespace character (x20, xD, xA, x9) is processed by +appending x20 to the normalized value, except that only a single +x20 is appended for a "xDxA" sequence that is part of an external +parsed entity or the literal entity value of an internal parsed entity +- other characters are processed by appending them to the normalized value +If the declared value is not CDATA, then the XML processor must further +process the normalized attribute value by discarding any leading and +trailing space (x20) characters, and by replacing sequences of space +(x20) characters by a single space (x20) character. +All attributes for which no declaration has been read should be treated +by a non-validating parser as if declared CDATA.

the AttValue parsed or NULL.the AttValue parsed or NULL. The value has to be freed by the caller.