W3C home > Mailing lists > Public > xmlschema-dev@w3.org > May 2002

Re: local symbol spaces

From: Jeni Tennison <jeni@jenitennison.com>
Date: Thu, 23 May 2002 15:27:46 +0100
Message-ID: <112343719642.20020523152746@jenitennison.com>
To: xmlschema-dev@w3.org, oliver fodor <fodor@itc.it>
Hi Oliver,

> if i have two anonymous complex type definitions. inside of these i
> declare a local element with equal names. is this allowed?

Yes, that's fine. If you declare an element inside a complex type,
rather than at the top level of the schema, then it's a local
declaration.

> do also anonymous type definitions define their own local symbol
> spaces?

They're not really defining their own local symbol spaces, but yes,
you can declare elements and attributes locally within complex types
and within model and attribute groups (xs:group and
xs:attributeGroup).

> how can such components be referenced from outside?

Within a schema, local declarations can't be referenced at all. They
can't even be referenced from within the type definition in which
they're declared. For example, if you had:

<xs:element name="a" type="x" />

<xs:element name="b">
  <xs:complexType>
    <xs:element name="a" type="y" />
    <xs:element ref="a" />
  </xs:complexType>
</xs:element>

then the reference to the element 'a' actually points to the global
declaration (with the type x) rather than the local declaration (with
the type y). In this case, this would cause an error because within a
content model, two element particles with the same name have to have
the same type.

As far as referring to these declarations from *outside the schema* is
concerned, there's an XPath-like notation for referring to them,
defined in the XML Schema Formal Description WD at
http://www.w3.org/TR/xmlschema-formal, if that's what you're after.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/
Received on Thursday, 23 May 2002 10:27:53 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:56 UTC