Microsoft XML SDK 2.6 - XML Reference

setProperty Method

Used for setting the SelectionLanguage property, which can be either "XSLPattern" or "XPath." The SelectionLanguage property defaults to "XSLPattern".

objXMLDOMDocument2.setProperty(name, value)

Parameters

name
The "SelectionLanguage" value.
value
Either the "XPath" or "XSLPattern" value.

Remarks

The following table shows properties that you can set using this method. Existing properties from DOMDocument are not accessible through this method. White space is not stripped or normalized in property names or values.

Property Value
SelectionLanguage "XPath" or "XSLPattern"

This property indicates the type of query the user plans to pass into selectNodes or selectSingleNode. "XSLPattern" is the default for backward compatibility. This flag applies to all nodes whose ownerDocument property points to this document object. Therefore, if a given node is moved to a different document, its selectNode behavior may change depending on the SelectionLanguage setting in the new document.

Example

Dim xmldoc As New MSXML2.DOMDocument
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 above message box displays "Customer/Name -- <Name>Microsoft</Name>"

selection.expr = "/Customer"
MsgBox selection.expr + " -- " + selection.Item(0).xml

The above message box displays "/Customer –-<Customer><Name>Microsoft</Name></Customer>"

See Also

Applies To: XMLDOMDocument2 Object