Re: [xml-dev] Can schemas be in the default namespace?

From
G. Ken Holman <>
To
Steinar Bang <>,
Date
2015-05-05T12:43:11Z
ID
<>
Thread
Re: [xml-dev] Can schemas be in the default namespace?
At 2015-05-05 14:15 +0200, Steinar Bang wrote:
>Is it legal to do this?
>   <schema xmlns="http://www.w3.org/2001/XMLSchema">
>     ...
>   </schema>

Yes.

>I'm dealing with some schemas that don't use a namspace prefix for the
>schema namespace, ie. they are defined like this:
>  <schema xmlns:xsd="http://www.w3.org/2001/XMLSchema.xsd" 
> xmlns="http://www.w3.org/2001/XMLSchema" 
> elementFormDefault="qualified" attributeFormDefault="unqualified">
>
>Ie. they have set xmlns="http://www.w3.org/2001/XMLSchema" (and
>xmlns:xsd="http://www.w3.org/2001/XMLSchema.xsd" as well, though the
>"xsd:" prefix isn't used anywhere I could see).

Not a problem.

>XML Validator Buddy[1] didn't complain about this, but eclipse WTP[2]
>(WTP 3.6.3 on Luna SR2) on
>  <import namespace="http://www.myorg.no/xmlstds" 
> schemaLocation="../common/myorg.xsd"/>
>gives the following error message
>  schema_reference.4: Failed to read schema document 
> '../common/myorg.xsd', because 1) could not find the document; 2) 
> the document could not be read; 3) the root element of the document 
> is not 
> <xsd:schema>.  ER-M30-2014-12-01.xsd   /MYProject/Myfolder     line 
> 13 XML Schema Problem

That sounds like a bug as if they were expecting prefix-based properties.

>The XSLT-based XSD to RNG converter[3] says:
>  error on line 11 at column 37: xml namespace URI cannot be the 
> default namespace

I understand the wording of that message to be talking about the 
namespace used for xml:space= and xml:lang=, not the namespace for 
XSD.  One isn't allowed to declare the namespace for the "xml:" prefix.

>Who are right?  Is it possible to tickle the schemas so that WTP and/or
>the XSLT converter will accept them?

"Tickle"?  No ... wholesale edit removing the use of the default 
namespace in order to accommodate a buggy validator.

>Is the problem that both the outer schema and the imported schema 
>uses "xmlns="?

It is difficult to understand the "bug emulation mode" of a 
non-conformant processor.

I hope this helps.

. . . . . . Ken

>Thanks!
>
>
>- Steinar
>
>[1] http://www.xml-buddy.com/ValidatorBuddy.htm
>[2] http://www.eclipse.org/webtools/phoenix/webtools/
>[3] http://debeissat.nicolas.free.fr/XSDtoRNG.php


--
Check our site for free XML, XSLT, XSL-FO and UBL developer resources |
Free 5-hour lecture:  http://www.CraneSoftwrights.com/links/video.htm |
Crane Softwrights Ltd.             http://www.CraneSoftwrights.com/x/ |
G. Ken Holman                    mailto: |
Google+ profile:       http://plus.google.com/+GKenHolman-Crane/about |
Legal business disclaimers:     http://www.CraneSoftwrights.com/legal |


---
This email has been checked for viruses by Avast antivirus software.
http://www.avast.com