RE: Problem with schemas and namespaces

Your schema contains a type named topology:resource, but no element named
topology:resource.

Saxon's error message is:

Error on line 16 of file:/c:/temp/sla.xsd:
  Element <topology:resource> is referenced, but has not been declared
Schema processing failed: The schema is invalid

Michael Kay 

> -----Original Message-----
> From: xmlschema-dev-request@w3.org 
> [mailto:xmlschema-dev-request@w3.org] On Behalf Of Martin Häcker
> Sent: 24 June 2004 22:08
> To: xmlschema-dev@w3.org
> Subject: Problem with schemas and namespaces
> 
> 
> Hi there,
> 
> we are getting some strange errors from xerxes 2.6.1 when we try to 
> validate an xml against two schemas.
> 
> The error we get is: "Error on line 15 of document 
> file:schemas/sla.xsd: src-resolve: Cannot resolve the name 
> 'topology:resource' to a(n) 'element declaration' component."
> 
> The relevant schemas are these:
> 
> --- topology.xsd ---
> <?xml version="1.0"?>
> <xs:schema
> 	xmlns:xs="http://www.w3.org/2001/XMLSchema"
> 	targetNamespace="urn:vrm-topology"
> 	xmlns="urn:vrm-topology"
> 	elementFormDefault="qualified"
> 	attributeFormDefault="unqualified">
> 
> 	<xs:element name="topology" type="topology"/>
> 
> 	<xs:complexType name="topology">
> 		<xs:sequence>
> 			<xs:element name="adcInfo" type="adcInfo" />
> 			<xs:element name="parent" type="xs:string" />
> 			     <!-- TODO: soll das hier ein richtiger 
> Verweis sein? //-->
> 			<xs:element name="resource" type="resource" 
> minOccurs="0" maxOccurs="unbounded" />
> 			<xs:element name="topology" type="topology" 
> minOccurs="0" maxOccurs="unbounded" />
> 		</xs:sequence>
> 	</xs:complexType>
> 
> 
> 	<xs:complexType name="adcInfo">
> 			<xs:sequence>
> 				<xs:element name="clusterName" 
> type="xs:string" />
> 				<xs:element name="url" 
> type="xs:anyURI" />
> 			</xs:sequence>
>              <xs:attribute name="id" type="id" use="required" />
> 	</xs:complexType>
> 
> 
> 	<xs:complexType name="resource">
> 			<xs:sequence>
> 				<xs:element name="earliestStart" 
> type="xs:date" />
> 				<xs:element name="deadline" 
> type="xs:date" />
> 				<xs:element name="duration" 
> type="xs:duration" />
> 				<xs:choice>
> 					<xs:element name="nodes" 
> type="nodes" />
> 					<xs:element name="network" 
> type="network" />
> 				</xs:choice>
> 			</xs:sequence>
> 	</xs:complexType>
> 
> 
> 	<xs:simpleType name="id">
> 		<xs:restriction base="xs:decimal" />
> 		<!-- Wie auf zehn Stellen begrenzen? -->
> 	</xs:simpleType>
> 
> 	<xs:complexType name="nodes">
> 		<xs:attribute name="amount" type="xs:positiveInteger" 
> use="required" />
> 		<xs:attribute name="architecture" use="required">
> 			<xs:simpleType>
> 				<xs:restriction base="xs:string">
> 					<xs:enumeration value="x86" />
> 					<xs:enumeration 
> value="PowerPC" />
> 					<xs:enumeration value="Alpha" />
> 					<xs:enumeration 
> value="Opteron" />
> 					<xs:enumeration value="ia64" />
> 					<xs:enumeration 
> value="Nokia NGage" />
> 					<xs:enumeration value="GBA" />
> 					<xs:enumeration value="680x0" />
> 				</xs:restriction>
> 			</xs:simpleType>
> 		</xs:attribute>
> 	</xs:complexType>
> 
> 	<xs:complexType name="network">
> 		<xs:attribute name="bandwidth" 
> type="xs:positiveInteger" use="required" />
> 		<xs:attribute name="latency" 
> type="xs:positiveInteger" />
> 	</xs:complexType>
> 
> </xs:schema>
> 
> --- sla.xsd ---
> <?xml version="1.0"?>
> <xs:schema
> 	targetNamespace="urn:vrm-sla"
> 	xmlns:xs="http://www.w3.org/2001/XMLSchema"
> 	xmlns="urn:vrm-sla"
>      xmlns:topology="urn:vrm-topology"
> 	elementFormDefault="qualified"
> 	attributeFormDefault="unqualified">
> 
>      <xs:import namespace="urn:vrm-topology" 
> schemaLocation="topology.xsd"/>
> 
> 	<xs:element name="sla">
> 		<xs:complexType>
> 			<xs:sequence>
>                  	<xs:element ref="topology:resource" 
> maxOccurs="unbounded" />
> 				<xs:element name="price" 
> type="xs:decimal" />
> 				<xs:element name="fine" 
> type="xs:decimal" />
> 				<xs:element name="provider" 
> type="party" />
> 				<xs:element name="client" 
> type="party" />
>                  <xs:element name="id" type="topology:id" />
> 			</xs:sequence>
>              <xs:attribute name="id" type="topology:id" 
> use="required" />
> 		</xs:complexType>
> 	</xs:element>
> 
> 
> 	<xs:complexType name="party">
> 		<xs:sequence>
> 			<xs:element name="name" type="xs:string" />
> 			<xs:element name="email" type="xs:string" />
> 		</xs:sequence>
>          <xs:attribute name="id" type="topology:id" use="required" />
> 	</xs:complexType>
> 
> </xs:schema>
> 
> --- end ---
> 
> This problem seems to me as if xerxes cannot find the implementation 
> topology.xsd, but I cannot understand this. I tried "topology.xsd" as 
> the path (the files are in the same directory, I also tried a "file:" 
> prefix, I tried absolute paths, urls to a local webserver and 
> whatever I could imagine - same result.
> 
> Though whatever manual/howto I read, they always seem to suggest that 
> declaring the namespace, importing them with xs:import and then just 
> using it - is the right solution to the problem. :(
> 
> I gather that this is some really simple problem - as it always is 
> when I get something wrong, but with three people staring at this for 
> two days now we just don't get any further, plus searching the web 
> didn't bring up anything that made us see the errors of our ways.
> 
> Thanks for any reply,
> cu Martin
> 
> p.s.: Sorry if this is the wrong list, but I found  what I Think may 
> be a related problem on this list, so I thought this should be ok. 
> Sorry if I'm wrong. Reference: 
> http://lists.w3.org/Archives/Public/xmlschema-dev/2001Dec/0216.html
> -- 
> dont.wanna.tell
> [ot]coder - hehe
> 
> 

Received on Thursday, 24 June 2004 22:30:26 UTC