Great Templates

FEATURED WEB TEMPLATES

Amazon Books

Learn PHP

PHP Training
Zend Cert Training Zend Certified Engineer Zend PHP Pro

XML: Introduction To Extensible Markup Language

# A Practical Problem
I have two credit cards from two different credit unions and a checking bank account. Almost every day I logon to their Web sites to check the account statements and spend 30 to 40 minutes (I do lots of shopping!) consolidating them and see the status as to where I am. Being a smart programmer, I wrote a Visual Basic application which connected to all three Web sites, downloaded account statements in HTML format, parsed them and generated a nice merged report for me. Few days later one credit union announced their new redesigned Web site and my application stopped working immediately - because I was getting data tagged inside totally different HTML. I took one day to update and test the code to parse hundreds of lines of HTML text just to get account data tagged inside HTML page. I was happy again until my bank redesigned their Web site making my application useless one more time.

All the three Web sites have my account data, then why isn't there an easy way to get to it and use it the way I want. I then realized that it's all because of HTML - which is only focussed at presentation (how the page should look) rather than the data structure and content. It would be really great to separate the actual data content from the presentation. The benefits include: easy access to data, easily change the presentation, get data in multiple formats, easy searching/querying of data, etc.

This is where XML comes into picture. XML, like HTML is a markup language. That said, here also you'll have to deal with tags, but unlike HTML, XML does not have any fixed set of tags (hence is extensible!). One more important difference is that XML is case-sensitive. Hence in an XML document <account>, <Account> and <ACCOUNT> are three different tags. Let's now have a little formal introduction to XML.

# What is XML?
Extensible Markup Language (XML) is a powerful mechanism of data exchange. It is an ideal solution for transferring structured data from server-to-client, server-to-server or an application-to-application. The W3C External link is the organization in charge of the development and maintenance of most Web standards. XML, like HTML, is also one of the standards defined and developed by W3C. Today, XML 1.0 (Second Edition) is an official W3C Recommendation External link . For a complete list of XML-related standards and their status, check my previous article Standards Reference.

Now, XML being formally defined let's have a look at how does XML document looks like.

    <?xml version="1.0" ?>
    <!--My first XML document -->
       <BankAccount>
            <Number>1234</Number>
            <Name>Darshan Singh</Name>
            <Type>Checking</Type>
            <OpenDate>11/04/1974</OpenDate>
            <Balance>25382.20</Balance>
       </BankAccount>



Simply save above nine lines into a text file (copy and paste in Notepad) and save the file as c:.xml. Now open this file (c:.xml) in Internet Explorer 5.0 or later and see how your first XML document looks like.

The Internet Explorer browser uses MSXML and default stylesheet to display a nice tree-like view of XML documents.

 


Learn PHP | Zend Certified Engineer | Zend PHP Pro | PHP Web Apps | Web Hosting Service | Low Cost Domain Names | Great Templates | Great Books | Testimonials | Tech.Articles | TOS | AUS | Home | Linux Apache MySQL PHP