/** * @param controller Receives the lines when the are parsed * @param PATH Path to the XML-file of the play */ public XMLParser(DBCInterface controller, final String PATH) { this.controller = controller; try { doc = new SAXBuilder().build(PATH); root = doc.getRootElement(); ns = root.getNamespace(); body = root.getChild("text", ns).getChild("body", ns); } catch (IOException | JDOMException e) { e.printStackTrace(); } acts = new ArrayList<Element>(body.getChildren("div1", ns)); }
// should be private except that JUnit testing creates multiple Roster objects public Roster(String rosterFilename) { this(); try { // if the rosterFilename passed in is null, create a complete path // to the default roster index before attempting to read if (rosterFilename == null) { rosterFilename = this.getRosterIndexPath(); } this.readFile(rosterFilename); } catch (IOException | JDOMException e) { log.error("Exception during roster reading: " + e); try { JOptionPane.showMessageDialog( null, Bundle.getMessage("ErrorReadingText") + "\n" + e.getMessage(), Bundle.getMessage("ErrorReadingTitle"), JOptionPane.ERROR_MESSAGE); } catch (HeadlessException he) { // ignore inability to display dialog } } }