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

System.Xml.XmlTextReader.ReadString Method

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

public override 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
InvalidOperationExceptionAn invalid operation was attempted. [Edit]
System.Xml.XmlExceptionAn error occurred while parsing the XML. [Edit]

Remarks

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:

This method overrides XmlReader.ReadString.

[Edit]

Requirements

Namespace: System.Xml
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0