OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Namespace: what's the correct usage?




----- Original Message -----
From: "Francis Norton" <francis@redrice.com>
To: "Martin Gudgin" <marting@develop.com>
Cc: "XML-Dev Mailing list" <xml-dev@lists.xml.org>
Sent: Monday, May 28, 2001 6:22 PM
Subject: Re: Namespace: what's the correct usage?


> Martin Gudgin wrote:
> >
> > > Because <xsd:any namespace='urn:x1' /> might also be
> > > elementFormDefault="unqualified" with local no-namespace elements, so
> > > *all* the xsd:any options could introduce element name clashes in
> > > no-namespace.
> >
> > But a such a wildcard would *only* be satisified by a qualified element
in
> > the correct namespace... Unqualified elements from a schema with the
same
> > value for the targetNamespace attribute would *not* satisfy such a
> > wildcard...
>
> I was talking about lower-level elements, and I decided to test it out.
> I'm really confused now - I tested whether <xsd:any namespace='urn:x1'
> /> would allow otherwise valid unqualified elements to appear in lower
> level elements with these two schemas and this message:

OK, the wildcard only specifies the namespace of the element that replaces
it. The namespace details of descendants of that element cannot be specified
by the wildcard. If processContents is strict then the descendants of the
wildcard must match whatever schema is being used for that namespace.

<SNIP>Instances removed</SNIP

> in other words, xsv says fine but msxml4 says not. From the spec I
> assume that the restrictions apply in the normal content model manner,
> so that xsv is correct, but I find it somewhat uncertain.

Strange. I get completely different output from XSV[1] which says there are
5 instance errors. This is what I would expect as your instance has the
children of the wildcard element in the 'friends' namespace rather than
unqualified.

I posted the schemas[2-3] and the instance[4] just in case you wanted to
check what I was running against.
I've also posted HTML of the XSV output[5]

To be valid the instance should look like this;

<?xml version="1.0" encoding="UTF-8"?>
<friend xmlns="http://redrice.com/friends">
  <b:birthdays xmlns="" xmlns:b="http://redrice.com/birthdays">
    <person>fred</person>
    <date>1990/09/28</date>
  </b:birthdays>
</friend>

or ( removing default namespace decl )

<?xml version="1.0" encoding="UTF-8"?>
<f:friend xmlns:f="http://redrice.com/friends">
  <b:birthdays xmlns:b="http://redrice.com/birthdays">
    <person>fred</person>
    <date>1990/09/28</date>
  </b:birthdays>
</f:friend>

I'd be interested to know why you got different results out of XSV than I
did...

MSXML claims the document is valid if I only pass in the friend.xsd schema.
If I pass in both friend.xsd and birthday.xsd I get the same error message
you did.

I tried to check against Xerces 1.4.0 but it always reports success even if
the instance has random elements in it so I must be doing something wrong
when trying to set up the schema validation. I gave it xsi:schemaLocation
and it is loading the docs but doesn't seem to be validating. I'll dig a bit
deeper and see what I can find...

Cheers

Gudge

[1] http://marting.develop.com/xsd/francis/output_friends.xml
[2] http://marting.develop.com/xsd/francis/friend.xsd
[3] http://marting.develop.com/xsd/francis/birthday.xsd
[4] http://marting.develop.com/xsd/francis/friend.xml
[5] http://marting.develop.com/xsd/francis/output_friends.html