Mono Class Library: System.Xml.XmlReader Overview | Members

System.Xml.XmlReader.ReadString Method

Reads the contents of an element or text node as a string. [Edit]

public virtual string ReadString ()

Returns

A string containing the contents of the Element or Text node, or string.Empty if the reader is positioned on any other type of node. [Edit]

Exceptions

TypeReason
System.Xml.XmlExceptionAn error occurred while parsing the XML. [Edit]

Remarks

Operation

If positioned on an Element node, this method concatenates all Text, SignificantWhitespace, Whitespace, and CDATA node types, and returns the concatenated data as the element content. If none of these node types exist, string.Empty is returned. Concatenation stops when any markup is encountered, which can occur in a mixed content model or when an element end tag is read.

If positioned on an element Text node, this method performs the same concatenation from the Text node to the element end tag. If the reader is positioned on an attribute Text node, this method has the same functionality as if the reader were position on the element start tag.

Note to Inheritors
This method must be overridden in order to provide the functionality described above, as there is no default implementation.

[Edit]

Requirements

Namespace: System.Xml
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0