// xml document is valid and existing nodes can be accessed without a problem
final Document doc = record.getDocument();
String author = "";
if (doc != null) {
// The next line throws a NullPointerException
author = doc.selectSingleNode("//mx:datafield[@tag='100']/mx:subfield[@code='a']").getText();
}
String xpath = "//mx:datafield[@tag='100']/mx:subfield[@code='a']";
List<Node> nodes = doc.selectNodes(xpath); //contains one element