XML parsing Method 1. Sax parsing Methods
SAX (simple API for XML) is an alternative to XML parsing. Compared to Dom,sax is a faster and more efficient method. It scans the document row by line, parsing while scanning. And you can stop parsing at any point in the parsing document, compared to Dom,sax. The advantages and disadvantages are:
Pros: Parsing can start immediately, fast, without memory pressure
Cons: Cannot modify the node
2. Dom Parsing method
DOM: (The Document Object model, or the file-objects models) is a way of dealing with XML recommended by the organization. When parsing an XML document, the DOM parser parses all the elements in the document into a Node object (nodes) according to the hierarchical relationships that appear. The advantages and disadvantages are:
Advantage: The XML file is constructed in memory to construct a tree structure that can traverse and modify nodes
Disadvantage: If the file is large, memory pressure, parsing time will be longer
24. Java Operation XML method