Redigeeri

Jagamisviis:


XmlReader.ReadElementString Method

Definition

Reads the simple text-only elements. However, we recommend that you use the ReadElementContentAsString method instead, because it provides a more straightforward way to handle this operation.

Overloads

ReadElementString()

Reads a text-only element. However, we recommend that you use the ReadElementContentAsString() method instead, because it provides a more straightforward way to handle this operation.

ReadElementString(String)

Checks that the Name property of the element found matches the given string before reading a text-only element. However, we recommend that you use the ReadElementContentAsString() method instead, because it provides a more straightforward way to handle this operation.

ReadElementString(String, String)

Checks that the LocalName and NamespaceURI properties of the element found matches the given strings before reading a text-only element. However, we recommend that you use the ReadElementContentAsString(String, String) method instead, because it provides a more straightforward way to handle this operation.

Remarks

We recommend that you use the ReadElementContentAsString method to read a text element.

ReadElementString()

Source:
XmlReader.cs
Source:
XmlReader.cs
Source:
XmlReader.cs

Reads a text-only element. However, we recommend that you use the ReadElementContentAsString() method instead, because it provides a more straightforward way to handle this operation.

public:
 virtual System::String ^ ReadElementString();
public virtual string ReadElementString ();
abstract member ReadElementString : unit -> string
override this.ReadElementString : unit -> string
Public Overridable Function ReadElementString () As String

Returns

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

Exceptions

The next content node is not a start tag; or the element found does not contain a simple text value.

An XmlReader method was called before a previous asynchronous operation finished. In this case, InvalidOperationException is thrown with the message "An asynchronous operation is already in progress."

Remarks

We recommend that you use the ReadElementContentAsString() method to read a text element.

Applies to

ReadElementString(String)

Source:
XmlReader.cs
Source:
XmlReader.cs
Source:
XmlReader.cs

Checks that the Name property of the element found matches the given string before reading a text-only element. However, we recommend that you use the ReadElementContentAsString() method instead, because it provides a more straightforward way to handle this operation.

public:
 virtual System::String ^ ReadElementString(System::String ^ name);
public virtual string ReadElementString (string name);
abstract member ReadElementString : string -> string
override this.ReadElementString : string -> string
Public Overridable Function ReadElementString (name As String) As String

Parameters

name
String

The name to check.

Returns

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

Exceptions

If the next content node is not a start tag; if the element Name does not match the given argument; or if the element found does not contain a simple text value.

An XmlReader method was called before a previous asynchronous operation finished. In this case, InvalidOperationException is thrown with the message "An asynchronous operation is already in progress."

Remarks

We recommend that you use the ReadElementContentAsString() method to read a text element.

Applies to

ReadElementString(String, String)

Source:
XmlReader.cs
Source:
XmlReader.cs
Source:
XmlReader.cs

Checks that the LocalName and NamespaceURI properties of the element found matches the given strings before reading a text-only element. However, we recommend that you use the ReadElementContentAsString(String, String) method instead, because it provides a more straightforward way to handle this operation.

public:
 virtual System::String ^ ReadElementString(System::String ^ localname, System::String ^ ns);
public virtual string ReadElementString (string localname, string ns);
abstract member ReadElementString : string * string -> string
override this.ReadElementString : string * string -> string
Public Overridable Function ReadElementString (localname As String, ns As String) As String

Parameters

localname
String

The local name to check.

ns
String

The namespace URI to check.

Returns

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

Exceptions

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

An XmlReader method was called before a previous asynchronous operation finished. In this case, InvalidOperationException is thrown with the message "An asynchronous operation is already in progress."

Remarks

We recommend that you use the ReadElementContentAsString(String, String) method to read a text element.

Applies to