I’m building a XML document dynamically where I create a a text node with CreateTextNode(text) method.
Now in case the text contains XML it will be XML encoded.
For instance:
text = "some <b>bolded</b> text"
How do you insert the text without being XML encoded.
EDIT:
I’m building a XML document with XmlDocument and insert elements and nodes.
The final output should not contain CDATA sections or encoded parts.
For instace I want the final output to look like this, where the text comes from a setting:
<root><p>Some <b>bolded</b> text</p></root>
If you want the text to be
"some <b>bolded</b> text", then encoding is the right thing – otherwise it isn’t (just) a text node. You could CDATA it, but I do not think that is what you mean either.Do you want the XML contents to be the above text (so that it gets a
<b>...</b>element inside it)?Here’s code that adds the content via various methods: