The interfaces of SAX are:
|A SAX parser takes the occurrences of components of an input document as events (i.e., event based processing), and tells the client what it reads as it reads through the input document.||A DOM parser creates a tree structure in memory from an input document and then waits for requests from client.|
|No navigation possible (top to bottom only once)||Whereas, we can navigate the DOM tree in any direction, any no. of times.|
|We cannot modify the document content in SAX||We can modify the document content in DOM|
|A SAX parser serves the client application always only with pieces of the document at any given time.||A DOM parser always serves the client application with the entire document no matter how much is actually needed by the client.|
|A SAX parser, however, is much more space efficient in case of a big input document||A DOM parser is space inefficient when the document is huge.|
Use SAX parser when
Use DOM when
CDATA Sections are used to escape blocks of text containing characters which would otherwise be recognized as markup. All tags and entity references are ignored by an XML processor that treats them just like any character data. CDATA blocks have been provided as a convenience measure when you want to include large blocks of special characters as character data, but you do not want to have to use entity references all the time.
eXtensible Stylesheet Language(XSL) deals with most displaying the contents of XML documents.XSL consists of three parts:
XSLT - a language for transforming XML documents
XPath - a language for navigating in XML documents
XSL-FO - a language for formatting XML documents
XSL is compatible with CSS and is designed to handle the new capabilities of XML that CSS can't handle. XSL is derived from Document Style Semantics and Specification Language (DSSSL), a complex Stylesheet language with roots in the SGML community. The syntax of XSL is quite different from CSS, which could be used to display simple XML data but isn't general enough to handle all the possibilities generated by XML. XSL adds the capability to handle these possibilities. For instance, CSS cannot add new items or generated text (for instance, to assign a purchase order number) or add a footer (such as an order confirmation). XSL allows for these capabilities.