Friday, February 6, 2009

XML Interview Questions

1. What is XML?
XML, Extensible Markup Language, is an open, text based markup language that provides structural and semantic information to data.

2. Describe the differences between XML and HTML?
Differences between XML and HTML:
XML
► User definable tags
► Content driven
► End tags required for well formed documents
► Quotes required around attributes values
► Slash required in empty tags
HTML
► Defined set of tags designed for web display
► Format driven
► End tags not required
► Quotes not required
► Slash not required

3. List the rules to be followed by an XML document?
They must have a root tag, the document should be well formed and the tags should be properly closed, since XML is case sensitive, one should take care

4. Define DTD (Document Type definition)?
XML DTD is a rule book that an XML document follows. Once DTD is ready, you can create number of XML documents following the same rules

5. What is a CDATA section in XML?
The term CDATA is used when you don’t want some text data to be parsed by the XML parser.

6. What is XSL?
XSL is a language for expressing style sheets. An XSL style sheet is a file that describes the way to display an XML document

7. What is XQuery?
Xquery is a query language that is used to retrieve data from XML documents

8. What is XMLA?
It is a Microsoft specified XML-messaging-based protocol for exchanging analytical data between client applications and servers

9. What is DOM?
DOM is an interface-oriented Application Programming Interface. It allows for navigation of the entire document

10. What is XML Namespace?
An XSL sheet or a document may have duplicate elements and attributes. Therefore, the XML namespaces define a way to distinguish between

11. What is XML data binding?
XML data binding refers to the process of representing the information in an XML document as an object in computer memory

12. What is an XML encoding error?
XML documents can contain non ASCII characters, like Norwegian æ ø å , or French ê è é which introduce errors

13. What are XML Serialization and Binary Serialization?
XML Serialization makes it possible to convert any common language runtime objects into XML documents or streams and vise versa.

14. How do you load data from XML file to a ORACLE table?
You need to first create a table in oracle that matches with the fields of the XML data .

15. What are XML indexes and secondary XML indexes?
The primary XML index is a B+tree and is useful because the optimizer creates a plan for the entire query.

16. What is the purpose of FOR XML in SQL Server?
SQL Server 2000 provides the facility to retrieve data in the form of XML with the help of the FOR XML clause appended to the end of a SELECT statement.

17. What is the difference between SAX parser and DOM parser?
DOM spec defines an object-oriented hierarchy.
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.

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 documents. Best suited for sequential-scan applications.

18. What is the difference between Schema and DTD?
Schema might out phase DTD. XML schemas 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.

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

20. What is XML Namespace?
Defining a 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.

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

22. What is XML template?
A style sheets describes transformation rules
A transformation rule consists of a pattern + a template
Pattern: a configuration in the source tree
Template: a structure to be instantiated in the result tree
When a pattern is matched in the source tree, the corresponding pattern is generated in the result tree

23. How would you produce PDF output using XSL’s?
1.transform xml into xsl-fo doc using xslt, or DOM or SAX
2.process xsl-fo using a Formatter to convert xsl-fo into a pdf.

24. What are the steps to transform XML into HTML using XSL?
An XSLT processor may output the result tree as a sequence of bytes.The xsl:output element allows stylesheet authors to specify how they wish the result tree to be output. If an XSLT processor outputs the result tree, it should do so as specified by the xsl:output element; however, it is not required to do so.The method attribute on xsl:output identifies the overall method that should be used for outputting the result tree.
The html output method outputs the result tree as HTML;

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

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

No comments:

Post a Comment