[xml] usage of xmlReconciliateNs
- From: Kasimier Buchcik <kbuchcik 4commerce de>
- To: <xml gnome org>
- Subject: [xml] usage of xmlReconciliateNs
- Date: Fri, 25 Apr 2003 12:25:08 +0200
i'm curious about when to use the xmlReconciliateNs(xmlDocPtr doc,
xmlNodePtr tree) function.
I tried a tiny test:
1. created a document with some stale links to namespace structures
(NULLed some nsDef pointers)
2. called xmlReconciliateNs(thisDoc, thisDoc->children)
I learned that the function recreates (at thisDoc->children) and remaps
all existing namespaces of the given subtree.
Here comes the point of my confusion:
The function xmlNewReconciliedNs called inside xmlReconciliateNs never
finds an existent nsDef pendant for any of the ns references *inside*
the subtree, since xmlNewReconciliedNs does search in the parental axis
of the tree - iow: *outside* the subtree.
This leaves my document with unnecessarily remapped namespaces, and
furthermore, with now useless xmlNs structures sleeping on nsDefs -
possibly corrupting a serialized output.
Since this might not be the desired result, I guess the function has an
other context of usability. The provided documentation does not give me
a clear idea of when to use this function without the problems described
Annother question: is the algorithm of this function intended to be
expanded someday, so that it could move namespace declarations to
elements where they are first needed (not all at the top of the tree)?
] [Thread Prev