Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: How to specify "coupled" attibutes

From: George Cristian Bina <george@---------.--->
To: wayne liu <waynix@-----.--->
Date: 10/10/2007 2:09:00 PM
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
www.---.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.
> 

From mike@s... Wed Oct 10 13:17:44 2007
Received: from lisa.w3.org


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent