The important thing is to ensure that your error handler doesn't throw an exception from any of its methods.

Phil :n.

On Fri, 2004-05-28 at 14:54, Jason Thorpe wrote:
Anyone have any hints on how to get ALL errors/warnings while doing
schema validation? (Not just the first error)

I've tried using xerces SAX and DOM parsers like this, but I only get
the first error, then it stops reporting them.

I've tried setting the feature
"http://apache.org/xml/features/continue-after-fatal-error" to true,
which didn't help. Only works for fatal errors I guess...

import org.apache.xerces.parsers.SAXParser;
import org.apache.xerces.parsers.*;

public class SchemaValidator{
	public static void main(String[] args) {
		try{
			
			MyErrorHandler eh = new MyErrorHandler();
			MyContentHandler ch = new MyContentHandler();
		
			XMLGrammarCachingConfiguration config = new
XMLGrammarCachingConfiguration();
	
config.setFeature("http://apache.org/xml/features/continue-after-fatal-e
rror",true);
			SAXParser sp = new SAXParser(config);
			sp.setErrorHandler( eh );
			sp.setContentHandler( ch );
			
			sp.parse("path to my doc...");
			
		} catch( Exception ex ){
			System.out.println(ex.toString());
		}
	}
}



I was able to get multiple DTD validation errors via JAXP (using
crimson) but that doesn't help because all of our XML doc specs are in
Schema...

Is there any hope for me?

Thanks

-jt->

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Phil Weighill-Smith <[EMAIL PROTECTED]>
Volantis Systems

Reply via email to