Nikel wrote:
Well then , Consider this case when both the "Size" elements are not declared closely :
<xs:complexType name="Team">
<xs:element name="Name" type="xs:string"/>
<xs:element name="Size">
<xs:restriction base="xs:integer">
<xs:totalDigits value="1"/>
<xs:element name="teamLeads">
<xs:element ref="Size"/>
My Question is aren't local elements referenceable in their own Local Scope?In the above case , "Size" is an element declaration local to the roottag "Team" ; then why can't I reuse the Same Declaration using "ref"? Usually , in other Computer Languages , a local element is reusable in the complete Local Scope.
As far as I understand the schema language you can only reference
globally declared elements (i.e. those declared with xs:element as
direct children of xs:schema).
See
http://www.w3.org/TR/xmlschema-1/#cElement_Declarations, it has a
section saying
"the <element> element information item has <complexType> or <group> as
an ancestor and the ref [attribute] is present), the corresponding
schema component is as follows (unless minOccurs=maxOccurs=0, in which
case the item corresponds to no component at all):
Particle Schema Component
Property Representation
{min occurs} The ·actual value· of the minOccurs [attribute], if
present, otherwise 1.
{max occurs} unbounded, if the maxOccurs [attribute] equals unbounded,
otherwise the ·actual value· of the maxOccurs [attribute], if present,
otherwise 1.
{term} The (top-level) element declaration ·resolved· to by the ·actual
value· of the ref [attribute]."
So "_The (top-level) element declaration ·resolved· to by the ·actual
value· of the ref [attribute]._" basically says that reference works
only to top level element declaration (i.e. the ones as direct children
of xs:schema).
--
Martin Honnen --- MVP Data Platform Development
http://msmvps.com/blogs/martin_honnen/