Export (0) Print
Expand All

XmlNode.InnerText Property

Gets or sets the concatenated values of the node and all its child nodes.

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

abstract InnerText : string with get, set 
override InnerText : string with get, set

Property Value

Type: System.String
The concatenated values of the node and all its child nodes.

Setting this property replaces all the child nodes with the parsed contents of the given string.

For leaf nodes, InnerText returns the same content as the Value property.

This property is a Microsoft extension to the Document Object Model (DOM).

The following example compares the InnerText and InnerXml properties.

No code example is currently available or this language may not be supported.

Output:

Display the InnerText of the element...
some textmore text
Display the InnerXml of the element...
some text<child />more text
<elem>Text containing &lt;markup/&gt; will have char(&lt;) and char(&gt;) escape
d.</elem>
<elem>Text containing <markup />.</elem>

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

XNA Framework

Supported in: 3.0, 2.0, 1.0
Show:
© 2015 Microsoft