List of usage examples for org.dom4j Node getStringValue
String getStringValue();
From source file:pt.webdetails.cpf.PluginSettings.java
License:Open Source License
protected String getStringSetting(String section, String defaultValue) { Node node = settings.selectSingleNode(getNodePath(section)); if (node == null) { return defaultValue; } else {/*from w w w .j av a 2 s.co m*/ return node.getStringValue(); } }
From source file:service.XML.SerXMLConverter.java
License:Open Source License
/** * @param XML-Document der BOX/*from w w w . j av a2 s. c o m*/ * @return BORecordArgs */ public static BORecordArgs parseRecordDocument(Document document) { BORecordArgs recordArgs = new BORecordArgs(false); Element root = document.getRootElement(); recordArgs.setPids(new BOPids()); Element command = (Element) root.selectSingleNode("//record"); Node channelname = root.selectSingleNode("//channelname"); Node epgtitle = root.selectSingleNode("//epgtitle"); Node channelId = root.selectSingleNode("//id"); Node epgInfo1 = root.selectSingleNode("//info1"); Node epgInfo2 = root.selectSingleNode("//info2"); Node epgid = root.selectSingleNode("//epgid"); Node mode = root.selectSingleNode("//mode"); Node videopid = root.selectSingleNode("//videopid"); Element selectedAudiopid = (Element) root.selectSingleNode("//audiopids selected"); List aPidNodes = selectedAudiopid.selectNodes("//audio"); Node vtxtpid = root.selectSingleNode("//vtxtpid"); recordArgs.setCommand(command.attributeValue("command")); recordArgs.setSenderName(channelname.getStringValue()); recordArgs.setEpgTitle(epgtitle.getText()); recordArgs.setEventId(channelId.getText()); recordArgs.setEpgInfo1(epgInfo1.getText()); recordArgs.setEpgInfo2(epgInfo2.getText()); recordArgs.setEpgId(epgid.getText()); recordArgs.setMode(mode.getText()); recordArgs.getPids() .setVPid(new BOPid(Integer.toHexString(Integer.parseInt(videopid.getText())), "video", 0)); if (ControlMain.getSettingsRecord().isRecordVtxt()) { recordArgs.getPids() .setVtxtPid(new BOPid(Integer.toHexString(Integer.parseInt(vtxtpid.getText())), "vtxt", 2)); } ArrayList pidList = new ArrayList(); for (int i = 0; i < aPidNodes.size(); i++) { Element aPid = (Element) aPidNodes.get(i); String number = Integer.toHexString(Integer.parseInt(aPid.attributeValue("pid"))); String name = aPid.attributeValue("name"); BOPid pid = new BOPid(number, name, 1); pidList.add(pid); } recordArgs.getPids().setAPids(pidList); try { recordArgs.getPids().setPmtPid(ControlMain.getBoxAccess().getPids().getPmtPid()); } catch (IOException e) { } recordArgs.loadLocalTimer(); return recordArgs; }