Welcome to the Intel® Software Dispatch Subscription Program

Elements and attributes: modeling relational data in XML, part 1
XML: You can use either elements or attributes to model relational data in XML, but unless you have some compelling reason not to, it is more efficient to use attributes for the data points. More on xml data management and xml attributes

by Kevin Williams, founder and CEO, Blue Oxide Technologies. Intel Corp.

This article is the first in a series that looks at the steps involved in modeling relational data in XML. We look at the three major components of a relational database—tables, columns, and the key relationships among them—and see how to best model each in XML.

Before discussing how we should model our relational data in XML, we first need to understand one of the classic problems in XML data modeling: whether to use elements or attributes to model our data points.

Data points (individual pieces of information, the equivalent of values in the columns in our relational database) can be expressed either as elements or attributes in an XML model. For example, an abbreviated customer table might be modeled either this way:

Or this way:


<customer>


       <name>Fred Q.

    Anybody</name>


       <address>123 Somewhere

    Street</address>


       <city>Randomtown</city>


       <state>WV</state>


       <zip>25423</zip>


    </customer>

While these two approaches appear interchangeable at first, a closer examination reveals that one is superior to the other for modeling relational information.

Comparing elements, attributes, and the relational model
In the relational model, a set of related information is stored in a table; individual pieces of information are stored as values in columns in the table. In XML, tables are modeled as elements that provide the only way to associate pieces of information together into a related group.

Order significance
In XML, the order in which elements appear is significant. Because the XML data model preserves the order found in the original document, the following document:


    <customer


       name="Fred Q. Anybody"


       address="123 Somewhere Street"


       city="Randomtown"


       state="WV"


       zip="25423" />

Subscribers who liked this article also read:

<customer>


       <name>Fred Q.

    Anybody</name>


       <address>123 Somewhere

    Street</address>


       <city>Randomtown</city>


       <state>WV</state>


       <zip>25423</zip>


    </customer>
Advanced packages drive on-board programming innovations
by Peter T. Larsen. Intel Corp. Vendors such as Intel recognize tha...

If you're interested in this topic, these articles may be helpful:

Custom ASP.NET DataGrid paging with Exact Count
by Dimitrios Markatos, independent .NET architect. Anybody in the D...
Determine the correct XML parser type for a Java application
by Padma Apparao, senior performance architect, Software Solutions Gro...
XMLSpy Home Edition 2005
from Altova Altova XMLSpy 2005 Home Edition is a free entry level X...
Schema Plus Professional trial download
from SchemaPlus Schema Plus is an array of robust database management...
Semantic interoperability with universal data element framework
by Neelima Vobugari, XML certified independent software consultant. ...

Related Jobs:

Microsoft Developer - Senior Consultant #1376 - MN - Richfield - Sogeti USA LLC
Microsoft Developer - Senior Consultant Req. ID: 1376 # Positions:...
Engineering Manager / Chief Architect #0D2000E1CDEE90F2 - CA - West Hollywood - Ask Jeeves,Inc.
Title Engineering Manager / Chief Architect City West Hollywood St...
Software Development Principal #002VF - TX - Dallas - Sabre Inc.
Software Development Principal – 002VF Job Description ...
Database & Java Developer #61559 - NY - Depew - HSBC Bank Usa
Database & Java Developer Here are all the details for this position....
.Net Developer #427842 - VA - Arlington - McDonald Bradley, Inc.
427842 - .Net Developer Jul 27, 2007 Arlington, Virginia Send ...
Web Developer/Front End #RX1000020442 - CA - Sunnyvale - Yahoo! Inc.
Web Developer/Front End - Structured Web Search Job No. RX1000020...
Web Developer/Front End #RX1000022062 - CA - Sunnyvale - Yahoo! Inc.
Web Developer/Front End, Structured Web Search Job No. RX10000...
Freelance Presentation Layer Architect #1977 - NY - New York - aQuantive, Inc.
Freelance Presentation Layer Architect Job ID: 1977 Business Unit:...
Data Migration Specialist #TEC00001143 - PA - Horsham - The Thomson Corporation
Data Migration Specialist – TEC00001143 Job Description ...
Sr. C# .Net OO Developer #3741826 - TX - Houstan - Ajilon
Description : If you're a professional looking for exciting, new oppo...