Home arrow XML arrow Page 3 - Introduction To XML

The Name Says It All..EXtensible: - XML

It's a fact of life that XML, which stands for eXtensible Markup Language, is invading our lives more and more as programmers, and I feel this is a good thing. The reason being XML has the ability to cross all sorts of boundaries, and probably the only chance we have to obtain a truly independent, cross-platform data transfer format.

TABLE OF CONTENTS:
  1. Introduction To XML
  2. Preparing Yourself For The Future!
  3. The Name Says It All..EXtensible:
  4. Proof Is In The Output
  5. Starting From The Roots of XML
  6. The Best Of Both The Worlds
  7. The Potential Of XML
  8. XML Parser
By: Gayathri Gokul
Rating: starstarstarstarstar / 44
August 28, 2003

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
HTML has a fixed set of element types, for example TITLE, H1, H2, EM, BODY, P, HR, and so on. A valid HTML document must use these elements. It cannot invent its own. A browser vendor can of course add its own proprietary tags (for instance, Netscape's <BLINK> tag), but there is no standard way to introduce new element types. While this is not the case with XML. XML has the ability to define new elements, and furthermore, this can be done in the document itself. Thus, XML documents are in essence self-describing. Let's consider an example. Imagine that you are looking at an HTML document with the following table in it:

Visual Basic ProgrammingBTechEduwardo WancellotiNaven
Gokul
Anna
Java ProgrammingEEERobert
John
Patricia
Mary
Sasi
ASP ProgrammingCSEDevi
Karun
Susan
Guna
<table > 
<tr>
<td> <i>Visual Basic Programming</i> </td>
<td> BTech</td>
<td> Eduwardo Wancelloti </td>
<td> Naven<br> Gokul <br> Anna </td>
</tr>
(and so on for each row)...
</table>
Although we as humans or programmers can make an educated guess, we really have no way of knowing what this data represents. Is "Visual Basic Programming" the name of a book? A course opted? Skill set required? It is impossible to say. And if it's a course (as appear to be), are there three named participants registered (Naven, Gokul, and Anna). Or just one named Naven Gokul Anna? XML fixes this. The corresponding information would be represented in XML like this:
<course>

<name> Java Programming </name>
<department> BTech </department>
<teacher> Eduwardo Wancelloti </teacher>
<student> Naven </student>
<student> Gokul </student>
<student> Anna </student>
</course>
The lesson here is tags can be anything you like, it is only how you use them that gives them meaning. Of course it is sensible to give meaningful names to start with. In the above example we have used XML to describe data, and weve used tag names that represent field names of the data. Thus in XML, information about the data structure can be preserved. Its standard text, so can easily transfer from machine to machine. Its not in proprietary format, so anyone can read it, and if the tags are named sensibly, the XML is self-describing. Furthermore, all information concerning presentation style has been removed from the document. We can say that this XML document evidently supports an element named "course," and the question you should be asking yourself is: But how am I supposed to know how to format this? (Notice that the HTML code contains a style directive for the text "Visual Basic Programming;" for example, the element indicates italics.

 
 
>>> More XML Articles          >>> More By Gayathri Gokul
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

XML ARTICLES

- Google Docs and Xpath Data Functions
- Flex Array Collection Sort and Filtering
- The Flex Tree Control
- Flex List Controls
- Working with Flex and Datagrids
- How to Set Up Podcasting and Vodcasting
- Creating an RSS Reader Application
- Building an RSS File
- An Introduction to XUL Part 6
- An Introduction to XUL Part 5
- An Introduction to XUL Part 4
- An Introduction to XUL Part 3
- An Introduction to XUL Part 2
- An Introduction to XUL Part 1
- XML Matters: Practical XML Data Design and M...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: