Is there some built-in way to output a node's basic XPath without iterating
upward through an XmlNode's parent hierarchy? I have a scenario where I
need to tell the user there was an error with a particular node, but I want
to express it as:
"There was an error with node Root/Parent2/Child2@Attribute1", but all the
methods I've looked up are more along the lines of "FromXPath". I'm
currently using a while loop to build a string with a path, but I'd rather
just call some framework method if one exists.
Martin Honnen - 18 Jul 2006 13:18 GMT
> Is there some built-in way to output a node's basic XPath without iterating
> upward through an XmlNode's parent hierarchy? I have a scenario where I
[quoted text clipped - 4 lines]
> currently using a while loop to build a string with a path, but I'd rather
> just call some framework method if one exists.
No, there is no such method, you need to write your own code. And be
aware that e.g.
Root/Parent2/Child2
can select several elements, if you want a precise path to exactly one
element then you need e.g.
Root/Parent2[1]/Child2[3]

Signature
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/