W3C home > Mailing lists > Public > xmlschema-dev@w3.org > September 2000

Re: problems defining namespaces

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 11 Sep 2000 19:09:48 +0100
To: Lindsey McNerney <lindzer1@yahoo.com>
Cc: xmlschema-dev@w3.org
Message-ID: <f5bzoleajgz.fsf@cogsci.ed.ac.uk>
Lindsey McNerney <lindzer1@yahoo.com> writes:

> I've been trying to validate the simple XML doc below
> using the xerces 1.2 parser with the schema also
> listed below.  I keep getting an error stating "type
> not found http://www.w3.org/1999/XMLSchema:Request". 
> Could someone please tell me if/how I'm namespacing
> the document incorrectly?

Not a xerces bug, but your bug.  See examples in the XML Schema Primer [1]
for help.  Your problem is that although you are defining your Request 
type in the http://www.test.org/namespaces namespace, you're referring 
to it as if it were in the http://www.w3.org/1999/XMLSchema
namespace.  The error message above is trying to tell you that.  To
correct this, use 'type = "my:Request"' etc., with a namespace
declaration linking 'my' to 'http://www.test.org/namespaces'.

> XML sample
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <Transaction xmlns = "http://www.test.org/namespaces"
> xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" 
> xsi:schemaLocation= "http://www.test.org/namespaces
> TestTxn.xsd" ReferenceNumber="5000"
> CreationDate="20000101">  
> 	<Request>
> 		<Customer>Jim Smith</Customer>	</Request>			
> </Transaction>
> 
> 
> Sample Schema:
> <?xml version="1.0" encoding="ISO-8859-1"?>
> 
> <schema xmlns = "http://www.w3.org/1999/XMLSchema" 
> targetNamespace = "http://www.test.org/namespaces"
> xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
> xsi:schemaLocation= "http://www.w3.org/1999/XMLSchema 
> http://www.w3.org/1999/XMLSchema.xsd">
>    <element name = "Transaction">
> 	<complexType>
> 		<element name = "Request" type = "Request"/>
> 		<attribute name = "ReferenceNumber" type =
> "lengthEighty" use="required"/>
> 		<attribute name = "CreationDate" type = "dateTime"
> use="required"/>
> 	</complexType>
>      </element> 
>      <complexType name = "Request">
> 	<element name = "Customer" type = "lengthEighty"
> minOccurs = "0" maxOccurs = "1"/>
>      </complexType>
>      <simpleType name = "dateTime" base = "string">
> 	<minLength value = "8"/>
> 	<maxLength value = "14"/>
>      </simpleType>
>      <simpleType name = "lengthEighty" base =
> "string">
> 	<minLength value = "1"/>
> 	<maxLength value = "80"/>
>     </simpleType>
> </schema>

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2001, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/
Received on Monday, 11 September 2000 14:09:50 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:18 GMT