Wednesday 25 April 2018

XML Interview Questions

1. What is a markup language?

Markup languages are designed for presentation of text in different formats, and it can also be used for transporting and storing data. This markup language specifies the code for formatting, layout and style of data .This markup code is called Tag.
HTML and XML are examples of Markup Language.

2. What is XML?

XML is called Extensible Markup Language which is designed to carry or transport and store data. XML tags are not as predefined as HTML, but we can define our own user tags for simplicity. It mainly concentrates on storing of data, not on displaying of data.

3. What are the features of XML?

Main features of XML are:
• Very easy to learn and implement
• XML files are text files, and no editor is required
• Minimal and a limited number of syntax rules in XML
• It is extensible, and it specifies that structural rules of tags

4. What are the differences between HTML and XML?

Following are the differences between HTML and XML:
HTML
XML
Markup language used to display data
Markup language used to store data
Case Insensitive
Case sensitive
Designing web pages
Used to transport and store data
Predefined Tags
Custom Tags
Does not Preserve white spaces
Preserve white spaces
Static
Dynamic

5. Which tag is used to find the version of XML and the syntax?

Declaring the XML version is very important for each XML document and platform needs to be specified in which it is running.
1
<?xml version=”1.1” encoding=”|ISO-8859-1|”?>

6. What is XML DOM Document?

XML Document object represents the whole XML document, and it is the root of a document tree. It gives access to entire XML document – Nodes and Elements, and it has its own properties.

7. What is XPath?

XPath is used to find information in an XML document and contains standard functions. XPath is the major element in XSLT, and it is w3c recommendation.

8. What is an attribute?

An attribute provides more or additional information about an element than otherwise.
Example –
1
<Person name=”Peter”>

Attribute name can be given to an element person.

9. Can we have empty XML tags?

Yes, we can have empty tags in XML. Empty tags are used to indicate elements that have no textual content. Empty tags can be represented as
1
2
3
 <person></person>
 <person/>


10. What are the advantages of XML DOM Document?

Advantages of XML DOM:
• XML structure is traversable, and it can be randomly accessed by traversing the tree.
• XML structure is modifiable, and values can be added, changed and removed

11. What are the basic rules while writing XML?

These are the basic rules while writing XML:
• All XML should have a root element
• All tags should be closed
• XML tags are case sensitive
• All tags should be nested properly
• Tag names cannot contain spaces
• Attribute value should appear within quotes
• White space is preserved

12. What is XML Element?

An XML document contains XML Elements, and it starts from an element’s start tag to end tag. It can contain:
• Other elements within main element
• An Attribute
• text

13. What is CDATA?

CDATA is unparsed character data that cannot be parsed by the XML parser. Character < and > are illegal in XML elements. CDATA section starts with <![CDATA[“ and end with “]]>”.

14. How comment can be represented in XML?

Comment can be represented as <!- – comments – -> as like HTML. This comment symbol is applicable for single or multiple lines.

15. What are XML Namespaces?

XML namespaces are used to avoid element name conflicts, and it can be avoided by using prefix before the name.

More about XML:

No comments:

Post a Comment