[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: XML-Schemas: purpose of elementFormDefault?

  • From: johns@s... (John F. Schlesinger)
  • To: "'Henry S. Thompson'" <ht@c...>
  • Date: Wed, 5 Jul 2000 13:04:14 -0400

elementformdefault
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@c...]
Sent: Wednesday, July 05, 2000 11:56 AM
To: John F. Schlesinger
Cc: XML-DEV@x...
Subject: Re: XML-Schemas: purpose of elementFormDefault?


johns@s... (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@c...
		     URL: http://www.ltg.ed.ac.uk/~ht/


***************************************************************************
This is xml-dev, the mailing list for XML developers.
To unsubscribe, mailto:majordomo@x...&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/
***************************************************************************

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.