Public Methods | |
| nodeappendchilddocfragment (DOMTestDocumentBuilderFactory factory) | |
| void | runTest () throws java.lang.Throwable |
| String | getTargetURI () |
Static Public Methods | |
| void | main (String[] args) |
Create and populate a new DocumentFragment object and append it to the second employee. After the "appendChild(newChild)" method is invoked retrieve the new nodes at the end of the list, they should be the two Element nodes from the DocumentFragment.
Definition at line 46 of file nodeappendchilddocfragment.java.
|
|
Definition at line 48 of file nodeappendchilddocfragment.java.
00049 {
00050 super(factory);
00051
00052 }
|
|
|
Reimplemented from DOMTest. Definition at line 124 of file nodeappendchilddocfragment.java.
00124 {
00125 return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodeappendchilddocfragment";
00126 }
|
|
|
Definition at line 127 of file nodeappendchilddocfragment.java. References DOMTestCase::doMain().
00127 {
00128 DOMTestCase.doMain(nodeappendchilddocfragment.class,args);
00129 }
|
|
|
Reimplemented from DOMTestCase. Definition at line 54 of file nodeappendchilddocfragment.java. References DOMTestCase::assertEquals(), DOMTest::isIgnoringElementContentWhitespace(), and DOMTest::load().
00054 {
00055 Document doc;
00056 NodeList elementList;
00057 Node employeeNode;
00058 NodeList childList;
00059 DocumentFragment newdocFragment;
00060 Node newChild1;
00061 Node newChild2;
00062 Node child;
00063 String childName;
00064 List result = new ArrayList();
00065
00066 Node appendedChild;
00067 List expectedWithWhitespace = new ArrayList();
00068 expectedWithWhitespace.add("#text");
00069 expectedWithWhitespace.add("employeeId");
00070 expectedWithWhitespace.add("#text");
00071 expectedWithWhitespace.add("name");
00072 expectedWithWhitespace.add("#text");
00073 expectedWithWhitespace.add("position");
00074 expectedWithWhitespace.add("#text");
00075 expectedWithWhitespace.add("salary");
00076 expectedWithWhitespace.add("#text");
00077 expectedWithWhitespace.add("gender");
00078 expectedWithWhitespace.add("#text");
00079 expectedWithWhitespace.add("address");
00080 expectedWithWhitespace.add("#text");
00081 expectedWithWhitespace.add("newChild1");
00082 expectedWithWhitespace.add("newChild2");
00083
00084 List expectedWithoutWhitespace = new ArrayList();
00085 expectedWithoutWhitespace.add("employeeId");
00086 expectedWithoutWhitespace.add("name");
00087 expectedWithoutWhitespace.add("position");
00088 expectedWithoutWhitespace.add("salary");
00089 expectedWithoutWhitespace.add("gender");
00090 expectedWithoutWhitespace.add("address");
00091 expectedWithoutWhitespace.add("newChild1");
00092 expectedWithoutWhitespace.add("newChild2");
00093
00094 doc = load("staff");
00095 elementList = doc.getElementsByTagName("employee");
00096 employeeNode = elementList.item(1);
00097 childList = employeeNode.getChildNodes();
00098 newdocFragment = doc.createDocumentFragment();
00099 newChild1 = doc.createElement("newChild1");
00100 newChild2 = doc.createElement("newChild2");
00101 appendedChild = newdocFragment.appendChild(newChild1);
00102 appendedChild = newdocFragment.appendChild(newChild2);
00103 appendedChild = employeeNode.appendChild(newdocFragment);
00104 for(int _index = 0; _index < childList.getLength();_index++) {
00105 child = ( Node ) childList.item(_index);
00106 childName = child.getNodeName();
00107 result.add(childName);
00108
00109 }
00110
00111 if(
00112 isIgnoringElementContentWhitespace()
00113 ) {
00114 assertEquals("nodeNamesNoWhitespace",expectedWithoutWhitespace,result);
00115
00116 }
00117
00118 else {
00119 assertEquals("nodeNamesWithWhitespace",expectedWithWhitespace,result);
00120
00121 }
00122
00123 }
|
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001