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. 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. HTML stands for Hyper Text Markup Language while XML stands for eXtensible Markup Language. The key differences between HTML and XML are given below: Version is a tag used to show which version of XML is used. 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. 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. 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. XSNL is an XML search neutral language. This language acts between the meta search interface and targeted system. A syntactically correct document is called well formed XML document. A well formed XML document must follow the XML?s basic rules of syntax: 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. DTD stands for Document Type Definition. It defines a leading building block of an XML document. It defines: To apply a DTD to an XML document, you can: You should consider the following rules to write an XML document. 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. 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. 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. 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. 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. 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: In this example, XPOINTER points "streetnumber = 9" in "address.xml". 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. 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. 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. 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; CDATA means unparsed character data whereas PCDATA means parsed character data. XQuery is a query language that is used to retrieve data from XML document. 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. SGML is a vast and powerful generalized markup language that is used to define descriptions for the structure of several electronic documents. Yes, graphics can be stored in XML file by using XLink and XPointer. It supports graphics like GIF, JPG, TIFF, PNG, CGM, EPS, SVG. Yes, XML is a case sensitive language.XML Interview Questions :
1) What is XML?
2) How XML is different from HTML?
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?
4) What are the benefits of XML?
5) What is XML DOM?
6) What is SAX in XML?
7) What is XSNL?
8) What is a well formed XML document?
9) What is a valid XML document?
10) What is DTD?
11) How can you apply a DTD to an XML document?
12) What are the basic rules to write XML document?
13) What is XSL?
14) What is XPath in XML?
15) What is XSLT?
16) What is the difference between XML DTD and XML schema or XSD?
17) Is XML meant to be a replacement of HTML?
18) Define element and attribute in an XML document.
19) What is the difference between simple element and complex element?
20) Define the concept of XPOINTER.
21) What is XML data binding? Why is it used?
22) What is XML encoding error?
23) What are the different XML API's?
24) What is XmlReader class? Explain.
25) What is the difference between CDATA and PCDATA?
26) What is XQuery?
27) What is XML Namespace?
28) What is SGML?
29) Can we use graphics in XML?
30) Is XML case sensitive?
31) Define Structure of XML?