Code example for Document

Methods: createAttributeNS, getElementsByTagName

0
        String qualifiedName = "emp:newAttr";
        Document doc;
        NodeList elementList;
        Node testAddr;
        Attr newAttr;
        Attr newAddrAttr;
        doc = (Document) load("staffNS", builder);
        elementList = doc.getElementsByTagName("emp:address");
        testAddr = elementList.item(0);
        assertNotNull("empAddrNotNull", testAddr);
        newAttr = doc.createAttributeNS(namespaceURI, qualifiedName);
        newAddrAttr = ((Element) /* Node */testAddr)
                .setAttributeNodeNS(newAttr);
        assertNull("throw_Null", newAddrAttr);
    } 
    @TestTargetNew( 
        level = TestLevel.PARTIAL_COMPLETE, 
        notes = "Doesn't verify DOMException.", 
        method = "setAttributeNodeNS", 
        args = {org.w3c.dom.Attr.class}
    )