Monday 8 December 2014

XML better than HTML?

Bismillahirrahmanirrahim..

Assalamualaikum dear readers!

How are you guys? Feeling better after reading the Internet's post? Feeling thankful for those whose created the Internet? I'm pretty sure you will, though there are bad sides of it. Hehehe

In this post, we will explain about XML. 

XML

XML stand for Extensible Markup Language. It is a markup language that defines a set of rules for encoding documents in a format which is both human-readable and machine-readable. It was designed to describe data and focus what data is. It is also a software-hardware independent tools for carrying information. XML is different from HTML.


XML
HTML
  •           Markup language defines a set of rules for encoding document that can be read by both humans and machines. Designed with focus on storing and transporting data.
  •            Carrying information
  •            Designed to transport and store data with focus on what data is

  •            Markup language for displaying web pages in a web browser. Designed to display data with focus on how the data looks.
  •            Displaying information
  •            Designed to display data with focus on how data looks.

XML Tree

The XML documents form a tree structure that starts at "the root" and branch to "the leaves". XML documents must contain a root element. This element is "the parent" of all other elements.

ROOT à BRANCHES à LEAVES 

Below is the example of XML tree. 

XML Tree


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

XML Rules
  • XML Syntax Rules
    • All XML elements must have a closing tag
      • <p>This is paragraph</>
  • XML Tags are case sensitive
    • The tag<Letter> is different from the tag<letter>
      • <Message>This is incorrect</message>
      • <message>This is correct<message>
  • XML elements must be properly nested
    • All elements must be properly nested within each other.
      • <b><i>This text is bold and italic. True</i></b>
      • <b><i>This text is bold and italic. False</b></i>
  • XML naming elements
    • Names can contain letters, numbers and other characters.
    • Names cannot start with a number.
    • Names cannot start with the letters like letters xml, XML or etc. 

Before you learn XML, you should have a basic understanding of HTML and Javascript. Thank you for lending your time to read this post. 

Have a good day! XOXO 

No comments:

Post a Comment