Altova Mailing List Archives


Problem with schemas and namespaces

From: Martin =?iso-8859-1?Q?H=E4cker?= <spamfaenger@---.-->
To: xmlschema-dev@--.---
Date: 6/25/2004 1:08:00 AM
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

From mhk@m...  Thu Jun 24 22:30:26 2004
Return-Path: <mhk@m...>
X-Original-To: xmlschema-dev@l...
Delivered-To: xmlschema-dev@l...
Received: from dr-nick.w3.org (dr-n

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.