Code Comments
Programming Forum and web based access to our favorite programming groups.Dear all,
Jusst a quickie, I won't post the xml or the remaining code - but... just
off the top of your heads, why does the following XPath query (passed to a
VB6 DOMDocument object) fail on any DOMDocument object version that isn't
DOMDocument (i.e. DOMDocument26, 40, 50 all fail - returning nothing).
Set objNode =
oDom.selectSingleNode("//interactionId[@root=""2.16.840.1.113883.2.1.3.2.4.1
2""]")
The element is valid, and the XPath appears to also be valid.
Any ideas why this won't work in later versions?
Thanks!
Mike
Post Follow-up to this message
Mike [MCP VB] wrote:
> Jusst a quickie, I won't post the xml or the remaining code - but... just
> off the top of your heads, why does the following XPath query (passed to a
> VB6 DOMDocument object) fail on any DOMDocument object version that isn't
> DOMDocument (i.e. DOMDocument26, 40, 50 all fail - returning nothing).
>
> Set objNode =
> oDom.selectSingleNode("//interactionId[@root=""2.16.840.1.113883.2.1.3.2.4
.12""]")
>
> The element is valid, and the XPath appears to also be valid.
>
> Any ideas why this won't work in later versions?
It could be that namespaces are used in the XML document, and XPath 1.0
and namespaces are only support in MSXML 3 and later where you need to set
oDom.setProperty "SelectionLanguage", "XPath"
and then
oDom.setProperty "SelectionNamespaces",
"xmlns:prefix1='http://example.com/ns1'
xmlns:prefix2='http://example.com/ns2'"
and finally use such a prefix e.g.
oDom.selectSingleNode("//prefix1:interactionId")
that way you should get consistent results using MSXML 3, 4, 5.
--
Martin Honnen
http://JavaScript.FAQTs.com/
Post Follow-up to this message"Martin Honnen" <mahotrash@yahoo.de> wrote in message
news:O7TN90OvEHA.4028@TK2MSFTNGP15.phx.gbl...
> It could be that namespaces are used in the XML document, and XPath 1.0
> and namespaces are only support in MSXML 3 and later where you need to set
Indeed - the scoped default namespace looks this way...
> and finally use such a prefix e.g.
> oDom.selectSingleNode("//prefix1:interactionId")
SUPERB. Many Thanks - this solved the problem.
Mike
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.