Importing local schema
Posted: 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="http://www.w3.org/2001/XMLSchema"
xmlns:s0="urn:schemas:device:local"
targetNamespace="urn:schemas:device:local"
elementFormDefault="qualified">
<s:complexType name="TESTING">
<s:sequence>
<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"/>
</s:complexType>
</s:schema>
extension :
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:ns1="urn:schemas:device:local2"
targetNamespace="urn:schemas:device:local2"
elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:local="urn:schemas:device:local">
<xs:import namespace="urn:schemas:device:local"
schemaLocation="urn:schemas:device:local
./local.xsd"/>
<xs:complexType name="DeviceDescription">
<xs:complexContent>
<xs:extension base="local:DEVICE_INFO_TYPE">
<xs:sequence>
<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"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
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'.
URL: http://www.w3.org/TR/xmlschema-1/#src-resolve
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.
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="http://www.w3.org/2001/XMLSchema"
xmlns:s0="urn:schemas:device:local"
targetNamespace="urn:schemas:device:local"
elementFormDefault="qualified">
<s:complexType name="TESTING">
<s:sequence>
<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"/>
</s:complexType>
</s:schema>
extension :
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:ns1="urn:schemas:device:local2"
targetNamespace="urn:schemas:device:local2"
elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:local="urn:schemas:device:local">
<xs:import namespace="urn:schemas:device:local"
schemaLocation="urn:schemas:device:local
./local.xsd"/>
<xs:complexType name="DeviceDescription">
<xs:complexContent>
<xs:extension base="local:DEVICE_INFO_TYPE">
<xs:sequence>
<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"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
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'.
URL: http://www.w3.org/TR/xmlschema-1/#src-resolve
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.