XML Tutorials

  Home arrow XML Tutorials arrow Page 3 - A Friendly Approach to XML
XML TUTORIALS

A Friendly Approach to XML
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 3
    2009-01-28

    Table of Contents:
  • A Friendly Approach to XML
  • The Disadvantages of XML
  • What You Can Do with XML
  • Keeping Your Data and Context Separated

  •  
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    advertisement

    A Friendly Approach to XML - What You Can Do with XML


    (Page 3 of 4 )

     

    Creating Your Own Markup 

    XML's brother, HTML (hypertextual markup language), as you probably know, is a language for creating web pages on the Internet. It has a set of predefined tags that coders use to display data and media on the Internet. These predefined tags, such as the <p> or paragraph tag, which allows you to create paragraphs, and the <b> tag, which creates bold text, can sometimes be restrictive, in that you cannot customize any tags to allow for any new type of data. I am reaching here a little bit, but as I get further into this section, it will begin to make more sense. 

    XML steps in to solve this issue. Say that I have a table in HTML that contains some song titles. The rows and data inside the table would look something like this:

     

    <tr>

    <td> Alive</td>

    <td> Sexyback</td>

    <td> She Thinks My Tractor Is Sexy </td>

    <tr>

     

    In HTML this table is just a list of song titles. That is, I can't easily define the data in each record without a bunch of hassle. XML comes in and saves the day by allowing us to give data to our data, or in simpler terms, to give context to the data in the table. 

    There exists no <genre> tag in HTML (there are of course ID3 tags for audio files, but that is another tutorial). With XML, however, we can create one. We could create any tag we wanted. We could have an <artist> tag, a <price> tag, and a <rating> tag, allowing us to give additional information about the data. So now in addition to song title, we have artist, price, genre, and rating, all of which make the field sortable and give a clearer vision of what our data is all about. After all, what good is data without a frame of reference? 

    If this seems a little fuzzy to you, don't worry too much about it. We will cover it in greater detail in our next article. 

    More XML Tutorials Articles
    More By James Payne

    blog comments powered by Disqus

    XML TUTORIALS ARTICLES

    - Validation with Document Type Definitions (D...
    - Creating a Well-Formed XML Document
    - Getting to Know XML
    - A Friendly Approach to XML
    - Creating RSS 2.0 Feeds
    - Using Modules in Your RSS Feed
    - RSS 2.0
    - Querying XML: Use Cases
    - Joins and Query Use with XML
    - Solving Problems by Querying XML
    - Performing Set Operations When Querying XML
    - Querying XML
    - Handling Data for Ajax with JSON
    - Handling XML Data for Ajax
    - XML and JSON for Ajax


    © 2003-2012 by Developer Shed. All rights reserved. DS Cluster 1 - Follow our Sitemap