OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] Schema validation question

[ Lists Home | Date Index | Thread Index ]

Linda Grimaldi wrote:
> 
> Thank you all for your replies, particularly the one about advising me to get some sleep!  But I have a 15 year old daughter, so, XML or no XML, sleep does not come easily...
> 
> Anyhow, I will tell my friend to try defining the groups instead of elements under the choice tag.  

IMHO, that would be an unwise choice - but to each their own.

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

> I looked at that, but the cheap reference I was using seemed to imply > that you could only "choice" elements.  That's what I get for not > going back to the standard, but somehow, I just couldn't make myself > do it.
> 
> Linda
> 
> -----Original Message-----
> From: Chiusano Joseph <chiusano_joseph@bah.com>
> Sent: May 5, 2004 7:23 AM
> To: Bob Foster <bob@objfac.com>
> Cc: Linda Grimaldi <grimlinda@earthlink.net>, xml-dev@lists.xml.org
> Subject: Re: [xml-dev] Schema validation question
> 
> Bob Foster wrote:
> >
> > This would be trivial to do in RELAX NG, but why do it? If the value of
> > one element is fixed by the name of another, then the value is redundant
> > and may be omitted.
> 
> How would you then pass that value on to the next system/process if it
> is omitted? The subsequent processing might depend on that value being
> there - and you may not be able to (for whatever reason) enhance the
> subsequent system/process to "inherently" recognize that value.
> 
> Kind Regards,
> Joe Chiusano
> Booz | Allen | Hamilton
> Strategy and Technology Consultants to the World
> 
> > Such a thing is only useful for producing error
> > messages.
> >
> > Bob Foster
> >
> > Linda Grimaldi wrote:
> > > I have been out of the XML world for a little while now, but someone just asked me a question and I have to admit, it's going to keep me up tonight if I can't come up with a better solution.  And I'm a little rusty, to boot...
> > >
> > > The issue is one of data dependency and validation.  The goal is to enforce a restriction on pairs of data values- if the data associated with the node <Fruit><Name> is "Apple", then the value of the sibling node <Fruit><Abbrev> must be "APL".  Effectively, the goal is to enforce a specific mapping from one enum into another within an XML document. The only way my associate could figure to capture this dependency is as follows:
> > >
> > > <xs:complexType name="Fruit">
> > >       <xs:annotation>
> > >               <xs:documentation>Defines the valid values for fruit types</xs:documentation>
> > >       </xs:annotation>
> > >       <xs:choice>
> > >               <xs:element name="APL" type="xs:token" fixed="Apple"/>
> > >               <xs:element name="ORG" type="xs:token" fixed="Orange"/>
> > >               <xs:element name="BAN" type="xs:token" fixed="Banana"/>
> > >               <xs:element name="LEM" type="xs:token" fixed="Lemon"/>
> > >               <xs:element name="GRP" type="xs:token" fixed="Grape"/>
> > >       </xs:choice>
> > > </xs:complexType>
> > >
> > > All in all, this strikes me as a very ugly, even offensive, solution.  My initial response was to forget about the validation- it wasn't worth it.  Is there a way to preserve the data dependency validation without warping the instance document as the above schema fragment would require?
> > >
> > > Thanks,
> > > Linda
> >
> > -----------------------------------------------------------------
> > 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>
> 
> --
> Kind Regards,
> Joseph Chiusano
> Associate
> Booz | Allen | Hamilton
> 
> -----------------------------------------------------------------
> 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>

-- 
Kind Regards,
Joseph Chiusano
Associate
Booz | Allen | Hamilton




 

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

Copyright 2001 XML.org. This site is hosted by OASIS