[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Identifying markup using namespaces versus using data (was: 4approaches

  • From: "Costello, Roger L." <costello@m...>
  • To: "'xml-dev@l...'" <xml-dev@l...>
  • Date: Thu, 19 Feb 2009 14:26:57 -0500

Identifying markup using namespaces versus using data  (was: 4approaches

Hi Folks

One way of identifying an XML building block (data component) is by namespace. For example, this list component is identified by the namespace http://week.days.org

   <DaysOfTheWeek xmlns="http://week.days.org">
       <Day>Sunday</Day>
       <Day>Monday</Day>
       <Day>Tuesday</Day>
       <Day>Wednesday</Day>
       <Day>Thursday</Day>
       <Day>Friday</Day>
       <Day>Saturday</Day>
   </DaysOfTheWeek>

This list is identified by the namespace http://meetings.org

   <Meetings xmlns="http://meetings.org">
       <Meeting>Dentist</Meeting>
       <Meeting>Doctor</Meeting>
       <Meeting>Boss</Meeting>
   </Meetings>

Applications can be built that are namespace-aware.

Different data components can be mashed together into a single document and still be extracted and processed individually because each is in a namespace.


There is an alternate way of identifying an XML building block (data component): by embedding an identifier within the document, as data. The weekday list could be expressed like this:

    <List>
        <Identifier>http://week.days.org</Identifier>
        <li>Sunday</li>
        <li>Monday</li>
        <li>Tuesday</li>
        <li>Wednesday</li>
        <li>Thursday</li>
        <li>Friday</li>
        <li>Saturday</li>
    </List>

And the meetings list could be expressed like this:

    <List>
        <Identifier>http://meetings.org</Identifier>
        <li>Dentist</li>
        <li>Doctor</li>
        <li>Boss</li>
    </List>

Things to note:

1. Namespaces are not being used. (I formatted the identifier as a namespace, but I didn't have to do that)

2. The list is identified by the content of <Identifier>

3. The same XML vocabulary is used for both lists. (In fact, the same XML vocabulary is used for all lists)

The two lists can be brought together into a single document and still be processed individually. Applications partition the document based on the value in <Identifier>


xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        ANALYSIS
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

The namespace approach has the benefit of being widely adopted. Most XML tools, parsers, and technologies are based on namespaces. For example, NVDL is entirely based on using namespaces to partition a compound document; an XSLT processor processes a document based on the XSLT namespace.

Ken nicely summarizes the advantages of the second approach:

> [because the same XML vocabulary is used for all lists it]
> makes all list-processing algorithms and code independent of 
> the content, allowing one to leverage a single investment in software 
> and access all code lists. 


Do you agree with this analysis? What else would you add?

/Roger


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.