Google News
XML Interview Questions
XML stands for eXtensible Markup Language. It is a simple and flexible 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.  It was evolved from an older standard format known as SGML in order to make it more Web-friendly.
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
HTML stands for Hyper Text Markup Language while XML stands for eXtensible Markup Language. The differences between HTML and XML are given below :

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.
DOM stands for Document Object Model which is used to describe XML document's logical structure. It's a hierarchical model that provides a way to manage and navigate an XML document.

Any language such as C #, VB, JavaScript and VB Script can use DOM methods and objects.
XSLT is a common XML technology that converts one XML file into another document, such as HTML etc. XSLT is like a language for the transformation of XML documents that has its own syntax, functions and operator. XSLT is often known as the HTML pages for viewing data present in XML files.
Declaring the XML version is very important for each XML document and platform needs to be specified in which it is running.
<?xml version=”1.1” encoding=”|ISO-8859-1|”?>


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.
Step 1 : Open Microsoft Excel
Step 2 : Click on ‘file’ on the top left corner of MS Excel. If you are using MS Excel version 2007, click on the MS Office logo.
Step 3 : You will land on the ‘open’ tab; if not, select the ‘open’ tab. Click ‘browse’ for the MS Excel version of 2010 and above.
Step 4 : Double click on the XML file you want to export into MS Excel.
Step 5 : Select ‘Open the file without applying a style sheet’ to select the standard format, or ‘Open the file with the stylesheet applied’ to format the data in accordance with the style sheet.
Step 6 : Click on ‘save as’ and select ‘Excel Workbook’ from the drop-down menu.
Step 7 : Save the file!
DTD stands for Document Type Definition. DTD defines the structure, elements and attributes of an XML document. Document Type Definition forms like the structure of the tree and describes something about its data. Document Type Definition (DTD) consists of SGML family structure, like GML, SGML, HTML, XML. In this case, it’s XML.
A DTD can be declared inline or as an external recommendation within an XML document. The DTD specifies how many times a node should appear and how their child nodes should be ordered.
PCDATA and CDATA are the two data types.
* PCDATA is character data that has been parsed.
* CDATA is character data that is not typically parsed.
SQL is good for tabular data, or information that fits neatly into rows and columns. XML is ideal for hierarchical data or data that has multiple levels of varying sizes. SQL is useful for storing and searching data. XML is useful for both conveying and formatting data.
Instead of developing a whole database, you might utilise XML. However, I would recommend that you consider the type and amount of data you want to keep, as well as your justifications for not using a database. The relational elements of a database, such as MySql or SQL, are one of the benefits of using one. The database server's ability to execute a reasonable amount of work, as well as the fact that this is a typical method of storing data in the tech world.
Nowadays, there are several alternatives to using a full-scale database, one of which is XML.
You can also store data as a JSON object if you're using Javascript, or as an array in whatever programming language, you're using. There are NoSql databases that use JSON to store data as a single large array of key => value pairs that can be nested for quite complex data structures. If you're using a framework like React, you can also use Flux or Redux to store data in a Javascript structure known as a Store.
XML Schema Definition(XSD) is another name for XML Schema . It describes and validates the structure and content of XML data. The elements, attributes, and data types are defined by the XML schema. Namespaces are supported by Schema elements. It is analogous to a database schema, which describes the data in a database.
Naming rules are :
* Element names must start with a letter or underscore.
* Element names are case sensitive.
* Element names cannot start with the letters XML.
* Element names can contain letters, digits, hyphens, underscore, and periods.
* Element names cannot contain spaces.
XSNL stands for XML Search Neutral Language. This language acts between the meta-search interface and the targeted system.
There are two types of data types in XML schema.
* simpleType
* complexType

simpleType : The simpleType allows you to have text-based elements. It contains less attributes, child elements, and cannot be left empty.
complexType : The complexType allows you to hold multiple attributes and elements. It can contain additional sub elements and can be left empty.
<xs:element name="employee"> : It defines the element name employee.
<xs:complexType> : It defines that the element 'employee' is complex type.
<xs:sequence> : It defines that the complex type is a sequence of elements.
<xs:element name="firstname" type="xs:string"/> : It defines that the element 'firstname' is of string/text type.
<xs:element name="lastname" type="xs:string"/> : It defines that the element 'lastname' is of string/text type.
<xs:element name="email" type="xs:string"/> : It defines that the element 'email' is of string/text type.
16 .
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.
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.
An XML element is everything from (including) the element's start tag to (including) the element's end tag.
An element can contain :
* text
* attributes
* other elements
* or a mix of the above
  <book category="children">
  <book category="web">
    <title>Learning XML</title>
In the example above :
<title>, <author>, <year>, and <price> have text content because they contain text (like 15.30).
<bookstore> and <book>have element contents, because they contain elements.
<book> has an attribute (category="children").
An element with no content is said to be empty.
In XML, you can indicate an empty element like this :
You can also use a so called self-closing tag :
<element />
The two forms produce identical results in XML software (Readers, Parsers, Browsers).
Empty elements can have attributes.
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 “]]>.
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.
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 :
address.xml#pointer(/ descendant ::streetnumber[@id =9])  
In this example, XPOINTER points "streetnumber = 9" in "address.xml".
There are two types of XML encoding errors :
* An invalid character was found in text content.
* 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.
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.
Yes, graphics can be stored in XML file by using XLink and XPointer. It supports graphics like GIF, JPG, TIFF, PNG, CGM, EPS, SVG.
XML Declaration
<?xmlversion="1.0" encoding ="UTF-8">​
Document Type Declaration
<!DOCTYPE library PUBLIC="-//DTDLibrary//EN" "path/of/library.dtd">​
XML Body
  <title>Free Time Learn</title>
  <body>XML Tutorial</body>

$XML=simpleXML_Load_file(“saleslist.XML”) or die(“Error: cannot create object”);

for ($x=0; $x<6; $x++)

echo $XML — > book[$x] — > title[‘bookname’] . “<br>”;

saleslist.XML – is the name of the file we are calling using PHP.
bookname – is the item we are calling for output. 
Here, x is the attribute.
Attributes in XML must be quoted, such as text strings and URLs. Other values such as images, heights and font size give the desired results regardless of the quotation.
Example : <person gender=”female”> or <person gender=’male’>
Attribute in XML can use both single and double quotes in a specific element in any combination.
Example : <flower name=”lotus” ‘rose’ ‘lily’>
The XML Signature is a technique of associating a key with referred data (octets); it does not define how keys are connected with people or institutions, nor does it define what the data being referenced and signed means.
As a result, while this specification is a crucial component of secure XML applications, it is not adequate in and of itself to handle all application security/trust concerns, particularly when employing signed XML (or other data formats) as the basis of human-to-human communication and agreement. An additional key, algorithm, processing, and rendering requirements must be included in such an application.
The XmlrReader class is a reader which provides fast, non-cached, forward-only access to XML data. To function with XmlReader class in.NET you will import the following namespaces.
In VB :
Imports System.Xml
In C# :
using System.Xml;
JSON Pro :
* Simple syntax, which results in less "markup" overhead compared to XML.
* Easy to use with JavaScript as the markup is a subset of JS object literal notation and has the same basic data types as JavaScript.
* JSON Schema for description and datatype and structure validation
* JsonPath for extracting information in deeply nested structures

JSON Con :
* Simple syntax, only a handful of different data types are supported.
* No support for comments.
XML Pro :
* Generalized markup; it is possible to create "dialects" for any kind of purpose
* XML deals remarkably well with the full richness of unstructured data CDATA
* XML Schema for datatype, structure validation. Makes it also possible to create new datatypes
* XSLT for transformation into different output formats
* XPath/XQuery for extracting information in deeply nested structures
* built in support for namespaces
XML Con :
* Relatively wordy compared to JSON (results in more data for the same amount of information).
* XML presents a 21% overhead over JSON
* Requires some reasonable more time to compress.
A CDATA section is "a section of element content that is marked for the parser to interpret as only character data, not markup." The data contained therein will not be parsed as XML, and as such does not need to be valid XML or can contain elements that may appear to be XML but are not.
Within this Character Data block I can
use double dashes as much as I want (along with <, &, ', and ")
*and* %MyParamEntity; will be expanded to the text
"Has been expanded" ... however, I can't use
the CEND sequence. If I need to use CEND I must escape one of the
brackets or the greater-than sign using concatenated CDATA sections.
<description>An example of escaped CENDs</description>
<!-- This text contains a CEND ]]> -->
<!-- In this first case we put the ]] at the end of the first CDATA block
     and the > in the second CDATA block -->
<data><![CDATA[This text contains a CEND ]]]]><![CDATA[>]]></data>
<!-- In this second case we put a ] at the end of the first CDATA block
     and the ]> in the second CDATA block -->
<alternative><![CDATA[This text contains a CEND ]]]><![CDATA[]>]]></alternative>
var xhttp= newXML Httprequest();
{ If this.readystate==4&& this.status==200)
        { Action to be performed when document is ready;
Basically, every element (or attribute) in XML belongs to a namespace, a way of "qualifying" the name of the element.
Imagine you and I both invent our own XML. You invent XML to describe people, I invent mine to describe cities. Both of us include an element called name. Yours refers to the person’s name, and mine to the city name—OK, it’s a little bit contrived.
If our two XMLs were combined into a single document, how would we tell the two names apart? As you can see above, there are two name elements, but they both have different meanings.
The answer is that you and I would both assign a namespace to our XML, which we would make unique:
<personxml:person xmlns:personxml=""
Now we’ve fully qualified our XML, there is no ambiguity as to what each name element means. All of the tags that start with personxml: are tags belonging to your XML, all the ones that start with cityxml: are mine.
Processing Instruction is defined in the XML standard, XML 1.0 Recommendation. The definition says: "Processing instructions (PIs) allow documents to contain instructions for applications… PIs are not part of the document's character data, but MUST be passed through to the application."
Following is the syntax of PI :
<?target instructions?>
And some examples :
<?display table-view?>
<?sort alpha-ascending?>
<?textinfo whitespace is allowed ?>
<?elementnames <fred>, <bert>, <harry> ?>
In the real world PIs are seldom used with a few common exceptions. The PI is the official method for an XML document to link to a stylesheet, and Microsoft uses PIs in MS Office 2003 to make it easy for MS Word and MS Excel documents to be identified when saved as XML :
<?xml-stylesheet href="style.css" type="text/css"?>
XML data binding refers to the reading and writing of XML data using a programming language. XML data binding usually occurs using a class library (like C++, Java ), specifically for the given XML data format.
With XML data binding, applications can directly access the required data with the XML file’s created APIs instead of relying on the Document Object Model (DOM) to retrieve the data from the XML file.
An XML parser is a software library that provides an interface for client applications to work with XML documents.
Working of XML Parser : XML Document which undergoes XML parser (usually the API part), and then this API is used in Client Applications.
There are two types of XML parser :
The distinction between well-formed and valid XML is straightforward : Valid XML is associated with a DTD and has been validated against all of the DTD's rules in addition to being well-formed. However, simply well-formed XML is not necessarily valid, though it may be.
The element within the element is referred to as XML nested elements. The structure begins with a root element, which is followed by another element. The most outer element is the root element. All of the other elements mentioned can have inner elements within the root element.
Step 1 : Review the structure of your pages.
The first thing you need to do is look at your website’s existing content and see how everything is structured.
Step 2 : Code your URLs
Format each URL with XML tags for each page, which you wish the search engine to crawl for search results.
Step 3 : Validate the code.
Validate code with tools like XML SiteMap Validator
Step 4 : Add your sitemap to the root and robots.txt
Locate the root folder of your website and add the sitemap file to this folder and also to robots.txt
Step 5 : Submit your sitemap.
Submit your website to Google Search Console.

Example : 
<urlset xmlns="">
* Since it is applied for user-defined transformations to an XML document, XSLT makes it simple to merge XML data into the presentation, and the output can be XML, HTML, or might be any other structured document.

* Xpath is a feature of XSLT that allows you to address elements/attributes within an XML document.

* XSLT is a template-based language.
XML can be integrated into any possible data format, from text and numbers to multimedia such as sound and images to active formats such as Java Applets or ActiveX Components.
We cannot include conditional statement as like programming language.
<foo if{DB}="A">bar</foo>
This can be done by using Document Type Definition(DTD).
<xsl:if test="@foo=’bar’">

<xsl:text>Hello, world!</xsl:text>

XLink is the standard way of creating hyperlinks in the XML files. Xpointer which allows those hyperlinks to point to more specific parts of the XML file or document.
XSL consists of three parts  :
XSLT : Used to transform XML documents
XPath : Used for navigating in XML documents
XSL-FO : Used for formatting XML documents
To import XML file data in tally, follow the below steps.
Step 1 : Once you open Tally, you will be welcomed with the StartUp page.
Step 2 : Now, press ‘L’ to login as ‘Remote Tally User’ to import your data.
Step 3 : You will be prompted with Login Screen, log in with user ID and password.
Step 4 : On logging in, you will see ‘Gateway of Tally’ to your screen’s right.
Step 5 : Under ‘Masters’ select, ‘Account Info.’
Step 6 : Under ‘Company Info’, ‘Select Company’, you want to import the XML file.
Step 7 : Under ‘Company’, select the company to which you want to import your data; let’s call the ‘Company’ as ‘xyz’.
Step 8 : Now, login to ‘xyz.’
Step 9 : Under Gateway of Tally, Select ‘Accounts Info’ under ‘Masters
Step 10 : Now select ‘trial balance’ as we wanted to update it.
Step 11 : Select ‘Outstandings
Step 12 : Now, under Types of Vouchers, select ‘Stock Journal’ as we would like to import the XML file of Stock Journal data.
Step 13 : Stock Journal by default will be zero, and now select ‘Import Data’ under ‘Utilities’.
Step 14 : Select ‘Vouchers’ under ‘Import Data
Step 15 : Now, a pop-up screen will appear, now enter the file location of XML as in your pc. Example: C://Downloads\Tally.XML
Step 16 : Done!
Web services are web application components.
Web services can be published, found, and used on the Web.
* WSDL stands for Web Services Description Language
* WSDL is an XML-based language for describing Web services.
* WSDL is a W3C recommendation

* SOAP stands for Simple Object Access Protocol
* SOAP is an XML based protocol for accessing Web Services.
* SOAP is based on XML
* SOAP is a W3C recommendation

* RDF stands for Resource Description Framework
* RDF is a framework for describing resources on the web
* RDF is written in XML
* RDF is a W3C Recommendation

* RSS stands for Really Simple Syndication
* RSS allows you to syndicate your site content
* RSS defines an easy way to share and view headlines and content
* RSS files can be automatically updated
* RSS allows personalized views for different sites
* RSS is written in XML