Thursday, March 19, 2009

XML -- Interview Questions


Interview preparation can be a difficult process and in the current market scenario one has to have the right skills and capabilities to get a job.

So I have a bunch of stuff that I have hands on experience but do not have thorough knowledge of. Lets begin with XML today.

1. What is XML?

Ans. XML (eXtensible Markup Language) is all about describing data.

2. What are the namespaces in .NET used for XML?

Ans.
1. System.Xml
2. System.Xml.Schema
3. System.XML.XPath
4. System.Xml.Xsl

3. What is a XML Parser?

Ans. XML Parser sits in between the XML document and the application who wants to use the XML document.

There are two standard specifications which are very common and should be followed by a XML parser:-

DOM (Document Object Model)
- W3C recommended way for treating XML documents.
- Load entire XML document into memory and allows us to manipulate the structure and data of XML document.

SAX (Simple API for XML
- Event Driven way for processing XML documents.
- SAX parser parses XML document sequentially and emits events like start and end of the document, elements, text content, etc.
- Best for large XML documents which cannot be loaded directly into the memory.

4. What are the core functionalities in XML.NET framework?

Ans. The core functionalities in XML.NET framework are

1. XML Readers
2. XML Writers
3. XML Document

1. XML Readers
- allows you to scroll forward through the contents like moving from node to node or element to element.
- allows you to browse through the XML document.

2. XML Writers
- can store the XML contents to any other storage media.

3. XML Document
- provides a in memory representation for the data in an XMLDOM structure as defined by W3C.
- supports browsing and editing of the document.
- Gives complete tree structure representation of your XML document.

5. What is XSLT?

- rule based language used to transform XML docs into other file formats.
- generic transformation rules which can be applied to transform XML document to HTML, CSS, Rich Text, etc.


6. What is XPATH?

- XML query language to select specific parts of an XML document.
- Using XPATH you can address or filter elements and text in a XML document.
- e.g. "Invoice/Amount" states find "Amount" node which are children of "Invoice" node.

7. What is a XPointer?

- used to locate data within XML document.
- can point to a particular portion of XML document.
- e.g.

address.xml#xpointer(/descendent::streetnumber[@id=9])

- So the above XPOINTER points streetnumber = 9 in "address.xml".
8. What is a XMLReader Class?

- abstract class from System.XML namespace.
- works on a read only stream browsing from one node to another in forward direction.
- You cannot modify the XML document. You can only move forward.

9. What is a XMLTextReader?

- helps provide fast access to streams of XML data in a fowrward-only and read-only manner.
- checks if the XML is well formed (properly formatted with opening and ending tags)
- does not validate against a schema or DTD for that you will need "XmlNodeReader" or "XmlValidationReader" class.

No comments: