XmlTextWriter.WriteCData(String) 方法
定义
写出包含指定文本的 <![CDATA[...]]> 块。Writes out a <![CDATA[...]]> block containing the specified text.
public:
override void WriteCData(System::String ^ text);
public override void WriteCData (string? text);
public override void WriteCData (string text);
override this.WriteCData : string -> unit
Public Overrides Sub WriteCData (text As String)
参数
- text
- String
要放置在 CDATA 块中的文本。Text to place inside the CDATA block.
例外
该文本将导致格式不正确的 XML 文档。The text would result in a non-well formed XML document.
WriteState 为 Closed。The WriteState is Closed.
注解
备注
从 .NET Framework 2.0 开始,我们建议 XmlWriter 使用 XmlWriter.Create 方法和类创建实例, XmlWriterSettings 以利用新功能。Starting with the .NET Framework 2.0, we recommend that you create XmlWriter instances by using the XmlWriter.Create method and the XmlWriterSettings class to take advantage of new functionality.
如果 text 是 null 或 String.Empty ,则此方法会写入一个空 CDATA 块,例如 < ! [CDATA []If text is either null or String.Empty, this method writes an empty CDATA block, for example <![CDATA[]