Thursday, 27 December 2012

X M L


XML (Extensible Markup Language)

Is a markup language much like HTML and was designed to describe data and focus what data is. In XML tags are not predefined. It uses a DTD or an XML schema to describe the data and both is designed to self-descriptive.


The Difference between XML and HTML :

  1. XML is not a replacement for HTML.

  2. XML and HTML were designed with different goals:
    –  XML was designed to transport and store data, with focus on what data is
    –  HTML was designed to display data, with focus on how data looks

  3. HTML is about displaying information, while XML is about carrying information.

      DIFFERENCES HTML XML
      CLOSING TAG            <p>This is a paragraph  
       <p>This is another paragraph
        <p>This is a paragraph</p>
       <p>This is another paragraph </p>
          NESTING        <b><i>This text is bold and italic</b></i>        <b><i>This text is bold and italic</i></b>
 
XML Does not DO Anything
1. XML was created to structure, store, and transport information

2. The following example is a note to Tove from Jani, stored as XML:
               
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>

</note>

X M L

XML Documents Form a Tree Structure
lXML documents must contain a root element
2. This element is "the parent" of all other elements
3. The elements in an XML document form a document tree
4. The tree starts at the root and branches to the lowest level of the tree
5.  All elements can have sub elements (child elements):
             
  
<root>
  <child>
    <subchild>.....</subchild>
  </child></root>


6.  The terms parent, child, and sibling are used to describe the relationships between elements
7.  Parent elements have children
8.  Children on the same level are called siblings (brothers or sisters)
9.  All elements can have text content and attributes (just like in HTML)

The image above represents one book in the XML below:

<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">Learning XML</title>
    <author>Erik T. Ray</author>
    <year>2003</year>
    <price>39.95</price>
  </book>
</bookstore> 

No comments:

Post a Comment