Code example for DocumentBuilderFactory

Methods: getAttribute, setAttribute

0
 
    public void test_getSetAttribute() { 
        // Android SAX implementation doesn't support attributes, so 
        // we can only make sure the expected exception is thrown. 
        try { 
            dbf.setAttribute("foo", new Object());
            fail("IllegalArgumentException expected");
        } catch (IllegalArgumentException e) {
            // Expected 
        } 
 
        try { 
            dbf.getAttribute("foo");
            fail("IllegalArgumentException expected");
        } catch (IllegalArgumentException e) {
            // Expected 
        } 
    } 
 
    /** 
     * javax.xml.parsers.DocumentBuilderFactory#setSchema(javax.xml.validation.Schema).