Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 20th, 2005, 08:47 AM
Jorge Ortiz Claver
Guest
 
Posts: n/a
Default How to get more details from validation errors

Hi,

I have to develop an application that is supposed to accept XML data.
I already have defined an XSD schema and validation against it works
properly.

Problem appears when my client, instead of error messages like

"The value 'AAA' of attribute 'code' on element
'comm-response' is not valid with respect to
its type, 'integer'.]"

(SAXException message) would like to receive error information
codified. Client only wants to receive a code for the tag that
produced the error (in this case, we will send a code assigned to tag
'AAA') and line/column information wouldn't be enough for him.

I tried to add a ContentHandler to the parser but it seems like
content-related events are fired before the validation process so I
can't keep control on what part of the XML file is being validated.

Thanks in advanced,
Jorge
  #2  
Old July 20th, 2005, 08:47 AM
Johannes Koch
Guest
 
Posts: n/a
Default Re: How to get more details from validation errors

Jorge Ortiz Claver wrote:[color=blue]
> Problem appears when my client, instead of error messages like
>
> "The value 'AAA' of attribute 'code' on element
> 'comm-response' is not valid with respect to
> its type, 'integer'.]"
>
> (SAXException message) would like to receive error information
> codified. Client only wants to receive a code for the tag that
> produced the error (in this case, we will send a code assigned to tag
> 'AAA') and line/column information wouldn't be enough for him.[/color]

In case you are using Xerces, you can overwrite the
XMLSchemaMessages.properties file. Bit of a hack, but it might work for you.
--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
  #3  
Old July 20th, 2005, 08:47 AM
Jorge Ortiz
Guest
 
Posts: n/a
Default Re: How to get more details from validation errors

Thanks,

Good shoot! It doesn't fullfit all my requirements but it's a lot more
than I expected.

Trying to go further, is there any way to do it without hacking the
Xerces jar package ... let's say a multi-language configuration or
something like that?

Thanks again
Jorge



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #4  
Old July 20th, 2005, 08:47 AM
Jorge Ortiz
Guest
 
Posts: n/a
Default Re: How to get more details from validation errors

Thanks,

Good shoot! It doesn't fullfit all my requirements but it's a lot more
than I expected.

Trying to go further, is there any way to do it without hacking the
Xerces jar package ... let's say a multi-language configuration or
something like that?

Thanks again
Jorge


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #5  
Old July 20th, 2005, 08:47 AM
Johannes Koch
Guest
 
Posts: n/a
Default Re: How to get more details from validation errors

Jorge Ortiz wrote:[color=blue]
> Trying to go further, is there any way to do it without hacking the
> Xerces jar package ... let's say a multi-language configuration or
> something like that?[/color]

You can add XMLSchemaMessage_foo.properties and set the language to 'foo'.
--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles