Code example for Document

Methods: createAttributeNSgetElementsByTagName

        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)
        assertNull("throw_Null", newAddrAttr);
        level = TestLevel.PARTIAL_COMPLETE, 
        notes = "Doesn't verify DOMException.", 
        method = "setAttributeNodeNS", 
        args = {org.w3c.dom.Attr.class}
Connect your IDE to all the code out there  Get Codota for Java