setProperty Method1

 

This method is used to set second-level properties on the DOM object.

objXMLDOMDocument2.setProperty(name, value);  

Parameters

name
The name of the property to be set. For a list of properties that can be set using this method, see second-level properties .

value
The value of the specified property. For a list of property values that can be set using this method, see second-level properties .

Example

var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.6.0");  
var selection;  
xmlDoc.loadXML("<Customer><Name>Microsoft</Name></Customer>");  
xmlDoc.setProperty("SelectionLanguage", "XPath");  
selection = xmlDoc.selectNodes("Customer/Name");  
WScript.Echo(selection.expr + " -- " + selection.item(0).xml);  

Output

Customer/Name -- <Name>Microsoft</Name>  

HRESULT setProperty (BSTR name, VARIANT value);  

Parameters

name [in]
The name of the property to be set. For a list of properties that can be set using this method, see second-level properties .

value [in]
The value of the specified property. For a list of property values that can be set using this method, see second-level properties .

Return Values

S_OK
Value returned if successful.

E_FAIL
Value returned if name or value is invalid.

Examples of the second-level properties include SelectionLanguage, ValidateOnParse, ServerHTTPRequest.

This method may not be applied to the first-level DOM properties that are exposed directly on a DOM object. Examples of the first-level properties include validateOnParse, async, parseError, etc.

Implemented in: MSXML 3.0 and MSXML 6.0

selectSingleNode Method
selectNodes Method
Second-Level DOM Properties
getProperty Method (IXMLDOMDocument2)
IXMLDOMDocument2

Show: