*/
public DOMForest buildDOMForest( InternalizationLogic logic )
throws SAXException {
// parse into DOM forest
DOMForest forest = new DOMForest(logic);
forest.setErrorHandler(errorReceiver);
if(opt.entityResolver!=null)
forest.setEntityResolver(opt.entityResolver);
// parse source grammars
for (InputSource value : opt.getGrammars()) {
errorReceiver.pollAbort();
forest.parse(value, true);
}
// parse external binding files
for (InputSource value : opt.getBindFiles()) {
errorReceiver.pollAbort();
Document dom = forest.parse(value, true);
if(dom==null) continue; // error must have been reported
Element root = dom.getDocumentElement();
// TODO: it somehow doesn't feel right to do a validation in the Driver class.
// think about moving it to somewhere else.
if (!fixNull(root.getNamespaceURI()).equals(Const.JAXB_NSURI)
|| !root.getLocalName().equals("bindings"))
errorReceiver.error(new SAXParseException(Messages.format(Messages.ERR_NOT_A_BINDING_FILE,
root.getNamespaceURI(),
root.getLocalName()),
null,
value.getSystemId(),
-1, -1));
}
scdBasedBindingSet = forest.transform(opt.isExtensionMode());
return forest;
}