Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries [Thread Prev] >Thread Next - Re: Accessing attributes via XPath Accessing attributes via XPathTo: NULL Date: 7/1/2009 1:02:00 AM Hi folks,
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
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
