There are no standard restrictions for XML documents or the DOM size, so it depends entirely on what the host can handle.
As you deploy to Android, you should take a fairly limited amount of memory and remember the DOM, XML parser, your program logic, display logic, JVM and Android, all of which should fit into the available memory !.
Typically, you can expect the DOM to take up about four times the size of the original XML document. So suppose that 512 MB of available memory, intend to take no more than half of this DOM for you, and you get 512/8 or a practical maximum of 64 MB for an XML document.
Just to be safe, I would be half as much as 32 MB max. Therefore, if you expect many documents of this size I will use for SAX analysis !.
If you want the application to respond at any speed on large documents, SAX is the way to go. The SAX analyzer can start returning results, as soon as the first element is read, the DOM parser must read the entire document before any output is sent to your program.
James anderson
source share