Re: Question on namespace and schemalocation

"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