Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Revamped HTML parsing, lots of bug fixes for HTML stuff,

Added xmlValidGetValidElements and xmlValidGetPotentialChildren,
Completed and cleaned up the tests,
Added doc for new modules gnome-xml-xmlmemory.html and gnome-xml-nanohttp.html,
Daniel
  • Loading branch information...
commit 7c1206fc060fd4260f7c6f003c32fbbea3e542fd 1 parent 7d2c276
Daniel Veillard authored
Showing with 3,822 additions and 144 deletions.
  1. +17 −0 ChangeLog
  2. +177 −116 HTMLparser.c
  3. +2 −2 HTMLtree.c
  4. +4 −2 Makefile.am
  5. +1 −1  SAX.c
  6. +9 −0 SAXresult/cdata
  7. +17 −0 SAXresult/comment.xml
  8. +13 −0 SAXresult/comment2.xml
  9. +16 −0 SAXresult/dtd12
  10. +16 −0 SAXresult/ent6
  11. +21 −0 SAXresult/ent7
  12. +10 −0 SAXresult/eve.xml
  13. +11 −0 SAXresult/ns
  14. +5 −0 SAXresult/ns2
  15. +5 −0 SAXresult/ns3
  16. +5 −0 SAXresult/ns4
  17. +17 −0 SAXresult/pi.xml
  18. +13 −0 SAXresult/pi2.xml
  19. +4 −0 debugXML.c
  20. +945 −0 doc/html/gnome-xml-nanohttp.html
  21. +1,277 −0 doc/html/gnome-xml-xmlmemory.html
  22. +10 −2 entities.c
  23. +2 −1  include/libxml/tree.h
  24. +8 −0 include/libxml/valid.h
  25. 0  result/HTML/Down.html.err
  26. +3 −3 result/HTML/fp40.htm
  27. +3 −0  result/HTML/fp40.htm.err
  28. +14 −0 result/HTML/liclose.html
  29. 0  result/HTML/liclose.html.err
  30. +12 −0 result/HTML/reg1.html
  31. 0  result/HTML/reg1.html.err
  32. +15 −0 result/HTML/reg2.html
  33. 0  result/HTML/reg2.html.err
  34. +16 −0 result/HTML/reg3.html
  35. 0  result/HTML/reg3.html.err
  36. +13 −0 result/HTML/reg4.html
  37. +3 −0  result/HTML/reg4.html.err
  38. 0  result/HTML/test2.html.err
  39. +12 −0 result/HTML/test3.html.err
  40. +24 −0 result/XPath/expr/compare
  41. +24 −0 result/XPath/expr/equality
  42. +6 −0 result/comment.xml
  43. +6 −0 result/comment2.xml
  44. +6 −0 result/noent/comment.xml
  45. +6 −0 result/noent/comment2.xml
  46. +4 −0 result/noent/ns
  47. +2 −0  result/noent/ns2
  48. +2 −0  result/noent/ns3
  49. +2 −0  result/noent/ns4
  50. +6 −0 result/noent/pi.xml
  51. +6 −0 result/noent/pi2.xml
  52. +4 −0 result/ns
  53. +2 −0  result/ns2
  54. +2 −0  result/ns3
  55. +2 −0  result/ns4
  56. +6 −0 result/pi.xml
  57. +6 −0 result/pi2.xml
  58. 0  result/valid/REC-xml-19980210.xml.err
  59. 0  result/valid/dia.xml.err
  60. +6 −0 result/valid/xlink.xml.err
  61. +13 −0 test/HTML/liclose.html
  62. +10 −0 test/HTML/reg1.html
  63. +12 −0 test/HTML/reg2.html
  64. +13 −0 test/HTML/reg3.html
  65. +12 −0 test/HTML/reg4.html
  66. +28 −0 test/XPath/docs/id
  67. +24 −0 test/XPath/expr/compare
  68. +25 −0 test/XPath/expr/equality
  69. +6 −0 test/comment.xml
  70. +6 −0 test/comment2.xml
  71. +4 −0 test/ns
  72. +3 −0  test/ns2
  73. +3 −0  test/ns3
  74. +2 −0  test/ns4
  75. +6 −0 test/pi.xml
  76. +6 −0 test/pi2.xml
  77. +570 −7 testHTML.c
  78. +2 −1  testXPath.c
  79. +32 −4 tester.c
  80. +4 −0 tree.c
  81. +2 −1  tree.h
  82. +168 −0 valid.c
  83. +8 −0 valid.h
  84. +41 −2 xmlmemory.c
  85. +4 −2 xpath.c
View
17 ChangeLog
@@ -1,3 +1,20 @@
+Thu Oct 14 10:29:56 CEST 1999 Daniel Veillard <Daniel.Veillard@w3.org>
+
+ * HTMLparser.c, HTMLtree.c, tree.h: completely revamped the
+ HTMLparser and debugged the HTML related code. HTML documents
+ now have their own type
+ * entities.c: do not dump &apos; for HTML output
+ * xmlmemory.c: improvement, breakpoint mechanism
+ * testHTML.c: added --sax --repeat ...
+ * Makefile.am: improved the HTML tests
+ * valid.[ch]: added xmlValidGetValidElements and
+ xmlValidGetPotentialChildren
+ * tester.c: added --insert to test the 2 new functions
+ * test//* result//* SAXresult//* : regression test cleanup
+ and extension.
+ * doc/html : added doc for new modules gnome-xml-xmlmemory.html and
+ gnome-xml-nanohttp.html
+
Mon Oct 11 14:31:58 CEST 1999 Daniel Veillard <Daniel.Veillard@w3.org>
* HTMLparser.c: fixed problems with some autoclose tags
View
293 HTMLparser.c
@@ -75,8 +75,9 @@ int html##name##Push(htmlParserCtxtPtr ctxt, type value) { \
} \
type html##name##Pop(htmlParserCtxtPtr ctxt) { \
type ret; \
- if (ctxt->name##Nr <= 0) return(0); \
+ if (ctxt->name##Nr < 0) return(0); \
ctxt->name##Nr--; \
+ if (ctxt->name##Nr < 0) return(0); \
if (ctxt->name##Nr > 0) \
ctxt->name = ctxt->name##Tab[ctxt->name##Nr - 1]; \
else \
@@ -445,17 +446,21 @@ htmlCheckAutoClose(const xmlChar *new, const xmlChar *old) {
void
htmlAutoClose(htmlParserCtxtPtr ctxt, const xmlChar *new) {
xmlChar *oldname;
-
while ((ctxt->name != NULL) &&
(htmlCheckAutoClose(new, ctxt->name))) {
#ifdef DEBUG
- printf("htmlAutoClose: %s closes %s\n", new, ctxt->name);
+ fprintf(stderr,"htmlAutoClose: %s closes %s\n", new, ctxt->name);
#endif
if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
ctxt->sax->endElement(ctxt->userData, ctxt->name);
oldname = ctxt->name;
htmlnamePop(ctxt);
- xmlFree(oldname);
+ if (oldname != NULL) {
+#ifdef DEBUG
+ fprintf(stderr,"htmlAutoClose: popped %s\n", oldname);
+#endif
+ xmlFree(oldname);
+ }
}
}
@@ -470,21 +475,42 @@ void
htmlAutoCloseOnClose(htmlParserCtxtPtr ctxt, const xmlChar *new) {
htmlElemDescPtr info;
xmlChar *oldname;
+ int i;
- while ((ctxt->name != NULL) &&
- (xmlStrcmp(new, ctxt->name))) {
+#ifdef DEBUG
+ fprintf(stderr,"Close of %s stack: %d elements\n", new, ctxt->nameNr);
+ for (i = 0;i < ctxt->nameNr;i++)
+ fprintf(stderr,"%d : %s\n", i, ctxt->nameTab[i]);
+#endif
+
+ for (i = (ctxt->nameNr - 1);i >= 0;i--) {
+ if (!xmlStrcmp(new, ctxt->nameTab[i])) break;
+ }
+ if (i < 0) return;
+
+ while (xmlStrcmp(new, ctxt->name)) {
info = htmlTagLookup(ctxt->name);
if ((info == NULL) || (info->endTag == 1)) {
#ifdef DEBUG
- printf("htmlAutoCloseOnClose: %s closes %s\n", new, ctxt->name);
+ fprintf(stderr,"htmlAutoCloseOnClose: %s closes %s\n", new, ctxt->name);
+#endif
+ } else {
+ if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
+ ctxt->sax->error(ctxt->userData,
+ "Opening and ending tag mismatch: %s and %s\n",
+ new, ctxt->name);
+ ctxt->wellFormed = 0;
+ }
+ if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
+ ctxt->sax->endElement(ctxt->userData, ctxt->name);
+ oldname = ctxt->name;
+ htmlnamePop(ctxt);
+ if (oldname != NULL) {
+#ifdef DEBUG
+ fprintf(stderr,"htmlAutoCloseOnClose: popped %s\n", oldname);
#endif
- if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
- ctxt->sax->endElement(ctxt->userData, ctxt->name);
- oldname = ctxt->name;
- htmlnamePop(ctxt);
xmlFree(oldname);
- } else
- break;
+ }
}
}
@@ -808,7 +834,7 @@ htmlEntityLookup(const xmlChar *name) {
sizeof(html40EntitiesTable[0]));i++) {
if (!xmlStrcmp(name, BAD_CAST html40EntitiesTable[i].name)) {
#ifdef DEBUG
- printf("Found entity %s\n", name);
+ fprintf(stderr,"Found entity %s\n", name);
#endif
return(&html40EntitiesTable[i]);
}
@@ -827,9 +853,7 @@ htmlEntityLookup(const xmlChar *name) {
*
* Subtitute the HTML entities by their value
*
- * TODO: once the internal representation will be UTF-8, all entities
- * will be substituable, in the meantime we only apply the substitution
- * to the one with values in the 0-255 UNICODE range
+ * DEPRECATED !!!!
*
* Returns A newly allocated string with the substitution done. The caller
* must deallocate it !
@@ -1138,7 +1162,7 @@ htmlNewDoc(const xmlChar *URI, const xmlChar *ExternalID) {
}
memset(cur, 0, sizeof(xmlDoc));
- cur->type = XML_DOCUMENT_NODE;
+ cur->type = XML_HTML_DOCUMENT_NODE;
cur->version = NULL;
cur->intSubset = NULL;
xmlCreateIntSubset(cur, BAD_CAST "HTML", ExternalID, URI);
@@ -1248,28 +1272,29 @@ htmlParseName(htmlParserCtxtPtr ctxt) {
/**
* htmlParseHTMLAttribute:
* @ctxt: an HTML parser context
+ * @stop: a char stop value
*
- * parse an HTML attribute value (without quotes).
+ * parse an HTML attribute value till the stop (quote), if
+ * stop is 0 then it stops at the first space
*
- * Returns the Nmtoken parsed or NULL
+ * Returns the attribute parsed or NULL
*/
xmlChar *
-htmlParseHTMLAttribute(htmlParserCtxtPtr ctxt) {
+htmlParseHTMLAttribute(htmlParserCtxtPtr ctxt, const xmlChar stop) {
xmlChar buf[HTML_MAX_NAMELEN];
int len = 0;
GROW;
- while ((!IS_BLANK(CUR)) && (CUR != '<') &&
- (CUR != '&') && (CUR != '>') &&
- (CUR != '\'') && (CUR != '"')) {
+ while ((CUR != 0) && (CUR != stop) && (CUR != '>')) {
+ if ((stop == 0) && (IS_BLANK(CUR))) break;
buf[len++] = CUR;
NEXT;
if (len >= HTML_MAX_NAMELEN) {
fprintf(stderr,
"htmlParseHTMLAttribute: reached HTML_MAX_NAMELEN limit\n");
while ((!IS_BLANK(CUR)) && (CUR != '<') &&
- (CUR != '&') && (CUR != '>') &&
+ (CUR != '>') &&
(CUR != '\'') && (CUR != '"'))
NEXT;
break;
@@ -1384,13 +1409,7 @@ htmlParseAttValue(htmlParserCtxtPtr ctxt) {
if (CUR == '"') {
NEXT;
- ret = htmlDecodeEntities(ctxt, -1, '"', '<', 0);
- if (CUR == '<') {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Unescaped '<' not allowed in attributes values\n");
- ctxt->wellFormed = 0;
- }
+ ret = htmlParseHTMLAttribute(ctxt, '"');
if (CUR != '"') {
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
ctxt->sax->error(ctxt->userData, "AttValue: ' expected\n");
@@ -1399,13 +1418,7 @@ htmlParseAttValue(htmlParserCtxtPtr ctxt) {
NEXT;
} else if (CUR == '\'') {
NEXT;
- ret = htmlDecodeEntities(ctxt, -1, '\'', '<', 0);
- if (CUR == '<') {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "Unescaped '<' not allowed in attributes values\n");
- ctxt->wellFormed = 0;
- }
+ ret = htmlParseHTMLAttribute(ctxt, '\'');
if (CUR != '\'') {
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
ctxt->sax->error(ctxt->userData, "AttValue: ' expected\n");
@@ -1416,14 +1429,13 @@ htmlParseAttValue(htmlParserCtxtPtr ctxt) {
/*
* That's an HTMLism, the attribute value may not be quoted
*/
- ret = htmlParseHTMLAttribute(ctxt);
+ ret = htmlParseHTMLAttribute(ctxt, 0);
if (ret == NULL) {
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
ctxt->sax->error(ctxt->userData, "AttValue: no value found\n");
ctxt->wellFormed = 0;
}
}
-
return(ret);
}
@@ -1912,10 +1924,9 @@ htmlParseAttribute(htmlParserCtxtPtr ctxt, xmlChar **value) {
*
* [NS 10] EmptyElement ::= '<' QName (S Attribute)* S? '/>'
*
- * Returns the element name parsed
*/
-xmlChar *
+void
htmlParseStartTag(htmlParserCtxtPtr ctxt) {
xmlChar *name;
xmlChar *attname;
@@ -1925,16 +1936,17 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) {
int maxatts = 0;
int i;
- if (CUR != '<') return(NULL);
+ if (CUR != '<') return;
NEXT;
+ GROW;
name = htmlParseHTMLName(ctxt);
if (name == NULL) {
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
ctxt->sax->error(ctxt->userData,
"htmlParseStartTag: invalid element name\n");
ctxt->wellFormed = 0;
- return(NULL);
+ return;
}
/*
@@ -1952,7 +1964,9 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) {
(CUR != '>') &&
((CUR != '/') || (NXT(1) != '>'))) {
const xmlChar *q = CUR_PTR;
+ int cons = ctxt->input->consumed;
+ GROW;
attname = htmlParseAttribute(ctxt, &attvalue);
if ((attname != NULL) && (attvalue != NULL)) {
/*
@@ -1961,12 +1975,13 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) {
for (i = 0; i < nbatts;i += 2) {
if (!xmlStrcmp(atts[i], attname)) {
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "Attribute %s redefined\n",
- name);
+ ctxt->sax->error(ctxt->userData,
+ "Attribute %s redefined\n",
+ attname);
ctxt->wellFormed = 0;
xmlFree(attname);
xmlFree(attvalue);
- break;
+ goto failed;
}
}
@@ -1979,7 +1994,8 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) {
if (atts == NULL) {
fprintf(stderr, "malloc of %ld byte failed\n",
maxatts * (long)sizeof(xmlChar *));
- return(NULL);
+ if (name != NULL) xmlFree(name);
+ return;
}
} else if (nbatts + 2 < maxatts) {
maxatts *= 2;
@@ -1987,7 +2003,8 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) {
if (atts == NULL) {
fprintf(stderr, "realloc of %ld byte failed\n",
maxatts * (long)sizeof(xmlChar *));
- return(NULL);
+ if (name != NULL) xmlFree(name);
+ return;
}
}
atts[nbatts++] = attname;
@@ -1996,8 +2013,9 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) {
atts[nbatts + 1] = NULL;
}
+failed:
SKIP_BLANKS;
- if (q == CUR_PTR) {
+ if ((cons == ctxt->input->consumed) && (q == CUR_PTR)) {
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
ctxt->sax->error(ctxt->userData,
"htmlParseStartTag: problem parsing attributes\n");
@@ -2010,6 +2028,9 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) {
* SAX: Start of Element !
*/
htmlnamePush(ctxt, xmlStrdup(name));
+#ifdef DEBUG
+ fprintf(stderr,"Start of element %s: pushed %s\n", name, ctxt->name);
+#endif
if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL))
ctxt->sax->startElement(ctxt->userData, name, atts);
@@ -2017,13 +2038,12 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) {
for (i = 0;i < nbatts;i++) xmlFree((xmlChar *) atts[i]);
xmlFree(atts);
}
- return(name);
+ if (name != NULL) xmlFree(name);
}
/**
* htmlParseEndTag:
* @ctxt: an HTML parser context
- * @tagname: the tag name as parsed in the opening tag.
*
* parse an end of tag
*
@@ -2035,7 +2055,7 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) {
*/
void
-htmlParseEndTag(htmlParserCtxtPtr ctxt, const xmlChar *tagname) {
+htmlParseEndTag(htmlParserCtxtPtr ctxt) {
xmlChar *name;
xmlChar *oldname;
int i;
@@ -2062,27 +2082,26 @@ htmlParseEndTag(htmlParserCtxtPtr ctxt, const xmlChar *tagname) {
NEXT;
/*
- * Check that we are not closing an already closed tag,
- * <p><b>...</p></b> is a really common error !
+ * If the name read is not one of the element in the parsing stack
+ * then return, it's just an error.
*/
- for (i = ctxt->nameNr - 1;i >= 0;i--) {
- if ((ctxt->nameTab[i] != NULL) &&
- (!xmlStrcmp(tagname, ctxt->nameTab[i])))
- break;
+ for (i = (ctxt->nameNr - 1);i >= 0;i--) {
+ if (!xmlStrcmp(name, ctxt->nameTab[i])) break;
}
if (i < 0) {
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData,
- "htmlParseEndTag: unexpected close for tag %s\n",
- tagname);
+ ctxt->sax->error(ctxt->userData,
+ "Unexpected end tag : %s\n", name);
xmlFree(name);
ctxt->wellFormed = 0;
return;
}
+
/*
* Check for auto-closure of HTML elements.
*/
+
htmlAutoCloseOnClose(ctxt, name);
/*
@@ -2090,7 +2109,10 @@ htmlParseEndTag(htmlParserCtxtPtr ctxt, const xmlChar *tagname) {
* With the exception that the autoclose may have popped stuff out
* of the stack.
*/
- if (xmlStrcmp(name, tagname)) {
+ if (xmlStrcmp(name, ctxt->name)) {
+#ifdef DEBUG
+ fprintf(stderr,"End of tag %s: expecting %s\n", name, ctxt->name);
+#endif
if ((ctxt->name != NULL) &&
(xmlStrcmp(ctxt->name, name))) {
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
@@ -2104,11 +2126,22 @@ htmlParseEndTag(htmlParserCtxtPtr ctxt, const xmlChar *tagname) {
/*
* SAX: End of Tag
*/
- if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
- ctxt->sax->endElement(ctxt->userData, name);
oldname = ctxt->name;
- htmlnamePop(ctxt);
- xmlFree(oldname);
+ if (!xmlStrcmp(oldname, name)) {
+ if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
+ ctxt->sax->endElement(ctxt->userData, name);
+ htmlnamePop(ctxt);
+ if (oldname != NULL) {
+#ifdef DEBUG
+ fprintf(stderr,"End of tag %s: popping out %s\n", name, oldname);
+#endif
+ xmlFree(oldname);
+#ifdef DEBUG
+ } else {
+ fprintf(stderr,"End of tag %s: stack empty !!!\n", name);
+#endif
+ }
+ }
if (name != NULL)
xmlFree(name);
@@ -2170,18 +2203,30 @@ htmlParseReference(htmlParserCtxtPtr ctxt) {
*/
void
-htmlParseContent(htmlParserCtxtPtr ctxt, const xmlChar *name) {
+htmlParseContent(htmlParserCtxtPtr ctxt) {
xmlChar *currentNode;
+ int depth;
currentNode = ctxt->name;
- while ((CUR != '<') || (NXT(1) != '/')) {
+ depth = ctxt->nameNr;
+ while (1) {
const xmlChar *test = CUR_PTR;
+ GROW;
+ /*
+ * Our tag or one of it's parent or children is ending.
+ */
+ if ((CUR == '<') && (NXT(1) == '/')) {
+ htmlParseEndTag(ctxt);
+ return;
+ }
+
/*
* Has this node been popped out during parsing of
* the next element
*/
- if (currentNode != ctxt->name) return;
+ if ((currentNode != ctxt->name) &&
+ (depth >= ctxt->nameNr)) return;
/*
* First case : a comment
@@ -2220,13 +2265,9 @@ htmlParseContent(htmlParserCtxtPtr ctxt, const xmlChar *name) {
ctxt->wellFormed = 0;
break;
}
+
GROW;
}
-
- /*
- * parse the end of tag: '</' should be here.
- */
- htmlParseEndTag(ctxt, name);
}
/**
@@ -2243,11 +2284,12 @@ htmlParseContent(htmlParserCtxtPtr ctxt, const xmlChar *name) {
void
htmlParseElement(htmlParserCtxtPtr ctxt) {
const xmlChar *openTag = CUR_PTR;
- xmlChar *name;
xmlChar *oldname;
+ xmlChar *name;
xmlChar *currentNode = NULL;
htmlElemDescPtr info;
htmlParserNodeInfo node_info;
+ int depth = ctxt->nameNr;
/* Capture start position */
if (ctxt->record_info) {
@@ -2256,8 +2298,21 @@ htmlParseElement(htmlParserCtxtPtr ctxt) {
node_info.begin_line = ctxt->input->line;
}
- name = htmlParseStartTag(ctxt);
- if (name == NULL) {
+ oldname = ctxt->name;
+ htmlParseStartTag(ctxt);
+ name = ctxt->name;
+#ifdef DEBUG
+ if (oldname == NULL)
+ fprintf(stderr, "Start of element %s\n", name);
+ else if (name == NULL)
+ fprintf(stderr, "Start of element failed, was %s\n", oldname);
+ else
+ fprintf(stderr, "Start of element %s, was %s\n", name, oldname);
+#endif
+ if (((depth == ctxt->nameNr) && (oldname == ctxt->name)) ||
+ (name == NULL)) {
+ if (CUR == '>')
+ NEXT;
return;
}
@@ -2286,9 +2341,12 @@ htmlParseElement(htmlParserCtxtPtr ctxt) {
if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
ctxt->sax->endElement(ctxt->userData, name);
oldname = ctxt->name;
+#ifdef DEBUG
+ fprintf(stderr,"End of tag the XML way: popping out %s\n", oldname);
+#endif
htmlnamePop(ctxt);
- xmlFree(oldname);
- xmlFree(name);
+ if (oldname != NULL)
+ xmlFree(oldname);
return;
}
@@ -2303,11 +2361,17 @@ htmlParseElement(htmlParserCtxtPtr ctxt) {
/*
* end of parsing of this node.
*/
- nodePop(ctxt);
- xmlFree(name);
- oldname = ctxt->name;
- htmlnamePop(ctxt);
- xmlFree(oldname);
+ if (!xmlStrcmp(name, ctxt->name)) {
+ nodePop(ctxt);
+ xmlFree(name);
+ oldname = ctxt->name;
+#ifdef DEBUG
+ fprintf(stderr,"End of start tag problem: popping out %s\n", oldname);
+#endif
+ htmlnamePop(ctxt);
+ if (oldname != NULL)
+ xmlFree(oldname);
+ }
/*
* Capture end position and add node
@@ -2328,10 +2392,13 @@ htmlParseElement(htmlParserCtxtPtr ctxt) {
if ((info != NULL) && (info->empty)) {
if ((ctxt->sax != NULL) && (ctxt->sax->endElement != NULL))
ctxt->sax->endElement(ctxt->userData, name);
- xmlFree(name);
oldname = ctxt->name;
+#ifdef DEBUG
+ fprintf(stderr,"End of empty tag %s : popping out %s\n", name, oldname);
+#endif
htmlnamePop(ctxt);
- xmlFree(oldname);
+ if (oldname != NULL)
+ xmlFree(oldname);
return;
}
@@ -2339,36 +2406,32 @@ htmlParseElement(htmlParserCtxtPtr ctxt) {
* Parse the content of the element:
*/
currentNode = ctxt->name;
- htmlParseContent(ctxt, name);
-
- /*
- * check whether the element get popped due to auto closure
- * on start tag
- */
- if (currentNode != ctxt->name) {
- xmlFree(name);
- return;
- }
+ depth = ctxt->nameNr;
+ while (IS_CHAR(CUR)) {
+ htmlParseContent(ctxt);
+ if (ctxt->nameNr < depth) break;
+ }
if (!IS_CHAR(CUR)) {
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
ctxt->sax->error(ctxt->userData,
- "Premature end of data in tag %.30s\n", openTag);
+ "Premature end of data in tag %s\n", currentNode);
ctxt->wellFormed = 0;
/*
* end of parsing of this node.
*/
nodePop(ctxt);
- xmlFree(name);
oldname = ctxt->name;
+#ifdef DEBUG
+ fprintf(stderr,"Premature end of tag %s : popping out %s\n", name, oldname);
+#endif
htmlnamePop(ctxt);
- xmlFree(oldname);
+ if (oldname != NULL)
+ xmlFree(oldname);
return;
}
- xmlFree(name);
-
/*
* Capture end position and add node
*/
@@ -2479,9 +2542,14 @@ htmlInitParserCtxt(htmlParserCtxtPtr ctxt)
if (sax == NULL) {
fprintf(stderr, "htmlInitParserCtxt: out of memory\n");
}
+ memset(sax, 0, sizeof(htmlSAXHandler));
/* Allocate the Input stack */
- ctxt->inputTab = (htmlParserInputPtr *) xmlMalloc(5 * sizeof(htmlParserInputPtr));
+ ctxt->inputTab = (htmlParserInputPtr *)
+ xmlMalloc(5 * sizeof(htmlParserInputPtr));
+ if (ctxt->inputTab == NULL) {
+ fprintf(stderr, "htmlInitParserCtxt: out of memory\n");
+ }
ctxt->inputNr = 0;
ctxt->inputMax = 5;
ctxt->input = NULL;
@@ -2538,7 +2606,8 @@ htmlFreeParserCtxt(htmlParserCtxtPtr ctxt)
if (ctxt->nodeTab != NULL) xmlFree(ctxt->nodeTab);
while ((oldname = ctxt->name) != NULL) {
htmlnamePop(ctxt);
- xmlFree(oldname);
+ if (oldname != NULL)
+ xmlFree(oldname);
}
if (ctxt->nameTab != NULL) xmlFree(ctxt->nameTab);
if (ctxt->inputTab != NULL) xmlFree(ctxt->inputTab);
@@ -2575,22 +2644,12 @@ htmlCreateDocParserCtxt(xmlChar *cur, const char *encoding) {
xmlFree(ctxt);
return(NULL);
}
+ memset(input, 0, sizeof(htmlParserInput));
- /*
- * plug some encoding conversion routines here. !!!
- if (encoding != NULL) {
- enc = htmlDetectCharEncoding(cur);
- htmlSwitchEncoding(ctxt, enc);
- }
- */
-
- input->filename = NULL;
input->line = 1;
input->col = 1;
input->base = cur;
input->cur = cur;
- input->free = NULL;
- input->buf = NULL;
inputPush(ctxt, input);
return(ctxt);
@@ -2685,6 +2744,7 @@ htmlCreateFileParserCtxt(const char *filename, const char *encoding)
perror("malloc");
return(NULL);
}
+ memset(ctxt, 0, sizeof(htmlParserCtxt));
htmlInitParserCtxt(ctxt);
inputStream = (htmlParserInputPtr) xmlMalloc(sizeof(htmlParserInput));
if (inputStream == NULL) {
@@ -2692,6 +2752,7 @@ htmlCreateFileParserCtxt(const char *filename, const char *encoding)
xmlFree(ctxt);
return(NULL);
}
+ memset(inputStream, 0, sizeof(htmlParserInput));
inputStream->filename = xmlMemStrdup(filename);
inputStream->line = 1;
View
4 HTMLtree.c
@@ -185,7 +185,7 @@ htmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur) {
if (cur->properties != NULL)
htmlAttrListDump(buf, doc, cur->properties);
- if (info->empty) {
+ if ((info != NULL) && (info->empty)) {
xmlBufferWriteChar(buf, ">");
if (cur->next != NULL) {
if ((cur->next->type != HTML_TEXT_NODE) &&
@@ -195,7 +195,7 @@ htmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur) {
return;
}
if ((cur->content == NULL) && (cur->childs == NULL)) {
- if (info->endTag != 0)
+ if ((info != NULL) && (info->endTag != 0))
xmlBufferWriteChar(buf, ">");
else {
xmlBufferWriteChar(buf, "></");
View
6 Makefile.am
@@ -86,13 +86,15 @@ HTMLtests : testHTML
if [ ! -f $(srcdir)/result/HTML/$$name ] ; then \
echo New test file $$name ; \
$(top_builddir)/testHTML $$i > $(srcdir)/result/HTML/$$name ; \
+ $(top_builddir)/testHTML $$i > $(srcdir)/result/HTML/$$name 2>$(srcdir)/result/HTML/$$name.err ; \
else \
echo Testing $$name ; \
- $(top_builddir)/testHTML $$i > result.$$name ; \
+ $(top_builddir)/testHTML $$i > result.$$name 2>error.$$name ; \
diff $(srcdir)/result/HTML/$$name result.$$name ; \
+ diff $(srcdir)/result/HTML/$$name.err error.$$name ; \
$(top_builddir)/testHTML result.$$name > result2.$$name ; \
diff result.$$name result2.$$name ; \
- rm result.$$name result2.$$name ; \
+ rm result.$$name result2.$$name error.$$name ; \
fi ; fi ; done)
XMLtests : tester
View
2  SAX.c
@@ -552,7 +552,7 @@ attribute(void *ctx, const xmlChar *fullname, const xmlChar *value)
ret = xmlNewNsProp(ctxt->node, namespace, name, NULL);
if (ret != NULL) {
- if (ctxt->replaceEntities == 0)
+ if ((ctxt->replaceEntities == 0) && (!ctxt->html))
ret->val = xmlStringGetNodeList(ctxt->myDoc, value);
else
ret->val = xmlNewDocText(ctxt->myDoc, value);
View
9 SAXresult/cdata
@@ -0,0 +1,9 @@
+SAX.setDocumentLocator()
+SAX.startDocument()
+SAX.startElement(doc)
+SAX.characters(
+, 1)
+SAX.characters(
+, 1)
+SAX.endElement(doc)
+SAX.endDocument()
View
17 SAXresult/comment.xml
@@ -0,0 +1,17 @@
+SAX.setDocumentLocator()
+SAX.startDocument()
+SAX.startElement(doc)
+SAX.characters(
+, 1)
+SAX.comment( document start )
+SAX.characters(
+, 1)
+SAX.startElement(empty)
+SAX.endElement(empty)
+SAX.characters(
+, 1)
+SAX.comment( document end )
+SAX.characters(
+, 1)
+SAX.endElement(doc)
+SAX.endDocument()
View
13 SAXresult/comment2.xml
@@ -0,0 +1,13 @@
+SAX.setDocumentLocator()
+SAX.startDocument()
+SAX.comment( document start )
+SAX.startElement(doc)
+SAX.characters(
+, 1)
+SAX.startElement(empty)
+SAX.endElement(empty)
+SAX.characters(
+, 1)
+SAX.endElement(doc)
+SAX.comment( document end )
+SAX.endDocument()
View
16 SAXresult/dtd12
@@ -0,0 +1,16 @@
+xmlSAXUserParseFile returned error 27
+SAX.setDocumentLocator()
+SAX.startDocument()
+SAX.internalSubset(doc, (null), (null))
+SAX.entityDecl(YN, 4, (null), (null), "Yes")
+SAX.getParameterEntity(YN)
+SAX.getParameterEntity(YN)
+SAX.error: PEReference: %YN; not found
+SAX.entityDecl(WhatHeSaid, 1, (null), (null), He said )
+SAX.getEntity(WhatHeSaid)
+SAX.startElement(doc)
+SAX.getEntity(WhatHeSaid)
+SAX.warning: Entity 'WhatHeSaid' not defined
+SAX.endElement(doc)
+SAX.endDocument()
+xmlSAXUserParseFile returned error 27
View
16 SAXresult/ent6
@@ -0,0 +1,16 @@
+SAX.setDocumentLocator()
+SAX.startDocument()
+SAX.internalSubset(doc, (null), (null))
+SAX.entityDecl(lt, 1, (null), (null), &#60;)
+SAX.getEntity(lt)
+SAX.entityDecl(gt, 1, (null), (null), >)
+SAX.getEntity(gt)
+SAX.entityDecl(amp, 1, (null), (null), &#38;)
+SAX.getEntity(amp)
+SAX.entityDecl(apos, 1, (null), (null), ')
+SAX.getEntity(apos)
+SAX.entityDecl(quot, 1, (null), (null), ")
+SAX.getEntity(quot)
+SAX.startElement(doc)
+SAX.endElement(doc)
+SAX.endDocument()
View
21 SAXresult/ent7
@@ -0,0 +1,21 @@
+xmlSAXUserParseFile returned error 27
+SAX.setDocumentLocator()
+SAX.startDocument()
+SAX.internalSubset(item, (null), (null))
+SAX.entityDecl(sampleEnt, 4, (null), (null), <!ELEMENT item (para)+>)
+SAX.getParameterEntity(sampleEnt)
+SAX.entityDecl(sampleEnt, 1, (null), (null), the hyacinth girl)
+SAX.getEntity(sampleEnt)
+SAX.getParameterEntity(sampleEnt)
+SAX.error: PEReference: %sampleEnt; not found
+SAX.elementDecl(para, 3, ...)
+SAX.startElement(item)
+SAX.startElement(para)
+SAX.characters('they called me , 16)
+SAX.getEntity(sampleEnt)
+SAX.warning: Entity 'sampleEnt' not defined
+SAX.characters(', 1)
+SAX.endElement(para)
+SAX.endElement(item)
+SAX.endDocument()
+xmlSAXUserParseFile returned error 27
View
10 SAXresult/eve.xml
@@ -0,0 +1,10 @@
+SAX.setDocumentLocator()
+SAX.startDocument()
+SAX.internalSubset(spec, -//testspec//, dtds/eve.dtd)
+SAX.entityDecl(iso6.doc.date, 1, (null), (null), 29-May-1999)
+SAX.getEntity(iso6.doc.date)
+SAX.startElement(spec)
+SAX.characters(
+, 1)
+SAX.endElement(spec)
+SAX.endDocument()
View
11 SAXresult/ns
@@ -0,0 +1,11 @@
+SAX.setDocumentLocator()
+SAX.startDocument()
+SAX.startElement(dia:diagram, xmlns:dia='http://www.lysator.liu.se/~alla/dia/')
+SAX.characters(
+ , 3)
+SAX.startElement(dia:diagramdata, dia:testattr='test')
+SAX.endElement(dia:diagramdata)
+SAX.characters(
+, 1)
+SAX.endElement(dia:diagram)
+SAX.endDocument()
View
5 SAXresult/ns2
@@ -0,0 +1,5 @@
+SAX.setDocumentLocator()
+SAX.startDocument()
+SAX.startElement(dia:diagram, xmlns:dia='http://www.lysator.liu.se/~alla/dia/', dia:testattr='test')
+SAX.endElement(dia:diagram)
+SAX.endDocument()
View
5 SAXresult/ns3
@@ -0,0 +1,5 @@
+SAX.setDocumentLocator()
+SAX.startDocument()
+SAX.startElement(dia:diagram, dia:testattr='test', xmlns:dia='http://www.lysator.liu.se/~alla/dia/')
+SAX.endElement(dia:diagram)
+SAX.endDocument()
View
5 SAXresult/ns4
@@ -0,0 +1,5 @@
+SAX.setDocumentLocator()
+SAX.startDocument()
+SAX.startElement(diagram, testattr='test', xml:lang='en', xml:link='simple', xml:space='preserve')
+SAX.endElement(diagram)
+SAX.endDocument()
View
17 SAXresult/pi.xml
@@ -0,0 +1,17 @@
+SAX.setDocumentLocator()
+SAX.startDocument()
+SAX.startElement(doc)
+SAX.characters(
+, 1)
+SAX.processingInstruction(document-start, doc)
+SAX.characters(
+, 1)
+SAX.startElement(empty)
+SAX.endElement(empty)
+SAX.characters(
+, 1)
+SAX.processingInstruction(document-end, doc)
+SAX.characters(
+, 1)
+SAX.endElement(doc)
+SAX.endDocument()
View
13 SAXresult/pi2.xml
@@ -0,0 +1,13 @@
+SAX.setDocumentLocator()
+SAX.startDocument()
+SAX.processingInstruction(document-start, doc)
+SAX.startElement(doc)
+SAX.characters(
+, 1)
+SAX.startElement(empty)
+SAX.endElement(empty)
+SAX.characters(
+, 1)
+SAX.endElement(doc)
+SAX.processingInstruction(document-end, doc)
+SAX.endDocument()
View
4 debugXML.c
@@ -152,6 +152,7 @@ void xmlDebugDumpOneNode(FILE *output, xmlNodePtr node, int depth) {
fprintf(output, "COMMENT\n");
break;
case XML_DOCUMENT_NODE:
+ case XML_HTML_DOCUMENT_NODE:
fprintf(output, "Error, DOCUMENT found here\n");
break;
case XML_DOCUMENT_TYPE_NODE:
@@ -238,6 +239,9 @@ void xmlDebugDumpDocument(FILE *output, xmlDocPtr doc) {
case XML_DOCUMENT_NODE:
fprintf(output, "DOCUMENT\n");
break;
+ case XML_HTML_DOCUMENT_NODE:
+ fprintf(output, "HTML DOCUMENT\n");
+ break;
case XML_DOCUMENT_TYPE_NODE:
fprintf(output, "Error, DOCUMENT_TYPE\n");
break;
View
945 doc/html/gnome-xml-nanohttp.html
@@ -0,0 +1,945 @@
+<HTML
+><HEAD
+><TITLE
+>nanohttp</TITLE
+><META
+NAME="GENERATOR"
+CONTENT="Modular DocBook HTML Stylesheet Version 1.33"><LINK
+REL="HOME"
+TITLE="Gnome XML Library Reference Manual"
+HREF="book1.html"><LINK
+REL="UP"
+TITLE="Gnome XML Library"
+HREF="libxml.html"><LINK
+REL="PREVIOUS"
+TITLE="xmlmemory"
+HREF="gnome-xml-xmlmemory.html"></HEAD
+><BODY
+BGCOLOR="#FFFFFF"
+TEXT="#000000"
+><DIV
+CLASS="NAVHEADER"
+><TABLE
+WIDTH="100%"
+BORDER="0"
+BGCOLOR="#000000"
+CELLPADDING="1"
+CELLSPACING="0"
+><TR
+><TH
+COLSPAN="4"
+ALIGN="center"
+><FONT
+COLOR="#FFFFFF"
+SIZE="5"
+>Gnome XML Library Reference Manual</FONT
+></TH
+></TR
+><TR
+><TD
+WIDTH="25%"
+BGCOLOR="#C00000"
+ALIGN="left"
+><A
+HREF="gnome-xml-xmlmemory.html"
+><FONT
+COLOR="#FFFFFF"
+SIZE="3"
+><B
+>&#60;&#60;&#60; Previous Page</B
+></FONT
+></A
+></TD
+><TD
+WIDTH="25%"
+BGCOLOR="#0000C0"
+ALIGN="center"
+><FONT
+COLOR="#FFFFFF"
+SIZE="3"
+><B
+><A
+HREF="book1.html"
+><FONT
+COLOR="#FFFFFF"
+SIZE="3"
+><B
+>Home</B
+></FONT
+></A
+></B
+></FONT
+></TD
+><TD
+WIDTH="25%"
+BGCOLOR="#00C000"
+ALIGN="center"
+><FONT
+COLOR="#FFFFFF"
+SIZE="3"
+><B
+><A
+HREF="libxml.html"
+><FONT
+COLOR="#FFFFFF"
+SIZE="3"
+><B
+>Up</B
+></FONT
+></A
+></B
+></FONT
+></TD
+><TD
+WIDTH="25%"
+BGCOLOR="#C00000"
+ALIGN="right"
+>&nbsp;</TD
+></TR
+></TABLE
+></DIV
+><H1
+>nanohttp</H1
+><DIV
+CLASS="REFNAMEDIV"
+><A
+NAME="AEN9064"
+></A
+><H2
+>Name</H2
+>nanohttp &#8212; </DIV
+><DIV
+CLASS="REFSYNOPSISDIV"
+><A
+NAME="AEN9067"
+></A
+><H2
+>Synopsis</H2
+><TABLE
+BORDER="0"
+BGCOLOR="#D6E8FF"
+WIDTH="100%"
+CELLPADDING="6"
+><TR
+><TD
+><PRE
+CLASS="SYNOPSIS"
+>&#13;
+
+int <A
+HREF="gnome-xml-nanohttp.html#XMLNANOHTTPFETCH"
+>xmlNanoHTTPFetch</A
+> (const char *URL,
+ const char *filename);
+void* <A
+HREF="gnome-xml-nanohttp.html#XMLNANOHTTPMETHOD"
+>xmlNanoHTTPMethod</A
+> (const char *URL,
+ const char *method,
+ const char *input,
+ char **contentType,
+ const char *headers);
+void* <A
+HREF="gnome-xml-nanohttp.html#XMLNANOHTTPOPEN"
+>xmlNanoHTTPOpen</A
+> (const char *URL,
+ char **contentType);
+int <A
+HREF="gnome-xml-nanohttp.html#XMLNANOHTTPRETURNCODE"
+>xmlNanoHTTPReturnCode</A
+> (void *ctx);
+int <A
+HREF="gnome-xml-nanohttp.html#XMLNANOHTTPREAD"
+>xmlNanoHTTPRead</A
+> (void *ctx,
+ void *dest,
+ int len);
+int <A
+HREF="gnome-xml-nanohttp.html#XMLNANOHTTPSAVE"
+>xmlNanoHTTPSave</A
+> (void *ctxt,
+ const char *filename);
+void <A
+HREF="gnome-xml-nanohttp.html#XMLNANOHTTPCLOSE"
+>xmlNanoHTTPClose</A
+> (void *ctx);</PRE
+></TD
+></TR
+></TABLE
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="AEN9077"
+></A
+><H2
+>Description</H2
+><P
+></P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="AEN9080"
+></A
+><H2
+>Details</H2
+><DIV
+CLASS="REFSECT2"
+><A
+NAME="AEN9082"
+></A
+><H3
+><A
+NAME="XMLNANOHTTPFETCH"
+></A
+>xmlNanoHTTPFetch ()</H3
+><TABLE
+BORDER="0"
+BGCOLOR="#D6E8FF"
+WIDTH="100%"
+CELLPADDING="6"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>int xmlNanoHTTPFetch (const char *URL,
+ const char *filename);</PRE
+></TD
+></TR
+></TABLE
+><P
+>This function try to fetch the indicated resource via HTTP GET
+and save it's content in the file.</P
+><P
+></P
+><DIV
+CLASS="INFORMALTABLE"
+><P
+></P
+><TABLE
+BORDER="0"
+WIDTH="100%"
+BGCOLOR="#FFD0D0"
+CELLSPACING="0"
+CELLPADDING="4"
+CLASS="CALSTABLE"
+><TR
+><TD
+WIDTH="20%"
+ALIGN="RIGHT"
+VALIGN="TOP"
+><TT
+CLASS="PARAMETER"
+><I
+>URL</I
+></TT
+>&nbsp;:</TD
+><TD
+WIDTH="80%"
+ALIGN="LEFT"
+VALIGN="TOP"
+> The URL to load</TD
+></TR
+><TR
+><TD
+WIDTH="20%"
+ALIGN="RIGHT"
+VALIGN="TOP"
+><TT
+CLASS="PARAMETER"
+><I
+>filename</I
+></TT
+>&nbsp;:</TD
+><TD
+WIDTH="80%"
+ALIGN="LEFT"
+VALIGN="TOP"
+> the filename where the content should be saved</TD
+></TR
+><TR
+><TD
+WIDTH="20%"
+ALIGN="RIGHT"
+VALIGN="TOP"
+><I
+CLASS="EMPHASIS"
+>Returns</I
+> :</TD
+><TD
+WIDTH="80%"
+ALIGN="LEFT"
+VALIGN="TOP"
+>-1 in case of failure, 0 incase of success. The contentType,
+if provided must be freed by the caller</TD
+></TR
+></TABLE
+><P
+></P
+></DIV
+></DIV
+><HR><DIV
+CLASS="REFSECT2"
+><A
+NAME="AEN9105"
+></A
+><H3
+><A
+NAME="XMLNANOHTTPMETHOD"
+></A
+>xmlNanoHTTPMethod ()</H3
+><TABLE
+BORDER="0"
+BGCOLOR="#D6E8FF"
+WIDTH="100%"
+CELLPADDING="6"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>void* xmlNanoHTTPMethod (const char *URL,
+ const char *method,
+ const char *input,
+ char **contentType,
+ const char *headers);</PRE
+></TD
+></TR
+></TABLE
+><P
+>This function try to open a connection to the indicated resource
+via HTTP using the given <TT
+CLASS="PARAMETER"
+><I
+>method</I
+></TT
+>, adding the given extra headers
+and the input buffer for the request content.</P
+><P
+></P
+><DIV
+CLASS="INFORMALTABLE"
+><P
+></P
+><TABLE
+BORDER="0"
+WIDTH="100%"
+BGCOLOR="#FFD0D0"
+CELLSPACING="0"
+CELLPADDING="4"
+CLASS="CALSTABLE"
+><TR
+><TD
+WIDTH="20%"
+ALIGN="RIGHT"
+VALIGN="TOP"
+><TT
+CLASS="PARAMETER"
+><I
+>URL</I
+></TT
+>&nbsp;:</TD
+><TD
+WIDTH="80%"
+ALIGN="LEFT"
+VALIGN="TOP"
+> The URL to load</TD
+></TR
+><TR
+><TD
+WIDTH="20%"
+ALIGN="RIGHT"
+VALIGN="TOP"
+><TT
+CLASS="PARAMETER"
+><I
+>method</I
+></TT
+>&nbsp;:</TD
+><TD
+WIDTH="80%"
+ALIGN="LEFT"
+VALIGN="TOP"
+> the HTTP method to use</TD
+></TR
+><TR
+><TD
+WIDTH="20%"
+ALIGN="RIGHT"
+VALIGN="TOP"
+><TT
+CLASS="PARAMETER"
+><I
+>input</I
+></TT
+>&nbsp;:</TD
+><TD
+WIDTH="80%"
+ALIGN="LEFT"
+VALIGN="TOP"
+> the input string if any</TD
+></TR
+><TR
+><TD
+WIDTH="20%"
+ALIGN="RIGHT"
+VALIGN="TOP"
+><TT
+CLASS="PARAMETER"
+><I
+>contentType</I
+></TT
+>&nbsp;:</TD
+><TD
+WIDTH="80%"
+ALIGN="LEFT"
+VALIGN="TOP"
+> the Content-Type information IN and OUT</TD
+></TR
+><TR
+><TD
+WIDTH="20%"
+ALIGN="RIGHT"
+VALIGN="TOP"
+><TT
+CLASS="PARAMETER"
+><I
+>headers</I
+></TT
+>&nbsp;:</TD
+><TD
+WIDTH="80%"
+ALIGN="LEFT"
+VALIGN="TOP"
+> the extra headers</TD
+></TR
+></TABLE
+><P
+></P
+></DIV
+></DIV
+><HR><DIV
+CLASS="REFSECT2"
+><A
+NAME="AEN9137"
+></A
+><H3
+><A
+NAME="XMLNANOHTTPOPEN"
+></A
+>xmlNanoHTTPOpen ()</H3
+><TABLE
+BORDER="0"
+BGCOLOR="#D6E8FF"
+WIDTH="100%"
+CELLPADDING="6"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>void* xmlNanoHTTPOpen (const char *URL,
+ char **contentType);</PRE
+></TD
+></TR
+></TABLE
+><P
+>This function try to open a connection to the indicated resource
+via HTTP GET.</P
+><P
+></P
+><DIV
+CLASS="INFORMALTABLE"
+><P
+></P
+><TABLE
+BORDER="0"
+WIDTH="100%"
+BGCOLOR="#FFD0D0"
+CELLSPACING="0"
+CELLPADDING="4"
+CLASS="CALSTABLE"
+><TR
+><TD
+WIDTH="20%"
+ALIGN="RIGHT"
+VALIGN="TOP"
+><TT
+CLASS="PARAMETER"
+><I
+>URL</I
+></TT
+>&nbsp;:</TD
+><TD
+WIDTH="80%"
+ALIGN="LEFT"
+VALIGN="TOP"
+> The URL to load</TD
+></TR
+><TR
+><TD
+WIDTH="20%"
+ALIGN="RIGHT"
+VALIGN="TOP"
+><TT
+CLASS="PARAMETER"
+><I
+>contentType</I
+></TT
+>&nbsp;:</TD
+><TD
+WIDTH="80%"
+ALIGN="LEFT"
+VALIGN="TOP"
+> if available the Content-Type information will be
+returned at that location</TD
+></TR
+></TABLE
+><P
+></P
+></DIV
+></DIV
+><HR><DIV
+CLASS="REFSECT2"
+><A
+NAME="AEN9156"
+></A
+><H3
+><A
+NAME="XMLNANOHTTPRETURNCODE"
+></A
+>xmlNanoHTTPReturnCode ()</H3
+><TABLE
+BORDER="0"
+BGCOLOR="#D6E8FF"
+WIDTH="100%"
+CELLPADDING="6"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>int xmlNanoHTTPReturnCode (void *ctx);</PRE
+></TD
+></TR
+></TABLE
+><P
+></P
+><P
+></P
+><DIV
+CLASS="INFORMALTABLE"
+><P
+></P
+><TABLE
+BORDER="0"
+WIDTH="100%"
+BGCOLOR="#FFD0D0"
+CELLSPACING="0"
+CELLPADDING="4"
+CLASS="CALSTABLE"
+><TR
+><TD
+WIDTH="20%"
+ALIGN="RIGHT"
+VALIGN="TOP"
+><TT
+CLASS="PARAMETER"
+><I
+>ctx</I
+></TT
+>&nbsp;:</TD
+><TD
+WIDTH="80%"
+ALIGN="LEFT"
+VALIGN="TOP"
+> the HTTP context</TD
+></TR
+><TR
+><TD
+WIDTH="20%"
+ALIGN="RIGHT"
+VALIGN="TOP"
+><I
+CLASS="EMPHASIS"
+>Returns</I
+> :</TD
+><TD
+WIDTH="80%"
+ALIGN="LEFT"
+VALIGN="TOP"
+>the HTTP return code for the request.</TD
+></TR
+></TABLE
+><P
+></P
+></DIV
+></DIV
+><HR><DIV
+CLASS="REFSECT2"
+><A
+NAME="AEN9175"
+></A
+><H3
+><A
+NAME="XMLNANOHTTPREAD"
+></A
+>xmlNanoHTTPRead ()</H3
+><TABLE
+BORDER="0"
+BGCOLOR="#D6E8FF"
+WIDTH="100%"
+CELLPADDING="6"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>int xmlNanoHTTPRead (void *ctx,
+ void *dest,
+ int len);</PRE
+></TD
+></TR
+></TABLE
+><P
+>This function tries to read <TT
+CLASS="PARAMETER"
+><I
+>len</I
+></TT
+> bytes from the existing HTTP connection
+and saves them in <TT
+CLASS="PARAMETER"
+><I
+>dest</I
+></TT
+>. This is a blocking call.</P
+><P
+></P
+><DIV
+CLASS="INFORMALTABLE"
+><P
+></P
+><TABLE
+BORDER="0"
+WIDTH="100%"
+BGCOLOR="#FFD0D0"
+CELLSPACING="0"
+CELLPADDING="4"
+CLASS="CALSTABLE"
+><TR
+><TD
+WIDTH="20%"
+ALIGN="RIGHT"
+VALIGN="TOP"
+><TT
+CLASS="PARAMETER"
+><I
+>ctx</I
+></TT
+>&nbsp;:</TD
+><TD
+WIDTH="80%"
+ALIGN="LEFT"
+VALIGN="TOP"
+> the HTTP context</TD
+></TR
+><TR
+><TD
+WIDTH="20%"
+ALIGN="RIGHT"
+VALIGN="TOP"
+><TT
+CLASS="PARAMETER"
+><I
+>dest</I
+></TT
+>&nbsp;:</TD
+><TD
+WIDTH="80%"
+ALIGN="LEFT"
+VALIGN="TOP"
+> a buffer</TD
+></TR
+><TR
+><TD
+WIDTH="20%"
+ALIGN="RIGHT"
+VALIGN="TOP"
+><TT
+CLASS="PARAMETER"
+><I
+>len</I
+></TT
+>&nbsp;:</TD
+><TD
+WIDTH="80%"
+ALIGN="LEFT"
+VALIGN="TOP"
+> the buffer length</TD
+></TR
+><TR
+><TD
+WIDTH="20%"
+ALIGN="RIGHT"
+VALIGN="TOP"
+><I
+CLASS="EMPHASIS"
+>Returns</I
+> :</TD
+><TD
+WIDTH="80%"
+ALIGN="LEFT"
+VALIGN="TOP"
+>the number of byte read. 0 is an indication of an end of connection.
+-1 indicates a parameter error.</TD
+></TR
+></TABLE
+><P
+></P
+></DIV
+></DIV
+><HR><DIV
+CLASS="REFSECT2"
+><A
+NAME="AEN9204"
+></A
+><H3
+><A
+NAME="XMLNANOHTTPSAVE"
+></A
+>xmlNanoHTTPSave ()</H3
+><TABLE
+BORDER="0"
+BGCOLOR="#D6E8FF"
+WIDTH="100%"
+CELLPADDING="6"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>int xmlNanoHTTPSave (void *ctxt,
+ const char *filename);</PRE
+></TD
+></TR
+></TABLE
+><P
+>This function saves the output of the HTTP transaction to a file
+It closes and free the context at the end</P
+><P
+></P
+><DIV
+CLASS="INFORMALTABLE"
+><P
+></P
+><TABLE
+BORDER="0"
+WIDTH="100%"
+BGCOLOR="#FFD0D0"
+CELLSPACING="0"
+CELLPADDING="4"
+CLASS="CALSTABLE"
+><TR
+><TD
+WIDTH="20%"
+ALIGN="RIGHT"
+VALIGN="TOP"
+><TT
+CLASS="PARAMETER"
+><I
+>ctxt</I
+></TT
+>&nbsp;:</TD
+><TD
+WIDTH="80%"
+ALIGN="LEFT"
+VALIGN="TOP"
+>&nbsp;</TD
+></TR
+><TR
+><TD
+WIDTH="20%"
+ALIGN="RIGHT"
+VALIGN="TOP"
+><TT
+CLASS="PARAMETER"
+><I
+>filename</I
+></TT
+>&nbsp;:</TD
+><TD
+WIDTH="80%"
+ALIGN="LEFT"
+VALIGN="TOP"
+> the filename where the content should be saved</TD
+></TR
+><TR
+><TD
+WIDTH="20%"
+ALIGN="RIGHT"
+VALIGN="TOP"
+><I
+CLASS="EMPHASIS"
+>Returns</I
+> :</TD
+><TD
+WIDTH="80%"
+ALIGN="LEFT"
+VALIGN="TOP"
+>-1 in case of failure, 0 incase of success.</TD
+></TR
+></TABLE
+><P
+></P
+></DIV
+></DIV
+><HR><DIV
+CLASS="REFSECT2"
+><A
+NAME="AEN9227"
+></A
+><H3
+><A
+NAME="XMLNANOHTTPCLOSE"
+></A
+>xmlNanoHTTPClose ()</H3
+><TABLE
+BORDER="0"
+BGCOLOR="#D6E8FF"
+WIDTH="100%"
+CELLPADDING="6"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>void xmlNanoHTTPClose (void *ctx);</PRE
+></TD
+></TR
+></TABLE
+><P
+>This function closes an HTTP context, it ends up the connection and
+free all data related to it.</P
+><P
+></P
+><DIV
+CLASS="INFORMALTABLE"
+><P
+></P
+><TABLE
+BORDER="0"
+WIDTH="100%"
+BGCOLOR="#FFD0D0"
+CELLSPACING="0"
+CELLPADDING="4"
+CLASS="CALSTABLE"
+><TR
+><TD
+WIDTH="20%"
+ALIGN="RIGHT"
+VALIGN="TOP"
+><TT
+CLASS="PARAMETER"
+><I
+>ctx</I
+></TT
+>&nbsp;:</TD
+><TD
+WIDTH="80%"
+ALIGN="LEFT"
+VALIGN="TOP"
+> the HTTP context</TD
+></TR
+></TABLE
+><P
+></P
+></DIV
+></DIV
+></DIV
+><DIV
+CLASS="NAVFOOTER"
+><BR
+CLEAR="all"><BR><TABLE
+WIDTH="100%"
+BORDER="0"
+BGCOLOR="#000000"
+CELLPADDING="1"
+CELLSPACING="0"
+><TR
+><TD
+WIDTH="25%"
+BGCOLOR="#C00000"
+ALIGN="left"
+><A
+HREF="gnome-xml-xmlmemory.html"
+><FONT
+COLOR="#FFFFFF"
+SIZE="3"
+><B
+>&#60;&#60;&#60; Previous Page</B
+></FONT
+></A
+></TD
+><TD
+WIDTH="25%"
+BGCOLOR="#0000C0"
+ALIGN="center"
+><FONT
+COLOR="#FFFFFF"
+SIZE="3"
+><B
+><A
+HREF="book1.html"
+><FONT
+COLOR="#FFFFFF"
+SIZE="3"
+><B
+>Home</B
+></FONT
+></A
+></B
+></FONT
+></TD
+><TD
+WIDTH="25%"
+BGCOLOR="#00C000"
+ALIGN="center"
+><FONT
+COLOR="#FFFFFF"
+SIZE="3"
+><B
+><A
+HREF="libxml.html"
+><FONT
+COLOR="#FFFFFF"
+SIZE="3"
+><B
+>Up</B
+></FONT
+></A
+></B
+></FONT
+></TD
+><TD
+WIDTH="25%"
+BGCOLOR="#C00000"
+ALIGN="right"
+>&nbsp;</TD
+></TR
+><TR
+><TD
+COLSPAN="2"
+ALIGN="left"
+><FONT
+COLOR="#FFFFFF"
+SIZE="3"
+><B
+>xmlmemory</B
+></FONT
+></TD
+><TD
+COLSPAN="2"
+ALIGN="right"
+>&nbsp;</TD
+></TR
+></TABLE
+></DIV
+></BODY
+></HTML
+>
View
1,277 doc/html/gnome-xml-xmlmemory.html
@@ -0,0 +1,1277 @@
+<HTML
+><HEAD
+><TITLE
+>xmlmemory</TITLE
+><META
+NAME="GENERATOR"
+CONTENT="Modular DocBook HTML Stylesheet Version 1.33"><LINK
+REL="HOME"
+TITLE="Gnome XML Library Reference Manual"
+HREF="book1.html"><LINK
+REL="UP"
+TITLE="Gnome XML Library"
+HREF="libxml.html"><LINK
+REL="PREVIOUS"
+TITLE="parserInternals"
+HREF="gnome-xml-parserinternals.html"><LINK
+REL="NEXT"
+TITLE="nanohttp"
+HREF="gnome-xml-nanohttp.html"></HEAD
+><BODY
+BGCOLOR="#FFFFFF"
+TEXT="#000000"
+><DIV
+CLASS="NAVHEADER"
+><TABLE
+WIDTH="100%"
+BORDER="0"
+BGCOLOR="#000000"
+CELLPADDING="1"
+CELLSPACING="0"
+><TR
+><TH
+COLSPAN="4"
+ALIGN="center"
+><FONT
+COLOR="#FFFFFF"
+SIZE="5"
+>Gnome XML Library Reference Manual</FONT
+></TH
+></TR
+><TR
+><TD
+WIDTH="25%"
+BGCOLOR="#C00000"
+ALIGN="left"
+><A
+HREF="gnome-xml-parserinternals.html"
+><FONT
+COLOR="#FFFFFF"
+SIZE="3"
+><B
+>&#60;&#60;&#60; Previous Page</B
+></FONT
+></A
+></TD
+><TD
+WIDTH="25%"
+BGCOLOR="#0000C0"
+ALIGN="center"
+><FONT
+COLOR="#FFFFFF"
+SIZE="3"
+><B
+><A
+HREF="book1.html"
+><FONT
+COLOR="#FFFFFF"
+SIZE="3"
+><B
+>Home</B
+></FONT
+></A
+></B
+></FONT
+></TD
+><TD
+WIDTH="25%"
+BGCOLOR="#00C000"
+ALIGN="center"
+><FONT
+COLOR="#FFFFFF"
+SIZE="3"
+><B
+><A
+HREF="libxml.html"
+><FONT
+COLOR="#FFFFFF"
+SIZE="3"
+><B
+>Up</B
+></FONT
+></A
+></B
+></FONT
+></TD
+><TD
+WIDTH="25%"
+BGCOLOR="#C00000"
+ALIGN="right"
+><A
+HREF="gnome-xml-nanohttp.html"
+><FONT
+COLOR="#FFFFFF"
+SIZE="3"
+><B
+>Next Page &#62;&#62;&#62;</B
+></FONT
+></A
+></TD
+></TR
+></TABLE
+></DIV
+><H1
+>xmlmemory</H1
+><DIV
+CLASS="REFNAMEDIV"
+><A
+NAME="AEN8804"
+></A
+><H2
+>Name</H2
+>xmlmemory &#8212; </DIV
+><DIV
+CLASS="REFSYNOPSISDIV"
+><A
+NAME="AEN8807"
+></A
+><H2
+>Synopsis</H2
+><TABLE
+BORDER="0"
+BGCOLOR="#D6E8FF"
+WIDTH="100%"
+CELLPADDING="6"
+><TR
+><TD
+><PRE
+CLASS="SYNOPSIS"
+>&#13;
+
+#define <A
+HREF="gnome-xml-xmlmemory.html#NO-DEBUG-MEMORY"
+>NO_DEBUG_MEMORY</A
+>
+void <A
+HREF="gnome-xml-xmlmemory.html#XMLFREE"
+>xmlFree</A
+> (void *ptr);
+void* <A
+HREF="gnome-xml-xmlmemory.html#XMLMALLOC"
+>xmlMalloc</A
+> (<GTKDOCLINK
+HREF="SIZE-T"
+>size_t</GTKDOCLINK
+> size);
+void* <A
+HREF="gnome-xml-xmlmemory.html#XMLREALLOC"
+>xmlRealloc</A
+> (void *ptr,
+ <GTKDOCLINK
+HREF="SIZE-T"
+>size_t</GTKDOCLINK
+> size);
+char* <A
+HREF="gnome-xml-xmlmemory.html#XMLMEMSTRDUP"
+>xmlMemStrdup</A
+> (const char *str);
+int <A
+HREF="gnome-xml-xmlmemory.html#XMLINITMEMORY"
+>xmlInitMemory</A
+> (void);
+int <A
+HREF="gnome-xml-xmlmemory.html#XMLMEMUSED"
+>xmlMemUsed</A
+> (void);
+void <A
+HREF="gnome-xml-xmlmemory.html#XMLMEMORYDUMP"
+>xmlMemoryDump</A
+> (void);
+void <A
+HREF="gnome-xml-xmlmemory.html#XMLMEMDISPLAY"
+>xmlMemDisplay</A
+> (<GTKDOCLINK
+HREF="FILE"
+>FILE</GTKDOCLINK
+> *fp);
+#define <A
+HREF="gnome-xml-xmlmemory.html#DEBUG-MEMORY-LOCATION"
+>DEBUG_MEMORY_LOCATION</A
+>
+#define <A
+HREF="gnome-xml-xmlmemory.html#DEBUG-MEMORY"
+>DEBUG_MEMORY</A
+>
+#define <A
+HREF="gnome-xml-xmlmemory.html#MEM-LIST"
+>MEM_LIST</A
+>
+void* <A
+HREF="gnome-xml-xmlmemory.html#XMLMALLOCLOC"
+>xmlMallocLoc</A
+> (int size,
+ const char *file,
+ int line);
+void* <A
+HREF="gnome-xml-xmlmemory.html#XMLREALLOCLOC"
+>xmlReallocLoc</A
+> (void *ptr,
+ int size,
+ const char *file,
+ int line);
+char* <A
+HREF="gnome-xml-xmlmemory.html#XMLMEMSTRDUPLOC"
+>xmlMemStrdupLoc</A
+> (const char *str,
+ const char *file,
+ int line);</PRE
+></TD
+></TR
+></TABLE
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="AEN8828"
+></A
+><H2
+>Description</H2
+><P
+></P
+></DIV
+><DIV
+CLASS="REFSECT1"
+><A
+NAME="AEN8831"
+></A
+><H2
+>Details</H2
+><DIV
+CLASS="REFSECT2"
+><A
+NAME="AEN8833"
+></A
+><H3
+><A
+NAME="NO-DEBUG-MEMORY"
+></A
+>NO_DEBUG_MEMORY</H3
+><TABLE
+BORDER="0"
+BGCOLOR="#D6E8FF"
+WIDTH="100%"
+CELLPADDING="6"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>#define NO_DEBUG_MEMORY</PRE
+></TD
+></TR
+></TABLE
+><P
+></P
+></DIV
+><HR><DIV
+CLASS="REFSECT2"
+><A
+NAME="AEN8838"
+></A
+><H3
+><A
+NAME="XMLFREE"
+></A
+>xmlFree ()</H3
+><TABLE
+BORDER="0"
+BGCOLOR="#D6E8FF"
+WIDTH="100%"
+CELLPADDING="6"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>void xmlFree (void *ptr);</PRE
+></TD
+></TR
+></TABLE
+><P
+>a <GTKDOCLINK
+HREF="FREE"
+>free</GTKDOCLINK
+>() equivalent, with error checking.</P
+><P
+></P
+><DIV
+CLASS="INFORMALTABLE"
+><P
+></P
+><TABLE
+BORDER="0"
+WIDTH="100%"
+BGCOLOR="#FFD0D0"
+CELLSPACING="0"
+CELLPADDING="4"
+CLASS="CALSTABLE"
+><TR
+><TD
+WIDTH="20%"
+ALIGN="RIGHT"
+VALIGN="TOP"
+><TT
+CLASS="PARAMETER"
+><I
+>ptr</I
+></TT
+>&nbsp;:</TD
+><TD
+WIDTH="80%"
+ALIGN="LEFT"
+VALIGN="TOP"
+>&nbsp;</TD
+></TR
+></TABLE
+><P
+></P
+></DIV
+></DIV
+><HR><DIV
+CLASS="REFSECT2"
+><A
+NAME="AEN8854"
+></A
+><H3
+><A
+NAME="XMLMALLOC"
+></A
+>xmlMalloc ()</H3
+><TABLE
+BORDER="0"
+BGCOLOR="#D6E8FF"
+WIDTH="100%"
+CELLPADDING="6"
+><TR
+><TD
+><PRE
+CLASS="PROGRAMLISTING"
+>void* xmlMalloc (<GTKDOCLINK
+HREF="SIZE-T"
+>size_t</GTKDOCLINK
+> size);</PRE
+></TD
+></TR
+></TABLE
+><P
+>a <GTKDOCLINK
+HREF="MALLOC"
+>malloc</GTKDOCLINK
+>() equivalent, with logging of the allocation info.</