value Property1

 

Contains the attribute value.

Script Syntax

objValue = oXMLDOMAttribute.value;  
objXMLDOMAttribute.value = objValue;  

Example

The following script example gets the value of the first attribute of the document root and assigns it to the variable myVar.

var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0");
var myVar;
xmlDoc.async = false;
xmlDoc.load("books.xml");
if (xmlDoc.parseError.errorCode != 0) {
   var myErr = xmlDoc.parseError;
   WScript.Echo("You have error " + myErr.reason);
} else {
   root = xmlDoc.documentElement;
   myVar = root.firstChild.attributes.item(0).value;
   WScript.Echo(myVar);
}

Visual Basic Syntax

objValue = oXMLDOMAttribute.value  
objXMLDOMAttribute.value = objValue  

C/C++ Syntax

HRESULT get_value(  
    VARIANT *attributeValue);  
HRESULT put_value(  
    VARIANT *attributeValue);  

Parameters

attributeValue [out, retval][in]
The value of the attribute. For attributes with subnodes, the string is the concatenated text of all subnodes with character and general entity reference expanded (replaced with their values).

C/C++ Return Values

S_OK
The value returned if successful.

E_INVALIDARG (for get_valueonly)
The value returned if the attributeValue parameter is Null.

E_FAIL (for put_valueonly)
The value returned if an error occurs.

Remarks

Variant. The property is read/write. It returns the value of the attribute. For attributes with subnodes, the string is the concatenated text of all subnodes with character and general entity references expanded (replaced with their values).

The new attribute value is added as the value of a single text node that is a child of the attribute node. The string contents are unparsed.

Versioning

Implemented in:

MSXML 3.0, MSXML 6.0

Applies to

IXMLDOMAttribute