- From: Jeni Tennison <jeni@jenitennison.com>
- Date: Tue, 18 Dec 2001 17:46:01 +0000
- To: "Slein, Judith A" <JSlein@crt.xerox.com>
- CC: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>, "Kurian, Binil" <BKurian@crt.xerox.com>, "Sembower, Neil R" <NSembower@crt.xerox.com>, "'Graham Mann'" <gmann@adobe.com>
Hi Judith,
> I am confused about the semantics of elementFormDefault and Form. Do
> they simply determine whether instance documents are forced to make
> explicit what namespace a local element belongs to, or do they
> actually change the namespace it belongs to?
They actually change the namespace that the element belongs to. The
intention is that just like an attribute without a prefix (an
unqualified attribute) is officially in no namespace, an unqualified
element is in no namespace. Applications are expected to look at the
parent/ancestor element to work out what markup language the
unqualified element is part of.
> If I say elementFormDefault="unqualified" and declare a local
> element, does the element belong to no namespace?
> If I say elementFormDefault="qualified", does the local element now
> belong to the targetNamespace?
Yes to both, as long as you don't have a form attribute on the element
with an overriding value.
> At least one of the schema processors I use seems to have this
> interpretation. When I say:
>
> <schema . . . elementFormDefault="qualified">
> <element name="X" type="typeA"/>
> <complexType name="Y">
> <sequence>
> <element name="X" type="typeB"/>
> </sequence>
> </complexType>
> </schema>
>
> I get an error message that I have defined the same element twice
> with different types.
I think you shouldn't get that error message, unless in fact your
sequence looks like:
<sequence>
<element ref="my:X" />
<element name="X" type="my:typeB" />
</sequence>
In other words, the error is (should be) about using the same element
twice within a particular content model, with different types. You're
otherwise perfectly able to declare two elements with the same name
but different content models, as long as they're not both global.
> Similarly, if I say:
>
> <schema . . . elementFormDefault="qualified">
> <element name="X" type="typeA"/>
> <complexType name="Y">
> <sequence>
> <element name="Z" type="typeB"/>
> <any namespace="##other"/>
> </sequence>
> </complexType>
> </schema>
>
> There is no error, but if I change elementFormDefault to
> "unqualified", I get an ambiguous content model error.
I think you should only get this error if it's not predictable how
many times the Z element should occur - otherwise it's clear that the
first N elements should be Z elements and anything after these Z
elements are elements matching the wildcard.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
Received on Tuesday, 18 December 2001 13:02:57 UTC