Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best method to parse various custom XML documents in Java

Tags:

java

xml

What is the best method to parse multiple, discrete, custom XML documents with Java?

like image 384
Matt Cummings Avatar asked Aug 22 '08 18:08

Matt Cummings


People also ask

What is the best way to parse XML in Java?

Java XML Parser - DOM 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.

What are the two methods of parsing in XML document?

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. SAX Parser − Parses an XML document on event-based triggers.

Does Java have an XML parser?

Using the XML Parser for Java: Overview. The fundamental component of any XML development is the XML parser. The XML parser for Java is a standalone XML component that parses an XML document (and possibly also a standalone DTD or XML Schema) so that your program can process it.


1 Answers

I would use Stax to parse XML, it's fast and easy to use. I've been using it on my last project to parse XML files up to 24MB. There's a nice introduction on java.net, which tells you everything you need to know to get started.

like image 85
dlinsin Avatar answered Oct 06 '22 00:10

dlinsin