내보내기(0) 인쇄
모두 확장
EN
이 콘텐츠는 한국어로 제공되지 않아 영어 버전으로 표시됩니다.

XmlReader Class

Represents a reader that provides fast, non-cached, forward-only access to XML data.

For a list of all members of this type, see XmlReader Members.

System.Object
   System.Xml.XmlReader
      System.Xml.XmlNodeReader
      System.Xml.XmlTextReader
      System.Xml.XmlValidatingReader

[Visual Basic]
MustInherit Public Class XmlReader
[C#]
public abstract class XmlReader
[C++]
public __gc __abstract class XmlReader
[JScript]
public abstract class XmlReader

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Remarks

XmlReader provides forward-only, read-only access to a stream of XML data. The current node refers to the node on which the reader is positioned. The reader is advanced using any of the read methods and properties reflect the value of the current node.

XmlReader conforms to the W3C Extensible Markup Language (XML) 1.0 and the Namespaces in XML recommendations and is implemented in the following classes:

Class Description
XmlTextReader Fastest implementation of XmlReader. It checks for well-formed XML, but does not support data validation. This reader cannot expand general entities and does not support default attributes.
XmlValidatingReader Implementation of XmlReader that can validate data using DTDs or schemas. This reader can also expand general entities and supports default attributes.
XmlNodeReader Implementation of XmlReader that reads XML data from an XmlNode.

To read strongly typed data, use the XmlConvert class. For example, the following C# code reads in data and converts it from a String to a Double.

Double price = XmlConvert.ToDouble(reader.Value);

XmlReader throws an XmlException on XML parse errors. After an exception is thrown the state of the reader is not predictable. For example, the reported node type may be different than the actual node type of the current node.

For further discussion on the XmlReader classes, see Reading XML with the XmlReader.

Requirements

Namespace: System.Xml

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

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

See Also

XmlReader Members | System.Xml Namespace

표시:
© 2014 Microsoft