Java: what is the difference between lsparser and documentbuilder
I'm at org w3c. dom. ls. No information was found on lsparser I know this is an interface, but there is only one way to get a specific object
DOMImplementationLS factory = (DOMImplementationLS) myXMLDocument.getImplementation(); LSParser parser = factory.createLSParser(DOMImplementationLS.MODE_ASYNCHRONOUS,null);
Lsparser and javax xml. parsers. How is documentbuilder (or saxparser) different
Solution
First, saxparser and javax xml. parsers. Unlike lsparser, documentbuilder uses XML streams instead of building document object model (DOM)
This lets us explain javax xml. parsers. Documentbuilder and lsparser The DOM specification has a level that defines the structure and behavior of the dom There are three levels (1, 2 and 3) Lsparser stands for "load and save parser" This parser provides support for DOM Level 3 It implements the behavior defined here – https://www.w3.org/TR/DOM-Level-3-LS/load-save.html. Because lsparser supports DOM Level 3 standard, it allows event handling (when loading DOM), saving and filtering Note that this is a specification, so it can be implemented in any language
In contrast, javax xml. parsers. Document builder is a Java - based API (jaxp) This is a project, not a specification
The lsparser specification is influenced by jaxp and sax projects It just standardizes the parsing of XML and the use of DOM
reference: https://www.amazon.com/Processing-XML-documents-Oracle-JDeveloper/dp/1847196667 (see Chapter 7 – related to this topic)
https://www.w3.org/TR/DOM-Level-3-LS/load-save.html (this is the complete specification)