List of usage examples for org.jdom2.output XMLOutputter XMLOutputter
public XMLOutputter()
XMLOutputter
with a default Format and XMLOutputProcessor . From source file:Modelo.FormularioD2XML.java
public void guardar() { XMLOutputter xMLOutputter = new XMLOutputter(); try {/*from w w w . j a va 2 s . co m*/ xMLOutputter.output(documento, new PrintWriter(ruta)); } catch (IOException ex) { Logger.getLogger(UsuarioXML.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:modelo.manejoXML.java
/** * @crea un fichero xml con los articulos visualizados y los guarda en la ruta especificada * @see controlador.controlador_visualizarProductos * @param lista lista de productos visualizados * @param arNom nombre del fichero xml// w ww. ja va2 s . co m * @param ruta ruta del fichero xml * @throws IOException */ public void crearXML(Articulo[] lista, String arNom, String ruta) throws IOException { try { Element articulos = new Element("Articulos"); Document doc = new Document(articulos); for (int i = 0; i < lista.length; i++) { Element articulo = new Element("articulo"); Attribute atributo = new Attribute("codigo", Integer.toString(lista[i].getCodigo())); articulo.setAttribute(atributo); Element nombre = new Element("nombre"); nombre.setText(lista[i].getNombre()); Element familia = new Element("familia"); familia.setText(lista[i].getFamilia()); Element precio = new Element("precio"); precio.setText(Float.toString(lista[i].getPrecio())); Element cantidad = new Element("cantidad"); cantidad.setText(Integer.toString(lista[i].getCantidad())); articulo.addContent(nombre); articulo.addContent(familia); articulo.addContent(precio); articulo.addContent(cantidad); doc.getRootElement().addContent(articulo); } XMLOutputter xmloutput = new XMLOutputter(); xmloutput.setFormat(Format.getPrettyFormat()); xmloutput.output(doc, new FileWriter(ruta + "\\" + arNom + ".xml")); } catch (IOException ex) { throw ex; } }
From source file:modelo.RegistroCitaXML.java
public void guardar() { XMLOutputter xMLOutputter = new XMLOutputter(); try {//from w w w .ja v a 2 s. c o m xMLOutputter.output(documento, new PrintWriter(ruta)); } catch (IOException ex) { Logger.getLogger(RegistroUsuarioXML.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:Modelo.RegistroEmpleado.java
private void guardar() { try {/* w w w.j a va 2 s . co m*/ XMLOutputter xmlo = new XMLOutputter(); xmlo.output(document, new PrintWriter(this.path)); xmlo.output(document, System.out); } catch (IOException ex) { Logger.getLogger(RegistroEmpleado.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:modelo.RegistroJuego.java
public void guardaDocumento() throws IOException { XMLOutputter xmlOutput = new XMLOutputter(); xmlOutput.output(documento, System.out); xmlOutput.output(documento, new PrintWriter(this.ruta)); }
From source file:modelo.RegistroPlanesXML.java
private void save() throws IOException { XMLOutputter xmlo = new XMLOutputter(); xmlo.output(documento, new PrintWriter(this.ruta)); xmlo.output(documento, System.out); }
From source file:modelo.RegistroUsuario.java
public void guardarDocumento() throws IOException { XMLOutputter xmlOutputter = new XMLOutputter(); xmlOutputter.output(documento, System.out); xmlOutputter.output(documento, new PrintWriter(this.rutaDocumento)); }
From source file:mx.com.pixup.portal.dao.ArtistaGenerateDaoJdbc.java
public ArtistaGenerateDaoJdbc() throws IOException { BasicDataSource dataSource = new BasicDataSource(); //seccion de la DB dataSource.setDriverClassName("com.mysql.jdbc.Driver"); dataSource.setUsername("root"); dataSource.setPassword("admin"); //dataSource.setPassword("mysqlroot"); dataSource.setUrl("jdbc:mysql://localhost:3306/pixup"); this.dataSource = dataSource; //seccion XML this.xmlLogico = new Document(); this.xmlFisico = new XMLOutputter(); this.archivoFisico = new FileWriter( "C:\\Users\\JAVA-08\\Documents\\VOSS\\Modulo 5\\pixup-dao-xml\\src\\testXML\\artistasNuevo.xml"); }
From source file:mx.com.pixup.portal.dao.DiscoPaisGenerateDaoJdbc.java
public DiscoPaisGenerateDaoJdbc(String archivo) throws IOException { BasicDataSource dataSource = new BasicDataSource(); //seccion de la DB dataSource.setDriverClassName("com.mysql.jdbc.Driver"); dataSource.setUsername("root"); dataSource.setPassword("admin"); //dataSource.setPassword("mysqlroot"); dataSource.setUrl("jdbc:mysql://localhost:3306/pixup"); this.dataSource = dataSource; //seccion XML this.xmlLogico = new Document(); this.xmlFisico = new XMLOutputter(); this.archivoFisico = new FileWriter(archivo); }
From source file:mx.com.pixup.portal.dao.MunicipioGenerateDaoJdbc.java
public MunicipioGenerateDaoJdbc() throws IOException { BasicDataSource dataSource = new BasicDataSource(); //seccion de la DB dataSource.setDriverClassName("com.mysql.jdbc.Driver"); dataSource.setUsername("root"); dataSource.setPassword("admin"); //dataSource.setPassword("mysqlroot"); dataSource.setUrl("jdbc:mysql://localhost:3306/pixup"); this.dataSource = dataSource; //seccion XML this.xmlLogico = new Document(); this.xmlFisico = new XMLOutputter(); this.archivoFisico = new FileWriter( "C:\\Users\\JAVA-08\\Documents\\VOSS\\Modulo 5\\pixup-dao-xml\\src\\testXML\\municipio1.xml"); }