XML Interview Questions
There is given XML interview questions and answers that has been asked in many companies. Let's see the list of top 25 XML interview questions.
1) What is XML?
XML stands for eXtensible Markup Language. It is a simple and flexible markup language. It is known as universal language for data on the web because XML documents can be created and used in any language. It is universal standard for information interchange.
XML technology facilitates you to create your own markup language.more details...
2) How XML is different from HTML?
HTML stands for Hyper Text Markup Language while XML stands for eXtensible Markup Language. The key differences between HTML and XML are given below:
3) What is the meaning of version in XML?
Version is a tag used to show which version of XML is used.
4) What are the benefits of XML?
These are the main benefits of using XML.
Simplicity: Very easy to read and understand the information coded in XML.
Openness: It is a W3C standard, endorsed by software industry market leaders.
Extensibility: It is extensible because it has no fixed set of tags. You can define them as you need.
Self-descriptive: XML documents do not need special schema set-up like traditional databases to store data. XML documents can be stored without such definitions, because they contain metadata in the form of tags and attributes.
Scalable: XML is not in binary format so you can create and edit files with anything and it is also easy to debug.
Fast access: XML documents are arranged in hierarchical form so it is comparatively faster.
5) What is XML DOM?
DOM stands for Document Object Model which is used to describe the logical structure of XML document. It is a hierarchical model that provides a way to access and manipulate an XML document.
6) What is SAX in XML?
SAX stands for Simple API for XML. It is a sequential access parser. It is a simple API for XML which provides a mechanism for reading data from an XML document. It is an alternative of DOM. DOM operates on the documents as whole, SAX parsers operate on each piece of the XML document sequentially.
SAX has no formal specification like DOM and consumes less memory. But it can be used to read the XML document only not write.
7) What is XSNL?
XSNL is an XML search neutral language. This language acts between the meta search interface and targeted system.
8) What is a well formed XML document?
A syntactically correct document is called well formed XML document. A well formed XML document must follow the XML?s basic rules of syntax:
9) What is a valid XML document?
A structurally correct element is called a valid XML document. It should follow some predefined rules of a specific type of document. These rules determine the type of data that each part of the document can contain. These rules can be written by the author of an XML document or someone other.
Note: A valid XML document may be well-formed but a well-formed XML document may not be valid.
10) What is DTD?
DTD stands for Document Type Definition. It defines a leading building block of an XML document. It defines:
11) How can you apply a DTD to an XML document?
To apply a DTD to an XML document, you can:
12) What are the basic rules to write XML document?
You should consider the following rules to write an XML document.
13) What is XSL?
XSL stands for Extensible Stylesheet Language. It is a language for expressing stylesheets. These stylesheets are like CSS which describes how to display an XML document of a given type.more details...
14) What is XPath in XML?
XPath is a technology used in XML. It is used to retrieve elements from XML documents. XPath expressions can be used to locate and retrieve elements, attributes and values from XML files because XML documents are structured. It is similar to SQL.
As SQL is used to retrieve data from database, XPath is used to retrieve data from XML.
15) What is XSLT?
XSLT is a popular XML technology which is used to transform one XML file to other format like HTML etc. XSLT is like a language which has its own syntax, functions and operator to transform XML documents. XSLT is also used to display data present in XML files as HTML pages.
16) What is the difference between XML DTD and XML schema or XSD?
XSL stands for Extensible Stylesheet Language. It is a language for expressing stylesheets. These stylesheets are like CSS which describes how to display an XML document of a given type.
17) Is XML meant to be a replacement of HTML?
No, both languages have their own specification and used for different purposes. XML is used to describes data while HTML focus on how to display data.
18) Define element and attribute in an XML document.
From a start tag to end tag everything you see in a XML document, is XML element. It can contain other elements, attributes and texts.
An Attribute is a value that is used to define additional information about the element.
Let's take an example to understand it well:
In the above example, <student> is an element and id is an attribute of the <student> element.
19) What is the difference between simple element and complex element?
In XML, simple elements are text-based elements. It contains less attributes, child elements, and cannot be left empty.
But, complex elements can hold multiple attributes and elements. It can contain additional sub elements and empty element also.
20) Define the concept of XPOINTER.
XPOINTER is used to point data within XML document. It is used to locate the particular part of the XML document. It is a W3C recommendation.
See this example:
In this example, XPOINTER points "streetnumber = 9" in "address.xml".
21) What is XML data binding? Why is it used?
XML data binding is the process of representing the information in an XML document as an object in computer memory.
XML data binding is used to short your development effort, simplify maintenance, increase reliability. It saves your development time and money. It makes working with XML data very intuitive.
22) What is XML encoding error?
There are two types of XML encoding errors:
These errors occur because XML document can contain non ASCII characters like Norwegian and French. These errors can be avoided by specifying the XML encoding Unicode.
23) What are the different XML API's?
Tree-based API: It compiles an XML document in a tree like structure and loads it into the memory. You can traverse and change the tree structure. Tree based API's are useful for a wide range of applications. Example of tree-based API is DOM parser.
Event-based API: An event based API provides the reports to an application about the parsing event. It uses a set of built-in call back functions. Example of event-based API is SAX parser.
24) What is XmlReader class? Explain.
The XmlrReader class represents a reader that provides fast, noncached, forward-only access to XML data. You need to import the following namespaces to work with XmlReader class in .NET.
25) What is the difference between CDATA and PCDATA?
CDATA means unparsed character data whereas PCDATA means parsed character data.more details...
26) What is XQuery?
XQuery is a query language that is used to retrieve data from XML document.
27) What is XML Namespace?
A namespace is a qualified name that is associated with the DTD/Schema location .
A document may have duplicate elements and attributes. So, the namespace defines a way to compare duplicate elements and attribute names.
28) What is SGML?
SGML is a vast and powerful generalized markup language that is used to define descriptions for the structure of several electronic documents.
29) Can we use graphics in XML?
Yes, graphics can be stored in XML file by using XLink and XPointer. It supports graphics like GIF, JPG, TIFF, PNG, CGM, EPS, SVG.
30) Is XML case sensitive?
Yes, XML is a case sensitive language.
31) Define Structure of XML?