Replace the error during the Validation

Good morning people,

I have a problem during the validation of XML Schema. I created voluntarily
an error in my XML Document so to control if my parser signed it. All was
ok, but I'm not able to capture the exception. The voluntarily error is: 

 

[Error] InvoiceXML.xml:22:62: cvc-datatype-valid.1.2.1: '' is not a valid
value for 'integer'.

[Error] InvoiceXML.xml:22:62: cvc-attribute.3: The value '' of attribute
'CAB' on element 'BankingEnds' is not valid with respect to its type,
'integer'.

 

And I would like to replace it with an easy new message like it:

 

   Error: the attribute integer have to contain zero. 

 

Now in my java code I wrote: 

 

try{

   parser.parse(file);

}catch (SAXException e){

  System.out.println(e);

}catch (IOException e){

  System.err.println(e);

}catch (Exception e){

  System.err.println(e);

}

 

I looked that when i have the error my code doesn't entry in that catch.
What is the correct exception?

Probably this isn' the correct environment to write java problem, but the
problem depend from XML DOCUMENT.

Please someone can help me. Thank you so much.

Regards from Italy

 

                 Gianni

Received on Friday, 6 February 2004 05:21:13 UTC