ElementFormDefault confusion

Hi all,
I can't quite get my head around this qualified and unqualified use in
the schema.  By allowing locally declared elements to be qualified, an
ambiguity can arise in an instance document.  This ambiguity is between
a globally declared element and a locally declared element with the same

name.  So consider this below schema fragment which has an
elementFormDefault = "qualified".

<element name="cat" type="feline"/>
<element name="zoo">
    <complexType>
        <element name="cat" type="animal" minOccurs="0" maxOccurs="1" />

    </complexType>
</element>

In an instance, let's say the prefix foo points to the targetNamespace
of the above schema.  I now have an instance fragment like:

<foo:zoo>
  <foo:cat    legs="4" heads="1" />
</foo:zoo>

Does the cat have type animal or feline?  I assume "animal" as i would
expect the local declaration to have precedence over the global, but
given "foo:cat" is qualified I would also be tempted to look for a
globally declared "cat" in the Namespace pointed to by "foo".

While the above can be resolved by an arbitrary choice of local over
global, there is another case where this ambiguity causes more of a
problem.  If I now add a wildcard in the complexType declaration like:

<element name="zoo">
    <complexType>
        <element name="cat" type="animal" minOccurs="0" maxOccurs="1" />

        <any namespace="##any" />
    </complexType>
</element>

Now in my instance, I again don't know which "cat" I am referring to,
and now there is no precedence of local over global.  The only thing I
could be sure about is any second occurance of foo:cat would indeed
refer to the global "cat", the first "cat" however I don't know.
How is this resolved?  Am I missing something?

Thanks in advance
  Michael.

Received on Thursday, 10 August 2000 03:05:17 UTC