|
[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: conditional schemas
From: Erik Beijnoff <erik@addsystems.com>
Date: Wed, 28 Nov 2001 16:16:53 +0100 To: "'Lieve Laporte'" <lieve.laporte@uz.kuleuven.ac.be> Cc: <xmlschema-dev@w3.org> Message-ID: <914A89E9F99D2C4B8E14FB8CC083F9BC739C@addex001.addsystems.com> >In this case, wouldn't I have to duplicate everything that is inside the "actions" element? 'Cause that's quite a lot... >Regards, Lieve Ok, here goes... <xs:complexType name="outer"> <xs:choice> <xs:element name="action" type="actionsWithAccess"/> <xs:element name="action" type="actionsWithSettings"/> </xs:choice> </xs:complexType> <xs:complexType name="action"> <xs:sequence> <xs:element name="whatevercontent"/> <xs:element name="whatevercontent2"/> </xs:sequence> </xs:complexType> <xs:complexType name="actionsWithSettings"> <xs:complexContent> <xs:extension base="action"> <xs:attribute name="name" use="required" fixed="settings"/> </xs:extension> </xs:complexContent> </xs:complexType> <xs:complexType name="actionsWithAccess"> <xs:complexContent> <xs:extension base="action"> <xs:sequence> <xs:element name="tag"/> </xs:sequence> <xs:attribute name="name" use="required" fixed="access"/> </xs:extension> </xs:complexContent> </xs:complexType> First <xs:complexType name="outer"> is the whole that combines the other parts. It contains a choice between two elements of type actionsWithSettings and actionsWithAccess. <xs:complexType name="action"> is the base action type that <xs:element name="actionsWithSettings"> and <xs:element name="actionsWithAccess"> extends. This way you have a common base for both elements. Perhaps not the easiest solution, but it works, and can be used as common framework for this type of problems. I'd like some expertise input to this solution though, since I've never tried this it before, and am a bit uncertain about extensions. Best regards Erik Beijnoff Systems development erik.beijnoff@addsystems.com erik@beijnoff.comReceived on Wednesday, 28 November 2001 10:20:17 GMT |
Subscribe in XML format
|






