XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Designing an XML Vocabulary: The First Two Questions

Hi Folks,

Based on our recent discussions, I have arrived at "The First Two
Questions."  Comments welcome.  /Roger


THE FIRST TWO QUESTIONS

1. Is the purpose of the XML vocabulary to encode behavior or to encode
data?

2. Is the purpose of the XML vocabulary to markup one specific kind of
data, or to markup multiple diverse kinds of data?


These two questions are elaborated on below.


1. ENCODE BEHAVIOR OR ENCODE DATA?

Encode behavior: each element has an associated behavior.  An element
is an instruction.  The data within an element may be considered to be
a parameter for the instruction.  An application that understands the
XML vocabulary will "execute each instruction."

    Example: the XSLT specification defines an XML vocabulary.
    Each element in the vocabulary is assigned a specific
    behavior. That is, the specification describes how an  
    XSLT application (processor) should behave for each element. 

If the purpose of your XML vocabulary is to encode behavior then the
specification of your XML vocabulary should define:

    - the syntax of each element
    - the semantics of each element
    - the behavior of each element

Encode data: there is no behavior associated with the elements.  The
elements are simply containers for data.  Each application is free to
process the elements in any fashion.

    Example: I may define a "Cellphone XML Vocabulary" without any 
    mandate on how an application should process a document 
    that uses the vocabulary.

If the purpose of your XML vocabulary is to encode data then the
specification of your XML vocabulary should define:

    - the syntax of each element
    - the semantics of each element


2. CUSTOM MARKUP OR GENERAL PURPOSE MARKUP?

Here are two examples of XML vocabularies that are customized to the
data they are marking up:

Book XML vocabulary - just for marking up book data:

    <Book>
        <Title>The Wisdom of Crowds</Title>
        <Classification>non-fiction</Classification>
        <Author>James Surowiecki</Author>
    </Book>
    
Music XML vocabulary - just for marking up music data:

    <Musical-Score>
       <Work>Winterreise</Work>
       <Genre>classical</Genre>
       <Composer>Franz Schubert</Composer>
    </Musical-Song>


Here the same data is marked up, this time using a single generic XML
vocabulary: 

Composition XML vocabulary - for marking up any literary data:

    <Composition class="Book">
        <Title>The Wisdom of Crowds</Title>
        <Category>non-fiction</Category>
        <Creator>James Surowiecki</Creator>
    </Composition>

    <Composition class="Musical-Score">
        <Title>Winterreise</Title>
        <Category>classical</Category>
        <Creator>Franz Schubert</Creator>
    </Composition>


SUMMARY

(a) Creating a new XML vocabulary is a last resort.  Use an existing
one if possible.

(b) If you do decide to create a new XML vocabulary, then be sure to
first answer these two questions:

1. Is the purpose of the XML vocabulary to encode behavior or to encode
data?

2. Is the purpose of the XML vocabulary to markup one specific kind of
data, or to markup multiple diverse kinds of data?


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


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS