Rishabh
Rishabh

Reputation: 175

How to easily parse large xml data with a DOM parser?

I am using DOM parser to parse xml data, but its taking lots of time to parse it on line 3 where "is" is the InputStrem object. Here is my code.

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder(); 
Document document = builder.parse(is);

how can i do it in a small time with large xml data.

can any body help me...

Upvotes: 2

Views: 1046

Answers (2)

vtd-xml-author
vtd-xml-author

Reputation: 3377

VTD-XML is ideally suited for parsing large XML documents when DOM consumes too much memory. It is better than Pul parsing in that it retains random acess and natively supports xpath 1.0...

Upvotes: 0

ng.
ng.

Reputation: 7189

Use the XmlPullParser available on Android, it is super light weight.

Upvotes: 3

Related Questions