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

RE: semantics in schema (xsd)


pedro joseph salazar


 RelaxNG can also handle this with the following schema:

start = human
human = element human { husbandModel | wifeModel }
husbandModel= ( maleGenderAttr, element husband { text } )
wifeModel = ( femaleGenderAttr, element wife { text } )
maleGenderAttr = attribute gender { "male" }
femaleGenderAttr = attribute gender { "female" }





-----Original Message-----
From: Chiusano Joseph [mailto:chiusano_joseph@b...] 
Sent: Wednesday, February 25, 2004 3:34 PM
To: Pedro Salazar
Cc: xml-dev@l...
Subject: Re:  semantics in schema (xsd)


This is not possible with W3C Schema - we normally refer to this requirement
as "co-occurrence constraints". This may be more than what you need, but you
could express these requirements as classes in RDF or OWL (where a wife
could be a subclass of female, for example).

Schematron will allow you to do this, however, and someone will most likely
be along soon to tell you how.

Kind Regards,
Joe Chiusano
Booz | Allen | Hamilton
Strategy and Technology Consultants to the World

Pedro Salazar wrote:
> 
> Greetings,
> 
> I'm creating a schema file but by several times I feel the needed of 
> something to validate my sub-elements in tree (children elements) 
> subordinated to an attribute value on the parent element.
> 
> Is it possible to validate this with the schema semantics?
> 
> For instance, a schema may define an element called "human" that would 
> allow to have a <wife> or <husband> element below it. However, I would 
> like to apply an extra semantic rule that would only allow the <wife> 
> element be inside a human of gender type "female", and the same thing 
> for <husband> with "male". Is it possible?
> 
> <human gender="female">
>    <wife />
> </human>
> 
> <human gender="male">
>    <husband />
> </human>
> 
> thanks,
> Pedro Salazar.
> --
> PS
> pedro-b-salazar_at_ptinovacao_dot_pt
> PGP:0E129E31D803BC61
> 
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an 
> initiative of OASIS <http://www.oasis-open.org>
> 
> The list archives are at http://lists.xml.org/archives/xml-dev/
> 
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://www.oasis-open.org/mlmanage/index.php>

-----------------------------------------------------------------
The xml-dev list is sponsored by XML.org <http://www.xml.org>, an initiative
of OASIS <http://www.oasis-open.org>

The list archives are at http://lists.xml.org/archives/xml-dev/

To subscribe or unsubscribe from this list use the subscription
manager: <http://www.oasis-open.org/mlmanage/index.php>

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.