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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Extending Types in xml schema

[ Lists Home | Date Index | Thread Index ]
  • To: <xml-dev@lists.xml.org>
  • Subject: Extending Types in xml schema
  • From: "Craig Edmunds" <craig.edmunds@comtec-europe.co.uk>
  • Date: Fri, 31 Oct 2003 10:24:41 -0000
  • Importance: normal
  • Priority: normal
  • Thread-index: AcOfmTNyHyYYvNU8REmjt9ugdqkTZQ==
  • Thread-topic: Extending Types in xml schema

I'm having problems adding elements to a choose group in the base type, from my new type:


Base Type:

	<xs:complexType name="textBaseType" mixed="true">
		<xs:annotation>
			<xs:documentation>
			Base class for text based objects, although the schema
			allows you to use this class directly, DON'T!  This is simply a base class- unfortunately
			xml schema has no way of declaring "private" types (as far as i know).
			</xs:documentation>
		</xs:annotation>
		<xs:choice minOccurs="0" maxOccurs="unbounded">
			<xs:element name="br"/>
			<xs:element name="p" type="textBaseType"/>
			<xs:element name="span" type="spanType"/>
			<xs:element name="ul" type="ulType"/>
			<xs:element name="table" type="tableType"/>
		</xs:choice>
	</xs:complexType>


Derived Type:

	<xs:complexType name="spanType" mixed="true">
		<xs:complexContent mixed="true">
			<xs:extension base="textBaseType">
				<xs:annotation>
					<xs:documentation/>
				</xs:annotation>
				<xs:choice minOccurs="0" maxOccurs="unbounded">
					<xs:element name="li" type="tableType"/>
				</xs:choice>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>

I understand that this would actually be represented as

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:complexType name="spanType" mixed="true">
		<xs:annotation>
			<xs:documentation/>
		</xs:annotation>
		<xs:sequence>
			<xs:choice minOccurs="0" maxOccurs="unbounded">
				<xs:element name="br"/>
				<xs:element name="p" type="textBaseType"/>
				<xs:element name="span" type="spanType"/>
				<xs:element name="ul" type="ulType"/>
				<xs:element name="table" type="tableType"/>
			</xs:choice>
			<xs:choice minOccurs="0" maxOccurs="unbounded">
				<xs:element name="li" type="tableType"/>
			</xs:choice>
		</xs:sequence>
	</xs:complexType>
</xs:schema>

And that is obviously wrong.  I have heard substitution groups mentioned but i haven't managed to find any good tutorials (there's only about 1/2 a page in Definitive XML Schema!).

Any Tips?

Cheers
c


==================================== 
Craig Edmunds 
Web Developer
Comtec (Europe) Ltd
==================================== 
t: +44 (0)1633 627500
f: +44 (0)1633 627501 
e: craig.edmunds@comtec-europe.co.uk
w: www.comtec-europe.co.uk

6th Floor Gwent House, Gwent Square 
Cwmbran, South Wales, NP44 1PL 
===================================



************************************************************************
This e-mail and any attachments are strictly confidential and intended solely for the addressee. They may contain information which is covered by legal, professional or other privilege. If you are not the intended addressee, you must not copy the e-mail or the attachments, or use them for any purpose or disclose their contents to any other person. To do so may be unlawful. If you have received this transmission in error, please notify us as soon as possible and delete the message and attachments from all places in your computer where they are stored. 

Although we have scanned this e-mail and any attachments for viruses, it is your responsibility to ensure that they are actually virus free.






 

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

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