Saturday, June 13, 2009

Xml Interview Questions

Q)What is XML ?

XML stands for EXtensible Markup Language.

XML was designed to transport and store data.

XML documents are universally accepted as a standard way of representing information in platform and language independent manner.

XML is universal standard for information interchange.

XML documents can be created in any language and can be used in any language

Q) What is the difference between Schema and DTD?
Schema might outphase DTD. XML shemas are in XML. XML Schema has a lot of built-in data types including xs:string,xs:decimal,xs:integer,xs:boolean,xs:date,xs:time. XML schemas can be edited with Schema files, parsed with XML parser, manipulated with XML DOM, and transformed with XSLT.
The building blocks of DTD include elements, attributes, entities, PCDATA, and CDATA.

Q) How do you parse/validate the XML document?
By using a SAXParser, DOMParser, or XSDValidator.

Q) What is XML Namespace?
Namespaces are a simple and straightforward way to distinguish names used in XML documents and namespace to avoid confusion involves using a prefix and adding an xmlns attribute to the tag to give the prefix a qualified name associated with the namespace. All child elements with the same prefix are associated with the namespace defined in the start tag of an element.

Q)What is a well-formed XML document?
If a document is syntactically correct it can be called as well-formed XML documents. A well-formed document conforms to XML's basic rules of syntax:

Every open tag must be closed.
The open tag must exactly match the closing tag: XML is case-sensitive.
All elements must be embedded within a single root element.
Child tags must be closed before parent tags.
A well-formed document has correct XML tag syntax, but the elements might be invalid for the specified document type.

Q)What is a valid XML document?

If a document is structurally correct then it can be called as valid XML documents. A valid document conforms to the predefined rules of a specific type of document:

These rules can be written by the author of the XML document or by someone else.
The rules determine the type of data that each part of a document can contain.
Note:Valid XML document is implicitly well-formed, but well-formed may not be valid

Q)What is a CDATA section in XML?
The CDATA section of XML is used to describe the text that should not be parsed by the XML parser.

Any text that is included in CDATA section is ignored by the parser.

Q)What is the difference between SAX parser and DOM parser?
DOM spec defines an object-oriented hieararchy.
The DOM parser creates an internal tree based on the hierarchy of the XML data.
Tree stays in memory until released. The DOM parser is more memory intensive. DOM Parser’s advantage is that it is simple. Pairs nicely with XSLT.
-Nice for smaller XML files, but because of the whole XML file
representation is in memory, it is possible not useful for
very large documents
-good for representation of an XML document.


SAX spec defines an event based approach, calling handler functions whenever certain text nodes or processing instructions are found.
These events include the start and end of the document, finding a text node, finding child elements, and hitting a malformed element. SAX development is more challenging. SAX can parse gigabytes worth of XML without hitting resource barriers.
It’s also faster and more complex. Better for huge XML docs. Best suited for sequential-scan applications.

Q)What's XLink?

This specification defines the XML Linking Language (XLink), which allows elements to be inserted into XML documents in order to create and describe links between resources. It uses XML syntax to create structures that can describe links similar to the simple unidirectional hyperlinks of today's HTML, as well as more sophisticated links.

Q)What is Xpath?
XPath is a language for addressing parts of an XML document, designed to be used by both XSLT and XPointer.

Q) What is XSL?
In addition to XSLT, XSL includes an XML vocabulary for specifying formatting. XSL specifies the styling of an XML document by using XSLT to describe how the document is transformed into another XML document that uses the formatting vocabulary.

Q) What is XSLT?
A language for transforming XML documents into other XML documents. XSLT is designed for use as part of XSL, which is a stylesheet language for XML.

Q)What is JAXP ?

The Java API for XML Processing (JAXP) is for processing XML data using applications written in the Java programming language. JAXP leverages the parser standards Simple API for XML Parsing (SAX) and Document Object Model (DOM) so that you can choose to parse your data as a stream of events or to build an object representation of it. JAXP also supports the Extensible Stylesheet Language Transformations (XSLT) standard, giving you control over the presentation of the data and enabling you to convert the data to other XML documents or to other formats, such as HTML. JAXP also provides namespace support, allowing you to work with DTDs that might otherwise have naming conflicts.

No comments:

Post a Comment

Your Ad Here ]]>