I am parsing the XML using commons digester, xsd and a digester rules.
I want to identify sepcific error conditions in the input xml -
For e.g. - error case 1 - the length of the data in a particular tag is greater than the one in the xsd xs:pattern pattern for that tag
error case 2 - the data in a particular tag contains characters that are invalid as per the xs:pattern pattern for that tag
The parse method throws exception for these error. The saxException.getMessage() method returns the same message (of the format <error code>:<description>)for both of the above cases -
cvc-pattern-valid: Value '<tag_data_appears_here>' is not facet-valid with respect to pattern '<xsd_pattern_for_that_tag_appears_here'.
As a result I am not able to identify what went wrong - was it a length problem or a invalid character problem.
Is there any way I can do it? Also, is there any way I can configure digester to throw different error codes (cvc-patter-valid etc) for different error conditions like - incorrect tag hierarchy, incorrect tag names, a tag present more than the number of times it is allowed to be present etc? Currently, I see that the same error code appears in the sax exception for all of the error conditions.
SCJP 1.4 - 95% [ My Story ] - SCWCD 1.4 - 91% [ My Story ] Performance is a compulsion, not a option, if my existence is to be justified.