Google News
logo
XML Interview Questions
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
<library>
  <title>Free Time Learn</title>
  <heading>Reminder</heading>
  <body>XML Tutorial</body>
</library>
<?php

$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;