XML

JavaXml Projects

JavaXml Project

JavaXml Examples

JavaXml EXAMPLE

More interview questions and answers

How you define DOM in XML?

 DOM is stands for Document Object Model.It is used to represent data in terms of node of tree. It is an interface given by W3C DOM Workgroup used to access,parse or update XML data.We make DOM document either by parser or manually by user.Data types that we used in DOM Nodes are abstract.DOM also supported java  

How XML support UNICODE characters ?

Generally XML doesn\'t support UNICODE character. But this makes possible when we using some techniques in XML.These techniques are given below:

<?xml version=\"1.0\" encoding=\"windows-1252\"?>

<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>

<?xml version=\"1.0\" encoding=\"UTF-8\"?>

<?xml version=\"1.0\" encoding=\"UTF-16\"?>.

How you define XMLA?

XMLA stands for XML Analysis Services.It is designed to generate reports of data that was contained in data warehouse.It does not create relation between the data structure.In XML we Use XMLA to show the analysis service data to outer world.

What is XHTML?

XHTML is stands for eXtensible HTML.It is a combination of HTML4 with XML rules means when we using XHTML than when we open any tag it should has an end tag and we write attribute value with in single quote or double quote.

what do you know about XML parser?

It is a COM component.Microsoft give XML Parser with interner explorer 5 or higher version of internet explorer.After that parser is avail with scripts.XML Parser has many function using them we can traverse the tree,access the nodes with their values.also using them we can insert,delete the nodes and after that it will changed to XML.
Using that code we can made the instance of XML Parser with JavaScript.
var xmlDoc=new ActiveXObject("Microsoft.XMLDOM")

Can made instanceof XML Parser with VBScript
set xmlDoc=CreateObject("Microsoft.XMLDOM")

Can made instance of XML Parser in anASP page.
set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")

Using this code we can load the XML document into the XML Parser.
<script type="text/javascript">
var xmlDoc=new ActiveXObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.load("note.xml")
***
***
***
</script>


 

How to create an XML Document? Explain it with example.

We you again in XML we can create our own tags.I have given you a XML example given below.
Example:
<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<to>abhi</to>
<from>vivek</from>
<heading>Welcome</heading>
<body>Hi! R4R Welcomes you.At this Place you can check or improve your intelligency. </body>
</note>
When we see this code we can easily understand that vivek send a message to abhi.Because we uses to and from self defined tags.
 

How XML support TREE Structure?

In XML document we called root element to the parent node and create other child tags with in the root.So,It creates a structure like tree.In this tree starts at the root and branches made at the  lowest level of the tree.I have given you a example which shows a tree structure.Syntax:<root>  <child>    <subchild>.....</subchild>  </child></root>Example:<bookstore><book category=\"JAVA\">  <title lang=\"en\">The Complete Reference</title>   <author>Herbert Schildt</author>   <year>2005</year>   <price>30.91</price> </book><book category=\"C++\">  <title lang=\"en\">Programming in ANSI C++</title>   <author>E Balaguruswamy</author>   <year>2007</year>   <price>38.99</price> </book><book category=\"C\">  <title lang=\"en\">Exploring C</title>   <author>Yashwant kanetkar</author>   <year>2006</year>   <price>42.95</price> </book></bookstore> Above, I have started with  bookstore category. It is called root node.Than after create a child node like:book.Than creates the attributes like:title,author,year and price attributes and assign values to them.This is look like a tree shape structure.


Write some basic rules of XML?

 I think their is no problem comes when we using XML rules.Because XML has no pre-defined tags.so, it can easy implement and made logical arranged data.Some basic rules of XML given below.Keep in mind when you creating any XML document.

Rule1: ALL tags that you open should have been closed.Like:<Welcome>......</Welcome>

Rule2:XML Tags are Case-Sensitive.So,if you create tag like:<Welcome> than you can\'t closed this tag with </welcome>.You should write </Welcome>.

Rule3:XML element should be properly nested.

Example:<R4R><Welcome>.......</R4R></Welcome>

is false.

<R4R><Welcome>.......</Welcome></R4R>

Rule4:Document should have a root node.

<root>

  <child>

    <subchild>.....</subchild>

  </child>

</root> 

Rule5:We should the attribute values.

<note date=\"03/02/2008\">

<to>abhi</to>

<from>vivek</from>

</note>   

How to define XML Element?

 Everything inside the open and closed tag is called as XML Element.It may be contain other element and text or may be a combination of both.

I have given you example which help you to understanding element in XML.

<bookstore>

   <book category=\"JAVA\">

      <title lang=\"en\">The Complete Reference </title> 

      <author>Herbert Schildt</author>     

      <year>2005</year>

      <price>30.91</price>

   </book>

   <book category=\"C++\">  

      <title lang=\"en\">Programming in ANSI C++</title>   

      <author>E Balaguruswamy</author>    

      <year>2007</year>   

      <price>38.99</price> 

   </book>

   <book category=\"C\">  

      <title lang=\"en\">Exploring C</title>   

      <author>Yashwant kanetkar</author>   

      <year>2006</year>   

      <price>42.95</price> 

   </book>

</bookstore> 

 Above,bookstore and book both are element content where as title,author,year and price are text content.book also called as attribute and JAVA,C++ and C is the value of book attribute.

How you define attributes in XML?

We define attribute in XML as same as HTML.But keep one thing in mind In XML every attribute should have a value,We can\'t make attribute without value in XML.Where as in case of HTML we can create attribute without value.

Example:

<student active=\"true\">

<name>Abhi</name>

<grade>A</grade>

</student>

 In above example \'student\' is a element,\'active\' is a attribute and \'true\' is a attribute value.

<student active>

<name>Abhi</name>

<score>75</score>

</student>

 This is wrong in case of XML because in this we declare attribute \'active\' without any value.But it will run in case of HTML. 


How you define XML Entity?

Using Entity we can represent the information in symbolic form.

Syntax:

When we write entity in the XML.We start with ampersand(&),after that write name than after write semicolon(;)

&entity_name;

 Here,I am writing a syntax to create XML entities.

<!ENTITY entityname \"write information according to entity.\">

Example:

<!ENTITY welcomenote \"Hello,I am Vivek.R4R welcome you! and enjoy after getting membership of R4R.\">

 Further,I given you a example how to use a XML entity.

Example:

<!ENTITY welcomenote \"Hello,I am Vivek.R4R welcome you! and enjoy after getting membership of R4R.\">

<email>

<to>client</to>

<body>&welcomenote;</body>

</email>


  

How to write comment in XML?

We use comment in XML to temporary write the note or want some code to edit on XML document.Some time writing a comment is very necessary for program.

 XML does not provide any special method for writing a comment it is same as HTML.Below I have given a code how to write comment on XML.

Example:

<?xml version=\"1.0\" encoding=\"ISO-8859-15\"?>

<!-- Student that marks on half yearly exam  -->

<class_student_list>

    <student>

<name>Hariom</name>

<score>70%</score>

    </student>

    <student>

<name>Abhi</name>

<score>75%</score>

    </student>

</class_student_list>

 Below I have given you a example in this i have remove some data about student temporarily.

Example:


<?xml version=\"1.0\" encoding=\"ISO-8859-15\"?>

<!-- Student that marks on half yearly exam  -->

<class_student_list>

    <student>

<name>Hariom</name>

  <!--  <score>70%</score>  -->

    </student>

    <student>

<name>Abhi</name>

  <!--  <score>75%</score>  -->

    </student>

</class_student_list>

 In this I have remove score temporarily. 

How you define DTD in XML?

DTD is stands for Document Type Definition.This is the oldest schema for XML.It is present every where in the XML 1.0.I have you reasons those make DTD limited. 1.It does not new features of XML.Like:namespaces.2.It lacks expressiveness.We can\'t captured the formal aspects of XML doc.3.DTD uses a custom non-XML syntax,inherited from SGML.

Example:

<!ELEMENT people_list (person*)>

<!ELEMENT person (name, age?, sex?, phoneno?)>

<!ELEMENT name (#PCDATA)>

<!ELEMENT age (#PCDATA)>

<!ELEMENT sex (#PCDATA)>

<!ELEMENT phoneno (#PCDATA)>


What is the XML prolog?

 IN XML their is no mandatory to use prolog it is optional.But if we want to use than it comes before the root element in XML.prolog has two parts these are,

1.XML Declaration

2.Document Type Declaration

 We can use both parts at same time,alone or not mandatory to use. 

  

How you define Tree Structure in XML?

 In XML document when we see wisely than we find that many relations come with in the XML document.

It has a root node.Those follows the root node called parent node and those follows this parent node called children.It create like tree type Structure.You have to follow those rules that I have given for making XML document with proper tree structure.

1.Descendant: Suppose that in your tree structure If element y is stored in x.Than we called y as the descendant of x.

2.Ancestor: If element y is stored in x.Than we called x as the ancestor of y.

What are the disadvantage of XML?

 XML has many advantages.But it has few drawbacks or disadvantage also.These are:

1.XML doesn\'t give permission of overlapping markup means that it doesn\'t give facility of creating a element inside the another and closed that created element into the another element.

2.It is useful for large document but it is less useful for small document because in case of small document it may be your markup be high than you original data.

3.Syntax that we used in XML is only made for human reader.

4.Distinction b/w content and attributes in XML not Typical. 

What is the XML Canonicalization?

XML Canonicalization is used to reduces the sensitivity of canonicalized XML fragments to context changes, we need a feature to sign sub documents. XML Canonicalization do a est job because when we applied to XML fragments, of including all inherited information (such as attributes from the XML namespaces and namespaces declarations)

What is the XQuery?

It is query language which is made for solved out the query related to XML document.Using them we can fetch the data from different database.It is a subset of Xpath.

 Some features of XQuery are given below:

1.XQuery is independent with logical and physical data.

2.It is a Declarative.

3.It is an High level query language.

4.This query language is free from side-effect.

5.It is a strong type query language. 

How we use xml.onload?

When we create any XML file and write some data on them.But later we try to delete or overwrite that XML file than xml.onload which is a property of XML prevent to delete or overwrite that XML file.  

What are the Limitations of DTD?

 Some limitations of DTD(Document Type Definition) are given below:

1.It does not support features that comes with new versions of XML.Like Namespaces.

2.It lacks in effectiveness.Some formal rules of XML are not happen in DTD.

3.It uses a non-XML tags.

What is the CDATA section in HTML?

We know that All text of XML document we parsed by the parser.But if we write any text inside the double quotes than when it will parsed by the parser it will gives the result like that.

Example:

\"We should know that in XML every start tag like <s> should be closed like </s>\"

 If  it will parse by the parser than.

<XML>\"We should know that in XML every start tag like &lt;s&gt; should be closed like &lt;/s&gt;\"</XML>


 If you want that our given text like that we have write than we have to use this in a CDATA 

element.

\"<!CDATA[We should know that in XML every start tag like <s> should be closed like </s>]]>\"


How to define tag name in XML?

 When you created any tag name in XML keep this rules in mind.

Rule1: Tag name should be start with a letter or underscore\'_\'. 

Rule2: XML does not reserve pre-defined tags.So, you can made your own tags as per requirement.

Rule3: We can also use digits(0123456789), hyphen(-),period(.) and \':\'.But don\'t use them unnecessary because these we also use when creating Namespaces.  

What is XSLT?

XSLT is a languages which is designed to make a XML document with i the other XML document.It is designed for use as a part of XSL(it is the style sheet language for XML). 

How we use CSS with XML?

 Using CSS(Cascading Style Sheet) we can display our XML document with attractive display.I have given you a example how to add CSS property with XML.

Example:

An example of XML document.

- <bookstore>

- <book>

  <category>JAVA</category> 

  <title>The Complete Reference</title> 

  <author>Herbert Schildt</author> 

  <year>2005</year> 

  <price>30.91</price> 

  </book>

- <book>

  <category>C++</category> 

  <title>Programming in ANSI C++</title> 

  <author>E Balaguruswamy</author> 

  <year>2007</year> 

  <price>38.99</price> 

  </book>

- <book>

  <category>C</category> 

  <title>Exploring C</title> 

  <author>Yashwant kanetkar</author> 

  <year>2006</year> 

  <price>42.95</price> 

  </book>

  </bookstore>

we create a CSS for above example.

bookstore

{

background-color: #ffffff;

width: 100%;

}

book

{

display: block;

margin-bottom: 30pt;

margin-left: 0;

}

category

{

color: #FF0000;

font-size: 20pt;

}

title

{

color: #0000FF;

font-size: 20pt;

}

author,year,price

{

display: block;

color: #000000;

margin-left: 20pt;

}


When we write our XML document with CSS

<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>

<!-- Edited by XMLSpy� -->

<?xml-stylesheet type=\"text/css\" href=\"cd_catalog.css\"?>


<bookstore>

    <book>

      <category>JAVA</category>

      <title>The Complete Reference </title> 

      <author>Herbert Schildt</author>     

      <year>2005</year>

      <price>30.91</price>

   </book>

   <book>

      <category>C++</category>  

      <title>Programming in ANSI C++</title>   

      <author>E Balaguruswamy</author>    

      <year>2007</year>   

      <price>38.99</price> 

   </book>

   <book>

      <category>C</category>  

      <title>Exploring C</title>   

      <author>Yashwant kanetkar</author>   

      <year>2006</year>   

      <price>42.95</price> 

   </book>

</bookstore> 


output:

JAVA The Complete Reference 

Herbert Schildt

 

2005

 

30.91

 

C++ Programming in ANSI C++ 

E Balaguruswamy

 

2007

 

38.99

 

C Exploring C 

Yashwant kanetkar

 

2006

 

42.95


What are the advantage of XML?

 Some useful advantage of XML document are given below:

1.We can easily transfer the XML document across the network application.

2.It support Unicode means that human can display information in our own language.

3.It gives a tree shaped structure which easy to understand.

4.It is a platform independent.

5.We can easily change in DTD because it has forward and backward capability.

 

What do you understand about XML Serialization and Binary Serialization?

 XML Serialization is also called as shallow serialization.It is used to serialize object into

XML document.This makes document human readable form.Using them we can shared files.

 Binary Serialization is more efficient than XML Serialization.It is also called as deep serialization because it serialize the object into binary form.So, it is not easily understandable by human being. 

What are the techniques that we use to process XML files?

 I have given you some technologies that we used to process XML files.These are:

1.With use of SAM API and a programing language.  

2.With use of DOM API and a programing language.

3.Pull parsing and data parsing.

4.With use of transformation engines and filters.

 

How to display XML data as HTML?

 I have given you a example which show how to convert an XML document into HTML.Example:Here,I have given you simple XML example:bookshop.xml
   
- 
- 
  JAVA 
  The Complete Reference 
  Herbert Schildt 
  2005 
  30.91 
  
- 
  C++ 
  Programming in ANSI C++ 
  E Balaguruswamy 
  2007 
  38.99 
  
- 
  C 
  Exploring C 
  Yashwant kanetkar 
  2006 
  42.95 
  
  

When you want that example in HTML you should write that.






 For converting XML into HTML we use this.1.First you have to check the browser and load the XML using the correct parser2.now,we have created a HTML table with 3.we use getElementsByTagName() to get all XML book nodes4.we display data from ARTIST and TITLE as table data for each book.5.Use 
to end the table.

What is the XMLHttpRequest Object?

 Using XMLHttpRequest Object XML document will become able to communicate with Server when page is fully loaded. XMLHttpRequest object is used to implements an interface exposed by a scripting engine that allows scripts to perform HTTP client functionality. Like that, Submitting form data or loading data from a server.And send data to a server in the background. 

 var user = new XMLHttpRequest();

How to create an XMLHttpRequest Object?

 We can create an XMLHttpRequest Object by simply using an one line code of JavaScript.

When we use on all browsers after come IE7.write this line to create an XMLHttpRequest Object.

var user=new XMLHttpRequest()


When we work with IE 5 and 6.

var user=new ActiveXObject(\"Microsoft.XMLHTTP\")


Example:

<script type=\"text/javascript\">

var user;

function loadXMLDoc(url)

{

   user=null;

   if (window.XMLHttpRequest)

   {    // for browsers above IE 6

      user=new XMLHttpRequest();

   }

   else if (window.ActiveXObject)

   {    // code for browser IE5 and IE6

      user=new ActiveXObject(\"Microsoft.XMLHTTP\");

   }

   if (user!=null)

   {

      user.onreadystatechange=state_Change;

      user.open(\"GET\",url,true);

      user.send(null);

   }

   else

   {

      alert(\"Your browser unable to support XMLHTTP.\");

   }

}


function state_Change()

{

   if (user.readyState==4)

   {        // 4 = \"loaded\"

      if (user.status==200)

      {     // 200 = OK

            // ***write code***

      }

      else

      {

         alert(\"Problem retrieving XML data\");

      }

   }

}

</script>

Why we called XML as self-describing data?

 XML has not pre-defined tags and we use DTD or schema to store the data.Because both DTD and schema are self-describing.So,we can say that XML is a self-describing data. 

How we define an empty XML element?

 I have given you a syntax using them you can create an empty XML element.

<! ELEMENT element_name EMPTY>

Example:

<!ELEMENT Abhi EMPTY>

 Now, An empty Abhi element has been created.

What do you understand about Schema?

We use schema to contain the all information of the XML document.It is nothing but Metadata (data about data).We know that we use XML to display or contain the data.It makes document read more easily for human being.In Metadata we includes the tags.These tags can be exchanged from one XML file to another XML file.

How we write the comments in the XML file?

 XML also give us facility to make comments.

Syntax:

<!------Write Comment Here------>

Example:

<message to=\"friendname@friendaddress.com\" from=\"myname@myaddress.com\" 

    subject=\"Welcome note\">

  <!--Don\'t miss it -->

  <text>

    Hi,Enjoy them with the members of R4R.

  </text>

</message>  

Where data is stored in XML?

In XML we stored data in the database.In this we created a table called main in a relational database management system.Main table has many column for storing XML data.In relational database management system we created one or more side tables.Each side has many column.This is use to store the attributes that was come from XML.When we write all data of XML into the each side table than we place these side tables into the main table.And our data is now will stored.

How we can say that XML is extensible?

We called XML as extensible because if we want add some new element and attribute etc. into the Original XML File.than it will easily inserted and keep the Original XML file structure.

 Means that Original XML file does not given any error when we adding some files on those files(original XML file). 

What you understand with document validity?

 If you want that your XML document work properly and no problem come with in future.Than your XML document should we valid.We can check your XML document validity by these three ways.

1.Well-Formed XML Files

2.Broken XML Files 

3.Valid XML Files

1.Well-Formed XML Files:This method check validity by using some rules that are also followed by other markup languages.These rules are.

1.1 Each XML should have only one root element.

1.2 XML document should be proper nested means that when we open any tag it should be in that manner they are opened.

Example:<a><b>.......</a></b>  False

        <a><b>.......</b></a>  True     

1.3 If we use entity in the XML document it should be properly referenced in the document.


2. Valid XML Files: If want to made valid XML it should be well formed.Because if it is not well-formed there is much difficult to made valid XML document.To generate valid XML our XML document should be validated.But we know that we can\'t validated our XML document without DTD,internal or external,is referenced for the XML processor (XML processor has the XML document and DTD and processes the information).  


3.Broken XML Files: Broken XML Files are those Files not proper satisfy the all rules that are compulsory for file to be Well-Formed and Valid.

We can fix the small errors of those XML document by using some XML editors. 

What is validating parser ?

Validating parser is the basically a parser that ensures that an XML document is valid in addition to being well formed.

What is the XML? Explain it.

 XML is stands for eXtensible Markup Language.It is invented

by World Wide Web Consortium(W3C). Don\'t Confuse with that 

HTML and XML are same.For efficient use of XML you should 

know HTML and JavaScript.I have given you some basic features

of XML.

1.It is called extensible because using XML you can create

own tags as per requirement.

2.XML is used to communicate and store the data,not to show

the data.

3.Using XML we can identify our information in a more accurate,

flexible and adaptable way.

4.It is used to make about structural information of data.

5.XML is a Metalanguage(Language use for describing other language.)

How we can say XML is differ from HTML?

Both XML(eXtensible Markup Language) and HTML(Hyper Text Markup Language)are markup languages.But they are different.I have given you some main difference b/w XML and HTML given below.

1.The key difference is that XML is used for to store data and made communication b/w them.Where HTML is used to present the data in attractive way.

2.In XML we emphasize on \'what data is\'. Where as in HTML we emphasize on \'What data looks like\'.

3.In HTML tag semantic and tag set are fixed means that in HTML their is no made our own tags.where as in XML these are not fixed so, can we made our own tags as per requirement.

4.XML is dynamic where as HTML is static.

5.HTML is case sensitive language where as XML is non-case sensitive language.

6.In XML it is mandatory to close all open tags where as in HTML their is not mandatory to close all open tags.

 

What do you understand about XML Namespaces and Linking?

 I have you some information about XML Namespaces and XML Linking.

XML Namespaces:

 XML give as facility to make our own tags. Suppose if we want add element of two XML sheets their may be conflicts. But if we made our own tags than it can solve the problem of data conflicts,because different tags may contain the same type of data.

XML Linking:  

 Using XML linking we can create the connection among the XML data means they can communicate each other.

XML Linking(XML Link,XML Pointer & XML Base)

 Where,

 XML Link is used to insert link into XML Sheets.

 XML Pointer is used to link the address of some specific data in XML sheets.

 XML Base is used to defining a default reference to external XML resources. 

   

What do you understand about XPath?

XPath is stands for XML Path Language.That is used to addressed

the element of XML Document.In XML document we define our data

in terms of tree.It is used to address the element and their 

attribute at any level.I have given you a example this shows 

how to address parts of XML.

Example:

 /xyz:Employeedatabase/xyz:Empname/@EmpID 

 Using above we can address the EmpID.  


What you define SAX in XML?

 SAX is stands for Simple API for XML.It is a lexical and event-driven interface.Implementation of SAX is fast and efficient but we can\'t extract information from XML at random.It is good for use when some types of information ewe handle in same way always without knowing that where it execute in document.  

How to use SAX in XML:

  

# Use to get a list of known parsers

my $parsers = XML::SAX->parsers();

# Use to add/update a parser

XML::SAX->add_parser(q(XML::SAX::PurePerl));

# Use to remove parser

XML::SAX->remove_parser(q(XML::SAX::Foodelberry));

# Use to save parsers

XML::SAX->save_parsers()

How SAX is different than DOM?

We use DOM for internal presentation of XML.It is good for small XML file but bad for large files because when we use DOM for large file it present whole filw into the memory.Where SAX is work on perticular event so,it can use to find out the specific element of XML doc.It can not present data of XML.It works from top to bottom in XML file.

 We can\'t use SAX without DOM.  

Define markup language?

A formal way of annotating a document or collection of digital data using embedded encoding tags to indicate the structure of the document or data file and the contents of its data elements. This markup also provides a computer with information about how to process and display marked-up documents A markup language is a set of words and symbols for describing the identity of pieces of a document (for example this is a system, this is a break, this is the head of this figure, etc).

Should I use XML,Where?

Following points define to where use XML:

1.XML is portable and non-proprietary, Information identification because you can define your own markup; you can define meaningful names for all your information items. Information storage, it can be used to store textual information across any platform. Because it is backed by an international standard, it will remain accessible and process able as a data format.

2.XML has been designed for ease of implementation and for interoperability with both SGML and HTML.  Despite early attempts, browsers never allowed other SGML, only HTML, and they allowed it to be corrupted or broken, which held development back for over a decade by making it impossible to program for it reliably.

3. XML fixes that by making it compulsory to stick to the rules, and by making the rules much simpler than SGML.  But XML is not just for Web pages: in fact its very rarely used for Web pages on its own because browsers still dont provide reliable support for formatting and transforming it.

4. Combining these three topics (identity, storage, structure) means it is possible to get all the benefits of robust document management and control (with XML) and publish to the Web (as HTML) as well as to paper (as PDF) and to other formats (eg Braille, Audio, etc) from a single source document by using the appropriate stylesheets.


When dynamically generating HTML pages from a relational database,describe the role that XSL ?

When Querying from database and then formatting the result set so that it can be validated as an XML document allows developers to translate the data into an HTML table using XSLT rules. Consequently, the format of the resulting HTML table can be modified without changing the database query or application code since the document rendering logic is isolated to the XSLT rules.

Define SGML in brief?

1. SGML is a metalanguage, that is, a means of formally describing a language, a markup language. Before going any further we should define these terms. SGML is an international standard for the description of marked-up electronic text. 

2. SGML is very large, powerful, and complex. It has been in heavy industrial and commercial use for nearly two decades, and there is a significant body of expertise and software to go with it.  

3. XML is a lightweight cut-down version of SGML which keeps enough of its functionality to make it useful but removes all the optional features which made SGML too complex to program for in a Web environment.

XML, SGML and HTML all the same thing or not,define brief?

Not same thing:

To describing thousands of different document types in many fields of human activity, from transcriptions of ancient Irish manuscripts to the technical documentation  and from patients clinical records to musical notation SGML is used ,is the mother tongue.And XML is an abbreviated version of SGML, to make it easier to use over the Web, easier for you to define your own document types, and easier for programmers to write programs to handle them and omits all the complex and less-used options of SGML.).  HTML is just one of many SGML or XML applications one most frequently used on the Web.     


Who is responsible for XML?

XML is a project of the World Wide Web Consortium (W3C), and the development of the specification is supervised by an XML Working Group. A Special Interest Group of co-opted contributors and experts from various fields contributed comments and reviews by email. XML is a public format:

it is not a proprietary development of any company, although the membership of the WG and the SIG represented companies as well as research and academic institutions.

Define SOAP and how does it relate to XML?

SOAP is the Simple Object Access Protocol used XML to define a protocol for the exchange of information in distributed computing environments. SOAP consists of three components: 

1. An envelope

2. A set of encoding rules and 

3. A convention for representing remote procedure calls.

Unless experience with SOAP is a direct requirement for the open position, knowing the specifics of the protocol, or how it can be used in conjunction with HTTP, is not as important as identifying it as a natural application of XML.


Define steps necessary to parse XML documents?

Determining whether a non-validating or validating parser is needed, choosing the appropriate parser, and handling errors are all important aspects to this process that should be included. 

Describe benefits of an XML Editor?

1. When coding XML, it will help prevent you from making errors.

2. XML editor should also provide validation a way for you to validate that the documents you create are well formed.

3. XML editors are similar to HTML editors in that they provide syntax highlighting which helps with readability when you\'re coding. 

4. Automatically insert a closing tag once you\'re added an opening tag like HTML editor.


Give examples of XML Editors?

1. XML Notepad

2. XML Cooktop

3. XML Pro

4. XML Spy

5. eNotepad


Define \"\" in brief?

1. ?xml version=\"1.0\": XML declaration indicates that the document is written in XML and specifies which version of XML. 

2. encoding=\"UTF-8\": Language encoding for the document (optional) and if the application refers to external entities (optional).

3. standalone=\"no\": This is not a standalone document as it relies on an external resource (i.e. the DTD).

Define brief \"\" ?

This syntax means Document Type Definition (DTD),defines the rules of your XML document,XML itself has rules,the rules defined in a DTD are specific to your own needs.The DTD is used when you validate your XML document.DTDs can be internal (i.e. specified within the document) or external (i.e. specified in an external file).

Define brief?

XML comments begin with <!-- and end with -->. Similar to HTML comments, XML comments allow you to write stuff within your document without it being parsed by the processor.

Define in brief?

It means processing instructions, begin with <? and end with ?>. Processing instructions are instructions for the XML processor. Processing instructions are not built into the XML recommendation.

Define Child Elements and Content in any XML Program?

1. Elements that are contained within the root element,represented by an opening and closing tag,Data and other elements reside between them. 

2. XML allows you to use empty elements. An empty element is one without a closing tag. Like HTML you must close empty elements with a forward slash before the > symbol. For example, <br />.

3. Elements can also contain one or more attributes. An attribute is a name/value pair, that you place within an opening tag, which allows you to provide extra information about an element.

\'Tags Are Case Sensitive\' how, define ?

All tags must be written using the correct case. XML sees <tutorial> as a different tag to <R4R>

The wrong declaration is :


<r4R>XML</R4r>


Right Declaration is:


<R4R>XML</R4R>

<r4r>XML</r4r>

<r4R>XML</r4R>


In XML elements have nested properly.Define?

Placed elements inside other elements but needed to ensure each element\'s closing tag doesn\'t overlap with any other tags.


Wrong declaration is:


<R4R>

  <name>XML</R4R>

</name>


Right declaration is:


<R4R>

  <name>XML</name>

</R4R>


Define some terms when naming the element in XML?

1. Element names can contain any character including letters and numbers.

2. Element names must not contain spaces

3. Element names must not begin with a number or punctuation character (for example a comma or semi-colon etc).

4. Element names must not start with the letters xml (whether lowercase, uppercase, or mixed case)


Define essential components of security does the XML Signatures provide?

Three Components are:

1. Authentication

2. Message integrity and

3. Non-repudiation

In addition to signature information, an XML Signature can also contain information describing the key used to sign the content.


What is an XML namespace name?

XML namespace name is a URI that uniquely identifies the namespace. URIs is used because they are widely understood and well documented. Because people may only allocate URIs under their control, it is easy to ensure that no two XML namespaces are identified by the same URI.

What software is needed to process XML Namespaces?

There is no need for any special XML namespace software.


Define Syntax rules in XML in brief?

1. All XML Elements Must Have a Closing Tag

2. XML Tags are Case Sensitive

3. XML Elements Must be Properly Nested

4. XML Documents Must Have a Root Element

5. XML Attribute Values Must be Quoted

6. Entity References:

&lt; < less than 

&gt; > greater than 

&amp; & ampersand  

&apos; \' apostrophe &quot; \" 

7. Comments in XML

8. White-space is Preserved in XML


define XML Elements, Attributes with example?

There are no rules about when to use attributes or when to use elements.

For Example:

1. <person sex=\"female\">

     <firstname>Anna</firstname>

       <lastname>Smith</lastname>

   </person>

2. <person>

     <sex>female</sex>

      <firstname>Anna</firstname>

     <lastname>Smith</lastname>

   </person>


In the first example sex is an attribute. In the last, sex is an element. Both examples provide the same information.


What are basic problems to using Attributes?

Some of the problems with using attributes are:

1. Attributes cannot contain multiple values 

2. Attributes cannot contain tree structures 

3. Attributes are not easily expandable

Attributes are difficult to read and maintain. Use elements for data. Use attributes for information that is not relevant to the data.

 


Define XMLHttpRequest Object?

Using XMLHttpRequest Object:

1. Updated a web page without reloading.

2. Requesting for data from a server after the page has loaded.

3. Receive data from a server after the page has loaded.

4. Send data to a server in the background. 


XMLHttpRequest Object creating like:

xmlhttp=new XMLHttpRequest();


Does XML replace HTML?

No. XML itself does not replace HTML. Instead, it provides an alternative which allows you to define your own set of markup elements. HTML is expected to remain in common use for some time to come, and the current version of HTML is in XML syntax. XML is designed to make the writing of DTDs much simpler than with full SGML.

Define XML namespace?

XML Namespaces provide a method to avoid element name conflicts.XML namespace is a collection of element type and attribute names.A reasonable argument can be made that XML namespaces dont actually exist as physical or conceptual entities. 

XML Interview Questions And Answers