|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
XmlNode.InnerText<code> XmlDocument doc = new XmlDocument(); string sInnerXml = "abc<i>def</i>ghi"; doc.LoadXml("<doc1 xmlns="myNamespace"><tag1>ABC</tag1><tag2>DEF</tag2></doc1>"); doc.FirstChild.FirstChild.InnerText = sInnerXml; string resultXml = doc.FirstChild.OuterXml; </code> I have the problem that the resultXml looks like: <xml-doc> <doc1 xmlns="myNamespace"> <tag1>abc<i xmlns="myNamespace">def</i>ghi</tag1> <tag2>DEF</tag2> </doc1> </xml-doc> The problem being that the <i> tag within <tag1> has an xmlns attribute. How can I get rid of it while keeping the namespace for the document as a whole? |
|||||||||||||||||||||||