W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2007

Re: RE: RE: RE: RE: unique question

From: Markus Gamperl <markus.gamperl@gmx.at>
Date: Thu, 15 Feb 2007 12:04:11 +0100
Message-ID: <20070215110411.269540@gmx.net>
To: "Michael Kay" <mike@saxonica.com>, xmlschema-dev@w3.org

Hi Michael!

Thanks for your explanation! Please allow me one more question.

I have now the following schema definition:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" targetNamespace="http://www.xyz.com" xmlns="http://www.xyz.com" xmlns:x="http://www.xyz.com">

The xmlns:x namespace is only used for the xs:unique. When I create an example xml from the schema with XML Spy all the created elements have the namespace prefix x attached. 

<x:root xsi:schemaLocation="http://www.xyz.com mg_ns.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:x="http://www.xyz.com">

Can I avoid this? I just want to use the default namespace in my xml file!

Thanks
Markus

-------- Original-Nachricht --------
Datum: Thu, 15 Feb 2007 10:30:40 -0000
Von: "Michael Kay" <mike@saxonica.com>
An: "\'Markus Gamperl\'" <markus.gamperl@gmx.at>, xmlschema-dev@w3.org
CC: 
Betreff: RE: RE: RE: RE: unique question

> 
> > 
> > But why isn't the default namespace enough within xs:unique? 
> > Is this the definition of xs:unique? What's the sense of the 
> > default namespace...
> 
> For better or worse, the XPath 1.0 specification states that an unprefixed
> name in a path expression represents a name in no namespace, regardless of
> any default namespace that might be in scope.
> 
> The original motivation for this, I think, was the scenario where XPath is
> embedded within XSLT and the default namespace for the source document is
> different from that for the result document. But like everything else to
> do
> with namespaces, it has tripped a lot of people up over the years.
> 
> XPath 2.0 makes the default namespace for unprefixed element names
> something
> that can be defined in the context, so XML Schema could, if it wished, say
> that it is taken from the default namespace of the enclosing element.
> 
> Michael Kay
> http://www.saxonica.com/
> 

-- 
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten 
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser
Received on Thursday, 15 February 2007 11:04:24 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:11 UTC