Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xmlschema-dev]

From: "Xan Gregg" <Xan.Gregg@---.--->
To: "Keith Suderman" <suderman@--.------.--->, <xmlschema-dev@--.--->
Date: 7/14/2004 4:18:00 AM
> XSV 2.5, XMLSpy">XMLSpy, and Xerces-J 2.6.2 all accept this schema as valid, =
but 
> Xerces-C 2.5 reports an error claiming that maxOccurs=0 is illegal.  =
When 
> this was pointed out on the xerces-c list the folks there seemed 
> unconvinced ...

Maybe they should talk to the Xerces-J folks!

Starting from Henry Thompson's clarification [ht1] that the =
min=max=0
element corresponds to no component, I think both of your
"empty" types are valid and that they have the same properties.

The following clause of complexType captures the relevant intent:

  {content type}
    1. If the <restriction> alternative is chosen, then the appropriate =
case
        among the following:
     ...
    1.1.2 There is an <all> or <sequence> among the [children] with no 
        [children] of its own excluding <annotation>;
     ...
    then empty;

So there is no content model and the tableau doesn't apply.  The catch
is that the above appeals to having no element *children*,
where here we actually have an element child, <any>, but we don't
have any particle *components*, which I think is what the text means
to depend on.

Even if you don't buy that, you end up with the content model particle =
of:

  {minOccurs} = 1
  {maxOccurs} = 1
  {term} = group
         {compositor} = sequence
         {particles} = ()      // empty list

which I think still matches anyType using the tableau.

Is it possible they don't accept Henry's clarification?

xan

[ht1] =
http://lists.w3.org/Archives/Public/xmlschema-dev/2004Jun/0008.html

-----Original Message-----
From: xmlschema-dev-request@w... on behalf of Keith Suderman
Sent: Tue 7/13/2004 5:22 PM
To: xmlschema-dev@w...
Subject: [xmlschema-dev] <none>
 
Hello,

I asked a similar question earlier, but I would like clarification since =
I 
didn't make it clear earlier that I wanted to restrict xs:anyType.

Is the following schema valid?

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
elementFormDefault="qualified" attributeFormDefault="unqualified">
         <xs:element name="root" type="empty"/>

         <xs:complexType name="empty">
                 <xs:complexContent>
                         <xs:restriction base="xs:anyType">
                                 <xs:sequence>
                                         <xs:any minOccurs="0" 
maxOccurs="0" processContents="lax"/>
                                 </xs:sequence>
                         </xs:restriction>
                 </xs:complexContent>
         </xs:complexType>
</xs:schema>


XSV 2.5, XMLSpy">XMLSpy, and Xerces-J 2.6.2 all accept this schema as valid, =
but 
Xerces-C 2.5 reports an error claiming that maxOccurs=0 is illegal.  =
When 
this was pointed out on the xerces-c list the folks there seemed 
unconvinced and replied:

 >'the derivation by restriction has some constraints, for some =
reference,
 >please see the following table:
 >http://www.w3.org/TR/xmlschema-0/#restrictsTable and
 =
>http://www.w3.org/TR/xmlschema-1/#section-Built-in-Complex-Type-Definiti=
on
 >You'll see that anyType has { minOccurs, maxOccurs } as { 1, 1 } which
 >can't be restricted.'

As I understand it, the restrictsTable referred to above (which has been =

amended in an errata [1]) only "shows several examples" of how element 
definitions may be restricted, it's not an exhaustive list of what is 
allowed.  Also, case 5.3 of [2] says "the particle of the complex type 
definition itself must be a *valid restriction* of the particle of the 
{content type} of the {base type definition}".  In the built in complex 
type definition [3] the {particle} of the {content type} is a sequence =
with 
{minOccurs, maxOccurs} = {0, unbounded}, which can be restricted to =
{0, 0}. 
However, I'm unlikely to convince anyone on the Xerces-C list that the 
above schema is correct (or that everyone else is wrong) without some =
sort 
of confirmation from this list.

Finally, is

         <xs:complexType name="empty"/>

equivalent (in the sense that <root/> is the only valid document) to the =

definition above?

Thanks in advance,
Keith

References

[1] http://www.w3.org/2001/05/xmlschema-errata.html#e0-20
[2] http://www.w3.org/TR/xmlschema-1/#derivation-ok-restriction
[3] =
http://www.w3.org/TR/xmlschema-1/#section-Built-in-Complex-Type-Definitio=
n


From mhk@m...  Wed Jul 14 08:35:12 2004
Return-Path: <mhk@m...>
X-Original-To: xmlschema-dev@l...
Delivered-To: xmlschema-dev@l...
Rec


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