This project is read-only.
2

Closed

Copy Node XPath - No attributes

description

'Copy Node XPath to Address Bar' - The generated XPath does not include the attributes
Example:
 
<root>
<child Name="label" />
</root>
 
Currently it generates the XPath for child element as,
/root/child
 
Expecting it to generate,
/roor/child[@Name='label']

file attachments

Closed Oct 22, 2011 at 1:43 AM by jcoon
Available in the 4.0.5 release

comments

jcoon wrote Jun 3, 2010 at 3:56 AM

Thanks for the feedback. There are several different XPath expressions that could be copied for the example element given, such as:

/root/child
/root/child[1]
/root/child[@Name='label']
//child

All would result in the selection of the node. I'm sure I could provide all of the above, just not sure how best to expose them in the UI. I also just noticed that the copied XPath doesn't include namespace prefixes, if any. I'll see what I can do.

Thanks!

mbelles wrote May 20, 2011 at 3:37 AM

Guys,

I just committed a change that adds a new menu to the node's context menu. Each attribute will show up as an item, allowing you to copy it's path to the address bar, with current attribute value.

The XPath will be in the format: /a/b/c[@foo='bar']

I made a decision to make the default use attribute name and value as the predicate. I've seen indices misused too often, and hopefully this will guide users away from them. :)

Thanks!

jcoon wrote May 20, 2011 at 4:13 AM

Well, done, Mark! Thanks for contributing. I was hung up on how to detect which attribute had been right-clicked, but this is a much simpler implementation. This will be very useful.