XPathLocation loc = (XPathLocation) e.getLocation();
if (loc == null) {
loc = new XPathLocation();
e.setLocation(loc);
if (localElement.getNodeType() == NodeType.Attribute) {
loc.addAttribute(localElement.getXMLName());
} else {
loc.addChild(localElement.getXMLName());
}
}
}