Hi Guillaume, Which API are you using and did you register an error handler?
The default error handler for a JAXP Validator is defined as:? class DraconianErrorHandler implements ErrorHandler { public void fatalError( SAXParseException e ) throws SAXException {? throw e; } public void error( SAXParseException e ) throws SAXException { throw e; } public void warning( SAXParseException e ) throws SAXException { // noop } } If you're using this API and didn't supply your own error handler, the validator will always stop on the first error. Thanks. [1] http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/validation/Validator.html#setErrorHandler (org.xml.sax.ErrorHandler) Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: mrgla...@ca.ibm.com E-mail: mrgla...@apache.org guillaume.desh...@gmail.com wrote on 05/21/2010 05:13:25 AM: > Hi > > I am facing exactly the issue reported by this oxygen user : http:// > www.oxygenxml.com/forum/topic2869.html?sid=a4b044cdcc3c06ae07059f924156f6d3 > When using several keyrefs causing errors, Xerces reports only the > first and then gives up. > > I would really like to have Xerces report all foreign key errors, > like I've seen with the saxon or libXml parsers. Is there a way to do that ? > > I've done a few hours of search and I've read that it is a fatal > error to Xerces and that's why it stops. I've tried to set continue- > after-fatal-error to true but it didn't change anything ; anyway > I've read that it's not recommended to set this option in a > production environment. > > I'm joining a sample XML and XSD files that show my problem. In my > example, each ASSREGARD references a ASSFILDO, I've created two bad > ASSREGARD that reference non-existent ASSFILDO. Then Xerces reports only : > Description: [Xerces] cvc-identity-constraint.4.3: Key > 'FK_ASSFILDOREGARD' with value 'non-existent1' not found for > identity constraint of element 'FeatureCollection'. > URL: http://www.w3.org/TR/xmlschema-1/#cvc-identity-constraint > > Instead of this I would like it to report both errors, on non- > existent1 and non-existent2. Thank you very much for any support ! > > Regards, Guillaume > > Here are the two files : > > ----> keyrefDemo.xml > > <?xml version="1.0" encoding="UTF-8"?> > > <glml:FeatureCollection > xmlns:gml="http://www.opengis.net/gml" > xmlns:glml="http://www.grandlyon.com/glml" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://www.grandlyon.com/glml ./keyrefDemo.xsd" > > > <glml:ASSFILDO> > <glml:IID_IDENTFILDO>28532</glml:IID_IDENTFILDO> > </glml:ASSFILDO> > > <glml:ASSREGARD> > <glml:IID_IDENTREGARD>23797</glml:IID_IDENTREGARD> > <glml:IID_ASSFILDO>28532</glml:IID_ASSFILDO> > </glml:ASSREGARD> > > <glml:ASSREGARD> > <glml:IID_IDENTREGARD>bad1</glml:IID_IDENTREGARD> > <glml:IID_ASSFILDO>non-existent1</glml:IID_ASSFILDO> > </glml:ASSREGARD> > > <glml:ASSREGARD> > <glml:IID_IDENTREGARD>bad2</glml:IID_IDENTREGARD> > <glml:IID_ASSFILDO>non-existent2</glml:IID_ASSFILDO> > </glml:ASSREGARD> > > </glml:FeatureCollection> > > > -----> keyrefDemo.xsd > > <?xml version="1.0" encoding="UTF-8" ?> > <schema targetNamespace="http://www.grandlyon.com/glml" xmlns:glml=" > http://www.grandlyon.com/glml" > xmlns:xlink="http://www.w3.org/1999/xlink" > xmlns="http://www.w3.org/2001/XMLSchema" > elementFormDefault="qualified" version="0.9"> > > <!-- element --> > <element name="FeatureCollection"> > <complexType> > <sequence> > > <element name="ASSFILDO" maxOccurs="unbounded" > > <complexType> > <sequence> > <element name="IID_IDENTFILDO" type="string" /> > </sequence> > </complexType> > </element> > > <element name="ASSREGARD" maxOccurs="unbounded" > > <complexType> > <sequence> > <element name="IID_IDENTREGARD" type="string" /> > <element name="IID_ASSFILDO" type="string" /> > </sequence> > </complexType> > </element> > > </sequence> > </complexType> > > <key name="PK_ASSFILDO"> > <selector xpath="glml:ASSFILDO"/> > <field xpath="glml:IID_IDENTFILDO"/> > </key> > > <key name="PK_ASSREGARD"> > <selector xpath="glml:ASSREGARD"/> > <field xpath="glml:IID_IDENTREGARD"/> > </key> > > <keyref name="FK_ASSFILDOREGARD" refer="glml:PK_ASSFILDO"> > <selector xpath="glml:ASSREGARD"/> > <field xpath="glml:IID_ASSFILDO"/> > </keyref> > > </element> > > </schema>