How to correctly import XML namespace

This should cover W3C XML Schema, Relax NG and DTD related problems.
abcoates
Posts: 26
Joined: Fri Mar 24, 2006 7:45 am
Location: London, UK

How to correctly import XML namespace

Post by abcoates » Fri Mar 24, 2006 7:52 am

I couldn't find an earlier post addressing this question. How does oXygen expect the XML namespace to be imported in XML Schemas that use xml:lang, xml:space, etc? I tried

<xs:import namespace="http://www.w3.org/XML/1998/namespace"/>

which works in some tools, but oXygen seems to require

<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="..."/>

where the schemaLocation points to a copy of "xml.xsd". Is there some reason why oXygen requires an explicit schemaLocation for the XML namespace? A quick read of the XML Schema spec didn't make it clear at all what [b]should[/b] be done, so perhaps it's a matter of choice. However, I'm often offline, so I don't want to use a schemaLocation that is on the Web, while at the same time I don't want to pollute my Schemas with references to local copies of "xml.xsd".

What do you recommend?

Cheers, Tony.

george
Site Admin
Posts: 2102
Joined: Thu Jan 09, 2003 2:58 pm

Post by george » Fri Mar 24, 2006 10:53 am

Dear Tony,

oXygen ships in frameworks a version of xml.xsd and the default catalog in oXygen maps the web location (http://www.w3.org/2004/10/xml.xsd) of that schema to this local copy so you should be able to specify in the schema location the remote location and oXygen will use the local copy. This is how I think this kind of problems should be handled, that is use actual remote locations in the files and map them through a catalog to local copies.
The xml.xsd evolved over time, for instance the id attribute was added at some point. If oXygen included an xml.xsd schema built in then users with a previous version of oXygen got at the time when xml.xsd did not contain the id attribute would hahe not been able to refer to xml:id.
There is a more recent version of the xml.xsd available currently, we did not include that because I rememebr at the time we wanted to update it the access to the remote schema was restricted to w3c members only so we left the current schema shich is the previous version of the xml.xsd.

Best Regards,
George

Post Reply