The reason why Android uses parsing XML documents is not only easy to parse XML with Java, but also because XML is the primary way for Android to transfer information between networks. Let me briefly talk about the two ways Android parses XML documents: Dom and sax. The DOM parsing method is that parsing methods treat an XML file as a tree. Knowledge of the data structure we know that the processing of the tree is relatively simple, that is, the node of the tree to increase, delete, change, check, which is one of the greatest advantages of DOM. However, the DOM way in parsing is a one-time to the entire XML document read into memory, this disadvantage does not need me to say, my precious memory is forbidden so toss.
The SAX parsing XML document is read-by-line and can be parsed by the characteristics of the XML language. However, it is also flawed, that is, the method of writing sax is more difficult.
Simple comparison of two ways that Android parses XML documents