Provides base definitions for classes that consume XAML input and produce XAML node streams.
public ref class XamlReader abstract : IDisposable
public abstract class XamlReader : IDisposable
type XamlReader = class interface IDisposable
Public MustInherit Class XamlReader Implements IDisposable
XamlReader is an abstract class and does not provide implementations or definitions that have a working result for all members. Members that do have an implementation in XamlReader are noted in the remarks for that member. Specifically, XamlReader has several abstract members that must be implemented, and several virtual members.
Of the virtual members, ReadSubtree and Skip each provide a default implementation that is appropriate for most cases. However, the ReadSubtree and Skip default implementations rely on other expected behavior of the implementing XAML reader; in particular, they rely on the Read override. Dispose is also a virtual member that has a working default implementation.
The following two classes are the most relevant and practical derived classes in .NET Framework XAML Services and the System.Xaml assembly:
XamlObjectReader, which reads an object graph, such as the active object graph of an application at run time.
XamlReader differs from XML Document Object Model (DOM) and XmlReader design principles because XamlReader does not have a
Create method to return underlying default XAML reader implementations. You must instead instantiate specific derived XAML reader classes by calling their constructors or other class-specific helper APIs.
For the most part, you call XamlReader API in the context of specific XAML reader classes that derive from XamlReader. However, in one particular case, you access XamlReader API on a practical XAML reader instance that is not public and not derived from XamlObjectReader or XamlXmlReader. This case is when you call ReadSubtree, which returns a XamlReader instance. In the default implementation, the XamlReader that is returned by this API is an internal class.
The XamlReader obtained for subtree reading has valid actions for APIs such as Read and NodeType, and those actions are based on the parent reader class. This design enables the internal class to track the frame level where the subtree was entered. The acting subtree XamlReader makes sure that if the current node position is moved beyond the bounds of the subtree, the specific subtree reader reports end-of-file or
null at the current node.
Notes about subtree reader usage are included on certain XamlReader APIs.
|XamlReader() XamlReader() XamlReader() XamlReader()||
Initializes the XamlReader class.
|IsDisposed IsDisposed IsDisposed IsDisposed||
Gets whether Dispose(Boolean) has been called.
|IsEof IsEof IsEof IsEof||
When implemented in a derived class, gets a value that reports whether the reader position is at end-of-file.
|Member Member Member Member||
When implemented in a derived class, gets the current member at the reader position, if the reader position is on a StartMember.
|Namespace Namespace Namespace Namespace||
When implemented in a derived class, gets the XAML namespace information from the current node.
|NodeType NodeType NodeType NodeType||
When implemented in a derived class, gets the type of the current node.
|SchemaContext SchemaContext SchemaContext SchemaContext||
When implemented in a derived class, gets an object that provides XAML schema context information for the information set.
|Type Type Type Type||
When implemented in a derived class, gets the XamlType of the current node.
|Value Value Value Value||
When implemented in a derived class, gets the value of the current node.
|Close() Close() Close() Close()||
Closes the XAML node stream.
|Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)||
Releases the unmanaged resources used by the XamlReader, and optionally, releases the managed resources.
|Equals(Object) Equals(Object) Equals(Object) Equals(Object)||
Determines whether the specified object is equal to the current object.(Inherited from Object)
|GetHashCode() GetHashCode() GetHashCode() GetHashCode()||
Serves as the default hash function.(Inherited from Object)
|GetType() GetType() GetType() GetType()||
Gets the Type of the current instance.(Inherited from Object)
|MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()||
Creates a shallow copy of the current Object.(Inherited from Object)
|Read() Read() Read() Read()||
When implemented in a derived class, provides the next XAML node from the source, if a node is available.
|ReadSubtree() ReadSubtree() ReadSubtree() ReadSubtree()|
|Skip() Skip() Skip() Skip()||
Skips the current node and advances the reader position to the next node.
|ToString() ToString() ToString() ToString()||
Returns a string that represents the current object.(Inherited from Object)
Explicit Interface Implementations
|IDisposable.Dispose() IDisposable.Dispose() IDisposable.Dispose() IDisposable.Dispose()||
Releases all resources used by the current instance of the XamlReader class.