Re: [xml] how to build dom tree with ns decls



On Mon, Jan 14, 2002 at 04:08:06AM +0100, Petr Kozelka wrote:
(the ns decl is missing). I used the code at the end.

  I usually don't debug other people code but this one is obvious:

 ns = xmlNewNs((xmlNodePtr)doc, "ns1.test", "t1");
 el = xmlNewDocNode(doc, ns, "t1:test", "something iside");

  You need to add back ns to el. Currently no node holds the namespace
node and hence it's not serialized.
   xmlSetNs(el, ns)

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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