I have it fixed .

 

I had the contentHandler set and not ErrorHandler

setErrorHandler was what I missed.

 

-----Original Message-----
From: Kiran Bhumana
Sent:
Thursday, January 09, 2003 4:00 PM
To: [EMAIL PROTECTED]
Subject: error handling in schema validation

 

 

I am trying to trap the errors being printed to the screen, during validation by

overwriting the methods of the import org.xml.sax.helpers.DefaultHandler;.

 

The errors look like this, but they don’t seem to be going through the apis

Such as,

    public void error (SAXParseException e)

            throws SAXException

    {

            System.out.println ("in error ");

            errorStringList.append(e.toString());

    }

   

public void fatalError (SAXParseException e)

            throws SAXException

    {

            System.out.println ("in Fatal error ");

            errorStringList.append(e.toString());

            //          throw e;

    }

 

the errors printed onto the screen are, 

 

shiporder

orderperson

[Error] shiporder.xml:6:9: cvc-complex-type.2.4.a: Invalid content starting with elem

ent 'name'. The content must match '(("":orderperson),("":shipto),("":item){1-UNBOUND

ED})'.

name

address

city

country

[Fatal Error] shiporder.xml:10:4: The element type "shiporder" must be terminated by

the matching end-tag "</shiporder>".

org.xml.sax.SAXParseException: The element type "shiporder" must be terminated by the

 matching end-tag "</shiporder>".

 

 

What am I missing something here ?

 

Thank you,

Kiran B.

 

Reply via email to