XML Tutorials
  Home arrow XML Tutorials arrow Getting to Know XML
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Download TestComplete 
Forums Sitemap 
Weekly Newsletter 
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
XML TUTORIALS

Getting to Know XML
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 5
    2009-02-04

    Table of Contents:
  • Getting to Know XML
  • More Definitions
  • Determining the Form of Your Data
  • Different Types of XML

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Getting to Know XML


    (Page 1 of 4 )

    In this second article in a series on beginning XML, I hope to familiarize you with some basic terminology used when discussing XML, as well as show you the basics of syntax, and furthermore, how to begin moving your data into an XML document.

    Just as a refresher, in our last article we talked about the advantages and disadvantages of XML, its history and lineage, and what XML is meant to do. For this article we will start with some definitions, so you can better understand the structure of the language. 

    What Does It Mean?  

    Attribute  

    An attribute in XML is a property that is associated with an element. It is also a named characteristic of an element and provides further information about an element. It is not, however, a part of an element's content. Here I will show you an example: 

    <car saleslot=”New York”> Mark’s Mazda Outlet </car> 

    Above, <car> and </car> are the elements. The word “saleslot” is an attribute that gives us more information about the <car> element. “New York” is a value ascribed to the “saleslot” attribute. The phrase “Mark’s Mazda Outlet” is the content that belongs to the <car> element. 

    Using “saleslot,” we now have more information about our <car> element; in this instance we can see that the location of Mark’s Mazda Outlet is in New York. While the visitor to your website might not see the saleslot=”New York” information, an example of its usage would come up if the user wanted to sort by location. You would have a program in place that looked for the value in the “saleslot” attribute and then sorted them accordingly. 

    Document Type Definition or DTD

    Every XML document must have rules to follow. This helps keep your data in order and protect its integrity. Document Type Definitions are one way to define those rules. Like XML, Document Type Definitions are based on SGML and dictate which elements or markup tags and attributes can be placed in your document. In addition, the DTD decides the order in which your elements and attributes can appear. You can also modify it to ensure that the elements and attributes appear in a strict order of your choosing. 

    I will provide more information about DTDs and something known as an XML Schema in a future article.

    Element  

    I described elements for you above, in the section on attributes. They are a part of your document that can be defined by starting and ending tags, with associated content in between. In the sample I will write below, we will take a look at several elements that might make up a database of information about a car seller. 

    <car> Mazda </car>

    <salesperson> Carl Fredericks </salesperson>

    <commissiontype> 1 </commissiontype>

    <salesdate> 10/22/2008 </salesdate> 

    Above we showcase four different elements. They are: car, salesperson, commissiontype, and salesdate. Each holds content that give us more information about the overall sale. In a later article we will discuss root, parent, and child architecture, and the role each of them has in a data structure such as the one above. For now, however, know that these are basic elements. 

    More XML Tutorials Articles
    More By James Payne


     

    XML TUTORIALS ARTICLES

    - Validation with Document Type Definitions (D...
    - Creating a Well-Formed XML Document
    - Creating XML Taxonomies
    - 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





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek