XML First Example



In the previous chapter we have learnt the difference between the XML and HTML.In this tutorial we will be learning the simple example and the process to execute or open XML file in IE Browser.

How to Write XML file and Open it in Internet Explorer ?

  1. In order to write XML file we must have text editor.
  2. Our recommendation is to use Notepad++ for Editing and Writing XML files. ( Link : Notepad++ )
  3. Open Notepad++ and type this Code.
<name>
    <first>Pritesh</first>
    <last>Taral</last>
</name>
  1. Save this Document with .xml extension. Let Our XML file be –
name.xml
  1. Open name.xml in Internet Explorer.
  2. You will be able to see your file like this –
Opening XML File in Internet Explorer

You can double click on hyphen Symbol in order to minimize Tree Structure –

Minimizing XML File

If you need sample XML then visit this link.

Sample XML :

<bookstore>
   <book category="COOKING">
      <title lang="en">Everyday Italian</title>
      <author>Giada De Laurentiis</author>
      <year>2005</year>
      <price>30.00</price>
   </book>
   <book category="CHILDREN">
      <title lang="en">Harry Potter</title>
      <author>J K. Rowling</author>
      <year>2005</year>
      <price>29.99</price>
   </book>
   <book category="WEB">
      <title lang="en">XQuery Kick Start</title>
      <author>James McGovern</author>
      <author>Per Bothner</author>
      <author>Kurt Cagle</author>
      <author>James Linn</author>
      <author>Vaidyanathan Nagarajan</author>
      <year>2003</year>
      <price>49.99</price>
   </book>
   <book category="WEB">
      <title lang="en">Learning XML</title>
      <author>Erik T. Ray</author>
      <year>2003</year>
      <price>39.95</price>
   </book>
</bookstore>

In the next tutorial we will be learning how to parse the document ?.