Export (0) Print
Expand All
3 out of 6 rated this helpful - Rate this topic

Processing XML Data with XmlReader and XmlWriter (Silverlight)

Silverlight

The XML classes in the System.Xml namespace allow you to work with XML documents and data. These classes support parsing, writing, and editing XML data in memory. Note that the System.Xml namespace in the .NET Framework for Silverlight is a subset of the System.Xml in the .NET Framework. Most significantly, the XmlDocument type is not available in Silverlight. Instead, you should use the XmlReader class to read XML data. For information about other differences between the two frameworks, see Processing XML in the .NET Framework vs. the .NET Framework for Silverlight.

The XmlReader class provides non-cached, forward-only, read-only access to XML data. This class supports reading XML data from a stream, TextReader, or file in an application's XAP package. It defines methods and properties that allow you to move through XML data and read its content. You must use the Create method to create the XmlReader object.

The XmlWriter class provides a forward-only, write-only, non-cached way to generate XML streams. You must use the Create method to create the XmlWriter object. When you use the XmlWriter methods to output XML, the elements and attributes will not be completely written until you call the Close method or the Flush method.

Note Note:

In your Silverlight project, you must reference the .NET Framework assemblies that are installed with Silverlight, instead of those that are installed with Visual Studio.

Creating XmlReader Objects

Provides an overview of the XmlReaderSettings class, which is used to create XmlReader objects. This topic provides links to task-based examples of creating XmlReader objects.

How to: Parse XML with XmlReader

Demonstrates how to use XmlReader in the .NET Framework for Silverlight to parse XML data.

How to: Save XMLWriter Content to Isolated Storage

Demonstrates how to use the XmlWriter in the .NET Framework for Silverlight to generate an XML stream and save it in isolated storage.

Show:
© 2014 Microsoft. All rights reserved.