Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: Both extending and restricting with

From: "Hirtle, David" <David.Hirtle@--------.--.-->
To: ht@---.--.--.--
Date: 4/4/2005 6:45:00 AM
Hi Henry,

Thanks for the reply.  There's been a little mix-up, though.  I changed
the file b.xsd after an earlier reply from Michael Kay, as explained in
this archived message:
http://lists.w3.org/Archives/Public/xmlschema-dev/2005Apr/0004.html

(I should have created new files instead of editing existing ones when
responding.  Sorry for the confusion.)

> Are you sure -- web form reports the expected error when I run it:
> http://www.w3.org/2001/03/webdata/xsv?docAddrs=http%3A%2F%2Fwww.ruleml.org%2F0.89%2Fexa%2Fab.ruleml&style=xsl#

That file which now validates fine with XSV uses a b.xsd with <redefine>s:

	<xs:redefine schemaLocation="a.xsd">
		<!-- add y to body -->
		<xs:group name="body.content">
			<xs:choice>
				<xs:group ref="body.content"/>
				<xs:element ref="y"/>				
			</xs:choice>
		</xs:group>	
	</xs:redefine>

	<xs:redefine schemaLocation="a.xsd">
		<!-- remove x from body by restriction --> 	
		<xs:group name="body.content">
			<xs:choice>
				<xs:element ref="y"/>
			</xs:choice>
		</xs:group>
	</xs:redefine>

The above just doesn't seem to right to me, but this strategy seems the
best supported right now (with Saxon and XSV, at least).

When I sent my original message to the list, the file b.xsd only used one
<redefine>:

	<xs:redefine schemaLocation="a.xsd">
		<!-- add y to body -->
		<xs:group name="body.content">
			<xs:choice>
				<xs:group ref="body.content"/>
				<xs:element ref="y"/>				
			</xs:choice>
		</xs:group>	

		<!-- remove x from body by restriction --> 	
		<xs:group name="body.content">
			<xs:choice>
				<xs:element ref="y"/>
			</xs:choice>
		</xs:group>
	</xs:redefine>

I created new files f.xsd, g.xsd (at http://www.ruleml.org/0.89/xsd) for this
original example.  Note that with this one <redefine>, XSV crashes:
http://www.w3.org/2001/03/webdata/xsv?docAddrs=http%3A%2F%2Fwww.ruleml.org%2F0.89%2Fexa%2Ffg.ruleml&style=xsl#

> The 'correct' way to do this is with _three_ files.

Unfortunately XSV doesn't seem to like the three file way either:

m.xsd is the same as the previous a.xsd/f.xsd

n.xsd redefines m.xsd, adding in <y>

o.xsd redefines n.xsd, removing <x>

(again all at http://www.ruleml.org/0.89/xsd)

Validating http://www.ruleml.org/0.89/exa/mno.ruleml results in a crash:
http://www.w3.org/2001/03/webdata/xsv?docAddrs=http%3A%2F%2Fwww.ruleml.org%2F0.89%2Fexa%2Fmno.ruleml&style=xsl#

I wish the spec were clearer on this.  Do you still recommend the 3 file
approach?  Normally in RuleML each schema represents a meaningful sublanguage,
so having extra "intermediate" schemas is less than ideal, but if it's
the only way to replace one element by another I guess we have no choice.

Thanks again,

David

-----Original Message-----
From: ht@i... [mailto:ht@i...] 
Sent: Saturday, April 02, 2005 10:43 AM
To: Hirtle, David
Cc: xmlschema-dev@w...
Subject: Re: Both extending and restricting with <redefine>

"Hirtle, David" <David.Hirtle@n...> writes:

> a.xsd (http://www.ruleml.org/0.89/xsd/a.xsd) defines an element "body"
> which allows only the element "x".
>
> b.xsd (http://www.ruleml.org/0.89/xsd/b.xsd) redefines "body" from 
> a.xsd, first extending it to allow a new element "y" and then 
> restricting it to disallow "x", effectively replacing "x" with "y" in 
> the content model of "body".
>
> Assuming this is permissible in XML Schema...
>
> ab.ruleml (http://www.ruleml.org/0.89/exa/ab.ruleml) should not be 
> valid w.r.t. b.xsd because "body" contains an "x".
>
> XSV (web form and installation) reports no validity problems but 
> crashes.  Saxon correctly (?) identifies the problem, as appended 
> below.

Are you sure -- web form reports the expected error when I run it:

  http://www.w3.org/2001/03/webdata/xsv?docAddrs=http%3A%2F%2Fwww.ruleml.org%2F0.89%2Fexa%2Fab.ruleml&style=xsl#

> So I'm left with the question: is this the correct way to "replace" an 
> element with another in a content model via <redefine> (if possible at 
> all with XML Schema)?  And what about the validators?

I can see why this works, but I don't _think_ it should.

The 'correct' way to do this is with _three_ files.

ht
--
 Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
                     Half-time member of W3C Team
    2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
            Fax: (44) 131 650-4587, e-mail: ht@i...
                   URL: http://www.ltg.ed.ac.uk/~ht/ [mail really from me _always_ has this .sig -- mail without it is forged spam]

From ht@i... Mon Apr 04 15:43:40 2005
Received: from bart.w3.org ([128.30.52.40])
	by frink.w3.org with esmtp (Exim 4.44)
	id 1DITjo-00039m-2T
	for


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent