You are on page 1of 5

XML

1) What is XML?
Extensible Markup Language (XML) is a structured format for storing and exchanging data across
different platforms and devices. XML contains User definable tags.

2) What is the version information in XML?

Version tag shows which version of XML is used.

3) What is ROOT element in XML?

Root element is the top most elements for a XML.

4) If XML does not have closing tag will it work?

No, every tag in XML which is opened should have a closing tag.

5) Is XML case sensitive?

Yes.

6) What is the difference between XML and HTML?


XML:
 XML is used describing data.
 User definable tags.
HTML:
 HTML is used for designing pages.
 Defined set of tags designed for web display.

7) Is XML meant to replace HTML?

No, they both go together one is for describing data while other is for displaying data.

8) What is DTD (Document Type definition)?


XML Document Type Definition (DTD) defines how your XML should structure. It contains markup declarations
that provide a grammar for a class of documents.
9) Can you explain why your project needed XML?
Note: - This is an interview question where the interviewer wants to know why you have chosen XML.
Remember XML was meant to exchange data between two entities as you can define your user friendly
tags with ease. In real world scenarios XML is meant to exchange data. For instance you have two
applications who want to exchange information. But because they work in two complete opposite
technologies it’s difficult to do it technically. For instance one application is made in JAVA and the other
in .NET. But both languages understand XML so one of the applications will spit XML file which will be
consumed and parsed by other applications
you can give a scenario of two applications which are working separately and how you chose XML as the
data transport medium.

10) What is well formed XML?


If a XML document is confirming to XML rules (all tags started are closed, there is a root element etc.) then
it’s a well formed XML.

11) What is a valid XML?


If XML is confirming to DTD rules then it’s a valid XML.

12) What is CDATA section in XML?


All data is normally parsed in XML but if you want to exclude some elements you will need to put those
elements in CDATA.

13) What is XSL?


XSL (extensible Style sheet Language) is used to transform XML document to some other document. So
its transformation document which can convert XML to some other document. For instance you can
apply XSL to XML and convert it to HTML document or probably CSV files.

14) What are the XML attributes?


An XML attribute can be used to give more information about the elements or its data. An attribute is
mostly used to uniquely identify an element within an XML document.
15) Which are the namespaces in .NET used for XML?
“System.xml.dll” is the actual physical file which has all XML implementation. Below are the commonly used
namespaces,
 System.Xml
 System.Xml.Schema
 System.Xml.XPath
 System.Xml.Xsl

16) What are the standard ways of parsing XML document?


DOM (Document Object Model):-
DOM is a W3C recommended way for treating XML documents. In DOM we load entire XML document into
memory and allows us to manipulate the structure and data of XML document.
(Or)
DOM parser creates a tree structure by parsing an XML document. The tree structure contains XML data
in hierarchically linked layout.

SAX (Simple API for XML): -

In DOM we load the whole XML document in to memory and then application manipulates the XML document.
But this is not always the best way to process large XML documents which have huge data elements.

SAX parser performs event based parsing of XML documents.

17) In what scenarios will you use a DOM parser and SAX parser?

 If you do not need all the data from the XML file then SAX approach is much preferred than DOM as
DOM can quiet memory intensive. In short if you need large portion of the XML document it’s better to
have DOM.
 With SAX parser you have to write more code than DOM.

 If you want to write the XML in to a file DOM is the efficient way to do it.

 Some time you only need to validate the XML structure and do not want to retrieve any Data for
those instances SAX is the right approach.

18) How was XML handled during COM times?

During COM it was done by using MSXML 4.0. So old languages like VB6, VC++ used MSXML 4.0 which was
shipped with SP1 (Service Pack 1).
19) What is the main difference between MSXML and .NET Framework XML classes?
MSXML supports XMLDOM and SAX parsers while .NET framework XML classes support XML
DOM and XML readers and writers.

20) What are the core functionalities in XML .NET framework?


The XML API for the .NET Framework comprises the following set of functionalities:

XML readers

With XML readers the client application gets reference to instance of reader class. Reader
class allows you to scroll forward through the contents like moving from node to node (or)
element to element. You can compare it with the SqlDataReader object in ADO.NET which is
forward only. In short XML reader allows you to browse through the XML document.

XML writers

Using XML writers you can store the XML contents to any other storage media. For instance
you want to store the whole in memory XML to a physical file or any other media.

XML document classes

XML documents provides a in memory representation for the data in an XMLDOM structure as
defined by W3C. It also supports browsing and editing of the document. So it gives you a
complete memory tree structure representation of your XML document.

21) What is XML parser?


XML parsers are used to parse XML documents. Parsing is necessary for inserting new contents
(or) modifying the existing contents of XML document.

22) What is XSLT?


XSLT (Extensible Style sheet Language Transformations) is a XML-based language used for
the transformation of XML documents into other XML documents. The original document is not
changed; rather, a new document is created based on the content of an existing one.

23) Define XPATH?

XPath, the XML Path Language, is a query language for selecting nodes from an XML document. In addition,
XPath may be used to compute values (e.g., strings, numbers, or Boolean values) from the content of an
XML document.
24) What is the concept of XPOINTER?

XPOINTER is used to locate data within XML document.


XPOINTER can point to a particular portion of a XML document for instance
address.xml#xpointer (/descendant:: street number[@id=9])
So the above XPOINTER points street number=9 in "address.xml".

25) What is XMLTextReader?

The “XmlTextReader” class helps to provide fast access to streams of XML data in a forward-only and
read-only manner.

26) What does XmlValidatingReader class do?

Represents a reader that provides document type definition (DTD), XML-Data Reduced (XDR) schema,
and XML Schema definition language (XSD) validation.

You might also like