[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Extending Types in xml schema

  • To: <xml-dev@l...>
  • Subject: Extending Types in xml schema
  • From: "Craig Edmunds" <craig.edmunds@c...>
  • Date: Fri, 31 Oct 2003 10:24:41 -0000
  • Importance: normal
  • Priority: normal
  • Thread-index: AcOfmTNyHyYYvNU8REmjt9ugdqkTZQ==
  • Thread-topic: Extending Types in xml schema

xml schema extending types
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@c...
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.



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.