Main Page Packages Class Hierarchy Compound List File List Compound Members

# nodeclonenodetrue Class Reference

Inherits DOMTestCase.

List of all members.

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

## Detailed Description

The "cloneNode(deep)" method returns a copy of the node and the subtree under it if deep=true.

Retrieve the second employee and invoke the "cloneNode(deep)" method with deep=true. The method should clone this node and the subtree under it. The NodeName of each child in the returned node is checked to insure the entire subtree under the second employee was cloned.

Author:
  NIST , Mary Brady

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

Definition at line 47 of file nodeclonenodetrue.java.

## Constructor & Destructor Documentation

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

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

## Member Function Documentation

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

| Reimplemented from DOMTest. Definition at line 113 of file nodeclonenodetrue.java.
    00113                                 {
    00114       return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeclonenodetrue";
    00115    }

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

| Definition at line 116 of file nodeclonenodetrue.java. References DOMTestCase::doMain().
    00116                                           {
    00117         DOMTestCase.doMain(nodeclonenodetrue.class,args);
    00118    }

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

| Reimplemented from DOMTestCase. Definition at line 55 of file nodeclonenodetrue.java. References DOMTestCase::assertEquals(), DOMTest::isIgnoringElementContentWhitespace(), and DOMTest::load().
    00055                                                     {
    00056       Document doc;
    00057       NodeList elementList;
    00058       Node employeeNode;
    00059       Node clonedNode;
    00060       NodeList clonedList;
    00061       Node clonedChild;
    00062       String clonedChildName;
    00063       List result = new ArrayList();
    00064
    00065       List expectedWhitespace = new ArrayList();
    00066       expectedWhitespace.add("#text");
    00067       expectedWhitespace.add("employeeId");
    00068       expectedWhitespace.add("#text");
    00069       expectedWhitespace.add("name");
    00070       expectedWhitespace.add("#text");
    00071       expectedWhitespace.add("position");
    00072       expectedWhitespace.add("#text");
    00073       expectedWhitespace.add("salary");
    00074       expectedWhitespace.add("#text");
    00075       expectedWhitespace.add("gender");
    00076       expectedWhitespace.add("#text");
    00077       expectedWhitespace.add("address");
    00078       expectedWhitespace.add("#text");
    00079
    00080       List expectedNoWhitespace = new ArrayList();
    00081       expectedNoWhitespace.add("employeeId");
    00082       expectedNoWhitespace.add("name");
    00083       expectedNoWhitespace.add("position");
    00084       expectedNoWhitespace.add("salary");
    00085       expectedNoWhitespace.add("gender");
    00086       expectedNoWhitespace.add("address");
    00087
    00088       doc = load("staff");
    00089       elementList = doc.getElementsByTagName("employee");
    00090       employeeNode = elementList.item(1);
    00091       clonedNode = employeeNode.cloneNode(true);
    00092       clonedList = clonedNode.getChildNodes();
    00093       for(int _index = 0; _index < clonedList.getLength();_index++) {
    00094       clonedChild = ( Node ) clonedList.item(_index);
    00095            clonedChildName = clonedChild.getNodeName();
    00096       result.add(clonedChildName);
    00097
    00098         }
    00099
    00100         if(
    00101         isIgnoringElementContentWhitespace()
    00102         ) {
    00103         assertEquals("nowhitespace",expectedNoWhitespace,result);
    00104
    00105         }
    00106
    00107                 else {
    00108                         assertEquals("whitespace",expectedWhitespace,result);
    00109
    00110                 }
    00111
    00112    }

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

- nodeclonenodetrue.java