Share via


XmlReader.ReadElementString Method (String, String)

Checks that the LocalName and NamespaceURI properties of the element found matches the given strings before reading a text-only element.

Namespace: System.Xml
Assembly: System.Xml (in system.xml.dll)

Syntax

public virtual string ReadElementString (
         stringlocalname,
         stringns
)

Parameters

Return Value

The text contained in the element that was read. An empty string if the element is empty ( or ).

Exceptions

Exception type Condition
XmlException If the next content node is not a start tag; or, if the element LocalName or NamespaceURI do not match the given arguments; or, if the element found does not contain a simple text value.

Version Information

Available in the .NET Micro Framework versions 2.5, 3.0, 4.0, and 4.1.

See Also

Reference

XmlReader Class
XmlReader Members
System.Xml Namespace