W3C home > Mailing lists > Public > xmlschema-dev@w3.org > August 2002

RE: Why doesn't this instance document validate?

From: <noah_mendelsohn@us.ibm.com>
Date: Fri, 23 Aug 2002 11:51:37 -0400
To: John Verhaeg <jverhaeg@metamatrix.com>
Cc: "'ht@cogsci.ed.ac.uk'" <ht@cogsci.ed.ac.uk>, "XML Schema Mailing List (E-mail)" <xmlschema-dev@w3.org>
Message-ID: <OF09DB7991.0782E548-ON85256C1E.00564409@lotus.com>

>> Just to clarify, the way I now understand 
>> this is that you cannot specify a default 
>> namespace in an instance document unless 
>> the root element is from a
>> separate qualified namespace.  Is this correct?

Well, this is legal:

        <a xmlns="http://example.org/yourdefaultnamespace">
                <b/>
        </a>

Both <a> and >b> are qualified (not prefixed!) by the namespace named 
http://example.org/yourdefaultnamespace.  So, defining a default on the 
root means that you cannot have the root element unqualified.   However, 
the root element may be qualified with the same (as above) or different 
namespace from the default.  I hope this helps. 

------------------------------------------------------------------
Noah Mendelsohn                              Voice: 1-617-693-4036
IBM Corporation                                Fax: 1-617-693-8676
One Rogers Street
Cambridge, MA 02142
------------------------------------------------------------------







John Verhaeg <jverhaeg@metamatrix.com>
Sent by: xmlschema-dev-request@w3.org
08/23/2002 11:34 AM

 
        To:     "'ht@cogsci.ed.ac.uk'" <ht@cogsci.ed.ac.uk>
        cc:     "XML Schema Mailing List (E-mail)" <xmlschema-dev@w3.org>, (bcc: Noah 
Mendelsohn/Cambridge/IBM)
        Subject:        RE: Why doesn't this instance document validate?



Just to clarify, the way I now understand this is that you cannot specify 
a
default namespace in an instance document unless the root element is from 
a
separate qualified namespace.  Is this correct?

John P. A. Verhaeg
JVerhaeg@MetaMatrix.Com
MetaMatrix, Inc.
11477 Olde Cabin Road Suite 400
Creve Coeur, MO 63141
(314) 739-3190 x150


-----Original Message-----
From: ht@cogsci.ed.ac.uk [mailto:ht@cogsci.ed.ac.uk]
Sent: Friday, August 23, 2002 9:36 AM
To: John Verhaeg
Cc: XML Schema Mailing List (E-mail)
Subject: Re: Why doesn't this instance document validate?


John Verhaeg <jverhaeg@metamatrix.com> writes:

> Can someone tell me why the attached instance document using the 
attached
> schemas won't validate?  XML Spy is saying "This file is not valid:
> Mandatory local element 'publisher' must be unqualified (i.e. outside of
any
> namespace), but you are using a default namespace".

Exactly what it says -- you have (by default) specified that
locally-declared elements (which 'publisher' is) must appear
unqualified, but by using a default NS decl in your instance, you've
caused it to appear qualified.

Either use an explicit prefix on the document element only in your
instance, or add "elementFormDefault='qualified'" to your xs:schema
elements.

This is a FAQ, sorry for the brief answer, there must be a longer one
around somewhere . . .

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of 
Edinburgh
          W3C Fellow 1999--2002, 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/
 [mail really from me _always_ has this .sig -- mail without it is forged
spam]
Received on Friday, 23 August 2002 11:52:57 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:34 GMT