Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.