Hi All,
I have an XML document that looks like this:
<book>
<title>Foo</title>
<description>
<div xmlns="http://www.w3.org/1999/xhtml">
<p>Body this is the body</p>
</div>
</description>
</book>
Now I need to append this document into another XmlDocument object. To
correctly do this I want to add a namespace on the original XmlDocument with
"book" as it prefix. But I don't want change the namespace of the <div> since
it has a namespace defined on it.
So for example the result should look something like this:
<book:book xmlns:book="http://localhost/book.xsd">
<book:title>Foo</book:title>
<book:description>
<div xmlns="http://www.w3.org/1999/xhtml">
<p>Body this is the body</p>
</div>
</book:description>
</book:book>
So how would I do this? What's the best way to achive the result? I've tried
using Regex but soon stumped on the problem that it couldn't differentiate
non-namespaced nodes with the one with namespace. Or maybe with super funky
Regex I could use that, but is there a nicer XML way of doing it?
Thanks,
--
Victor Hadianto
http://www.synop.com/Products/SauceReader/