This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Get specific error message in xml validation with xsd Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Get specific error message in xml validation with xsd" Watch "Get specific error message in xml validation with xsd" New topic
Author

Get specific error message in xml validation with xsd

shiva kumar g
Greenhorn

Joined: Jun 08, 2010
Posts: 8
Hi,

I am using XSD schema to validate the XML String. I am able to validate the XML against XSD schema, but while validating the XML i am getting the SAXException messages as below

cvc-maxExclusive-valid: Value '23123132321323123123213' is not facet-valid with respect to maxExclusive '999999999999999' for type 'MerchantTrackIdType'.
cvc-type.3.1.3: The value '23123132321323123123213' of element 'MerchantTrackId' is not valid.

Here i am implementing the ErrorHandler(MyErrorHandler) class and getting the above exception messages. But to give exact error response to out i wish to get the only
The value '23123132321323123123213' of element 'MerchantTrackId' is not valid.



I googled out for getting the only cvc-type message from SAXException, Please help me in this regards if you found any solution.

Thanks in advance.
shiva kumar g
Greenhorn

Joined: Jun 08, 2010
Posts: 8
Hi,

Anyone please help me for the above issue. I am still working/searching on the same but no use. Any solutions for the same is greatly appreciated.

Thanks.
g tsuji
Ranch Hand

Joined: Jan 18, 2011
Posts: 499
    
    3
The bare minimal to establish the "localized message" from within the ErrorHandler can be this (or some variants you can think of).

You can conceive a scheme to collect and to store the messages from within the handler and construct a method (called getLocalizedMessage() or whatever) to return the complete messages to the caller. It is up to you to do.
shiva kumar g
Greenhorn

Joined: Jun 08, 2010
Posts: 8
Hi g tsuji,

Thanks for your reply. I will try to get resolve my issue.

 
jQuery in Action, 2nd edition
 
subject: Get specific error message in xml validation with xsd
 
Similar Threads
How to turn on Xerces validation? Help!!!
Writing errors to file (HELP)
SAX XSD Validation. Error callback is called twice.
XML validation question
all validation error using saxParser