You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Jeff Greif <jg...@alumni.princeton.edu> on 2004/10/28 23:45:46 UTC

Meaning of namespace="##other"

This could be a xerces bug (2.6.2) or an XML Schema misunderstanding on my part.

I have a schema fragment (in a schema with targetNamespace present and elementFormDefault="qualified") inside a complexType:

            <element name="namedInstance" minOccurs="0" maxOccurs="unbounded">
              <complexType>
                <choice>
                  <element name="simpleInstance" type="anySimpleType"/>
                  <any namespace="##other" processContents="skip"/>
                </choice>
                <attribute name="instanceParameterName" type="NCName" use="required"/>
              </complexType>
            </element>

and a corresponding fragment of the instance document like this:

        <ups:namedInstance instanceParameterName="foo">
             <instance xmlns="" xsi:type="...">
                       ...
              </instance>
        <ups:instance>

and I get this error:

26:139 - cvc-complex-type.2.4.a: Invalid content was found starting with element 'instance'. One of '{"http://webalo.com/xmlns/ups":simpleInstance, WC[##other:"http://webalo.com/xmlns/ups"]}' is expected.

I assume the WC[...] part of the message means what I wanted: a WildCard element in any namespace but  http://webalo.com/xmlns/ups

Does <any namespace="##other"/> prohibit the use of elements in no namespace?

Jeff

Re: Meaning of namespace="##other"

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
This was clarified in the first edition schema errata [1]. ##other doesn't 
allow wildcards whose namespace is absent.

[1] http://www.w3.org/2001/05/xmlschema-errata#e1-11

"Jeff Greif" <jg...@alumni.princeton.edu> wrote on 10/28/2004 05:45:46 
PM:

> This could be a xerces bug (2.6.2) or an XML Schema misunderstanding
> on my part.
> 
> I have a schema fragment (in a schema with targetNamespace present 
> and elementFormDefault="qualified") inside a complexType:
> 
>             <element name="namedInstance" minOccurs="0" 
maxOccurs="unbounded">
>               <complexType>
>                 <choice>
>                   <element name="simpleInstance" type="anySimpleType"/>
>                   <any namespace="##other" processContents="skip"/>
>                 </choice>
>                 <attribute name="instanceParameterName" 
> type="NCName" use="required"/>
>               </complexType>
>             </element>
> and a corresponding fragment of the instance document like this:
> 
>         <ups:namedInstance instanceParameterName="foo">
>              <instance xmlns="" xsi:type="...">
>                        ...
>               </instance>
>         <ups:instance>
> 
> and I get this error:
> 
> 26:139 - cvc-complex-type.2.4.a: Invalid content was found starting 
> with element 'instance'. One of 
'{"http://webalo.com/xmlns/ups":simpleInstance
> , WC[##other:"http://webalo.com/xmlns/ups"]}' is expected.
> 
> I assume the WC[...] part of the message means what I wanted: a 
> WildCard element in any namespace but  http://webalo.com/xmlns/ups
> 
> Does <any namespace="##other"/> prohibit the use of elements in no 
namespace?
> 
> Jeff

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org