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

Re: Namespace: what's the correct usage?

  • From: Francis Norton <francis@r...>
  • To: Martin Gudgin <marting@d...>
  • Date: Mon, 28 May 2001 18:22:15 +0100

xsd any namespace
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.

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.