John
John

Reputation: 1922

How do I Query XML in Java

In .net I would use LINQ to XML to query an xml document with linq. Is there anything similar in Java EE?

I have a large xml file with state,city,town names that i need to use for cascading dropdowns. So I am looking for the best way to retrieve this data.

Thanks

Upvotes: 2

Views: 97

Answers (1)

Aviram Segal
Aviram Segal

Reputation: 11120

You can use XPath to select the relevant data using javax.xml.xpath

It is a more standard way and you'll be able to use the same XPath expression in many programming languages (unlike LINQ)

You can see a nice example for XPath here as well.

Upvotes: 4

Related Questions