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


Help: OASIS Mailing Lists Help | MarkMail Help



   RE: [xml-dev] Problems with xs:redefine

[ Lists Home | Date Index | Thread Index ]
  • To: "'Dan Vint'" <dvint@dvint.com>
  • Subject: RE: [xml-dev] Problems with xs:redefine
  • From: "Allison Bloodworth" <abloodworth@berkeley.edu>
  • Date: Mon, 28 Nov 2005 14:18:23 -0800
  • Cc: <xml-dev@lists.xml.org>
  • In-reply-to: <>
  • Thread-index: AcXwrSH6B5wupkZ5QWuhj2aQXWJO9QDrosrQ

Hi Dan, 

Thanks much for your advice. I downloaded Xerces-j 2.7.1 but unfortunately
can't find instructions on how to invoke the validator on the command line
(which is I assume what you are talking about). Though I know a bit about
java, I'm not a developer so I don't think I can sift through the API
documentation to find the right command. Do you know what the command is, or
have some other advice for me? I looked in their forums and sent a request
for help to their list, but the only response I got was "try an IDE like XML
Spy or Eclipse".

Also, both the original and redefining schema have the same targetNamespace,
so it doesn't sound like that is the problem.

From UCBEvents.xsd:

from Events_1.6.xsd:
elementFormDefault="qualified" attributeFormDefault="unqualified"

Thanks again,

-----Original Message-----
From: Dan Vint [mailto:dvint@dvint.com] 
Sent: Wednesday, November 23, 2005 8:18 PM
To: Allison Bloodworth
Subject: Re: [xml-dev] Problems with xs:redefine

First I would recommend that you setup Xerces-J and use it to test your 
schemas. XML Spy is full of bugs and problems as you try to use different 
schema features. If nothing else it will give you different error messages 
that might make more sense than Spy;s - than again they might be more 
cryptic but they will be different. I also will double check my schemas 
with the MS com XML parser as well. Both of these seem to be better 
implementations and if I pass them I feel pretty confident in my schema

below for more

At 07:23 PM 11/23/2005, you wrote:
>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>

<drv>Usually the redefin requireise the two type nemase to be the same, so 
where you have xs:string, replace it with RecurrenceIDRangeType.

>(RecurrenceIDRangeType even looks like it's correct from this article, but
>is invalid in XML Spy 2005:
>                 <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
>                                                         <xs:element
>                                                 </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>

<drv>Both of these samples look suspicious like your redefine schema may 
have applied a prefix to the targetNamespace and you used the default in 
the base schema. Anyway I've seen Spy recently with 2005 track elements by 
the prefix value when I did something similar.

<drv>Notice that if this is the situation, that my first statement then is 
correct, because both references to the data type really are the same once 
you track down the namespace definitions.


>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
>http://eberkeley-dev.vcbf.berkeley.edu/UCBCN/Events_1.6.xsd (original
>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
>The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
>initiative of OASIS <http://www.oasis-open.org>
>The list archives are at http://lists.xml.org/archives/xml-dev/
>To subscribe or unsubscribe from this list use the subscription
>manager: <http://www.oasis-open.org/mlmanage/index.php>

Danny Vint

Specializing in Panoramic Images of California and the West

voice: 510-522-4703

When H.H. Bennett was asked why he preferred to be out
shooting landscapes rather than spending time in his portrait studio:

"It is easier to pose nature and less trouble to please."




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

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