Just cutting my teeth a bit with MSXML, and came across an issue that
is confusing me.
Given the following XML fragment:
<parent>
<child>
<grandchild attrib1="test" />
</child>
</parent>
I have an IXMLDOMNodePtr pointing to <child>, and I want to grab the
value of attrib1 in <grandchild>.
I was expecting the XPath to feed to selectNodes() would be
"grandchild@attrib1", but this causes MSXML to throw an exception
(with no error info).
It turns out the correct XPath is "grandchild/@attrib1", and I was
confused why, since I'm sure I've seen tutorials using the first
format.
Many thanks,
Jeremy
If the address is supposed to be an XPath expression, then the slash is
mandatory. I haven't seen a different (ie non-XPath) syntax that just
uses elementname@attribname but someone may well have invented one. If
you can find the page you think you've seen, it may just be a typo.
//Peter