W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2004

Re: ERROR With XML Schema

From: Curt Arnold <carnold@houston.rr.com>
Date: Fri, 23 Jan 2004 08:17:56 -0600
Message-Id: <F09FA71C-4DAE-11D8-812E-000393B97126@houston.rr.com>
Cc: xmlschema-dev@w3.org
To: Ferrari GIanni <Ferrari.gi@apss.tn.it>

On Jan 23, 2004, at 4:37 AM, Ferrari GIanni wrote:

> [Error] InvoiceXML.xml:1:174: cvc-elt.1: Cannot find the declaration 
> of element 'Invoice'.
> What kind of error is it? What does error mean?

The error code is defined in 
http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#cvc-elt (reason 1). 
  Basically, it looked for a definition of Invoice and could not find 
> XML Model:
> <Invoice xsi:schemaLocation="http://your_namespace 
> file://C:\Lavoro\Java\xerces-2_6_0\data\InvoiceXML.xsd" 
> xmlns="http://your_namespace" 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
> DocType="Delete">
>             <DocumentSender>
>                         <Company LegalName=""....
> How I can have a namespace? Can I try one for default?

The second entry in the xsi:schemaLocation is not a valid URI since it 
contains backslashes which are prohibited.  I also believe it should 
have three initial slashes.  RFC 2606 
(http://www.rfc-editor.org/rfc/rfc2606.txt) defines classes of URI's 
that can be used for testing and examples, so you could use 
http://ferrari.glanni.example/2004-01-23/invoice as a namespace

> XML Schema:
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <xsd:element name="Invoice">
> <xsd:complexType>
> <xsd:sequence>.........
> .........

This is missing a targetNamespace attribute and default namespace 

> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"

The targetNamespace defines the namespace in which the definitions 
appear, xmlns causes references without namespace prefixes to be 
interpreted as being links within the same namespace so <element 
ref="Company"/> will be interpreted as a reference to Company element 
in the "http://your_namespace" namespace.
Received on Friday, 23 January 2004 09:24:07 GMT

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