Inspired? No home

SelectionLanguage Property - XPath in MSXML Parser 3.0

In MSXML 3.0 you can set this property to "XPath" to switch the query language from XSLPattern to XPath. Once the property is set, there is no way to switch back without creating an instance of a new DOM object.


xmldoc.setProperty("SelectionLanguage", "XPath"); // JScript
xmldoc.setProperty "SelectionLanguage", "XPath"   ' VBScript

Second-level DOM Properties

This caused me many headaches until I found this solution. I have MSXML Parser 5.0 installed here (from Office 2003). Another colleague of mine encountered problems with the web-application I am currently developing. After some testing I noticed he had MSXML Parser 3.0 installed. A google search led me to MSXML DOM Tips page which revealed:

If you want MSXML3 to use XPATH instead of "MS patterns" in methods like selectNodes, you need to set the SelectionLanguage property
Written on 30 November 2004.
blog comments powered by Disqus