DocumentBuilder db = dbf.newDocumentBuilder();
Document d;
if (isFastInfosetDocument) {
d = db.newDocument();
DOMDocumentParser ddp = new DOMDocumentParser();
ddp.parse(d, document);
} else {
if (workingDirectory != null) {
db.setEntityResolver(createRelativePathResolver(workingDirectory));
}
d = db.parse(document);