Contains the attribute value.
objValue = oXMLDOMAttribute.value; objXMLDOMAttribute.value = objValue;
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.5.0"); var myVar; xmlDoc.async = false; xmlDoc.load("books.xml"); if (xmlDoc.parseError.errorCode <> 0) { var myErr = xmlDoc.parseError; alert("You have error " + myErr.reason); } else { root = xmlDoc.documentElement; myVar = root.firstChild.attributes.item(0).value; alert(myVar); }
objValue = oXMLDOMAttribute.value objXMLDOMAttribute.value = objValue
The following Microsoft® Visual Basic® example gets the value of the first attribute of the document root and assigns it to the variable myVar.
Dim xmlDoc As New Msxml2.DOMDocument50 Dim myVar As Variant xmlDoc.async = False xmlDoc.Load ("books.xml") If (xmlDoc.parseError.errorCode <> 0) Then Dim myErr Set myErr = xmlDoc.parseError MsgBox("You have error " & myErr.reason) Else Set root = xmlDoc.documentElement myVar = root.firstChild.Attributes.Item(0).Value MsgBox myVar End If
HRESULT get_value( VARIANT *attributeValue); HRESULT put_value( VARIANT *attributeValue);
get_value
only)attributeValue
parameter is Null.put_value
only)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.
To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button in the upper-left corner of the page.
Applies to: IXMLDOMAttribute