Re: Default namespaces and <includes>

Thank you for replying Henry.

I understand (I think) the situation of a reference from the includer
to the includee - the default namespace definition is
definitely in scope at that point.

However, I was thinking more of the reverse case - references
from the includee to the includer.

Assume the includee has no namespace declarations but the
includer does declare a default namespace equal to the
targetnamespace.

Does this namespace declaration apply to instances of
the attributes "type", "base" and "ref" in the includee, and
if so, is this explicitly covered in the XML Schema spec? If
it does apply, I don't need to prefix the values of these
attributes.

Put another way, if I wish to have the default namespace as the
target namespace in every included schema, do I have
to explicitly do this via a default namespace declaration
within each included schema, or can I rely on a default
namespace declaration on the includer?

The namespace rec says nothing about includes, so I'm
assuming the include mechanism as defined by XML
schema results in a single logical XML document against
which the rules of the namespace rec can be applied.

I have not put default namespace declarations
on my included schemas and do have references from the
includee schemas to the includer, and have not seen errors
in XSV, Xerces and XMLSpy. So I assume I'm not doing anything
wrong but would like to understand better how the spec supports
this approach.

Thanks
Michael




                                                                                                                                        
                    ht@cogsci.ed.                                                                                                       
                    ac.uk (Henry         To:     Mike_Leditschke@nemmco.com.au                                                          
                    S. Thompson)         cc:     <xmlschema-dev@w3.org>                                                                 
                                         Subject:     Re: Default namespaces and <includes>                                             
                    27/09/2001                                                                                                          
                    07:21 PM                                                                                                            
                                                                                                                                        
                                                                                                                                        




Mike_Leditschke@nemmco.com.au writes:

> I would appreciate some clarification as to what the
> XML Schema spec says about the operation of
> namespace definitions on included schemas.
>
> For example, assume I set up a default namespace
> on the schema element of the including schema.
>
> If I now <include> a schema, do all the
> namespace mappings active at the point of the
> include carry into the included document?
>
> I am thinking particularly of the best practice
> document on default namespaces, approach 2.
> That's the one where the XML Schema namespace
> is qualified, and the default namespace is the
> target namespace.
>
> It shows references from the including document to
> the included document not including a namespace
> prefix. It doesn't give an example of the reverse.
>
> I believe the reverse should be true, given my very
> rough understanding of how includes work. However
> I would like to know where the XMl Schema spec
> covers this.

The interpretation of all attributes in XML Schema documents declared
to be of type QName, including 'type', 'base' and 'ref', is always
strictly per the Namespaces REC for element names, i.e. qualified if
prefixed or if (unprefixed and default NS decl in scope).

The interpretation of all 'name' attributes in XML Schema documents is
that they provide names for the associated definition or declaration
in the namespace determined by the enclosing <schema> element's
'targetNamespace' attribute (with an exception for chameleon includes,
which is not relevant here).

So since valid includes must be from a schema doc't to a schema doc't
which _share_ a targetNamespace value, references in the includer to
components defined in the includee look just like references in the
includer to itself.  No transfer of namespace bindings, which are
purely a matter for the XML Namespaces REC, is implied or required.

ht
--
  Henry S. Thompson, HCRC Language Technology Group, University of
Edinburgh
          W3C Fellow 1999--2001, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
               Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
                          URL: http://www.ltg.ed.ac.uk/~ht/






------------------------------------------
This e-mail is confidential.  If you are not the intended recipient, any use, disclosure or copying of this document is unauthorised and prohibited.  If you have received this document in error, please delete the email and notify me by return email or by phoning the NEMMCO Helpdesk on 1300 300 295.

Received on Friday, 28 September 2001 07:53:15 UTC