Home » XML Interview Questions

XML Interview Questions

by Online Tutorials Library

XML Interview Questions

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:

No. HTML XML
1) HTML is used to display data and focuses on how data looks. XML is a software and hardware independent tool used to transport and store data. It focuses on what data is.
2) HTML is a markup language itself. XML provides a framework to define markup languages.
3) HTML is not case sensitive. XML is case sensitive.
4) HTML is a presentation language. XML is neither a presentation language nor a programming language.

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.

DOM methods and objects can be used with any languages like C#, VB, JavaScript and VB Script.


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:

  • It must have a closing tag.
  • The closing tag must exactly match the open tag: XML is case sensitive.
  • All elements should be included within a single root tag.
  • Child elements must be closed within parent tag.

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:

  • Names of elements
  • How and where they can be used
  • Element attributes
  • Proper nesting

11) How can you apply a DTD to an XML document?

To apply a DTD to an XML document, you can:

  • Use the DTD element definition within the XML document itself.
  • Provide a DTD as a separate file and reference its name in XML document.

12) What are the basic rules to write XML document?

You should consider the following rules to write an XML document.

  • It should have a root element.
  • All tags must be closed.
  • Spaces are not allowed in tag names.
  • All tags must be nested properly.
  • XML tags are case sensitive.
  • Use the attribute values within quotes.
  • Whitespace is preserved in XML.

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.

  • DTD stands for Document Type Definition whereas XSD stands for XML Schema Definition.
  • DTD does not support namespaces. It has its own set of keywords to define a schema whereas XSD uses its own set of namespaces and elements to define the schema.
  • DTD is the predecessor of XML schema whereas XML schema is a new technology, some XML parser do not support it yet.

more details…


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:

  1. An invalid character was found in text content.
  2. Switching from current encoding to specified encoding not supported.

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.

In VB:

Imports System.Xml

In C#:

using System.Xml;


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?

XML Structure


You may also like