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

Validate an instance document that has a replaceable datacomponent, spec

  • From: "Costello, Roger L." <costello@m...>
  • To: "'xml-dev@l...'" <xml-dev@l...>
  • Date: Wed, 21 Jan 2009 12:36:07 -0500

Validate an instance document that has a replaceable datacomponent

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]


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