XML Interview Q/A Part 1

on 2:59 AM

Introduction

Full Content
What is XML?
XML (Extensible markup language) is all about describing data.An XML tag is not something predefined but it is something you have to define according to your needs.The XML document is self explanatory, any one can easily understand looking at the XML data what exactly it means.

What is the version information in XML?

“version” tag shows which version of XML is used.

What is ROOT element in XML?
In our XML sample given previously tag is the root element. Root
element is the top most elements for a XML.

If XML does not have closing tag will it work?
No, every tag in XML which is opened should have a closing tag. For instance in the top
if I remove tag that XML will not be understood by lot of application.

Is XML case sensitive?
Yes, they are case sensitive.

What is the difference between XML and HTML?
XML describes data while HTML describes how the data should be displayed. So HTML is about displaying information while XML is about describing information.

Is XML meant to replace HTML?
No, they both go together one is for describing data while other is for displaying data.

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.

What is DTD (Document Type definition)?
It defines how your XML should structure. For instance in the above XML we want to make it compulsory to provide “qty” and “totalcost”, also that these two elements can only contain numeric. So you can define the DTD document and use that DTD document with in that XML.

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.

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

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.

What is CSS?
With CSS you can format a XML document.

What is XSL?
XSL (the eXtensible Stylesheet 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.

What is element and attributes in XML?
In the below example invoice is the element and the invnumber the attribute.


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

0 comments:

Post a Comment