Displaying a Node and its Descendants as xpaths

Oxygen general issues.
pcstockman
Posts: 3
Joined: Thu Jan 19, 2012 8:24 pm

Displaying a Node and its Descendants as xpaths

Post by pcstockman »

I would like to select a node and display it as a series of xpaths, one for each of the terminal descendants. Ideally I would also like to capture this information in a text file for further processing. Is this possible to do?

Peter
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: Displaying a Node and its Descendants as xpaths

Post by adrian »

Hello,

I'm not sure if I understood the exact result that you want to obtain. An example could be helpful.

If you want the XPaths of all the leaf elements for a given element you can use the XPath toolbar or XPath builder from Oxygen.
Execute this expression:

Code: Select all

//element_name//*[not(descendant::*)]
You will get a result in Oxygen results panel and you can save that either as text or XML. One of the fields(description) from the results contains the XPath of each element. The result is of the form:
XPath - content
e.g.

Code: Select all

<incident>
<description>/personnel[1]/person[1]/name[1]/given[1] - Big</description>
<systemID>file:/D:/projects/eXml/samples/personal.xml</systemID>
<location>
<start>
<line>9</line>
<column>13</column>
</start>
<end>
<line>9</line>
<column>31</column>
</end>
</location>
</incident>
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Post Reply