Comcast Cable Communications, Inc.

Avoiding Character Escape When Calling XmlWriter.WriteElementString

I have a line:

<entry key="Provider">Comcast Cable Communications, Inc.</entry>
<entry key="Challenged">No</entry>

I want to print this line with XmlWriter.WriteElementString(). The problem here is that it XmlWriter.WriteElementString()will come out of all characters <and >with &lt;and &gt;. I checked MSDN to find out if there is a way to disable this, but did not find an answer.

Is there a way to turn off auto-escaping that happens?

+3
source share
3 answers

Using XmlWriter.WriteRaw () to output the text solved my problem.

+9
source

XML, ? XML XML? - :

<outer>
    <entry key="Provider">Comcast Cable Communications, Inc.</entry>
    <entry key="Challenged">No</entry>
</outer>

WriteElementString. XmlWriter.WriteNode.

0

Is this the same XML you are trying to write? (not literally inside XML)?

Try the following:


xmlWriter.WriteStartElement("entry");
xmlWriter.WriteAttributeString("key", "Provider");
xmlWriter.WriteValue("Comcast Cable Communications, Inc.")
xmlWriter.WriteEndElement()

0
source

Source: https://habr.com/ru/post/1738536/


All Articles