Re: [xml] Adding a namespace to an existing tree?
- From: Abraham Nelson <abe49_90210 yahoo com>
- To: veillard redhat com
- Cc: xml gnome org
- Subject: Re: [xml] Adding a namespace to an existing tree?
- Date: Sun, 20 Mar 2005 08:59:15 -0800 (PST)
--- Daniel Veillard <veillard redhat com> wrote:
node and attributes structure have an ns field
indicating to which
manespace they pertain or NULL if they are not
related to any namespace.
I had seen a reference to those in the archive, so I
tried this (which works):
xmlNsPtr
NameSpace=xmlNewNs(xmlDocGetRootElement(xmlDoc),(xmlChar
*)"<ns>",NULL);
setElementNS(xmlDocGetRootElement(receiver),nameSpace);
void setElementNS(xmlNode * a_node,xmlNsPtr nameSpace)
{
xmlNode *cur_node = NULL;
for (cur_node = a_node; cur_node; cur_node =
cur_node->next) {
if (cur_node->type == XML_ELEMENT_NODE) {
cur_node->ns=nameSpace;
}
setElementNS(cur_node->children,nameSpace);
}
}
However now I wonder if the namespace structure I
created will automatically be freed when I call
xmlFreeDoc(xmlDoc) later, or if I have to release it
myself with xmlFreeNS?
__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]