You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by "Samuel B. Quiring" <sb...@cayuse.com> on 2007/02/18 23:28:58 UTC

decoding errors

Greetings,

I am trying to map some of the validating parse error messages into something our non-technical users could understand.  For example, the message:

     string length (string) is less than minLength facet (0) for 1

might map to:

     The field <blah-blah> is empty, but it is required that you type something into that field.

Most of our users only see 2 or 3 different kinds of errors.  If I can make those error messages understandable, I'll have covered 95% of the situations our customers experience.  I'm looking for the best way to test an XmlError object to find out if it is a specific error, for example is it the error shown above?  Obviously I could test the message for an exact match to the text shown above, but there seem to be 3 parameters in the message, "string", "0", and "1", so there are problems with that approach.  Not to mention the text might be changed in the future.

When I get the above error, my code prints out the value of getErrorCode() and it is:  "cvc-minLength-valid.1.1".  So I thought I'll compare the value returned by getErrorCode() with a constant from XmlErrorCodes.  But when I look at the constants in the XmlErrorCodes package I have no error code has this value.  The closest is:

public static final java.lang.String DATATYPE_MIN_LENGTH_VALID = "cvc-minLength-valid";

when I look at this web site:  http://xmlbeans.apache.org/docs/2.0.0/reference/constant-values.html and search for "cvc-minLength-valid.1.1", I get this:

public static final String DATATYPE_MIN_LENGTH_VALID$STRING "cvc-minLength-valid.1.1"

but the variable name DATATYPE_MIN_LENGTH_VALID$STRING is not in my local copy of XmlErrorCodes.

Does anyone know what's going on here.  I'm not really a Java expert, so I'm not quite sure how to take this $STRING suffix.

-Sam