File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes xpath query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "xpath query" Watch "xpath query" New topic

xpath query

Nigel Rowe

Joined: Jun 17, 2012
Posts: 6
Hello all,
I have xml files that look like this:

I have to insert this data into two tables, airport and runway based on nodes from <ICAO id="****"> and nodes from <Runway id="***">
I am up to here for the moment:

Which returns:

Any ideas on what to do next? Can I do it with one xpath query?
Any propositions welcome!
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Not sure, but do you really need it to be one query? It seems that would be two different data sets (for which you probably need to use different code for the DB insert), so maybe they shouldn't be treated the same. An outer loop dealing with airports, and an inner loop dealing with runways -each with its own XPath expression- would seem to be a natural approach.

(By the way, a tool like can help figuring out XPath expressions. Just in case you don't already some other tool :-)
Nigel Rowe

Joined: Jun 17, 2012
Posts: 6
Hello Ulf,
First of all, please accept my apologies for not replying earlier. For some reason, I could not even connect to the ranch, and then, when I could, I could not reply to any of the posts.

Your reply is perfectly correct. That's what I did in the end, I couldn't afford to waste anymore time on the thing, and as it was a one off shot it didn't realy matter. Thanks very much for your help.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: xpath query
It's not a secret anymore!