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?



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:

---
C:\xml>type friend.xsd birthdays.xsd friend.xml

friend.xsd


<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                targetNamespace="http://redrice.com/friends"
elementFormDefault="qualified">
        <xsd:element name="friend">
                <xsd:complexType>
                        <xsd:sequence>
                                <xsd:any
namespace="http://redrice.com/birthdays" minOccurs="0" />
                        </xsd:sequence>
                        <xsd:attribute name="name" type="xsd:string" />
                </xsd:complexType>
        </xsd:element>
</xsd:schema>

birthdays.xsd


<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                targetNamespace="http://redrice.com/birthdays"
elementFormDefault="unqualified">
        <xsd:element name="birthdays">
                <xsd:complexType>
                        <xsd:sequence>
                                <xsd:element name="person"
type="xsd:string"/>
                                <xsd:element name="date"
type="xsd:date"/>
                        </xsd:sequence>
                </xsd:complexType>
        </xsd:element>
</xsd:schema>

friend.xml


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

C:\xml>xsv friend.xml friend.xsd
<?xml version='1.0'?>
<xsv docElt='{http://redrice.com/friends}friend' instanceAssessed='true'
instanceErrors='0' rootType
='[Anonymous]' schemaDocs='friend.xsd' schemaErrors='0' schemaLocs=''
target='file:/C:/xml/friend.xm
l' validation='strict' version='XSV 1.180/1.88 of 2001/03/17 12:11:13'
xmlns='http://www.w3.org/2000
/05/xsv'/>

C:\xml>msxsd-sch friend.xml friend.xsd
Error loading friend.xml
Code: -1072898035
Source:                 <person>fred</person>
Line: 4
Error: The element 'person' is used but not declared in the DTD/Schema.

C:\xml>
---

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.

Francis.