Help please...How to import a schema with a different namespace?

I

Ingrid

I am looking to incorporate Schema 1 (below) into Schema 2, using the
<import> element. But I just can't figure out how to declare the in:
namespace prefix/use targetNamespace correctly - for both Schemas...

Any ideas? Please put me out of my misery - somebody...

As soon as I add the targetNamespace="http://num/in"> in Schema 1 both
Schemas throw up the following error message:

Error resolving component 'numType'. It was detected that 'numType'
has no namespace, but components with no target namespace are not
referenceable from schema document "Schema 1". If 'numType' is
intended to have a namespace, perhaps a prefix needs to be provided.
If it is intended that 'numType' has no namespace, then an 'import'
without a "namespace" attribute should be added to "Schema 1".

Schema 2:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema elementFormDefault="qualified"
attributeFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:in="http://num/in">
<xs:import namespace="http://num/in"
schemaLocation="Num.xsd"></xs:import>
<xs:element name="num">
<xs:complexType>
<xs:sequence>
<xs:element ref="in:num"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>


Schema 1:
<in:schema xmlns:in="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://num/in">
<in:element name="num" type="numType"></in:element>
<in:complexType name="numType">
<in:simpleContent>
<in:extension base="pageRange">
<in:attribute name="type" use="required">
<in:simpleType>
<in:restriction base="in:string">
<in:enumeration
value="pagerange"></in:enumeration>
</in:restriction>
</in:simpleType>
</in:attribute>
</in:extension>
</in:simpleContent>
</in:complexType>
<in:simpleType name="pageRange">
<in:restriction base="in:string">
<in:minLength value="3"></in:minLength>
<in:maxLength value="7"></in:maxLength>
<in:pattern value="\d{1,3}-\d{1,3}"></in:pattern>
</in:restriction>
</in:simpleType>
</in:schema>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top