some cleanup after an unsuccessful attempt at fixing #61290 :-( Daniel
* debugXML.c tree.c: some cleanup after an unsuccessful attempt
at fixing #61290 :-(
Daniel
diff --git a/ChangeLog b/ChangeLog
index 1b9960b..dc14efd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Jan 14 17:53:41 CET 2002 Daniel Veillard <daniel@veillard.com>
+
+ * debugXML.c tree.c: some cleanup after an unsuccessful attempt
+ at fixing #61290 :-(
+
Sun Jan 13 21:30:54 CET 2002 Daniel Veillard <daniel@veillard.com>
* tree.c: fixed xmlSaveFormatFileEnc() when encoding == NULL
diff --git a/debugXML.c b/debugXML.c
index e3b5c3d..fa25c91 100644
--- a/debugXML.c
+++ b/debugXML.c
@@ -1111,17 +1111,22 @@
case XML_NOTATION_NODE:
fprintf(output, "N");
break;
+ case XML_NAMESPACE_DECL:
+ fprintf(output, "n");
+ break;
default:
fprintf(output, "?");
}
- if (node->properties != NULL)
- fprintf(output, "a");
- else
- fprintf(output, "-");
- if (node->nsDef != NULL)
- fprintf(output, "n");
- else
- fprintf(output, "-");
+ if (node->type != XML_NAMESPACE_DECL) {
+ if (node->properties != NULL)
+ fprintf(output, "a");
+ else
+ fprintf(output, "-");
+ if (node->nsDef != NULL)
+ fprintf(output, "n");
+ else
+ fprintf(output, "-");
+ }
fprintf(output, " %8d ", xmlLsCountNode(node));
@@ -1169,6 +1174,15 @@
break;
case XML_NOTATION_NODE:
break;
+ case XML_NAMESPACE_DECL: {
+ xmlNsPtr ns = (xmlNsPtr) node;
+
+ if (ns->prefix == NULL)
+ fprintf(output, "default -> %s", ns->href);
+ else
+ fprintf(output, "%s -> %s", ns->prefix, ns->href);
+ break;
+ }
default:
if (node->name != NULL)
fprintf(output, "%s", node->name);
@@ -1363,6 +1377,9 @@
if ((node->type == XML_DOCUMENT_NODE) ||
(node->type == XML_HTML_DOCUMENT_NODE)) {
cur = ((xmlDocPtr) node)->children;
+ } else if (node->type == XML_NAMESPACE_DECL) {
+ xmlLsOneNode(stdout, node);
+ return (0);
} else if (node->children != NULL) {
cur = node->children;
} else {
diff --git a/tree.c b/tree.c
index e2d599a..4ae0a1e 100644
--- a/tree.c
+++ b/tree.c
@@ -2352,6 +2352,10 @@
#endif
return;
}
+ if (cur->type == XML_NAMESPACE_DECL) {
+ xmlFreeNsList((xmlNsPtr) cur);
+ return;
+ }
while (cur != NULL) {
next = cur->next;
/* unroll to speed up freeing the document */
@@ -2425,8 +2429,14 @@
return;
}
/* use xmlFreeDtd for DTD nodes */
- if (cur->type == XML_DTD_NODE)
+ if (cur->type == XML_DTD_NODE) {
+ xmlFreeDtd((xmlDtdPtr) cur);
return;
+ }
+ if (cur->type == XML_NAMESPACE_DECL) {
+ xmlFreeNs((xmlNsPtr) cur);
+ return;
+ }
if ((cur->children != NULL) &&
(cur->type != XML_ENTITY_REF_NODE))
xmlFreeNodeList(cur->children);