• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to get the error code of xml validation error ?  RSS feed

 
Sachin Kumar Khandelwal
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm validating an xml document against a schema, using javax.xml.validation.Validator .

It generates a SAXException when the document is invalid.
It displays the error code (such as cvc-attribute) in the message of exception .
But i need the error code in the program.
is there any way to get the generated error code.

Thanks in advance.

Sachin
 
Choon-Chern Lim
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes....

You need to create a valid validator handler for that which basically extends DefaultHandler.
 
Choon-Chern Lim
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Sachin Kumar Khandelwal
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mike,

Thanks

The code in the url will give me the complete message, includes the error code and the description (handler.saxParseException.getMessage()) .

but i only want the error code (not the message or description).

Sachin
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to XML...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!