The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
XmlElement::InnerText Property
.NET Framework (current version)
Gets or sets the concatenated values of the node and all its children.
Assembly: System.Xml (in System.Xml.dll)
public: property String^ InnerText { virtual String^ get() override; virtual void set(String^ value) override; }
Setting this property replaces all the children with the parsed contents of the given string.
This property is a Microsoft extension to the Document Object Model (DOM).
The following example compares the InnerText and InnerXml properties.
#using <System.Xml.dll> using namespace System; using namespace System::Xml; int main() { XmlDocument^ doc = gcnew XmlDocument; doc->LoadXml( "<root><elem>some text<child/>more text</elem></root>" ); XmlElement^ elem = dynamic_cast<XmlElement^>(doc->DocumentElement->FirstChild); // Note that InnerText does not include the markup. Console::WriteLine( "Display the InnerText of the element..." ); Console::WriteLine( elem->InnerText ); // InnerXml includes the markup of the element. Console::WriteLine( "Display the InnerXml of the element..." ); Console::WriteLine( elem->InnerXml ); // Set InnerText to a string that includes markup. // The markup is escaped. elem->InnerText = "Text containing <markup/> will have char(<) and char(>) escaped."; Console::WriteLine( elem->OuterXml ); // Set InnerXml to a string that includes markup. // The markup is not escaped. elem->InnerXml = "Text containing <markup/>."; Console::WriteLine( elem->OuterXml ); }
Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Available since 10
.NET Framework
Available since 1.1
Show: