Importing local schema

This should cover W3C XML Schema, Relax NG and DTD related problems.
Posts: 2
Joined: Thu Jul 07, 2005 12:55 am

Importing local schema

Post by rwaltz » Thu Jul 07, 2005 1:11 am

Newbie question here.

I'm trying to extend an element in an existing schema in the following way (I've snipped what I've thought is pertinent and changed some names to protect the innocent) :

existing schema :

<?xml version="1.0" encoding="UTF-8"?>
<s:schema xmlns:s=""

<s:complexType name="TESTING">
<s:element name="serial-number" type="s:anyURI"/>
<s:element name="modelname" type="s:string"/>
<s:element name="location" type="s:string"/>
<s:element name="mac_address" type="s:string"/>

extension :

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:ns1="urn:schemas:device:local2"

<xs:import namespace="urn:schemas:device:local"

<xs:complexType name="DeviceDescription">
<xs:extension base="local:DEVICE_INFO_TYPE">
<xs:element name="DeviceName" type="xs:string"/>
<xs:element name="EventSink" type="xs:anyURI"/>
<xs:element name="VersionNumber" type="xs:string"/>
<xs:element name="ServiceMode" type="xs:boolean"/>

I get the following error :

SystemID: Z:\XXX\XML\local2.xsd
Location: 12:46
Description: E src-resolve.4.2: Error resolving component 'local:DEVICE_INFO_TYPE'. It was detected that 'local:DEVICE_INFO_TYPE' is in namespace './local.xsd', but components from this namespace are not referenceable from schema document 'file:/Z:/XXX/XML/local2.xsd'. If this is the incorrect namespace, perhaps the prefix of 'local:DEVICE_INFO_TYPE' needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added to 'file:/Z:/XXX/XML/sharplocal.xsd'.

So, it looks like my import tag is not correct. The schema name and the path are correct, what am I missing? Both files reside in the same directory - I haven't exposed these via a website because I'm just doing local development and didn't think I needed to.

Thanks for any advice.

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

Post by george » Thu Jul 07, 2005 9:10 am

<xs:import namespace="urn:schemas:device:local"
The schema location in case of an import does not take as value a list of pairs or a pair of the forma namespace followed by location as it is the case with xsi:schemaLocation. You already have the namespace specified in the namespace attribute, you need to specify only the location in the schemaLocation attribute:

Code: Select all

<xs:import namespace="urn:schemas:device:local"
Best Regards,

Posts: 2
Joined: Thu Jul 07, 2005 12:55 am


Post by rwaltz » Thu Jul 07, 2005 7:43 pm

That did it. Thank you.

Post Reply