Wednesday 26 December 2012

What is XML???

Assalamu'alaikum...



How are you today? Hope all of you have a nice day!!




Today, we want to introduce about XML. Do you know what is XML? Actually, XML is stand for Extensible Markup Language. It was designed to describe data and focus what data is

It is different with HTML that was designed to display data, with focus on how the data looks.



XML Simplifies Data Sharing



In the real world, computer systems and databases contain data in incompatible formats. XML data is stored in plain text format. This provides a software- and hardware-independent way of storing data.

 This makes it much easier to create data that can be shared by different applications.


XML Does Not DO Anything



Maybe it is a little hard to understand, but XML does not DO anything. XML was created to structure, store, and transport information.




The following example is a note to Ali, from Ahmad, stored as XML:

_____________________________________
<note>
<to>Ali</to>
<from>Ahmad</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
_____________________________________

The note above is quite self descriptive. It has sender and receiver information, it also has a heading and a message body. But still, this XML document does not DO anything. 

It is just information wrapped in tags. Someone must write a piece of software to send, receive or display it.


With XML You Invent Your Own Tags



The tags in the example above (like <to> and <from>) are not defined in any XML standard. These tags are "invented" by the author of the XML document. That is because the XML language has no predefined tags.




The tags used in HTML are predefined. HTML documents can only use tags defined in the HTML standard (like <p>, <h1>, etc.).




XML allows the author to define his/her own tags and his/her own document structure.



There is an example of XML document (in form of tree structure):
_________________________________________________________
<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>
________________________________________________________



Entity References



Some characters have a special meaning in XML.




If you place a character like "<" inside an XML element, it will generate an error because the parser interprets it as the start of a new element.




This will generate an XML error:




<message>if salary < 1000 then</message>


To avoid this error, replace the "<" character with an entity reference:



<message>if salary &lt; 1000 then</message>




There are 5 predefined entity references in XML:

< < less than
>
>
greater than
&
&
ampersand
'
apostrophe
"
quotation mark


XML is Not a Replacement for HTML



XML is a complement to HTML.




It is important to understand that XML is not a replacement for HTML. In most web applications, XML is used to transport data, while HTML is used to format and display the data.




My best description of XML is this:




XML is a software- and hardware-independent tool for carrying information.





XML is Everywhere




XML is now as important for the Web as HTML was to the foundation of the Web.




XML is the most common tool for data transmissions between all sorts of applications.



XML is Used to Create New Internet Languages



A lot of new Internet languages are created with XML.




Here are some examples:

  • XHTML 
  • WSDL for describing available web services
  • WAP and WML as markup languages for handheld devices
  • RSS languages for news feeds
  • RDF and OWL for describing resources and ontology
  • SMIL for describing multimedia for the web 


#  Do you want to have a TUTORIAL for XML???  Try it here.

No comments:

Post a Comment