Reputation: 6399
I am trying to parse an XML file with 1000 elements using DOM API in Java. It takes 30 seconds to process the XML file.
1 element, for eg store is the root and it has around 15 children like store name, store count, store location, etc...
Is there any other API that can be used to make the whole thing faster?
How about using JAXB (I do not know much about JAXB but I am told by my peers to consider it)?
Upvotes: 0
Views: 291
Reputation: 163322
A 30 second delay during parsing is usually caused by fetching the DTD from the web, especially if it's one of the standard DTDs (like XHTML) found on the w3C web site. If your XML references one of these DTDs you need to make sure that the parser is redirected to a local copy, by using catalogs.
Upvotes: 2