Luxuguy Posted July 16, 2008 Share Posted July 16, 2008 Hi,I have created a root node like this:<root></root>I also create another node like this:<child></child>Now I want to write a method that:+ insert the Child node into root+ insert a namespace "ts" in front of the childSo it will look like this:<root><ts:child></ts:child><root>Inserting the child node into root node is simple ( I know how to do it ), but I have no clue how to insert "ts" in front of child.Can anyone help me ?Thanks a lot,Luxuguy Link to comment Share on other sites More sharing options...
boen_robot Posted July 16, 2008 Share Posted July 16, 2008 What language are we talking about?In PHP, it's as simple as using createElementNS() and knowing the actual namespace URI behind the "ts" prefix. eg. $dom->documentElement->appendChild($dom->createElementNS('http://example.com/myNamespace', 'child', 'Contents of the child element (optional)')); Assuming the namespace URI is "http://example.com/myNamespace" of course. Link to comment Share on other sites More sharing options...
Luxuguy Posted July 17, 2008 Author Share Posted July 17, 2008 Sorry, it's C# using .NET 2.0 Link to comment Share on other sites More sharing options...
boen_robot Posted July 17, 2008 Share Posted July 17, 2008 Well... how do you insert a non-namespaced element? Is it again with DOM (i.e. with an appendChild() and createElement() duo)? If so, the solution is again to use createElementNS() instead. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.