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

Problems with xs:redefine

  • To: <xml-dev@l...>
  • Subject: Problems with xs:redefine
  • From: "Allison Bloodworth" <abloodworth@b...>
  • Date: Wed, 23 Nov 2005 19:23:10 -0800
  • Thread-index: AcXwpmOtno3tDUS+R9alZlv7v37SLA==

xs redefine
Hi, 

I am having problems with xs:redefine. Schemas that were validated in XML
Spy 2004 are coming up as invalid in XML Spy 2005. I don't know if perhaps
XML Spy 2004 wasn't looking back to the original schema to make sure that
the redefines were valid restrictions of the elements in the original
schema? However, when I used the "Generate Sample XML file" from schema
function in 2004, it was coming up with valid instances that matched the
constraints in my redefining schema it seemed that the schemas must be
OK...until I ran into errors using 2005.

In the redefining schema I'm trying to a) create enumerated lists for the
elements that were simpleTypes in the original schema and b) restrict
certain complexTypes so that some of their sub-elements that were optional
in the original schema are required. 

For instance, in the original schema I have the following types (important
points indicated by "<-<-"):

	<xs:simpleType name="RecurrenceIDRangeType">
		<xs:restriction base="xs:string"/> <-<-
	</xs:simpleType>

	<xs:complexType name="SponsorType">
		<xs:sequence> <-<-
			<xs:element ref="ev:SponsorID" minOccurs="0"/>
			<xs:element ref="ev:Name" minOccurs="0"/>
			....
		</xs:sequence>
	</xs:complexType>

Which I was able to successfully redefine in XML Spy 2004 like this:
	<xs:redefine schemaLocation="Events_1.6.xsd">
		<xs:simpleType name="RecurrenceIDRangeType">
			<xs:restriction base="xs:string"> <-<-
				<xs:enumeration value="ThisAndFuture"/>
				<xs:enumeration value="ThisAndPrior"/>
			</xs:restriction>
		</xs:simpleType>

(RecurrenceIDRangeType even looks like it's correct from this article, but
is invalid in XML Spy 2005:
http://www.xml.com/pub/a/2000/11/29/schemas/part1.html?page=7)

		<xs:complexType name="SponsorType">
			<xs:complexContent>
				<xs:restriction base="ev:SponsorType">
					<xs:sequence>
						<xs:choice maxOccurs="2">
(e.g. must have one or the other or both) <-<-
							<xs:element
ref="ev:SponsorID"/>
							<xs:element
ref="ev:Name"/>
						</xs:choice>
						...
					</xs:sequence>
				</xs:restriction>
			</xs:complexContent>
		</xs:complexType>

However, XML Spy 2005 is requiring this: 

		<xs:simpleType name="RecurrenceIDRangeType">
			<xs:restriction base="ev:RecurrenceIDRangeType">
<-<-
				<xs:enumeration value="ThisAndFuture"/>
				<xs:enumeration value="ThisAndPrior"/>
			</xs:restriction>
		</xs:simpleType>

This does seem to result in correct instance documents, but I'm not sure
what the right way to do this should be. And I can't even figure out how to
fix ev:SponsorType there--using the choice seems to render the schema
completely invalid. Any ideas? I haven't been able to find many examples of
using xs:redefine on restrictions on-line and didn't find much help in this
document: http://www.w3.org/TR/xmlschema-1/. My latest efforts to make this
work can be found at:

http://eberkeley-dev.vcbf.berkeley.edu/UCBCN/UCBEvents.xsd (redefining
schema)
http://eberkeley-dev.vcbf.berkeley.edu/UCBCN/Events_1.6.xsd (original
schema)

Thanks very much for any help anyone can give,

Allison Bloodworth
Principal Administrative Analyst
e-Berkeley Program Office
University of California, Berkeley
(415) 377-8243
abloodworth@b...




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.