Re: Cross-schema derivation and qualifications

Hi Robin,

> it may be because it's starting to be a bit late at the end of a
> long day, but I'm having trouble figuring out issues to do with
> cross-schema derivation. It'll probably be easier to explain with an
> example:
>
> Schema A
> <schema
>            xmlns='http://www.w3.org/2001/XMLSchema'
>            xmlns:A='AAA'
>            targetNamespace='AAA'
>            >
>
>    <attribute name='attrA' form='qualified' type='string'/>
>    <element   name='eltA'  form='qualified' type='string'/>
>
>    <complexType name='ctA'>
>      <sequence>
>        <element ref='A:eltA'/>
>        <element name='locEltA' type='string'/>
>      </sequence>
>      <attribute ref='A:attrA'/>
>      <attribute name='locAttrA' type='string'/>
>    </complexType>
> </schema>

The form attribute only affects the target namespace of *locally
declared* elements and attributes. Globally declared elements and
attributes are in the target namespace of the schema that they're
declared in. The namespace of locally declared elements is no
namespace if form is unqualified (the default) or the target namespace
if the form is qualified.

> Schema B
> <schema
>            xmlns='http://www.w3.org/2001/XMLSchema'
>            xmlns:A='AAA'
>            xmlns:B='BBB'
>            targetNamespace='BBB'
>            >
>    <import namespace='AAA'/>
>
>    <element name='eltB' type='A:ctA'/>
> </schema>
>
> How does locality and qualification come into play here? Is it
> straightforward or do some rules come into play? I tried the spec
> but I may be a bit thick today :)
>
> Would the following be a valid instance (provided already declared
> namespaces):
>
>    <B:eltB A:attrA='' locAttrA=''>
>      <A:eltA/>
>      <locEltA/>
>    </B:eltB>

Yes, that's correct. The locAttrA and locEltA nodes are in no
namespace because they're locally declared with no form attributes and
there's no elementFormDefault or attributeFormDefault in Schema A. The
A:attrA and A:eltA nodes are in the AAA namespace because they're
declared globally. Similarly, the B:eltB element is in the BBB
namespace because it's declared globally.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Received on Friday, 22 November 2002 07:50:17 UTC