Change the namespace in your schema and xml file to
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; instead of
xmlns:xsd="http://www.w3.org/2000/10/XMLSchema";

this is the new namespace for xerces 1.4.0.






-----Original Message-----
From: Martin Farrell [mailto:[EMAIL PROTECTED]
Sent: Friday, June 22, 2001 12:34 PM
To: [EMAIL PROTECTED]
Subject: General Schema Error problem


Hi

At the risk of looking really stupid but I am having a problem validating
the following xml file using this xml schema.

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://www.schemaValid.com/s1ns";
xmlns:xsd="http://www.w3.org/2000/10/XMLSchema";
xmlns:s1="http://www.schemaValid.com/s1ns"; elementFormDefault="qualified">
        <xsd:element name="root">
                <xsd:complexType>
                        <xsd:sequence>
                                <xsd:element name="grade" type="s1:abc"/>
                        </xsd:sequence>
                </xsd:complexType>
        </xsd:element>
        <xsd:simpleType name="abc">
                <xsd:restriction base="xsd:string">
                        <xsd:enumeration value="a"/>
                        <xsd:enumeration value="b"/>
                        <xsd:enumeration value="c"/>
                </xsd:restriction>
        </xsd:simpleType>
</xsd:schema>


<?xml version="1.0" encoding="UTF-8"?>
<root xmlns="http://www.schemaValid.com/s1ns";
xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance";
xsi:schemaLocation="http://www.schemaValid.com/s1ns
D:\Xerces-J-bin.1.4.0\xerces-1_4_0\data\slns.xsd">
<grade>a</grade>
</root>

nb - the Schema definitely exists in that directory

The parser generates the following errors

[Error] Untitled2.xml:3:66: General Schema Error: Grammar with uri 2:
http://www.schemaValid.com/s1ns , can not be found.
[Error] Untitled2.xml:3:66: Element type "root" must be declared.
[Error] Untitled2.xml:4:9: Element type "grade" must be declared.

And I have the following features set -

parser.setFeature("http://xml.org/sax/features/validation";, true);
parser.setFeature("http://xml.org/sax/features/namespaces";, true);
parser.setFeature("http://apache.org/xml/features/validation/schema";, true);
parser.setFeature("http://apache.org/xml/features/validation/schema-full-che
cking", true);
parser.setFeature("http://apache.org/xml/features/continue-after-fatal-error
", true);

I would very much appreciate some help as to where the error lies

thanks

Martin


----------------------------------------------------------------------------
----
The information in this email is intended only for the addressee(s) named
above.
Access to this email by anyone else is unauthorised.
If you are not the intended recipient of this message any disclosure,
copying,
distribution or any action taken in reliance on it is prohibited and may be
unlawful.

Emap plc and or its subsidiaries do not warrant that any attachments are
free from
viruses or other defects and accept no liability for any losses resulting
from
infected email transmissions.

Please note that any views expressed in this email may be those of the
originator
and do not necessarily reflect those of this organisation.
----------------------------------------------------------------------------
----

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to