Main Page Packages Class Hierarchy Compound List File List Compound Members

# nodeinsertbeforenewchildexists Class Reference

Inherits DOMTestCase.

List of all members.

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

## Detailed Description

If the "newChild" is already in the tree, the "insertBefore(newChild,refChild)" method must first remove it before the insertion takes place.

Insert a node Element ("employeeId") that is already present in the tree. The existing node should be removed first and the new one inserted. The node is inserted at a different position in the tree to assure that it was indeed inserted.

Author:
  NIST , Mary Brady

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

Definition at line 47 of file nodeinsertbeforenewchildexists.java.

## Constructor & Destructor Documentation

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

| Definition at line 49 of file nodeinsertbeforenewchildexists.java.
    00050  {
    00051       super(factory);
    00052
    00053    }

## Member Function Documentation

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

| Reimplemented from DOMTest. Definition at line 124 of file nodeinsertbeforenewchildexists.java.
    00124                                 {
    00125       return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeinsertbeforenewchildexists";
    00126    }

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

| Definition at line 127 of file nodeinsertbeforenewchildexists.java. References DOMTestCase::doMain().
    00127                                           {
    00128         DOMTestCase.doMain(nodeinsertbeforenewchildexists.class,args);
    00129    }

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

| Reimplemented from DOMTestCase. Definition at line 55 of file nodeinsertbeforenewchildexists.java. References DOMTestCase::assertEquals(), DOMTest::isIgnoringElementContentWhitespace(), and DOMTest::load().
    00055                                                     {
    00056       Document doc;
    00057       NodeList elementList;
    00058       Node employeeNode;
    00059       NodeList childList;
    00060       Node refChild;
    00061       Node newChild;
    00062       Node child;
    00063       String childName;
    00064       Node insertedNode;
    00065       List expectedWhitespace = new ArrayList();
    00066       expectedWhitespace.add("#text");
    00067       expectedWhitespace.add("#text");
    00068       expectedWhitespace.add("name");
    00069       expectedWhitespace.add("#text");
    00070       expectedWhitespace.add("position");
    00071       expectedWhitespace.add("#text");
    00072       expectedWhitespace.add("salary");
    00073       expectedWhitespace.add("#text");
    00074       expectedWhitespace.add("gender");
    00075       expectedWhitespace.add("#text");
    00076       expectedWhitespace.add("employeeId");
    00077       expectedWhitespace.add("address");
    00078       expectedWhitespace.add("#text");
    00079
    00080       List expectedNoWhitespace = new ArrayList();
    00081       expectedNoWhitespace.add("name");
    00082       expectedNoWhitespace.add("position");
    00083       expectedNoWhitespace.add("salary");
    00084       expectedNoWhitespace.add("gender");
    00085       expectedNoWhitespace.add("employeeId");
    00086       expectedNoWhitespace.add("address");
    00087
    00088       List expected = new ArrayList();
    00089
    00090       List result = new ArrayList();
    00091
    00092       doc = load("staff");
    00093       elementList = doc.getElementsByTagName("employee");
    00094
    00095         if(
    00096         isIgnoringElementContentWhitespace()
    00097         ) {
    00098         expected =  expectedNoWhitespace;
    00099 employeeNode = elementList.item(0);
    00100       childList = employeeNode.getChildNodes();
    00101       refChild = childList.item(5);
    00102       newChild = childList.item(0);
    00103
    00104         }
    00105
    00106                 else {
    00107                         expected =  expectedWhitespace;
    00108 employeeNode = elementList.item(1);
    00109       childList = employeeNode.getChildNodes();
    00110       refChild = childList.item(11);
    00111       newChild = childList.item(1);
    00112
    00113                 }
    00114         insertedNode = employeeNode.insertBefore(newChild,refChild);
    00115       for(int _index = 0; _index < childList.getLength();_index++) {
    00116       child = ( Node ) childList.item(_index);
    00117            childName = child.getNodeName();
    00118       result.add(childName);
    00119
    00120         }
    00121       assertEquals("childNames",expected,result);
    00122
    00123    }

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

- nodeinsertbeforenewchildexists.java