Export (0) Print
Expand All

XNode.CreateReader Method

Creates an XmlReader for this node.

Namespace:  System.Xml.Linq
Assembly:  System.Xml.Linq (in System.Xml.Linq.dll)

public XmlReader CreateReader()

Return Value

Type: System.Xml.XmlReader
An XmlReader that can be used to read this node and its descendants.

You typically use this method when you have to supply another component with an XmlReader.

All of the readers returned by Create are normalizing readers. They always perform line break normalization and full normalization of attributes. In contrast, the XmlReader returned by CreateReader is not a normalizing reader. It does not transform any white space. It also returns attributes in the order that they were added, not in attribute name order.

LINQ to XML does not keep information about whether attributes are default attributes. IsDefault will always return false regardless of whether the attribute was populated from a default value or not.

The the PUBLIC and SYSTEM pseudo-attributes on XDocumentType are not available through the XmlReader.MoveToAttribute method. They are only available through the XmlReader.GetAttribute method that takes the qualified name of the attribute as a parameter. If you have to retrieve the PUBLIC or SYSTEM attributes, you should use the XmlReader.GetAttribute method.

Base64 and BinHex data are not supported. If you attempt to retrieve these types of data (for example, by calling ReadElementContentAsBase64), the reader will throw NotSupportedException.

The xml declaration is not surfaced by the reader. While reading, you will not encounter a node of type XmlDeclaration.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft