public Rom unmarshallRom(Node rootNode, Rom rom) throws XMLParseException, RomNotFoundException, StackOverflowError, Exception { Node n; NodeList nodes = rootNode.getChildNodes(); progress.update("Creating tables...", 15); if (!unmarshallAttribute(rootNode, "base", "none").equalsIgnoreCase("none")) { rom = getBaseRom(rootNode.getParentNode(), unmarshallAttribute(rootNode, "base", "none"), rom); rom.getRomID().setObsolete(false); } for (int i = 0; i < nodes.getLength(); i++) { n = nodes.item(i); // update progress int currProgress = (int) ((double) i / (double) nodes.getLength() * 40); progress.update("Creating tables...", 10 + currProgress); if (n.getNodeType() == ELEMENT_NODE) { if (n.getNodeName().equalsIgnoreCase("romid")) { rom.setRomID(unmarshallRomID(n, rom.getRomID())); } else if (n.getNodeName().equalsIgnoreCase("table")) { Table table = null; try { table = rom.getTable(unmarshallAttribute(n, "name", "unknown")); } catch (TableNotFoundException e) { /* table does not already exist (do nothing) */ } try { table = unmarshallTable(n, table, rom); table.setRom(rom); rom.addTable(table); } catch (TableIsOmittedException ex) { // table is not supported in inherited def (skip) if (table != null) { rom.removeTable(table.getName()); } } catch (XMLParseException ex) { LOGGER.error("Error unmarshalling rom", ex); } } else { /* unexpected element in Rom (skip)*/ } } else { /* unexpected node-type in Rom (skip)*/ } } return rom; }