XmlReader Class
NuGet: GHIElectronics.TinyCLR.System.Xml
Assembly: GHIElectronics.TinyCLR.System.Xml
Namespace: System.Xml
Forward-only XML reader. Same surface as .NET's System.Xml.XmlReader.
public abstract class XmlReader : IDisposable
Properties
NodeType
public abstract XmlNodeType NodeType { get; }
The type of the current node.
LocalName
public abstract string LocalName { get; }
The local name of the current node.
NamespaceURI
public abstract string NamespaceURI { get; }
The namespace URI of the current node.
Prefix
public abstract string Prefix { get; }
The namespace prefix of the current node.
HasValue
public abstract bool HasValue { get; }
Indicates whether the current node has a value.
Value
public abstract string Value { get; }
The text value of the current node.
Depth
public abstract int Depth { get; }
The depth of the current node in the element tree.
BaseURI
public abstract string BaseURI { get; }
The base URI of the current node.
IsEmptyElement
public abstract bool IsEmptyElement { get; }
Indicates whether the current element is empty.
AttributeCount
public abstract int AttributeCount { get; }
The number of attributes on the current node.
EOF
public abstract bool EOF { get; }
Indicates whether the reader is positioned at the end of the stream.
ReadState
public abstract ReadState ReadState { get; }
The current state of the reader.
Name
public virtual string Name { get; }
The qualified name of the current node.
HasAttributes
public virtual bool HasAttributes { get; }
Indicates whether the current node has any attributes.
Methods
GetAttribute(string name)
public abstract string GetAttribute(string name)
Gets the value of the attribute with the specified name.
Returns string
GetAttribute(string name, string namespaceURI)
public abstract string GetAttribute(string name, string namespaceURI)
Gets the value of the attribute with the specified local name and namespace URI.
Returns string
GetAttribute(int i)
public abstract string GetAttribute(int i)
Gets the value of the attribute at the specified index.
Returns string
MoveToAttribute(string name)
public abstract bool MoveToAttribute(string name)
Moves to the attribute with the specified name.
Returns bool
MoveToAttribute(string name, string ns)
public abstract bool MoveToAttribute(string name, string ns)
Moves to the attribute with the specified local name and namespace URI.
Returns bool
MoveToFirstAttribute()
public abstract bool MoveToFirstAttribute()
Moves to the first attribute of the current node.
Returns bool
MoveToNextAttribute()
public abstract bool MoveToNextAttribute()
Moves to the next attribute of the current node.
Returns bool
MoveToElement()
public abstract bool MoveToElement()
Moves to the element that contains the current attribute node.
Returns bool
ReadAttributeValue()
public abstract bool ReadAttributeValue()
Parses the attribute value into one or more Text, EntityReference, or EndEntity nodes.
Returns bool
Read()
public abstract bool Read()
Reads the next node from the stream.
Returns bool
Close()
public abstract void Close()
Closes the reader and the underlying stream.
LookupNamespace(string prefix)
public abstract string LookupNamespace(string prefix)
Resolves a namespace prefix in the scope of the current node.
Returns string
ResolveEntity()
public abstract void ResolveEntity()
Resolves the entity reference for EntityReference nodes.
Skip()
public virtual void Skip()
Skips the children of the current node.
ReadString()
public virtual string ReadString()
Reads the contents of the current text or element node as a string.
Returns string
IsStartElement()
public virtual bool IsStartElement()
Indicates whether the current content node is a start tag.
Returns bool
IsStartElement(string name)
public virtual bool IsStartElement(string name)
Indicates whether the current content node is a start tag with the specified name.
Returns bool
MoveToContent()
public virtual XmlNodeType MoveToContent()
Advances past non-content nodes to the next content node and returns its type.
Returns XmlNodeType
ReadStartElement()
public virtual void ReadStartElement()
Verifies the current content node is a start tag and advances the reader past it.
ReadStartElement(string name)
public virtual void ReadStartElement(string name)
Verifies the current content node is a start tag with the specified name and advances the reader past it.
ReadEndElement()
public virtual void ReadEndElement()
Verifies the current content node is an end tag and advances the reader past it.
ReadElementString()
public virtual string ReadElementString()
Reads a text-only element and returns its content as a string.
Returns string
Dispose()
public virtual void Dispose()
Releases the resources used by the reader.
Create(Stream input)
public static XmlReader Create(Stream input)
Creates a new reader over the specified stream.
Returns XmlReader
Create(Stream input, XmlReaderSettings settings)
public static XmlReader Create(Stream input, XmlReaderSettings settings)
Creates a new reader over the specified stream using the specified settings.
Returns XmlReader
Create(Stream input, XmlReaderSettings settings, string baseUri)
public static XmlReader Create(Stream input, XmlReaderSettings settings, string baseUri)
Creates a new reader over the specified stream using the specified settings and base URI.
Returns XmlReader
IsName(string str)
public static bool IsName(string str)
Indicates whether the specified string is a valid XML name.
Returns bool
IsNameToken(string str)
public static bool IsNameToken(string str)
Indicates whether the specified string is a valid XML name token.
Returns bool