List of usage examples for org.jdom2.output Format getPrettyFormat
public static Format getPrettyFormat()
From source file:org.educautecisystems.core.Sistema.java
License:Open Source License
private static void generarChatConf(File archivoConfChatXML) { Document document = new Document(); Namespace baseNamespace = Namespace.getNamespace("chat", "http://free.chat.com/"); Element root = new Element("config", baseNamespace); /* Datos servidor */ Element eServidor = new Element("server", baseNamespace); eServidor.addContent(new Element("ip").setText(ip_defecto)); eServidor.addContent(new Element("port").setText(port_defecto)); root.addContent(eServidor);/*from w w w. j a va 2 s . c o m*/ /* Datos sesin */ Element eSession = new Element("session", baseNamespace); eSession.addContent(new Element("nickname").setText(nickname_defecto)); eSession.addContent(new Element("real_name").setText(realName_defecto)); root.addContent(eSession); /* Guardar archivo */ XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat()); document.setRootElement(root); try { outputter.output(document, new FileOutputStream(archivoConfChatXML)); } catch (IOException ioe) { System.err.println("No se puedo crear archivo de configuracin."); } /* Iniciar informacin */ chatServerConf = new ChatServerConf(ip_defecto, port_defecto); chatSessionConf = new ChatSessionConf(nickname_defecto, realName_defecto); }
From source file:org.educautecisystems.core.Sistema.java
License:Open Source License
public static void guardarChatConf() { File archivoConfChatXML = new File(pathChatConf); /* Borrar archivo, si existe. */ if (archivoConfChatXML.exists()) { archivoConfChatXML.delete();// www . j a v a 2 s . c o m } Document document = new Document(); Namespace baseNamespace = Namespace.getNamespace("chat", "http://free.chat.com/"); Element root = new Element("config", baseNamespace); /* Datos servidor */ Element eServidor = new Element("server", baseNamespace); eServidor.addContent(new Element("ip").setText(chatServerConf.getIp())); eServidor.addContent(new Element("port").setText(chatServerConf.getPort())); root.addContent(eServidor); /* Datos sesin */ Element eSession = new Element("session", baseNamespace); eSession.addContent(new Element("nickname").setText(chatSessionConf.getNickname())); eSession.addContent(new Element("real_name").setText(chatSessionConf.getRealName())); root.addContent(eSession); /* Guardar archivo */ XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat()); document.setRootElement(root); try { outputter.output(document, new FileOutputStream(archivoConfChatXML)); } catch (IOException ioe) { System.err.println("No se puedo crear archivo de configuracin."); } }
From source file:org.esa.beam.occci.ModisL1aScanner.java
License:Open Source License
private static void printElement(Element element) { XMLOutputter fmt = new XMLOutputter(Format.getPrettyFormat()); try {//from w ww . j a va 2 s . co m fmt.output(element, System.out); } catch (IOException e) { e.printStackTrace(); } }
From source file:org.esa.snap.core.dataop.downloadable.XMLSupport.java
License:Open Source License
public static void SaveXML(final Document doc, final String filePath) throws IOException { final XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat()); try (final FileWriter writer = new FileWriter(filePath)) { outputter.output(doc, writer);// w ww . j a v a 2 s . c o m writer.close(); } }
From source file:org.esa.snap.framework.dataop.downloadable.XMLSupport.java
License:Open Source License
public static void SaveXML(final Document doc, final String filePath) { try {/*from w w w. j a v a2 s . co m*/ final Format xmlFormat = Format.getPrettyFormat(); final XMLOutputter outputter = new XMLOutputter(xmlFormat); final FileWriter writer = new FileWriter(filePath); outputter.output(doc, writer); //outputter.output(doc, System.out); writer.close(); } catch (java.io.IOException e) { e.printStackTrace(); } }
From source file:org.fiware.cybercaptor.server.attackgraph.AttackGraph.java
License:Open Source License
/** * Save the attack graph in an xml file//from ww w. j a v a 2s. co m * * @param filePath the path in which the attack graph is saved * @throws Exception */ public void saveToXmlFile(String filePath) throws Exception { XMLOutputter output = new XMLOutputter(Format.getPrettyFormat()); output.output(toDomElement(), new FileOutputStream(filePath)); }
From source file:org.fiware.cybercaptor.server.informationsystem.InformationSystem.java
License:Open Source License
/** * Save the attack graph in an xml file/* ww w . j a v a 2s . co m*/ * * @param filePath the file path where the attack graph will be save * @throws Exception */ public void saveToXmlFile(String filePath) throws Exception { XMLOutputter output = new XMLOutputter(Format.getPrettyFormat()); output.output(toDomXMLElement(), new FileOutputStream(filePath)); }
From source file:org.fiware.cybercaptor.server.remediation.cost.GlobalParameters.java
License:Open Source License
/** * Function used to save the parameters in an xml file * * @param path the path where the xml file should be created * @throws Exception//from w w w . j a v a2 s. c o m */ public void saveToXMLFile(String path) throws Exception { Document document = new Document(toDomElement()); //Save the DOM element in file XMLOutputter output = new XMLOutputter(Format.getPrettyFormat()); output.output(document, new FileOutputStream(path)); }
From source file:org.fiware.cybercaptor.server.remediation.cost.OperationalCostParameters.java
License:Open Source License
/** * Function used to save the parameters in an xml file * * @param path the path where the xml file should be created * @throws Exception the exception//from w w w. j a v a 2 s. co m */ public void saveToXMLFile(String path) throws Exception { Document document = new Document(toDomElement()); //Save the DOM element in file XMLOutputter output = new XMLOutputter(Format.getPrettyFormat()); output.output(document, new FileOutputStream(path)); }
From source file:org.fiware.cybercaptor.server.rest.RestAPIAttackPaths.java
License:Open Source License
@GET @Path("list") @Produces(MediaType.TEXT_XML)/*w w w. j a va 2 s . c o m*/ public Response getList(@Context HttpServletRequest request) { Monitoring monitoring = ((Monitoring) request.getSession(true).getAttribute("monitoring")); if (monitoring == null) return Response.status(Status.NO_CONTENT).build(); Element attackPathsXML = org.fiware.cybercaptor.server.api.AttackPathManagement .getAttackPathsXML(monitoring); XMLOutputter output = new XMLOutputter(Format.getPrettyFormat()); return Response.ok(output.outputString(attackPathsXML)).build(); }