[
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: <6.1.0.6.2.20051123201124.034f8cc0@mail.dvint.com>
- 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:
xmlns:ev="urn:cde.berkeley.edu:babl:events:1.00"
targetNamespace="urn:cde.berkeley.edu:babl:events:1.00"
from Events_1.6.xsd:
targetNamespace="urn:cde.berkeley.edu:babl:events:1.00"
elementFormDefault="qualified" attributeFormDefault="unqualified"
xmlns:ev="urn:cde.berkeley.edu:babl:events:1.00"
Thanks again,
Allison
-----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
design.
below for more
At 07:23 PM 11/23/2005, you wrote:
>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>
<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:
>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>
<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.
..dan
>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@berkeley.edu
>
>
>
>
>-----------------------------------------------------------------
>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
http://www.dvint.com
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."
http://www.portalwisconsin.org/bennett_feature.cfm
|