System.Xml.XPath.XPathNavigator.WriteSubtree Method

Streams the current node and its child nodes to the System.Xml.XmlWriter object specified.

Syntax

public virtual void WriteSubtree (System.Xml.XmlWriter writer)

Parameters

writer
The System.Xml.XmlWriter object to stream to.

Remarks

Namespace declarations for the in-scope namespaces of the current node are inserted into the XML streamed to the System.Xml.XmlWriter object specified.

For example, if the XPathNavigator.WriteSubtree(System.Xml.XmlWriter) method is called on the first book element of the books.xml file, the http://www.contoso.com/books namespace declaration made at the top of the XML document will appear in the XML streamed to the System.Xml.XmlWriter object specified as shown in the following example.

Example

<?xml version="1.0" encoding="utf-8"?>
<book genre="autobiography" publicationdate="1981" ISBN="1-861003-11-0" 
Note:

The XPathNavigator.WriteSubtree(System.Xml.XmlWriter) method does not affect the position of the System.Xml.XPath.XPathNavigator.

Requirements

Namespace: System.Xml.XPath
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0