Export (0) Print
Expand All

XmlNode.Value Property

Gets or sets the value of the node.

[Visual Basic]
Public Overridable Property Value As String
[C#]
public virtual string Value {get; set;}
[C++]
public: __property virtual String* get_Value();
public: __property virtual void set_Value(String*);
[JScript]
public function get Value() : String;
public function set Value(String);

Property Value

The value returned depends on the NodeType of the node:

Type Value
Attribute The value of the attribute.
CDATASection The content of the CDATA Section.
Comment The content of the comment.
Document A null reference (Nothing in Visual Basic).
DocumentFragment A null reference (Nothing).
DocumentType A null reference (Nothing).
Element A null reference (Nothing). You can use the XmlElement.InnerText or XmlElement.InnerXml properties to access the value of the element node.
Entity A null reference (Nothing).
EntityReference A null reference (Nothing).
Notation A null reference (Nothing).
ProcessingInstruction The entire content excluding the target.
Text The content of the text node.
SignificantWhitespace The white space characters. White space can consist of one or more space characters, carriage returns, line feeds, or tabs.
Whitespace The white space characters. White space can consist of one or more space characters, carriage returns, line feeds, or tabs.
XmlDeclaration The content of the declaration (that is, everything between <?xml and ?>).

Exceptions

Exception Type Condition
ArgumentException Setting the value of a node that is read-only.
InvalidOperationException Setting the value of a node that is not supposed to have a value (for example, an Element node).

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

XmlNode Class | XmlNode Members | System.Xml Namespace

Show:
© 2014 Microsoft