Hi all wM gurus - I am hoping someone has had this requirement and found an elegant solution.
Let’s say I call pub.schema:validate and my “zipCode” field is invalid because it doesn’t comply to the internal Address document I’m validating against.
Say my value is “1234567” and my schema constraint is that zipCode has to be 5 bytes long. So pub.schema:validate will exit with “isValid=false” and contain an “errors” Doc list with fields “pathName”, “errorCode” and “errorMessage”.
The errorMessage will say something like “field is too long”. What I need to extract is the actual constraint value of that zipCode field (i.e., 5 bytes). I’m guessing that internally, this may be an attribute of the zipCode XML tag and so it must exist. I just don’t know how to get that constraint value.
Any ideas on how this can be done via a Java API or other built-in service? One solution I came up with involves using a property file that contains these constraints but I want to avoid using an external file.
- Rajesh