private static Element parse(String s) throws GNLibException { try { SAXBuilder builder = new SAXBuilder(); return builder.build(new StringReader(s)).detachRootElement(); } catch (Exception ex) { LOGGER.error("Error parsing GN response: " + s); throw new GNLibException("Error parsing GN response: " + ex.getMessage(), ex); } }
private void openLayout(InputStream layoutStream) { try { InputStreamReader isr = new InputStreamReader(layoutStream); SAXBuilder builder = new SAXBuilder(false); Document document = builder.build(isr); basePane.configure(document.detachRootElement()); } catch (Exception ex) { logger.error("Error opening layout file", ex); JOptionPane.showMessageDialog(basePane, "Error opening layout file: " + ex.getMessage()); } }
private static Element parse(String s) throws GNLibException { try { SAXBuilder builder = new SAXBuilder(); return builder.build(new StringReader(s)).detachRootElement(); } catch (Exception ex) { LOGGER.error("Error parsing GN response: " + s); throw new GNLibException("Error parsing GN response: " + ex.getMessage(), ex); } } }
private void openLayout(InputStream layoutStream) { try { InputStreamReader isr = new InputStreamReader(layoutStream); SAXBuilder builder = new SAXBuilder(false); Document document = builder.build(isr); basePane.configure(document.detachRootElement()); } catch (Exception ex) { logger.error("Error opening layout file", ex); JOptionPane.showMessageDialog(basePane, "Error opening layout file: " + ex.getMessage()); } }
protected Dataflow loadDataflow(String resourceName) throws Exception { XMLDeserializer deserializer = new XMLDeserializerImpl(); InputStream inStream = InvocationTestHelper.class.getResourceAsStream("/t2flow/" + resourceName); if (inStream==null) throw new IOException("Unable to find resource for t2 dataflow:"+resourceName); SAXBuilder builder = new SAXBuilder(); Element el= builder.build(inStream).detachRootElement(); return deserializer.deserializeDataflow(el); } }
private Element getQueryElement(String resourceName) throws Exception { InputStream inStream = TestBiomartActivityContextualView.class .getResourceAsStream("/"+resourceName); if (inStream == null) throw new IOException( "Unable to find resource for:" + resourceName); SAXBuilder builder = new SAXBuilder(); return builder.build(inStream).detachRootElement(); }
private Element getQueryElement(String resourceName) throws Exception { InputStream inStream = TestBiomartActivityContextualView.class .getResourceAsStream("/"+resourceName); if (inStream == null) throw new IOException( "Unable to find resource for:" + resourceName); SAXBuilder builder = new SAXBuilder(); return builder.build(inStream).detachRootElement(); }
Element detachRootElement = null; try { detachRootElement = builder.build(inputStream).detachRootElement(); } catch (JDOMException e) { logger.error("", e);
private void savePerspective(PerspectiveSPI perspective) { InputStreamReader isr = new InputStreamReader(perspective .getLayoutInputStream()); SAXBuilder builder = new SAXBuilder(false); Document document; try { document = builder.build(isr); Element layout = new Element("layout"); layout.setAttribute("visible", Boolean.toString(perspective .isVisible())); layout.addContent(document.detachRootElement()); String filename = perspective.getClass().getName() + ".perspective"; File confDir = new File(applicationRuntime.getApplicationHomeDir(), "conf"); confDir.mkdirs(); File file = new File(confDir, filename); XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat()); outputter.output(layout, new FileOutputStream(file)); logger.info("Saved "+ perspective.getClass().getName()+ " perspective into file."); } catch (JDOMException e) { logger.error("Error parsing perspective "+ perspective.getClass().getName() + " from an XML file.", e); } catch (IOException e) { logger.error("Error saving perspective " + perspective.getClass().getName() + " to an XML file.", e); } }
private void savePerspective(PerspectiveSPI perspective) { InputStreamReader isr = new InputStreamReader(perspective.getLayoutInputStream()); SAXBuilder builder = new SAXBuilder(false); Document document; try { document = builder.build(isr); Element layout = new Element("layout"); layout.setAttribute("visible", Boolean.toString(perspective.isVisible())); layout.addContent(document.detachRootElement()); String filename = perspective.getClass().getName() + ".perspective"; File file = new File(MyGridConfiguration.getUserDir("conf"), filename); XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat()); outputter.output(layout, new FileOutputStream(file)); } catch (JDOMException e) { logger.error("Error parsing perspective XML", e); } catch (IOException e) { logger.error("Error saving perspective XML", e); } }
public void saveAll(Set<CustomPerspective> perspectives) throws FileNotFoundException, IOException { File userdir = new File(applicationRuntime.getApplicationHomeDir(), "conf"); userdir.mkdirs(); File perspectiveFile = new File(userdir, XMLDOCNAME); Element topElement = new Element("perspectives"); for (CustomPerspective perspective : perspectives) { Element layoutElement = new Element("layout"); layoutElement.setAttribute("name", perspective.getName()); layoutElement.setAttribute("visible", Boolean.toString(perspective .isVisible())); try { Element layoutContent = new SAXBuilder().build( perspective.getLayoutInputStream()).detachRootElement(); layoutElement.addContent(layoutContent); } catch (JDOMException e) { logger.error("Error parsing layout xml", e); } catch (IOException e) { logger.error("Error reading stream for layout xml", e); } topElement.addContent(layoutElement); } XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat()); outputter.output(topElement, new FileOutputStream(perspectiveFile)); } }
public Element elementForProcessor(Processor p) { WorkflowProcessor wp = (WorkflowProcessor)p; Element spec = new Element("workflow",XScufl.XScuflNS); // Does this processor have a reference to an external file? if (wp.getDefinitionURL() != null) { Element definition = new Element("xscufllocation",XScufl.XScuflNS); spec.addContent(definition); definition.setText(wp.getDefinitionURL()); } else { // No definition URL so inline the workflow Document doc = XScuflView.getDocument(wp.getInternalModel()); spec.addContent(doc.detachRootElement()); } return spec; }
private Plugin createPluginFromXML(String xml) throws Exception { SAXBuilder builder=new SAXBuilder(false); Element el=builder.build(new ByteArrayInputStream(xml.getBytes())).detachRootElement(); return Plugin.fromXml(el); }
perspective.getLayoutInputStream()).detachRootElement();
new SAXBuilder().build(perspective.getLayoutInputStream()).detachRootElement();
private static MetadataInfo parseMetadataInfo(String response) throws GNLibException { try { SAXBuilder builder = new SAXBuilder(); Element root = builder.build(new StringReader(response)).detachRootElement(); String id = root.getChildText("id"); String uuid = root.getChildText("uuid"); String sver = root.getChildText("version"); MetadataInfo info = new MetadataInfo(); info.id = Long.parseLong(id); info.uuid = uuid; if(sver!=null && ! sver.isEmpty()) info.version = Integer.parseInt(sver); return info; } catch (JDOMException ex) { LOGGER.error("Error parsing GN response: " + response); throw new GNLibException("Error parsing GN response: " + ex.getMessage(), ex); } catch (IOException ex) { throw new GNLibException("Error while outputting", ex); } catch(NumberFormatException ex) { LOGGER.error("Error parsing number in GN response: " + response); throw new GNLibException("Error parsing number in GN response: " + ex.getMessage(), ex); } } }
Element detachRootElement = null; try { detachRootElement = builder.build(inputStream).detachRootElement(); } catch (JDOMException e) {
private static String parseVersion(String s) throws GNLibException { try { SAXBuilder builder = new SAXBuilder(); Element root = builder.build(new StringReader(s)).detachRootElement();
try { detachRootElement = builder.build(resourceAsStream) .detachRootElement(); } catch (JDOMException e) { throw new ItemCreationException("Could not parse resource "
(composite.toXML())).detachRootElement(); mobyObjectElement.setNamespace(mobyNS);