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]
Validate an instance document that has a replaceable datacomponent, specified by a taxonomy


Hi Folks,

Consider an XML instance document that has two parts:

1. The "what" part describes - using a standard taxonomy - what's in the other part.

2. The "payload" part contains a data component.


Example #1: the "what" part uses the DMOZ taxonomy to provide the hierarchy for a philosophy book. The "payload" part contains data on a philosophy book.

<Document xmlns="http://www.example.org";>
   <What taxonomy="http://www.dmoz.org/Society/Book/Philosophy/"; />
   <Payload>
        <Book xmlns="http://www.book.org";>
                <Title>The First and Last Freedom</Title>
                <Author>J. Krishnamurti</Author>
                <Date>1954</Date>
                <ISBN>0-06-064831-7</ISBN>
                <Publisher>Harper &amp; Row</Publisher>
        </Book>
   </Payload>
</Document>


Example #2: the "what" part uses the DMOZ taxonomy to provide the hierarchy for the Chinese language. The "payload" part contains data on the Chinese language.

<Document xmlns="http://www.example.org";>
   <What taxonomy="http://www.dmoz.org/World/Language/Chinese/"; />
   <Payload>
        <Chinese xmlns="http://www.chinese.org";>
                <Pronouns>
                    <Spoken>Ta</Spoken>
                </Pronouns>
        </Chinese>
   </Payload>
</Document>


The two examples illustrate the need for conditional validation, e.g.

   If the value of the taxonomy attribute is

     http://www.dmoz.org/Society/Book/Philosophy/

   then validate the data component in <Payload> against:

     the Book schema

   If the value of the taxonomy attribute is

     http://www.dmoz.org/World/Language/Chinese/

   then validate the data component in <Payload> against:

     the Chinese schema


Problem: write a schema which:

1. Validates each part of an XML instance document against the appropriate schema.

2. Validates the payload has an appropriate data component, given the value of the taxonomy attribute.

Furthermore ... the data component in the payload must be capable of being expressed in any schema language (XML Schema, Relax NG, DTD, Schematron).

How would you write such a schema?

Answer: use NVDL (Namespace-based Validation Dispatching Language). I created some (Powerpoint) slides to summarize this problem and the solution:

   www.xfront.com/nvdl/example23.ppt


Also, here is a zip file containing all the text files (in case you want to run the example):

    www.xfront.com/nvdl/example23.zip


Finally, I added the slides and example to my NVDL tutorial:

    www.xfront.com/nvdl/

/Roger


[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