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

RE: Replace the error during the Validation

From: Michael Kay <mhk@mhk.me.uk>
Date: Fri, 6 Feb 2004 11:26:44 -0000
To: "'Ferrari GIanni'" <Ferrari.gi@apss.tn.it>, <xmlschema-dev@w3.org>
Message-ID: <000901c3eca4$19f0f7c0$6401a8c0@pcukmka>
This rather depends on the product you are using, which you haven't told
us.
 
Michael Kay

-----Original Message-----
From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org]
On Behalf Of Ferrari GIanni
Sent: 06 February 2004 10:22
To: xmlschema-dev@w3.org
Subject: 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 06:26:29 GMT

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