Main Page Packages Class Hierarchy Compound List File List Compound Members

# namednodemapsetnameditemthatexists Class Reference

Inherits DOMTestCase.

List of all members.

## Public Methods
| namednodemapsetnameditemthatexists (DOMTestDocumentBuilderFactory factory)
void | runTest () throws java.lang.Throwable
String | getTargetURI ()
## Static Public Methods
void | main (String[] args)

## Detailed Description

If the node to be added by the "setNamedItem(arg)" method already exists in the NamedNodeMap, it is replaced by the new one.

Retrieve the second employee and create a NamedNodeMap object from the attributes of the last child by invoking the "getAttributes()" method. Once the list is created an invocation of the "setNamedItem(arg)" method is done with arg=newAttr, where newAttr is a new Attr Node previously created and whose node name already exists in the map. The "setNamedItem(arg)" method should replace the already existing node with the new one. This node is then retrieved using the "getNamedItem(name)" method. This test uses the "createAttribute(name)" method from the document interface

Author:
  NIST , Mary Brady

See also:
  http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788 , http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9

Definition at line 55 of file namednodemapsetnameditemthatexists.java.

## Constructor & Destructor Documentation

namednodemapsetnameditemthatexists::namednodemapsetnameditemthatexists | ( | DOMTestDocumentBuilderFactory | factory | ) | `[inline]`

| Definition at line 57 of file namednodemapsetnameditemthatexists.java.
    00058  {
    00059       super(factory);
    00060
    00061    }

## Member Function Documentation

String namednodemapsetnameditemthatexists::getTargetURI | ( |  | ) | `[inline, virtual]`

| Reimplemented from DOMTest. Definition at line 83 of file namednodemapsetnameditemthatexists.java.
    00083                                 {
    00084       return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapsetnameditemthatexists";
    00085    }

void namednodemapsetnameditemthatexists::main | ( | String | args[] | ) | `[inline, static]`

| Definition at line 86 of file namednodemapsetnameditemthatexists.java. References DOMTestCase::doMain().
    00086                                           {
    00087         DOMTestCase.doMain(namednodemapsetnameditemthatexists.class,args);
    00088    }

void namednodemapsetnameditemthatexists::runTest | ( |  | ) | `[inline, virtual]`

| Reimplemented from DOMTestCase. Definition at line 63 of file namednodemapsetnameditemthatexists.java. References DOMTestCase::assertEquals(), and DOMTest::load().
    00063                                                     {
    00064       Document doc;
    00065       NodeList elementList;
    00066       Attr newAttribute;
    00067       Node testAddress;
    00068       NamedNodeMap attributes;
    00069       Attr districtNode;
    00070       String attrValue;
    00071       Node setNode;
    00072       doc = load("staff");
    00073       elementList = doc.getElementsByTagName("address");
    00074       testAddress = elementList.item(1);
    00075       newAttribute = doc.createAttribute("street");
    00076       attributes = testAddress.getAttributes();
    00077       setNode = attributes.setNamedItem(newAttribute);
    00078       districtNode = (Attr)attributes.getNamedItem("street");
    00079       attrValue = districtNode.getNodeValue();
    00080       assertEquals("namednodemapSetNamedItemThatExistsAssert","",attrValue);
    00081
    00082    }

The documentation for this class was generated from the following file:

- namednodemapsetnameditemthatexists.java