elementsetattributenodenullpublic final class elementsetattributenodenull extends org.w3c.domts.DOMTestCase The "setAttributeNode(newAttr)" method returns the
null value if no previously existing Attr node with the
same name was replaced.
Retrieve the last child of the third employee and add a
new attribute to it. The new attribute node added is
"district", which is not part of this Element. The
method should return the null value.
This test uses the "createAttribute(name)"
method from the Document interface. |
Constructors Summary |
---|
public elementsetattributenodenull(org.w3c.domts.DOMTestDocumentBuilderFactory factory)Constructor.
super(factory);
//
// check if loaded documents are supported for content type
//
String contentType = getContentType();
preload(contentType, "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/elementsetattributenodenull";
| public static void | main(java.lang.String[] args)Runs this test from the command line.
DOMTestCase.doMain(elementsetattributenodenull.class, args);
| public void | runTest()Runs the test case.
Document doc;
NodeList elementList;
Element testEmployee;
Attr newAttribute;
Attr districtAttr;
doc = (Document) load("staff", true);
elementList = doc.getElementsByTagName("address");
testEmployee = (Element) elementList.item(2);
newAttribute = doc.createAttribute("district");
districtAttr = testEmployee.setAttributeNode(newAttribute);
assertNull("elementSetAttributeNodeNullAssert", districtAttr);
|
|