gpt4 book ai didi

c# - 通过 System.Xml.XmlWriter 转义尖括号

转载 作者:数据小太阳 更新时间:2023-10-29 02:38:18 35 4
gpt4 key购买 nike

我正在通过 System.Xml.XmlWriter 编写一个包含一些 XML 的字符串。我被困在使用 WriteString() 和文档中:

WriteString does the following: The characters &, <, and > are replaced with &amp;, &lt;, and &gt;, respectively.

我希望停止此操作,但我似乎找不到任何 XmlWriterSettings 属性来控制此行为。有哪些解决方法?谢谢!

大卫

最佳答案

尝试将您的真实内容包装在 CDATA 标签之间:

<![CDATA[ 这是我的内容 ]]>

关于c# - 通过 System.Xml.XmlWriter 转义尖括号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66479/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com