W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > April to June 2000

Re: Question on namespace and schemalocation

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 08 May 2000 08:58:58 +0100
To: "gmacri@libero.it"<gmacri@libero.it>
Cc: www-xml-schema-comments@w3.org
Message-ID: <f5bg0rttqv1.fsf@cogsci.ed.ac.uk>
"gmacri@libero.it"<gmacri@libero.it> writes:

> In this example there are three declarations of namespace and two 
> declaration of schemalocation that are indipendent.
> 
> <Library xmlns:book="http://www.somewhere.org/Book" 
>          xmlns:person="http://www.somewhere-else.org/Person" 
>          xmlns:xsi="http://www.w3.org/1999/XMLSchema/instance" 
>          xsi:schemaLocation="http://www.somewhere.org/Examples 
>                              http://www.somewhere.org/Examples/Book.xsd 
>
>                       http://www.somewhere-else.org/Person 
>                       http://www.somewhere-else.org/Person/Person.xsd">
>  <BookCatalogue>
>   <book:Book>
>   <book:Title>Illusions The Adventures of a Reluctant 
>                Messiah</book:Title> 
>   <book:Author>Richard Bach</book:Author> 
>   <book:Date>1977</book:Date> 
>   <book:ISBN>0-440-34319-4</book:ISBN> 
>   <book:Publisher>Dell Publishing Co.</book:Publisher> 
>   </book:Book>
> 
> When I analize this document with an application (automatically),  how I 
> can understand that, for example, for "Book" element I must search it 
> in the schema "Book.xsd" and no in the "Person.xsd", to verify  the 
> validity of this document ?

The above document is just fine even if it doesn't in itself provide the
answer to your question for a processor.  The <Book> element is in
the {http://www.somewhere.org/Book} namespace, for which no schema
document is identified explicitly in the value of
'xsi:schemaLocation'.  That doesn't mean the document is not schema
valid.  Note als that the document element (<Library>) is not in any
namespace, and no schema is provided explicitly (with
'xsi:noNamespaceSchemaLocation') for that element either.

But there are at least two other ways schema components for these
elements might be found:

  1) The schema documents http://www.somewhere.org/Examples/Book.xsd
      and http://www.somewhere-else.org/Person/Person.xsd might <import>
      schemas with appropriate target namespaces (that is,
      http://www.somewhere.org/Book and none, for <Book> and <Library>
      respectively);

  2) The user who invokes schema validation may supply such schemas,
     either in the form of schema documents, or in some
     application-specific built-in form.

Hope this helps.

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/
Received on Monday, 8 May 2000 03:59:06 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:49:52 UTC