Skip to main content

35 Best XML Interview Questions | Extensible Markup Language

What Is XML?
XML stand for Extensible Markup Language. The Extensible Markup Language (XML) is the universal language for data on the web.

Extensible Markup Language (XML) is a technology which allows us to create our own markup language.

Extensible Markup Language (XML) documents are universally accepted as a standard way of representing information in platform and language independent manner.

Extensible Markup Language (XML) is universal standard for information interchange.

Extensible Markup Language (XML) documents can be created in any language and can be used in any language.

What Are the Benefits of XML?
The Benefits of using XML on the web -
1.      Simplicity - It is very easy to read and understand.
2.      Extensibility - There is no fixed set of tags and the tags can be created as per your needed.
3.      Openness - It is a W3C standard, endorsed by software industry market leaders.
4.      Self-description - XML documents can be stored without such definitions, because they contain Meta data in the form of tags and attributes.
5.      Contains machine-readable context information
6.      Separates content from presentation
7.      Supports multilingual documents and Unicode
8.      Facilitates the comparison and aggregation of data
9.      Can embed multiple data types
10.  Can embed existing data

Is XML case sensitive?
Yes, XML is a case sensitive language.

What Is XML Schema?
XML Schema describes the structure of an XML instance document by defining what each element must or may contain.XML Schema is expressed in the form of a separate XML file.
Note –some XML data types are predefined and new ones can be created.

As an Example,
  <xsd:schema  xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:element  name="eleName">
       <xsd:complexType>

What Is a well-formed XML document?
If a document is syntactically correct it can be called as well-formed XML document.

The basic rules of well-formed XML document:
1.      Each and every open tag must be closed.
2.      XML is case-sensitive so that every open tag must exactly match the closing tags.
3.      Each and every element must be embedded within a single root element.
4.      All child tags must be closed before parent tags.

What Are the difference between XML and HTML?
The HTML is used to mark up text whereas XML is used to mark up data.
The HTML is used for UI displaying purpose but the XML is used for data representation.
The HTML uses a fixed, unchangeable set of tags but in XML, you make up your own tags.

What Is a valid XML document?
If a document is structurally correct (with the above well-formed XML rules) then it can called as valid XML documents.

How does the XML structure is defined?
The Extensible Markup Language (XML) document will have a structure which has to be defined before we can create the documents and work with them. The structural rules can be defined using 
many available technologies, but the following are popular way of doing so, 
1) Document Type Definition (DTD)
2) Schema

What Is DTD?
The DTD stands for Document Type Definition and used to define the legal building blocks of an XML document.

DTD defines rules for a specific type of document i.e.
1.      Names of elements
2.      Order of elements
3.      Proper nesting and containment of elements
4.      Element attributes

What Is XML Schema Element?
The schema element defines the root element of a schema.

As an Example,
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="values" type="xs:string" />
</xs:schema>

How To apply a DTD to an XML document?
Include the DTD's element definitions within the XML document itself. Also provide the DTD as a separate file, whose name you reference in the XML document.

What Are differences between DTD and Schema?
The DTD follow SGML syntax but the Schema document is an XML document.

In DTD everything is treated as text where as the Schema supports variety of dataTypes similar to programming language.

In Schema, we can inherit, create relationship among elements but not possible in DTD.

What Is a Complex Element?
A complex element is an XML element that contains other elements & attributes as well.

The Types of complex elements:
1.      An empty element
2.      A complex element that contain only text
3.      A complex element that contain only other elements
4.      A complex element that contain both text and other elements

What Is a Simple Element?
A simple element is an XML element that can contain only text.

Types of simple elements,
1.      A simple element can't be empty
2.      A simple element can't have attributes
3.      A simple element contains text - it can be of many different types.

What Are namespaces in XML? Why are important?
XML namespaces are used for providing uniquely named elements and attributes in an XML instance and the uniquely named elements avoid name collisions on elements.

What Are the ways to use XML namespaces?
There are two ways,
1.      Fist one, declare a default namespace
2.      Second one, associate a prefix with a namespace, then use the prefix in the XML to refer to the namespace.

What Is the Global and Local Elements in XML?
An element is global or local depending on how it is defined in a schema.  Any element that is an immediate child of Schema, or is a ref to an immediate child of Schema, is a global element.  All other elements are local elements.

What Is ElementFormDefault attribute?
An XML Schema can define whether its local elements must be qualified or unqualified in an XML document.  This is declared with the “elementFormDefault” attribute in the <schema> element.   The two possible values are appropriately named: qualified and unqualified.

What Is XmlReader class?
The XmlrReader class represents a reader that provides fast, noncached, forward-only access from XML data. We must need to import the Xml namespaces before using the XmlReader class in C#.NET - using System.Xml;

What Is an XML parser?
A XML parser is a program that "parses" XML and evaluates the XML code. Its use of XML parser is to read XML document by using library.

The XML parsers basically convert code into something that the hardware will recognize. The main objective of the parsers is to transform XML into a readable code.

The Features of XML parser are,
1.      Analyze the XML schema (XSD) or a significant XML sample
2.      Create an optimized relational target schema
3.      Automatically processes the XML files
4.      Can handle arbitrarily complex XML files and supports the whole XSD spec
5.      Provides data lineage in the form of a source to target map
6.      Scales for very large volumes

The Available Tools that use as parser,
1.      XMLHttpRequest: XMLHttpRequest object has inbuilt parser.
2.      Expat XML Parser: Specially written in C language.
3.      CodeBeauty Parser: Free XML Viewer, XML Formatter and convert XML document/string into readable format.
4.      Alteryx Parser Tool: The XML parse tool reads in a chunk of Extensible Markup Language (XML) and parse it into individual fields

What Is DOM?
The DOM stands for Document Object Model.
DOM is a cross-platform and language-independent standard object model for representing XML and related formats.

DOM represents an XML document as a tree model and the tree model makes the XML document hierarchal by nature. Each and every construct of the XML document is represented as a node in the tree.

DOM is a programming interface for HTML and XML documents.

What Is the difference between DOM and HTML?
DOM is an abstraction of a structured text. For web developers, this text is an HTML code, and the DOM is simply called HTML DOM. Elements of HTML become nodes in the DOM. So, while HTML is a text, the DOM is an in-memory representation of this text.

What Is SAX?
The SAX stands for Simple API for XML processing and the SAX provides a mechanism for reading data from an XML document.
SAX provides an event based processing approach unlike DOM which is tree based.

What Are the differences between DOM, SAX and StAX XML parsers?
DOM stands for Document Object Model while SAX stands for Simple API for XML parsing.
SAX provides an event based processing approach unlike DOM which is tree based.

DOM parser load full XML file in memory and creates a tree representation of XML document, while SAX is an event based XML parser and doesn't load whole XML document into memory.

StAX Much like SAX but instead of responding to events found in the stream you iterate through the xml.

The difference between SAX and StAX is that of push and pull. SAX Push Model and the StAX Pull Model.

StAX enables you to create bidirectional XML parsers that are fast. It proves a better alternative to other methods, such as DOM and SAX, both in terms of performance and usability.

What Are the interfaces of SAX in XML?
The interfaces of SAX are,
DocumentHandler- It is used for getting event notification relating to a document.
ErrorHandler- It is used for handling error related notifications.
EntityResolver- It is used for reading external entities.
DTDHandler- It is implemented to get the notifications related to declarations in DTD like entities and notations

What Is XSL in XML?
XSL stands for eXtensible Stylesheet Language.
XSL is used for displaying the contents of XML documents.

XSL consists of three parts,
1.      XSLT
2.      XPath
3.      XSL-FO

What Is XSLT in XML?
XSLT stands for eXtensible Stylesheet Language Transformation.
XSLT is used for transformation of one XML document into XHTML documents or to other XML documents.
XSLT uses XPath only.

What Is XPath in XML?
XPath is used to retrieve elements from XML documents.
XPath expressions also can be use to retrieve elements, attributes and values from XML files.

What Is XSL-FO?
XSL-FO is a markup language and used to generate PDF, DOC files.
XSL-FO is part of XSL.

What Is CDATA in XML?
What does <![CDATA[]]> node in a XML document?
CDATA stands for Character Data.

A CDATA section starts with "<![CDATA[" and ends with "]]>": CDATA sections cannot be nested.
A CDATA section contains text that will NOT be parsed by a parser. Tags inside a CDATA section will NOT be treated as markup and entities will not be expanded. The primary purpose is for including material such as XML fragments, without needing to escape all the delimiters.

From Wikipedia:
[In] an XML document or external parsed entity, a CDATA section is a section of element content that is marked for the parser to interpret as only character data, not markup.

As an Example,
<script>
<![CDATA[
function checkNumber(a,b)
{
  if (a > b) then
   {
     return 1;
   }
  else
   {
   return 0;
   }
}
]]>
</script>

In the example above, everything inside the CDATA section is ignored by the parser.

Notes - The "]]>" that marks the end of the CDATA section cannot contain spaces or line breaks. Nested CDATA sections are not allowed.

What Is the difference between CDATA and PCDATA?
CDATA means un-parsed character data whereas PCDATA means parsed character data.

Is it possible to use graphics in XML?
Yes, you can do using XLink and XPointer.

The multiples graphics formats supports,
GIF,JPG, PNG, CGM, EPS, TIFF, and SVG

Which are the types of parser in XML?
List of XML parser are,
1.      DOM Parser
2.      SAX Parser
3.      StAX Parser
4.      JAXB

What Is XPOINTER in XML?
XPOINTER is a W3C recommendation.
XPOINTER is used to point data within XML document and also used to locate the particular part of the XML document.
By Anil Singh | Rating of this article (*****)

Popular posts from this blog

nullinjectorerror no provider for httpclient angular 17

In Angular 17 where the standalone true option is set by default, the app.config.ts file is generated in src/app/ and provideHttpClient(). We can be added to the list of providers in app.config.ts Step 1:   To provide HttpClient in a standalone app we could do this in the app.config.ts file, app.config.ts: import { ApplicationConfig } from '@angular/core'; import { provideRouter } from '@angular/router'; import { routes } from './app.routes'; import { provideClientHydration } from '@angular/platform-browser'; //This (provideHttpClient) will help us to resolve the issue  import {provideHttpClient} from '@angular/common/http'; export const appConfig: ApplicationConfig = {   providers: [ provideRouter(routes),  provideClientHydration(), provideHttpClient ()      ] }; The appConfig const is used in the main.ts file, see the code, main.ts : import { bootstrapApplication } from '@angular/platform-browser'; import { appConfig } from ...

39 Best Object Oriented JavaScript Interview Questions and Answers

Most Popular 37 Key Questions for JavaScript Interviews. What is Object in JavaScript? What is the Prototype object in JavaScript and how it is used? What is "this"? What is its value? Explain why "self" is needed instead of "this". What is a Closure and why are they so useful to us? Explain how to write class methods vs. instance methods. Can you explain the difference between == and ===? Can you explain the difference between call and apply? Explain why Asynchronous code is important in JavaScript? Can you please tell me a story about JavaScript performance problems? Tell me your JavaScript Naming Convention? How do you define a class and its constructor? What is Hoisted in JavaScript? What is function overloadin...

List of Countries, Nationalities and their Code In Excel File

Download JSON file for this List - Click on JSON file    Countries List, Nationalities and Code Excel ID Country Country Code Nationality Person 1 UNITED KINGDOM GB British a Briton 2 ARGENTINA AR Argentinian an Argentinian 3 AUSTRALIA AU Australian an Australian 4 BAHAMAS BS Bahamian a Bahamian 5 BELGIUM BE Belgian a Belgian 6 BRAZIL BR Brazilian a Brazilian 7 CANADA CA Canadian a Canadian 8 CHINA CN Chinese a Chinese 9 COLOMBIA CO Colombian a Colombian 10 CUBA CU Cuban a Cuban 11 DOMINICAN REPUBLIC DO Dominican a Dominican 12 ECUADOR EC Ecuadorean an Ecuadorean 13 EL SALVA...

25 Best Vue.js 2 Interview Questions and Answers

What Is Vue.js? The Vue.js is a progressive JavaScript framework and used to building the interactive user interfaces and also it’s focused on the view layer only (front end). The Vue.js is easy to integrate with other libraries and others existing projects. Vue.js is very popular for Single Page Applications developments. The Vue.js is lighter, smaller in size and so faster. It also supports the MVVM ( Model-View-ViewModel ) pattern. The Vue.js is supporting to multiple Components and libraries like - ü   Tables and data grids ü   Notifications ü   Loader ü   Calendar ü   Display time, date and age ü   Progress Bar ü   Tooltip ü   Overlay ü   Icons ü   Menu ü   Charts ü   Map ü   Pdf viewer ü   And so on The Vue.js was developed by “ Evan You ”, an Ex Google software engineer. The latest version is Vue.js 2. The Vue.js 2 is very similar to Angular because Evan ...

55 Best TypeScript Interview Questions and Answers - JavaScript!

What Is TypeScript? By definition, "TypeScript is a typed superset of JavaScript that compiles to plain JavaScript." TypeScript is a superset of JavaScript which provides optional static typing, classes and interfaces. => The TypeScript was first made public in the year 2012. => Typescript is a modern age JavaScript development language. => TypeScript is a strongly typed, object oriented, compiled language. => TypeScript was designed by Anders Hejlsberg (designer of C#) at Microsoft. => TypeScript is both a language and a set of tools. As an Example of TypeScript, class Hello {     msg : string ;      constructor ( message : string ) {          this . msg = message ;      }       getMsg () {          return "Hello, " + this . msg ;      } } TypeScript introduced a great deal...