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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Derived by extension and restriction in XML schema

[ Lists Home | Date Index | Thread Index ]
  • From: "David Valera" <dvalera@pcl-hage.nl>
  • To: <xml-dev@xml.org>
  • Date: Thu, 15 Jun 2000 09:51:58 +0200

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@xml.org&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/
***************************************************************************




 

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

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