Writes the current node to an XmlWriter.
[Visual Basic] Public Sub WriteTo( _ ByVal writer As XmlWriter _ ) [C#] public void WriteTo( XmlWriter writer ); [C++] public: void WriteTo( XmlWriter* writer ); [JScript] public function WriteTo( writer : XmlWriter );
The action performed by this method depends on the current node type as follows:
NodeType | Action |
---|---|
StartTag | Calls WriteStartTag and then repeatedly calls WriteAttr for each attribute. |
EndTag | Calls WriteEndTag. |
Text | Calls WriteText. |
CData | Calls WriteCData. |
Comment | Calls WriteComment. |
PI | Calls WritePI. |
Header | Calls WriteHeader. |
DocType | Calls WriteDocType. |
BOF | No action. |
EOF | No action. |
The WriteTo method does not change the position of the reader.
The following example copies one XML file to another, removing all comments and processing instructions in the process.