// validate input file
ArrayList<XmlError> validationErrors = new ArrayList<XmlError>();
XmlOptions validationOptions = new XmlOptions();
validationOptions.setErrorListener(validationErrors);
boolean isValid = dictionaryDoc.validate(validationOptions);
// output the errors if the XML is invalid.
if (!isValid) {
Iterator<XmlError> iter = validationErrors.iterator();
StringBuffer errorMessages = new StringBuffer();