Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java: Ways to parse XML in E4X?

I was wondering if there was a way to parse XML using E4X, or something similar to E4X.

Does such a framework / library exist?

Thanks!

like image 943
bguiz Avatar asked Jan 06 '10 09:01

bguiz


People also ask

What is the best way to parse XML in Java?

DOM Parser is the easiest java xml parser to learn. DOM parser loads the XML file into memory and we can traverse it node by node to parse the XML. DOM Parser is good for small files but when file size increases it performs slow and consumes more memory.

Does Java have built in XML parser?

Java provides multiple options to parse XML documents. Following are the various types of parsers which are commonly used to parse XML documents. Dom Parser − Parses an XML document by loading the complete contents of the document and creating its complete hierarchical tree in memory.


2 Answers

You can use JavaScript engine Rahino with Java which can handle E4X.

  1. http://blogs.oracle.com/sundararajan/entry/desktop_scripting_applications_with_netbeans
  2. http://www.ibm.com/developerworks/library/ws-ajax1/
like image 81
Chandra Patni Avatar answered Sep 19 '22 01:09

Chandra Patni


Java cannot support dynamically defined members, as JavaScript can.

However, with design-time generation, you can get Java whose members reflect the XML. E.g., JAXB

like image 31
Joshua Fox Avatar answered Sep 22 '22 01:09

Joshua Fox