This method is used to set second-level properties on the DOM object.
objXMLDOMDocument2.setProperty(name, value);
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.5.0"); var selection; xmlDoc.loadXML("<Customer><Name>Microsoft</Name></Customer>"); xmlDoc.setProperty("SelectionLanguage", "XPath"); selection = xmlDoc.selectNodes("Customer/Name"); alert(selection.expr + " -- " + selection.item(0).xml);
The preceding message box displays "Customer/Name -- <Name>Microsoft</Name>".
selection.expr = "/Customer"; alert(selection.expr + " -- " + selection.item(0).xml);
The preceding message box displays "/Customer -<Customer><Name>Microsoft</Name></Customer>".
objXMLDOMDocument2.setProperty(name, value)
Dim xmldoc As New Msxml2.DOMDocument50 Dim selection As Msxml2.IXMLDOMSelection xmldoc.loadXML ("<Customer><Name>Microsoft</Name></Customer>") xmldoc.setProperty "SelectionLanguage", "XPath" Set selection = xmldoc.selectNodes("Customer/Name") MsgBox selection.expr + " -- " + selection.Item(0).xml
The preceding message box displays "Customer/Name -- <Name>Microsoft</Name>".
selection.expr = "/Customer" MsgBox selection.expr + " -- " + selection.Item(0).xml
The preceding message box displays "/Customer -<Customer><Name>Microsoft</Name></Customer>".
HRESULT setProperty (BSTR name, VARIANT value);
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.
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.
selectSingleNode Method | selectNodes Method | document Function | second-level properties | getProperty Method
Applies to: IXMLDOMDocument2