java tutorial

Different example to parse XML file in Java – DOM , SAX and JDOM parser

Reading file in Java is very easy because Java provides good support for xml file reading with lots of XML parsers including popular DOM parser and SAX Parser in Java. You can read xml file by using either SAX(Simple API for XML) parser or DOM (Document Object model) parser in Java.

SAX and DOM parsers are two very popular XML Parse used to read XML files in Java but there is difference how they parse xml file and without knowling there limitation if you parse large xml files you can get several errors.see Difference between SAX and DOM parsers and guides when to use DOM parser and when to use SAX parser in java.

Check out this article if you are looking to read xml file using DOM parser or check this article which contains step by step example with full java code for reading xml file in Java using SAX parser and advantage of SAX parser over DOM parser.

Even properties file can also be represented using xml format but Java has special API for reading XML properties file.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s