System.Xml.XmlNodeReader.ReadString Method

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

Syntax

public override string ReadString ()

Returns

The contents of the element or text-like node (This can include CDATA, Text nodes, and so on). This can be an empty string if the reader is positioned on something other than an element or text node, or if there is no more text content to return in the current context.

Note: The text node can be either an element or an attribute text node.

Remarks

Note:

In the dnprdnext, the recommended practice is to create System.Xml.XmlReader instances using the System.Xml.XmlReaderSettings class and the erload:System.Xml.XmlReader.Create method. This allows you to take full advantage of all the new features introduced in the dnprdnshort. For more information, see Creating XML Readers.

If positioned on an element, ReadString concatenates all text, significant white space, white space, and CData section node types together and returns the concatenated data as the element content. It stops when any markup is encountered. This could occur in a mixed content model, or when an element end tag is read.

If positioned on a text-like node, ReadString performs the same concatenation from the text node to the element end tag. If the reader is positioned on an attribute text node, ReadString has the same functionality as if the reader were position on the element start tag. It returns all the concatenated element text nodes.

Requirements

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