XmlWriter¶
Builds XML text element by element.
Remarks¶
Create a writer with Xml.Create in server scripts. Element and attribute values are encoded, so the writer is safer than building XML by concatenating strings. The methods return the writer, so calls can be chained; call XmlWriter.ToXml to get the text.
Capabilities¶
XmlWriter Operations¶
- XmlWriter.Attribute: Adds a new attribute with the specified name and value to the current element.
- XmlWriter.CData: Writes the specified value to the current element as CDATA.
- XmlWriter.Element: Adds a new element with the specified name and value.
- XmlWriter.EndElement: Ends the current element.
- XmlWriter.StartElement: Starts a new element with the specified name.
- XmlWriter.ToXml: Returns the XML content generated by the XmlWriter as a string.
- XmlWriter.Write: Writes the specified value as text content to the current element.
- XmlWriter.Xml: Writes the given XML content as a child element of the current element.