Adding a new set of APIs based on the C# TextXmlReader API but converted
* Makefile.am xmlreader.c include/libxml/Makefile.am
include/libxml/xmlreader.h: Adding a new set of APIs based on
the C# TextXmlReader API but converted to C. Allow to parse
in constant memory usage, far simpler to program and explain
than the SAX like APIs, unfinished but working.
* testReader.c: test program
Daniel
diff --git a/tree.c b/tree.c
index b995c78..cf50bce 100644
--- a/tree.c
+++ b/tree.c
@@ -2589,7 +2589,8 @@
if ((cur->children != NULL) &&
(cur->type != XML_ENTITY_REF_NODE))
xmlFreeNodeList(cur->children);
- if (cur->properties != NULL)
+ if ((cur->type == XML_ELEMENT_NODE) &&
+ (cur->properties != NULL))
xmlFreePropList(cur->properties);
if ((cur->type != XML_ELEMENT_NODE) &&
(cur->type != XML_XINCLUDE_START) &&
@@ -2666,7 +2667,7 @@
if ((cur->children != NULL) &&
(cur->type != XML_ENTITY_REF_NODE))
xmlFreeNodeList(cur->children);
- if (cur->properties != NULL)
+ if ((cur->type == XML_ELEMENT_NODE) && (cur->properties != NULL))
xmlFreePropList(cur->properties);
if ((cur->type != XML_ELEMENT_NODE) &&
(cur->content != NULL) &&
@@ -2701,7 +2702,11 @@
xmlFree((char *) cur->name);
}
- if (cur->nsDef != NULL) xmlFreeNsList(cur->nsDef);
+ if (((cur->type == XML_ELEMENT_NODE) ||
+ (cur->type == XML_XINCLUDE_START) ||
+ (cur->type == XML_XINCLUDE_END)) &&
+ (cur->nsDef != NULL))
+ xmlFreeNsList(cur->nsDef);
xmlFree(cur);
}