Home   |   QuickStart Welcome   |   ASP.NET   |   Web Services   |   How Do I...?   
  |   I want my samples in...      

How Do I...? Common Tasks QuickStart Tutorial

How Do I...Read and Write XML?

This sample illustrates how to use the WriteNode method to copy data from an XmlReader or XPathNavigator object to the XmlWriter instance. This method can be used to quickly copy data from a source object to the XmlWriter. It copies data from the current position of the XmlReader or XPathNavigator object, including any child nodes.

C# XMLReadWrite.exe
View Source
[This sample can be found at C:\DevFusion.Data\legacy\quickstart.developerfusion.co.uk\QuickStart\howto\samples\Xml\XMLReadWrite\]

The following code loads an XML document into the XmlReader object.

reader = XmlReader.Create(document);

The following code copies everything from the XmlReader object to the XmlWriter object.

 writer.WriteNode(reader, true);

Microsoft .NET Framework SDK QuickStart Tutorials Version 2.0
Copyright � 2004 Microsoft Corporation. All rights reserved.