[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Derived by extension and restriction in XML schema
Hello, I asked this question a few days ago in comp.text.xml but I didnt get any answers. Maybe I will get more lucky here. Here is the problem I have: I have a complextype in an XML schema declared like this: <xsd:complexType name="HeaderType" content="elementOnly"> <xsd:element name="messagekind" type="xsd:string"/> <xsd:element name="messageversion" type="xsd:string"/> <xsd:element name="Value" type="xsd:string" minOccurs="0" maxOccurs="3"/> </xsd:complexType> I have another complextype that is derived from this one. I need to add a few elements, and I need to restrict the 'value' element. Can I do something like this? <xsd:element name="SpecialHeader"> <xsd:complexType base="HeaderType" derivedBy="extension"> <xsd:element name="Value" type="xsd:string" minOccurs="3"/> <xsd:element name="HeaderText" type="xsd:string"/> </xsd:complexType> </xsd:element> I am adding a new element called HeaderText' and restricting the 'Value' element to appear at least and most 3 times. Is this correct or should I do it this way: <xsd:complexType name="SpecialHeaderType" base="HeaderType" derivedBy="extension"> <xsd:element name="HeaderText" type="xsd:string"/> </xsd:complexType> <xsd:element name="SpecialHeader"> <xsd:complexType base="SpecialHeaderType" derivedBy="restriction"> <xsd:element name="Value" type="xsd:string" minOccurs="3"/> </xsd:complexType> </xsd:element> Or maybe both methods are wrong :-) Thanks for any help on this. -- David Valera *************************************************************************** This is xml-dev, the mailing list for XML developers. To unsubscribe, mailto:majordomo@x...&BODY=unsubscribe%20xml-dev List archives are available at http://xml.org/archives/xml-dev/ ***************************************************************************
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|