Example usage for javax.xml.parsers DocumentBuilderFactory isIgnoringElementContentWhitespace

List of usage examples for javax.xml.parsers DocumentBuilderFactory isIgnoringElementContentWhitespace

Introduction

In this page you can find the example usage for javax.xml.parsers DocumentBuilderFactory isIgnoringElementContentWhitespace.

Prototype


public boolean isIgnoringElementContentWhitespace() 

Source Link

Document

Indicates whether or not the factory is configured to produce parsers which ignore ignorable whitespace in element content.

Usage

From source file:org.apache.xml.security.test.signature.ECDSASignatureTest.java

protected void setUp() throws Exception {
    ////w w w . ja  v  a  2 s . c  om
    // If the BouncyCastle provider is not installed, then try to load it 
    // via reflection. If it is not available, then skip this test as it is
    // required for elliptic curves
    //
    if (Security.getProvider("BC") == null) {
        Constructor cons = null;
        try {
            Class c = Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider");
            cons = c.getConstructor(new Class[] {});
        } catch (Exception e) {
            //ignore
        }
        if (cons == null) {
            // BouncyCastle is not available so just return
            return;
        } else {
            Security.addProvider((java.security.Provider) cons.newInstance(new Object[] {}));
        }
    }

    javax.xml.parsers.DocumentBuilderFactory dbf = javax.xml.parsers.DocumentBuilderFactory.newInstance();
    dbf.setNamespaceAware(true);
    log.info("dbf.isIgnoringComments()=" + dbf.isIgnoringComments());
    log.info("dbf.isIgnoringElementContentWhitespace()=" + dbf.isIgnoringElementContentWhitespace());

    String id = "http://apache.org/xml/properties/dom/document-class-name";

    dbf.setAttribute(id, IndexedDocument.class.getName());

    db = dbf.newDocumentBuilder();
    org.apache.xml.security.Init.init();
}