W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > July to September 2000

Re: Schemas, namespaces, local, global, in no namespace

From: Liz Castro <lcastro@cookwood.com>
Date: Mon, 14 Aug 2000 09:28:21 -0400
Message-ID: <3997F3F5.4C0B5719@cookwood.com>
To: www-xml-schema-comments@w3.org
> <SNIP>>
> > As expected, XSV gives me errors (and XML Spy doesn't), but curiously,
> > XSV only complains about bar and item, but not about name and town. Why
> > isn't there a problem with all of them? If bar and item aren't part of
> > the 'something' namespace because they are local elements in the schema,
> > then name and town shouldn't be in any namespace either...and thus there
> > should be a problem when I declare 'something' as the default namespace
> > for the whole document (which is what happens when I get rid of the
> > 'red' qualifier).
> >
> > Why isn't there a problem with name and town?
> [MJG]
> My guess is this is just the way XSV reports stuff. Having already reported
> an error with 'item' it doesn't report errors with the content of item
> beause that content is implicitly in error. Or put another way; there is no
> way for XSV to validate the content of 'item' because 'item' itself is
> unexpected.
> So yes, there is a problem with 'name' and 'town' but XSV can't tell you
> anything about them because it didn't know what to do with 'item'

OK, that does help. I guess what I don't get is if name and town (and bar and item) are all not associated
with the 'something' namespace that I'm using to schema validate my xml docs, how does XSV (or any
validator) know how to validate them?

Imagine that I dutifly qualify the something namespace in the xml document with "red" and I add a new
element (zip) of type integer (and deliberately give it bad content.

<?xml version="1.0" encoding="UTF-8"?>
<red:baz xmlns:red="http://www.example.org/something"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:schemaLocation="http://www.example.org/something

 <bar>this is a string</bar>
  <name>pen knife</name>
  <zip>not a number!</zip>

I add a definition for the zip element in the new schema (http://www.cookwood.com/xmltests/martin3.xsd):

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/1999/XMLSchema" xmlns:tns="http://www.example.org/something"
 <complexType name="foo">
  <element name="bar" type="string"/>
  <element name="item">
    <element name="name" type="string"/>
    <element name="town" type="string"/>
    <element name="zip" type="integer"/>
 <element name="baz" type="tns:foo"/>

XSV properly tells me that the zip element has bad content. But how does it know that if zip isn't in the
target namespace that is defined with the schema?

Thanks for your patience and help!

Received on Monday, 14 August 2000 09:22:00 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:49:53 UTC