}
private static boolean addLocation(Document doc, Node node,
XMLStreamReader reader,
boolean recordLoc) {
if (recordLoc) {
Location loc = reader.getLocation();
if (loc != null && (loc.getColumnNumber() != 0 || loc.getLineNumber() != 0)) {
try {
final int charOffset = loc.getCharacterOffset();
final int colNum = loc.getColumnNumber();
final int linNum = loc.getLineNumber();
final String pubId = loc.getPublicId() == null ? doc.getDocumentURI() : loc.getPublicId();
final String sysId = loc.getSystemId() == null ? doc.getDocumentURI() : loc.getSystemId();
Location loc2 = new Location() {
public int getCharacterOffset() {
return charOffset;
}
public int getColumnNumber() {
return colNum;