[xml] xmlAddChild (and namespace)



Hello, I am trying to add a node and am doing so successfully except that the namespace declarations are lost? The xml from both of these docs has the namespace in question defined.  Example follows.

 

// assume both these are valid and belong to separate xmlDocs

    xmlNodePtr content_node 

    xmlNodePtr body_node 

 

// sc is the xmlDocPtr I want to add the node to

body_node = xmlDocCopyNode(body_node, sc, 1);

 xmlAddChild(content_node, body_node->children);

 

xmlDocDumpMemory(sc,&new_doc,&new_doc_size);

ret_xml = (char *) new_doc;

// The ret_xml has everything there except the namespace declarations from the body_node. So, rather than rn:special_tag I get special_tag.  I guess something extra must be done to declare the namespace.


Find just what you're after with the new, more precise MSN Search - try it now!

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]