Microsoft XML 2.5 SDK


 

nodeValue Property

[This is preliminary documentation and subject to change.]

Contains the text associated with the node.

Syntax

objValue = oXMLDOMNode.nodeValue

objXMLDOMNode.nodeValue = objValue

Remarks

Variant. The property is read/write.

This value depends on the value of the nodeType property.

NODE_ATTRIBUTE Contains a string representing the value of the attribute. For attributes with subnodes, this is the concatenated text of all subnodes with entities expanded. Setting this value deletes all children of the node and replaces them with a single text node containing the value written.
NODE_CDATA_SECTION Contains a string representing the text stored in the CDATA section.
NODE_COMMENT Contains the content of the comment, exclusive of the comment's begin and end sequence.
NODE_DOCUMENT, NODE_DOCUMENT_TYPE, NODE_DOCUMENT_FRAGMENT, NODE_ELEMENT, NODE_ENTITY, NODE_ENTITY_REFERENCE, NODE_NOTATION Contains NULL. Note that attempting to set the value of nodes of these types generates an error.
NODE_PROCESSING_INSTRUCTION Contains the content of the processing instruction, excluding the target. (The target appears in the nodeName property.)
NODE_TEXT Contains a string representing the text stored in the text node.

Example

The following VBScript example creates an XMLDOMNode object and tests if it is a comment node. If it is, it displays its value:

Dim xmlDoc
Dim currNode
Set xmlDoc = CreateObject("microsoft.xmldom")
xmlDoc.async = False
xmlDoc.load("c:\books.xml")
Set currNode = xmlDoc.documentElement.childNodes.item(0)
If currNode.nodeTypeString = "comment" Then
  MsgBox currNode.nodeValue
End If

Applies To

XMLDOMAttribute, XMLDOMCDATASection, XMLDOMCharacterData, XMLDOMComment, XMLDOMDocument, XMLDOMDocumentFragment, XMLDOMDocumentType, XMLDOMElement, XMLDOMEntity, XMLDOMEntityReference, XMLDOMNode, XMLDOMNotation, XMLDOMProcessingInstruction, XMLDOMText, XTLRuntime