I am trying to create an XML document using Powershell. I am using System.XML.XMLTextWriter to create my document. I have searched all over looking for an answer and can't find it.
Here's what I have right now:
$variable = "my text"
$xmlWriter.WriteStartElement('Legal')
$xmlWriter.WriteStartElement("heading")
$XmlWriter.WriteAttributeString("![CDATA[]]",$Variable)
I would like the end result to look like:
<Legal>
<heading>
<![CDATA[ $Variable ]]>
</heading>
</Legal>
$XmlWriter.WriteCData($Variable)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.