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

Re: How to specify "coupled" attibutes

From: wayne liu <waynix@gmail.com>
Date: Wed, 10 Oct 2007 10:32:45 -0700
Message-ID: <d159c93f0710101032p478f8964wca4ce29ee9425089@mail.gmail.com>
To: "George Cristian Bina" <george@oxygenxml.com>
Cc: xmlschema-dev@w3.org
Re: How to specify "coupled" attibutes
Got it.
Thank you very much George.


Waynix

On 10/10/07, George Cristian Bina <george@oxygenxml.com> wrote:
>
> Hi Waynix,
>
> You cannot do that in XML Schema (at least not in the current version,
> 1.0). You need to define a more relaxed schema, that is make both
> attributes optional and check the constraint at application level.
> One alternative is to add a Schematron embedded rule to check that if
> one is present you have also the other one and perform both XML Schema
> validation and a validation against the Schematron embedded rules.
>
> FWIW this is a case that is very easily handled in Relax NG.
>
> Best Regards,
> George
> ---------------------------------------------------------------------
> George Cristian Bina - http://aboutxml.blogspot.com/
> <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
> http://www.oxygenxml.com
>
>
> wayne liu wrote:
> > Hello All;
> >
> > I have an element that takes two attributes as a coupled group, meaning
> > either none or all of them have to be present.
> > For example, if a guys wares glass, it's required that the type is
> > specified.
> > <SomeGuy wears-glass="yes" glass-type="contact-lense">
> >   Info about this guy
> > </SomeGuy>
> >
> > How do I enforce this in XSD ?.  I tried attributeGroup and it's not it.
> >
> > My apology if this is not the right place, in which case would someone
> > please give a pointer.
> >
> > Thanks a lot.
> >
> > Waynix.
> >
>
Received on Wednesday, 10 October 2007 17:32:54 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
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.