Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a large (10k lines) XML file. Normally i use Notepad++ or Chrome to open XML files. Although it is possible to collapse/uncollapse child entries, i can't see which element has which parents.

For example:

my aim entry

Every time i want to check parents of element1 i check upper lines, collapse/uncollapse them to find out that actual heritage is like this:


Is it possible to find this heritage by a program? Because i do this job for this big XML file every week and sometimes I make errors and all system breaks.

share|improve this question
up vote 1 down vote accepted

Good XML editors will have this future, one that's used by IBM for instance is oxygen.

share|improve this answer

If you have xmllint (should be on Linux/OS X by default, otherwise here), just do:

xmllint --shell your-xml-file.xml

Then formulate the following XPath query:

xpath //element1/ancestor::*

The result would be:

Object is a Node Set :
Set contains 3 nodes:
1  ELEMENT parent1
2  ELEMENT parent2
3  ELEMENT parent3
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .