Append XML string block WITH NAMESPACE REF to existing XmlDocument in .NET
Posted
by FT
on Stack Overflow
See other posts from Stack Overflow
or by FT
Published on 2010-03-22T11:27:46Z
Indexed on
2010/03/22
11:31 UTC
Read the original article
Hit count: 500
I have an xml document (XmlDocument) which looks like this...
<stuff xmlns:n="hhtp://tempuri.com/">
</stuff>
... and a "fragment" (string) which looks like this
<things>
<thing n:type="info">
</thing>
</things>
I want to "inject" the fragment into the main document.
How?
(HINT: You can't use XmlDocumentFragment because the namespace 'n' isn't declared in the fragment, and the object model complains about this - throwing an 'unknown namespace' error even though the resultant document will be perfectly valid.)
© Stack Overflow or respective owner