1) What is XML?
XML stands for Extensible Markup language which means you can extend XML based upon your needs. You can define custom tags like
There are couple of differences between DTD and XML Schema e.g. DTD is not written using XML while XML schema are xml documents in itself, which means existing XML tools like XML parsers can be used to work with XML schema. Also XML schema is designed after DTD and it offer more types to map different types of data in XML documents. On the other hand DTD stands for Document Type definition and was a legacy way to define structure of XML documents.
In this sample XML id is an attribute of element.
Here , and are also
other elements but they don't have any attribute.
6) What is meaning of well formed XML ?
Another interesting XML
interview question which most appeared in telephonic interviews. A well
formed XML means an XML document which is syntactically correct e.g. it
has a root element, all open tags are closed properly, attributes are in quotes
etc. If an XML is not well formed, it
may not be processed and parsed correctly by various XML parsers.
7) What is XML namespace? Why it's important?
XML namespace are similar to package in Java and used to
provide a way to avoid conflict between two xml tags of same name but different
sources. XML namespace is defined using xmlns attribute at top of the XML
document and has following syntax
xmlns:prefix="URI". later that prefix is used along with
actual tag in XML documents. Here is an example of using XML namespace :
8) Difference between DOM and SAX parser ?
This is another very popular XML interview question, not just in
XML world but also on Java world. Main difference between DOM and SAX parser is
the way they parse XML documents. DOM creates an in memory tree representation
of XML documents during parsing while SAX is a event driven parser. See Difference between DOM and SAX parser
for more detailed answer of this question.
9) What is a CDATA section in XML?
I like this XML Interview questions for its simplicity and
importance, yet many programmer doesn't know much about it. CDATA stands for character DATA and has special instruction for XML parsers. Since XML parser parse all
text in XML document e.g. This is name of person
here even though value of tag
Question
10: What is XML data Binding in Java?
Answer : XML binding in Java refers to creating Java classes and object
from XML documents and then modifying XML documents using
Java programming language. JAXB , Java API for XML binding provides convenient
way to bind XML documents with Java objects. Other alternatives for XML binding
is using open source library e.g. XML Beans. One of the biggest advantage of
XML binding in Java is to leverage Java programming capability to create and
modify XML documents.
No comments:
Post a Comment