* @param e The {@link ValidationException} to enrich.
* @param occurence If greater than 0, denotes the position of the invalid collection value.
*/
private void addLocationInformation(final XMLFieldDescriptor fieldDescriptor,
final ValidationException e, final long occurence) {
XPathLocation loc = (XPathLocation) e.getLocation();
if (loc == null) {
loc = new XPathLocation();
e.setLocation(loc);
String xmlName = fieldDescriptor.getXMLName();
if (occurence > 0) {
xmlName += "[" + occurence + "]";
}
if (fieldDescriptor.getNodeType() == NodeType.Attribute) {
loc.addAttribute(xmlName);
} else {
loc.addChild(xmlName);
}
}
}