W3C home > Mailing lists > Public > xmlschema-dev@w3.org > October 2010

Re: What would be the consequence of prohibiting local element and attribute declarations?

From: Mukul Gandhi <gandhi.mukul@gmail.com>
Date: Sat, 16 Oct 2010 19:33:49 +0530
Message-ID: <AANLkTikdca-4jv1UYcpdiCqr5uMj_OwVm6OOkx8RC0iM@mail.gmail.com>
To: "Costello, Roger L." <costello@mitre.org>
Cc: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
Hi Roger,
    To me, this looks like a design problem of visibility of schema components.

Here are few examples please:

1. local element (e.g "x") good:

<xs:complexType>
    <xs:sequence>
       <xs:element name="x" type="xs:string" />
    </xs:sequence>
</xs:complexType>

Reasons:
The element declaration here is fairly trivial (specifically due to
the built-in schema type that's been used, and this being lexically
very simple, so there's a very little [design] overhead of repeating
this at multiple places in an XML schema document). To me this is
something like declaring a global variable in procedural languages,
where local ones are necessary (the concerns are same with XML
schema's too).

2. global element (e.g "address") good:

<xs:element name="address">
    <xs:complexType>
        <xs:sequence>
           <xs:element name="street1" type="xs:string" />
           <xs:element name="street2" type="xs:string" minOccurs="0" />
           <xs:element name="city" type="xs:string" minOccurs="0" />
           <xs:element name="state" type="xs:string" minOccurs="0" />
           <xs:element name="country" type="xs:string" />
       </xs:sequence>
    </xs:complexType>
</xs:element>

<xs:complexType>
    <xs:sequence>
        <xs:element ref="address" />
    </xs:sequence>
</xs:complexType>

Reasons:
Here the complex type refers to a global element declaration
("address") -- which could potentially be included/imported (which is
a modulation schema abstraction) as well. Global element look useful
to me, if their definitions are relatively complex and then we get
real benefits of re-usability of design too.

I also agree that, global XML schema elements allow better integration
(due to an open visibility) with other XML technologies.

I believe, similar design concerns would apply to XML schema attributes as well.

On Sat, Oct 16, 2010 at 5:33 PM, Costello, Roger L. <costello@mitre.org> wrote:
> Hi Folks,
>
> Suppose a team has this XML Schema design policy:
>
>   No local element or attribute declarations
>   are permitted. All elements and attributes
>   must be globally declared.
>
> This policy strips the XML Schema language of a significant functionality. What are the consequences? Specifically what things will not be expressible because of this policy? Would this policy result in the creation of XML Schemas that don't integrate with other XML technologies?
>
> /Roger




-- 
Regards,
Mukul Gandhi
Received on Saturday, 16 October 2010 14:04:43 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:15:27 GMT