Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

XML Example


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.

If developers have sense, future applications will exchange their data in XML since it is less time consuming and easily editable.

XML documents form a tree structure that starts at "the root" and branches to "the leaves".

An Example XML Document

XML documents use a self-describing and simple syntax:

<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
  <to>Peter</to>
  <from>Jani</from>
  <heading>Birthday Reminder</heading>
  <body>Don't forget me this weekend!</body>
</note>

The first line is the XML declaration. It defines the XML version (1.0) and the encoding used (ISO-8859-1 = Latin-1/West European character set).

The next line describes the Root element of the document (like saying: "this document is a note"):

<note>
The next 4 lines describe 4 child elements of the root (to, from, heading, and body):

<to>Peter</to>
<from>Jani</from>
<heading>Birthday Reminder</heading>
<body>Don't forget me this weekend!</body>
And finally the last line defines the end of the root element:

</note>
You can assume, from this example, that the XML document contains a note to Peter from Jani.

Don't you agree that XML is pretty self-descriptive?

  • XML Documents Form a Tree Structure
  • XML documents must contain a root element. This element is "the parent" of all other Elements.
  • The elements in an XML document form a document tree. The tree starts at the root and branches to the lowest level of the tree.
  • All elements can have sub elements (child elements):

<root>
  <child>
    <subchild>.....</subchild>
  </child>
</root>

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


This post first appeared on Web Designing With Internet Marketing And Social M, please read the originial post: here

Share the post

XML Example

×

Subscribe to Web Designing With Internet Marketing And Social M

Get updates delivered right to your inbox!

Thank you for your subscription

×