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

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 UTC