Monday, February 8, 2010

Explain the difference between DOM and SAX.

Answer
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.

XML DOM and SAX -

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.

What is XML Namespace?

Answer
An XSL sheet or a document may have duplicate elements and attributes. Therefore, the XML namespaces define a way to distinguish between duplicate element types and attribute names.
An XML namespace is a collection of element type and attribute names. It is a URI due to which any element type or attribute name in an XML namespace can be uniquely identified.
It consists of two parts : the name of the XML namespace and the local name.

e.g.: xmlns: h=”http://www.abc.com”
After this, you can write

……..

to associate the table with the declared namespace.

No comments:

Post a Comment