Which would be the preferred, or more efficient, way to read in a 40mb XML file? I remember reading (awhile ago) there were different methods of parsing XML, some more efficient than others depending on the need. The entire file would eventually need to be loading into an array, so I don't really need to search the file for a specific entry at random but simply all of them.

Recommended Answers

All 4 Replies

You don't want to keep that much data in memory...

Use a SAX parser for large amounts of data, as it doesn't need to retain the data in between operations.

If you are looking for a particular piece of information in that XML file, maybe this would interest you. Also take a look at this.

You could also try XALAN from apache. Its an open source parser. Available in Java and C++

Xalan won't solve his problems...
For one it's not an XML parser and also it won't limit his memory use to something reasonable...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.