hc_elementremoveattributeaftercreatepublic final class hc_elementremoveattributeaftercreate extends org.w3c.domts.DOMTestCase The "removeAttributeNode(oldAttr)" method removes the
specified attribute.
Retrieve the last child of the third employee, add a
new "lang" attribute to it and then try to remove it.
To verify that the node was removed use the
"getNamedItem(name)" method from the NamedNodeMap
interface. It also uses the "getAttributes()" method
from the Node interface. |
Constructors Summary |
---|
public hc_elementremoveattributeaftercreate(org.w3c.domts.DOMTestDocumentBuilderFactory factory)Constructor.
super(factory);
//
// check if loaded documents are supported for content type
//
String contentType = getContentType();
preload(contentType, "hc_staff", true);
|
Methods Summary |
---|
public java.lang.String | getTargetURI()Gets URI that identifies the test.
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_elementremoveattributeaftercreate";
| public static void | main(java.lang.String[] args)Runs this test from the command line.
DOMTestCase.doMain(hc_elementremoveattributeaftercreate.class, args);
| public void | runTest()Runs the test case.
Document doc;
NodeList elementList;
Element testEmployee;
Attr newAttribute;
NamedNodeMap attributes;
Attr districtAttr;
doc = (Document) load("hc_staff", true);
elementList = doc.getElementsByTagName("acronym");
testEmployee = (Element) elementList.item(2);
newAttribute = doc.createAttribute("lang");
districtAttr = testEmployee.setAttributeNode(newAttribute);
districtAttr = testEmployee.removeAttributeNode(newAttribute);
attributes = testEmployee.getAttributes();
districtAttr = (Attr) attributes.getNamedItem("lang");
assertNull("removed_item_null", districtAttr);
|
|