*********************************************************************
* Scottish Equitable plc *
* Registered Office: Edinburgh Park, Edinburgh EH12 9SE. *
* Regulated by the Personal Investment Authority. *
* A member of the Scottish Equitable Marketing Group. *
*********************************************************************
I had a nightmare with this as well - perhaps the 'Schema' page of the Xerces
documentation could be made clearer on this point?. I found that as well as
Arup's recommendation below I had to set the following four features on my
parser (one more than in your example):
parser.setFeature("http://xml.org/sax/features/validation", true);
parser.setFeature("http://apache.org/xml/features/validation/schema",
true); //if false will do DTD validation instead
parser.setFeature("http://apache.org/xml/features/validation/dynamic",
false); //if true won't validate at all
parser.setFeature("http://xml.org/sax/features/namespaces", true);
//default is true anyway but doesn't hurt to set it explicitly
Then validation against schema worked fine.
However for some reason this /works/ with xerces.jar from Xerces 1.3 but NOT
with Xerces 1.4, where the above settings simply lead to the parser trying to
do DTD validation.
If anyone could help me with this I'd be grateful.
cameron smith
[EMAIL PROTECTED] on 19/06/2001 12:06:13 AM
Please respond to [EMAIL PROTECTED]@INTERNET
To: [EMAIL PROTECTED]@INTERNET
cc:
Subject: RE: Validation against Schema
If you used XML Spy 3.5 or earlier to write your schema make sure that it
uses the may 2001 recommendation:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
and not
<xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema" > which is the
default. That should solve your problem.
cheers,
Arup Barat
-----Original Message-----
From: Willy Ching [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 18, 2001 5:23 AM
To: [EMAIL PROTECTED]
Subject: Validation against Schema
Hello all,
I just like my xml file to be validated against the schema, I create
the schema
using XML Spy, so I use the ff code:
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);
but my error handler returns :Error] processed.xml:64:11: Element type
"B0022"
must be declared
I'm using xerces 1.4. I try to use Samples/SAX2Count.java but the same
error
occur.
Can somebody help me? Thanks!
---------------------------------------------------------------------
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]
______________________________________________________________________
EMAIL DISCLAIMER
This message is for the intended recipient only. It may contain confidential
or proprietary information. If you receive this message in error, please
immediately delete it, destroy all copies of it and notify the sender.
You must not use or disclose any part of this message if you are not the
intended recipient. We may monitor all Email communication through our
networks.
If you contact us by Email, we may store your name and address to
facilitate communication.
Any views expressed in this message are those of the individual sender,
except where the message states otherwise.
We take reasonable precautions to ensure our Emails are virus free.
However, we cannot accept responsibility for any virus transmitted by us
and recommend that you subject any incoming Email to your own virus
checking procedures.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]