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

RE: 4 approaches to structure lists, plus an analysis of eachapproach

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

RE: 4 approaches to structure lists

Hi Folks,

I started learning the approach to creating lists that Ken described, called genericode. I will call that Approach #4. Below I review the first three approaches, then describe Approach #4. 

Approach #1 - Express the list using the XML Schema vocabulary, e.g.,

    <xs:simpleType name="countriesType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="Afghanistan"/>
            <xs:enumeration value="Albania"/>
            <xs:enumeration value="Algeria"/>
            ...
        </xs:restriction>
    </xs:simpleType>

Approach #2 - Express the list using the RELAX NG vocabulary, e.g.,

    <define name="countriesType">
        <choice>
            <value>Afghanistan</value>
            <value>Albania</value>
            <value>Algeria</value>
            ...
        </choice>
    </define>

Approach #3 - Express the list using a domain-specific vocabulary, e.g.,

    <countries xmlns="http://www.countries.org">

        <country>Afghanistan</country>
        <country>Albania</country>
        <country>Algeria</country>
        ...
    </countries>

Approach #4 - Express the list using a "list vocabulary" 

(Ken, please correct where I err in my description/analysis)

In this approach the vocabulary is not customized for a specific list as with approach #3; rather, it is a vocabulary for any list.

Oftentimes when creating a list there are multiple ways to express each value in the list. For example, in a list of countries we may express the first value as Afghanistan or AF. Approach #4 permits each value to be expressed in multiple ways. Thus, the list is expressed in terms of rows and columns - each row has a column for the multiple ways to express a list value.

Here is (a simplified version of) a country list using the genericode vocabulary:

<gc:CodeList xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/">
    <SimpleCodeList>
        <Row>
            <Value>
                <SimpleValue>AF</SimpleValue>
            </Value>
            <Value>
                <SimpleValue>AFGHANISTAN</SimpleValue>
            </Value>
        </Row>
        <Row>
            <Value>
                <SimpleValue>AL</SimpleValue>
            </Value>
            <Value>
                <SimpleValue>ALBANIA</SimpleValue>
            </Value>
        </Row>
        ...
    </SimpleCodeList>
</gc:CodeList>

An element in an XML instance document can be validated against the list using Schematron in the same manner described in Approach #3.

Approach #4 a standardized list vocabulary that may be used for any list.

Approach #4 does not enable a list to be used as a building block (data component). This is because every list has the same namespace. Consider a compound document comprised of multiple genericode lists. Since the lists all have the same namespace an application cannot, say, extract the country list and perform application-specific processing. 


SUMMARY

Each of the four approaches has pros and cons so, as always, be sure to understand the alternatives and decide which is best for your situation.

Comments?

/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-2013 All Rights Reserved.