XML DOM and SAX

What is DOM?

DOM is an interface-oriented Application Programming Interface. It allows for navigation of the entire document. A DOM document can be created by a parser, or can be generated manually by users. Data types in DOM Nodes are abstract. DOM implementations generally require the entire document to be loaded into memory and constructed as a tree of objects before access is allowed. DOM is supported in Java. Its specification is regulated by the World Wide Web Consortium.

Explain the difference between DOM and SAX.

- SAX parser works incrementally and generates events that are passed to the application. DOM parser reads the whole XML document and returns a DOM tree representation of xml document
- In DOM the xml file is arranged as a tree and backward and forward search is possible In SAX traversing in any direction is not possible as Top to bottom approach is used.
- SAX is essentially an API for reading XML, and not writing it. DOM allows you to read and write.

Explain the features of DOM.

DOM is Document Object Model. It is used to read data from a XML document. It is more commonly used in applications where data in the document needs to be repeated accessed. DOM supports navigation in any direction. XML DOM is typically used for XML documents. The DOM defines the objects and properties of all document elements, and the methods (interface) to access them.

What is SAX? Explain its features.

SAX is Simple API for XML. It is used to read data from a XML document. A parser that uses SAX parses the XML serially. The API is event driven and these events are fired when the XML features are encountered. XML parsing is unidirectional. Memory used by a SAX parses is relatively low. Due to the event nature of SAX, the parsing is faster of an XML document.
XML Namespace - What is XML Namespace?
XML Namespace - An XSL sheet or a document may have duplicate elements and attributes. Therefore, the XML namespaces define a way to distinguish between....
XML data binding - What is XML data binding?
XML data binding - XML data binding refers to the process of representing the information in an XML document as an object in computer memory......
XML encoding error - What is an XML encoding error?
XML encoding error - XML documents can contain non ASCII characters, like Norwegian æ ø å , or French ê è é which introduce errors.....
Post your comment