Re: XML Schema Implementation

Hi Srinivas,

> not getting how to validate my xml file against the schema. Used
> apache parser which supports W3C schema. Getting the following
> error.
>
> Recoverable Error: Attribute "xsd:noNamespaceSchemaLocation" must be
> declared for element type "SupplierInvoice".
> (file:///C:/binusha/SupplierInvoice.xml:10,51) SupplierInvoice
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
> seems to be problem with directing the location of xsd file to the
> xml file.

It could be that the URL that you're using in the
xsi:noNamespaceSchemaLocation attribute can't be resolved properly.
Since the XML instance and schema are in the same directory, rather
than use the absolute URL, try using a relative URL:

<SupplierInvoice xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:noNamespaceSchemaLocation="finalSchema.xsd">
...
</SupplierInvoice>

Or try changing the path that you use into a proper URL:

<SupplierInvoice xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="file:///C:/binusha/finalSchema.xsd">
...
</SupplierInvoice>

Alternatively, perhaps Xerces was objecting to the fact that it
couldn't find an element declaration for the SupplierInvoice element.
Try adding:

<xsd:element name="SupplierInvoice" type="SupplierInvoiceType" />

at the top level of the schema.

With this added, XSV throws up some other errors in the schema, such
as the fact that you're using the maxLength facet on various numerical
data types where it's not permitted. It might be that you have to
correct those as well, in case Xerces is actually complaining about
the validity of the schema.

I hope that you manage to get it working,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Received on Friday, 21 September 2001 06:06:00 UTC