[
Lists Home |
Date Index |
Thread Index
]
- From: johns@syscore.com (John F. Schlesinger)
- To: "'Henry S. Thompson'" <ht@cogsci.ed.ac.uk>
- Date: Wed, 5 Jul 2000 13:04:14 -0400
Henry wrote:
"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."
I'm getting very confused. Are you saying that, for local elements to be
unqualified in the instance they must have a Form="qualified" attribute?
This would be consistent with what I thought was a misprint in the primer.
It says in section 3.1 in the text:
"In po1.xsd we globally specify the qualification of elements and attributes
by setting the values of both elementFormDefault and attributeFormDefault to
qualified."
But it shows in the following example:
"<schema xmlns="http://www.w3.org/1999/XMLSchema"
xmlns:po="http://www.example.com/PO1"
targetNamespace="http://www.example.com/PO1"
elementFormDefault="unqualified"
attributeFormDefault="unqualified">"
Are you saying that you set elementFormDefault to qualified by coding
elementFormDefault="unqualified"?
My issue is to get all the elements into the right namespace without being
'prefixed' in the instance document.
Yours,
John F Schlesinger
SysCore Solutions
212 619 5200 x 219
917 886 5895 Mobile
-----Original Message-----
From: Henry S. Thompson [mailto:ht@cogsci.ed.ac.uk]
Sent: Wednesday, July 05, 2000 11:56 AM
To: John F. Schlesinger
Cc: XML-DEV@xml.org
Subject: Re: XML-Schemas: purpose of elementFormDefault?
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/
***************************************************************************
|