Example usage for org.jdom2.input SAXBuilder setIgnoringElementContentWhitespace

List of usage examples for org.jdom2.input SAXBuilder setIgnoringElementContentWhitespace

Introduction

In this page you can find the example usage for org.jdom2.input SAXBuilder setIgnoringElementContentWhitespace.

Prototype

public void setIgnoringElementContentWhitespace(final boolean ignoringWhite) 

Source Link

Document

Specifies whether or not the parser should eliminate whitespace in element content (sometimes known as "ignorable whitespace") when building the document.

Usage

From source file:lu.list.itis.dkd.aig.util.DocumentConverter.java

License:Apache License

/**
 * Method used to build a {@link Document} from a provided input stream.
 *
 * @param inputStream//www  .j av  a 2s . c  o  m
 *            The stream to read the document from.
 * @return The created {@link Document} instance.
 * @throws TemplateParseException
 *             Thrown when conversion of the stream contents to document
 *             fails.
 */
@SuppressWarnings("null")
public static Document convertStreamToDocument(final InputStream inputStream) throws TemplateParseException {
    final SAXBuilder saxBuilder = new SAXBuilder();
    saxBuilder.setIgnoringElementContentWhitespace(true);
    try {
        return saxBuilder.build(new InputStreamReader(inputStream));
    } catch (final JDOMException e) {
        throw new TemplateParseException("The provided XML contains errors and cannot be parsed!", e); //$NON-NLS-1$
    } catch (final IOException e) {
        throw new TemplateParseException("An I/O error occured during parsing!", e); //$NON-NLS-1$
    }
}

From source file:modelo.ArchivoXmlUsuario.java

private ArchivoXmlUsuario(String rutaArchivo) throws JDOMException, IOException {
    SAXBuilder saxB = new SAXBuilder();
    saxB.setIgnoringElementContentWhitespace(true);
    this.documento = saxB.build(rutaArchivo);
    this.raiz = this.documento.getRootElement();
    this.ruta = rutaArchivo;

}

From source file:Modelo.FormularioD2XML.java

public void abrirArchivo() throws IOException {
    try {/*from  w w  w.ja  va 2s.  c  o  m*/
        SAXBuilder sAXBuilder = new SAXBuilder();
        sAXBuilder.setIgnoringElementContentWhitespace(true);
        documento = sAXBuilder.build(ruta);
        raiz = documento.getRootElement();
    } catch (JDOMException ex) {
        System.out.println("error");
    }
}

From source file:modelo.RegistroCitaXML.java

public void abrirArchivo() {
    try {//from  w ww.  ja  va  2 s. c  om
        SAXBuilder sAXBuilder = new SAXBuilder();
        sAXBuilder.setIgnoringElementContentWhitespace(true);
        documento = sAXBuilder.build(ruta);
        raiz = documento.getRootElement();
    } catch (JDOMException | IOException ex) {
        System.out.println("error");
    }
}

From source file:Modelo.RegistroEmpleado.java

private RegistroEmpleado(String path) {
    try {//from   w ww . j  a va  2  s  .co m
        SAXBuilder saxb = new SAXBuilder();
        saxb.setIgnoringElementContentWhitespace(true);
        this.document = saxb.build(path);
        this.path = path;
        this.root = document.getRootElement();
    } catch (JDOMException ex) {
        Logger.getLogger(RegistroEmpleado.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(RegistroEmpleado.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:modelo.RegistroJuego.java

private RegistroJuego(String ruta) throws JDOMException, IOException {
    SAXBuilder sBuilder = new SAXBuilder();
    sBuilder.setIgnoringElementContentWhitespace(true);
    this.documento = sBuilder.build(ruta);
    this.raiz = documento.getRootElement();
    this.ruta = ruta;
}

From source file:modelo.RegistroPlanesXML.java

private RegistroPlanesXML(String ruta) throws IOException, JDOMException {
    SAXBuilder saxb = new SAXBuilder();
    saxb.setIgnoringElementContentWhitespace(true);
    this.documento = saxb.build(ruta);
    this.ruta = ruta;
    this.raiz = documento.getRootElement();
}

From source file:modelo.RegistroUsuario.java

private RegistroUsuario(String rutaDocumento) throws JDOMException, IOException {
    SAXBuilder saBuilder = new SAXBuilder();
    saBuilder.setIgnoringElementContentWhitespace(true);
    this.documento = saBuilder.build(rutaDocumento);
    this.raiz = documento.getRootElement();
    this.rutaDocumento = rutaDocumento;
}

From source file:modelo.RegistroUsuarioXML.java

private RegistroUsuarioXML(String rutaArchivo) throws JDOMException, IOException {
    SAXBuilder saxB = new SAXBuilder();
    saxB.setIgnoringElementContentWhitespace(true);
    this.documento = saxB.build(rutaArchivo);
    this.raiz = this.documento.getRootElement();
    this.ruta = rutaArchivo;
}