Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

XmlBeans validation - is it possible to get the xpath to the field that fails validation  RSS feed

 
Ole Bille
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.

When I validate xmlbeans objects and it fails then sometimes I get this error.

cvc-minLength-valid.1.1: string length (0) is less than minLength facet (2) for StringMin2Max256 in namespace http://efpi.dk/ehp2011/xml/schemas/EFPI_Strings_v1

Is it possible to get the xpath to the String that isnt valid from the error list.

My java code looks like this.

XmlOptions validateOptions = new XmlOptions();
ArrayList<XmlError> errorList = new ArrayList<XmlError>();
validateOptions.setErrorListener(errorList);

invocation.getRequest().getOpretOgStartRequest().validate(validateOptions);

for (XmlError xmlError : errorList) {
XmlValidationError xmlValidationError = (XmlValidationError) xmlError;
System.out.println("["+xmlError.getLine()+","+xmlError.getColumn()+"]-" +xmlError.getSeverity());
System.out.println(xmlError.getErrorCode() + ": " +xmlError.getMessage());
}

Kind regards.
Ole Bille
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!