FileDocCategorySizeDatePackage
ElementRemoveAttributeNS.javaAPI DocAndroid 1.5 API2573Wed May 06 22:41:06 BST 2009tests.org.w3c.dom

ElementRemoveAttributeNS

public final class ElementRemoveAttributeNS extends DOMTestCase
The method removeAttributeNS removes an attribute by local name and namespace URI. Create a new element and add a new attribute node to it. Remove the attribute node using the removeAttributeNodeNS method. Check if the attribute was remove by invoking the hasAttributeNS method on the element and check if it returns false.
author
IBM
author
Neil Delima
see
http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElRemAtNS

Fields Summary
DOMDocumentBuilderFactory
factory
DocumentBuilder
builder
Constructors Summary
Methods Summary
protected voidsetUp()

        super.setUp();
        try {
            factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
                    .getConfiguration1());
            builder = factory.getBuilder();
        } catch (Exception e) {
            fail("Unexpected exception" + e.getMessage());
        }
    
protected voidtearDown()

        factory = null;
        builder = null;
        super.tearDown();
    
public voidtestRemoveAttributeNS()
Runs the test case.

throws
Throwable Any uncaught exception causes test to fail

        Document doc;
        Element element;
        boolean state;
        Attr attribute;

        doc = (Document) load("staff", builder);
        element = doc.createElementNS("http://www.w3.org/DOM", "elem");
        attribute = doc.createAttributeNS(
                "http://www.w3.org/DOM/Test/createAttributeNS", "attr");
        element.setAttributeNodeNS(attribute);
        element.removeAttributeNS(
                "http://www.w3.org/DOM/Test/createAttributeNS", "attr");
        state = element.hasAttributeNS(
                "http://www.w3.org/DOM/Test/createAttributeNS", "attr");
        assertFalse("elementremoveattributens01", state);