|
Questions
: 1
|
What
is XML?
|
|
Answers
: 1
|
XML (Extensible markup
language) is all about describing data. Below is a XML which describes book
store. < ?xml version="1.0" encoding="ISO-8859-1"? > < book> < php>php by pcds infotech< /php> < java>Jave j2ee by pcds infotec< /java> An XML tag is not something predefined but it is something you have to define according to your needs. For instance in the above example of books all tags are defined according to business needs. The XML document is self explanatory, any one can easily understand looking at the XML data what exactly it means. |
|
|
|
|
Questions
: 2
|
What
is the version information in XML?
|
|
Answers
: 2
|
"version" tag
shows which version of XML is used. |
|
|
|
|
Questions
: 3
|
What
is ROOT element in XML ?
|
|
Answers
: 3
|
In our XML sample given
previously < book> tag is the root element. Root element is the top
most elements for a XML. and it's must be unique |
|
|
|
|
Questions
: 4
|
If
XML does not have closing tag will it work ?
|
|
Answers
: 4
|
No, every tag in XML
which is opened should have a closing tag. For instance in the top if we
remove tag that XML will not be understood by lot of application. |
|
|
|
|
Questions
: 5
|
Is
XML case sensitive ?
|
|
Answers
: 5
|
Yes, they are case
sensitive. . |
|
|
|
|
Questions
: 6
|
What
is the difference between XML and HTML?
|
|
Answers
: 6
|
XML describes data while
HTML describes how the data should be displayed. So HTML is about displaying
information while XML is about describing and storing the information. |
|
|
|
|
Questions
: 7
|
Is
XML meant to replace HTML?
|
|
Answers
: 7
|
No, they both go
together one is for describing data while other is for displaying data. |
|
|
|
|
Questions
: 8
|
Can
you explain why your project needed XML ? or why you have chosen XML.
|
|
Answers
: 8
|
Remember XML was meant
to exchange data between two entities as we can define our user friendly tags
with ease. In real world scenarios XML is meant to exchange data. For
instance we 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 we can give a scenario of two applications which are working separately and how you chose XML as the data transport medium. |
|
|
|
|
Questions
: 9
|
What
is DTD ( Document Type definition )?
|
|
Answers
: 9
|
It defines how our XML
should structure.means type of element like integer or value char etc |
|
|
|
|
Questions
: 10
|
What
is well formed XML?
|
|
Answers
: 10
|
If a XML document is
confirming to XML rules (all tags started are closed, there is a root element
, all valid char have used etc) then it’s a well formed XML. |
|
|
|
|
Questions
: 11
|
What
is a valid XML?
|
|
Answers
: 11
|
If XML is confirming to
DTD rules then it’s a valid XML. |
|
|
|
|
Questions
: 12
|
What
is CDATA section in XML?
|
|
Answers
: 12
|
All data is normally
parsed in XML but if you want to exclude some elements you will need to put
those elements in CDATA. |
|
|
|
|
Questions
: 13
|
What
is element and attributes in XML?
|
|
Answers
: 13
|
In the below example
book is the element and the price the attribute < book price=1002><
/book> |
|
|
|
|
Questions
: 14
|
What
is XSL?
|
|
Answers
: 14
|
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. |
|
|
|
|
Questions
: 15
|
What
are the standard ways of parsing XML document? or What is a XML parser?
|
|
Answers
: 15
|
XML parser sits in
between the XML document and the application who want to use the XML
document. Parser exposes set of well defined interfaces which can be used by
the application for adding, modifying and deleting the XML document contents.
Now whatever interfaces XML parser exposes should be standard or else that
would lead to different vendors preparing there own custom way of interacting
with XML document. There are two standard specifications which are very common and should be followed by a XML parser:- 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. SAX: - Simple API for XML. SAX is event driven way for processing XML documents. 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. For instance you only want one element from the whole XML document or you only want to see if the XML is proper which means loading the whole XML in memory will be quiet resource intensive. SAX parsers parse the XML document sequentially and emit events like start and end of the document, elements, text content etc. So applications who are interested in processing these events can register implementations of callback interfaces. SAX parser then only sends those event messages which the application has demanded. |
|
|
|
|
Questions
: 16
|
In
What scenarios will you use a DOM parser and SAX parser ?
|
|
Answers
: 16
|
=> If we 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 its better to have DOM. => With SAX parser you have to write more code than DOM. => If we 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. |
|
|
|
|
Questions
: 17
|
Define
XPATH? and What is XSLT?
|
|
Answers
: 17
|
XPATH is an XML query
language to select specific parts of an XML document. Using XPATH we can
address or filter elements and text in a XML document. For instance a simple
XPATH expression like "book/price" states find "price"
node which are children of “Invoice” node. XSLT is a rule based language used to transform XML documents in to other file formats. XSLT are nothing but generic transformation rules which can be applied to transform XML document to HTML, CS, Rich text etc. |
|
|
|
|
Questions
: 18
|
What
is the concept of XPOINTER?
|
|
Answers
: 18
|
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::streetnumber[@id=9]) So the above XPOINTER points streetnumber=9 in "address.xml". |
XML
Posted by
Giri
|
Subscribe to:
Post Comments (Atom)






0 comments:
Post a Comment