

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


<excerpt><bold><fontfamily><param>Arial</param><color><param>FFFF,0000,0000</param><x-tad-bigger>[Error]
InvoiceXML.xml:1:174: cvc-elt.1: Cannot find the declaration of
element 'Invoice'.</x-tad-bigger></color></fontfamily></bold>

<fontfamily><param>Arial</param><x-tad-bigger>What kind of error is
it? What does error mean?</x-tad-bigger></fontfamily>


</excerpt>

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 one.

<excerpt>

<bold><fontfamily><param>Arial</param><x-tad-bigger>XML Model:</x-tad-bigger></fontfamily></bold>


<fontfamily><param>Arial</param><x-tad-bigger> </x-tad-bigger></fontfamily>


<fontfamily><param>Arial</param><x-tad-bigger><<Invoice
xsi:schemaLocation="http://your_namespace
file://</x-tad-bigger><x-tad-bigger>C:\Lavoro\Java\xerces-2_6_0\data\InvoiceXML</x-tad-bigger><x-tad-bigger>.xsd"
xmlns="http://your_namespace"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" DocType="Delete"></x-tad-bigger></fontfamily>


<fontfamily><param>Arial</param><x-tad-bigger>           
<<DocumentSender></x-tad-bigger></fontfamily>


<fontfamily><param>Arial</param><x-tad-bigger>                       
<<Company LegalName=""....</x-tad-bigger></fontfamily>



<fontfamily><param>Arial</param><x-tad-bigger>How I can have a
namespace? Can I try one for default?</x-tad-bigger></fontfamily>


</excerpt>

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



<excerpt><bold><fontfamily><param>Arial</param><x-tad-bigger>XML
Schema:</x-tad-bigger></fontfamily></bold>


<fontfamily><param>Arial</param><x-tad-bigger><<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"></x-tad-bigger></fontfamily>


<fontfamily><param>Arial</param><x-tad-bigger><<xsd:element
name="Invoice"></x-tad-bigger></fontfamily>


<fontfamily><param>Arial</param><x-tad-bigger><<xsd:complexType></x-tad-bigger></fontfamily>


<fontfamily><param>Arial</param><x-tad-bigger><<xsd:sequence>.........</x-tad-bigger></fontfamily>


<fontfamily><param>Arial</param><x-tad-bigger>.........

</x-tad-bigger></fontfamily></excerpt>

This is missing a targetNamespace attribute and default namespace
declaration


<excerpt><fontfamily><param>Arial</param><x-tad-bigger><<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"

</x-tad-bigger></fontfamily></excerpt>                              
targetNamespace="http://your_namespace"

                              xmlns="http://your_namespace">


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.


