[
Lists Home |
Date Index |
Thread Index
]
- From: ht@cogsci.ed.ac.uk (Henry S. Thompson)
- To: johns@syscore.com (John F. Schlesinger)
- Date: 05 Jul 2000 16:55:34 +0100
johns@syscore.com (John F. Schlesinger) writes:
> Henry wrote:
> "There are clearly problems with (1), for instance because it means that
> changing from a local to a global declaration for an element will have an
> impact on the appearance of valid instances;"
>
> Does this mean that it is not necessary to prefix the global elements in the
> schema? If I have to prefix the global elements in the schema but not the
> local elements, then changing the schema would change the form of an
> instance.
>
> In any case, am I required to prefix the root element of my document (where
> I define the default namespace to be the schema's target namespace)? Or will
> the validating parser recognize that even the root element is in the default
> namespace? Using Roger's schema, is this then a valid instance (it is the
> same as Roger's except that I declare a default namespace and remove the
> qualification)?
>
> <?xml version="1.0"?>
> <BookCatalogue
> xmlns="http://www.publishing.org/namespaces/BookCatalogue"
> xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
> xsi:schemaLocation="http://www.publishing.org/namespaces/BookCatalogue
> BookCatalogue2.xsd">
> <Book>
> <Title>My Life and Times</Title>
> <Author>Paul McCartney</Author>
> <Date>1998</Date>
> <ISBN>94303-12021-43892</ISBN>
> <Publisher>McMillin Publishing</Publisher>
> </Book>
> ...
> </BookCatalogue>
>
> This is what I would like to be able to do so that poor developers that
> create instances of my schema don't have to worry about namespaces, which
> they don't understand (any more than I do).
This is fine _if and only if_ form='qualified' for <Book>, <Title>,
etc. (or elementFormDefault='qualified') in the schema. Why? Because
locally declared elements must be _unqualified_ in instances, and by
using the default namespace declaration, you've qualified all those
names.
You use 'prefixed' in your discussion above, but that's _not_ the
right way to approach this: elements in instances can be qualified
without being prefixed (although attributes cannot :-(. All the
elements in your version of the example are qualified, because of the
default namespace declaration, which does indeed apply to
<BookCatalogue>, the document element.
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 is xml-dev, the mailing list for XML developers.
To unsubscribe, mailto:majordomo@xml.org&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/
***************************************************************************
|