W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2004

Replace the error during the Validation

From: Ferrari GIanni <Ferrari.gi@apss.tn.it>
Date: Fri, 6 Feb 2004 11:21:55 +0100
Message-ID: <D11D57B75A3CD411BF7F00E018C3356F018C0AD1@NTGEN05>
To: xmlschema-dev@w3.org
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:41 GMT