Main Page   Packages   Class Hierarchy   Compound List   File List   Compound Members  

nodelistreturnlastitem Class Reference

Inherits DOMTestCase.

List of all members.

Public Methods

 nodelistreturnlastitem (DOMTestDocumentBuilderFactory factory)
void runTest () throws java.lang.Throwable
String getTargetURI ()

Static Public Methods

void main (String[] args)


Detailed Description

The "item(index)" method returns the indexth item in the collection.

Create a list of all the children elements of the third employee and access its last child by invoking the "item(index)" method with an index=12. This should result in "text" being returned. Further we evaluate its content(by using the "getNodeName()" method) to ensure the proper element was accessed.

Author:
NIST , Mary Brady
See also:
http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-844377136

Definition at line 48 of file nodelistreturnlastitem.java.


Constructor & Destructor Documentation

nodelistreturnlastitem::nodelistreturnlastitem DOMTestDocumentBuilderFactory    factory [inline]
 

Definition at line 50 of file nodelistreturnlastitem.java.

00051  {
00052       super(factory);
00053 
00054    }


Member Function Documentation

String nodelistreturnlastitem::getTargetURI   [inline, virtual]
 

Reimplemented from DOMTest.

Definition at line 85 of file nodelistreturnlastitem.java.

00085                                 {
00086       return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodelistreturnlastitem";
00087    }

void nodelistreturnlastitem::main String    args[] [inline, static]
 

Definition at line 88 of file nodelistreturnlastitem.java.

References DOMTestCase::doMain().

00088                                           {
00089         DOMTestCase.doMain(nodelistreturnlastitem.class,args);
00090    }

void nodelistreturnlastitem::runTest   [inline, virtual]
 

Reimplemented from DOMTestCase.

Definition at line 56 of file nodelistreturnlastitem.java.

References DOMTestCase::assertEquals(), DOMTest::isIgnoringElementContentWhitespace(), and DOMTest::load().

00056                                                     {
00057       Document doc;
00058       NodeList elementList;
00059       Node employeeNode;
00060       NodeList employeeList;
00061       Node child;
00062       String childName;
00063       doc = load("staff");
00064       elementList = doc.getElementsByTagName("employee");
00065       employeeNode = elementList.item(2);
00066       employeeList = employeeNode.getChildNodes();
00067       
00068         if(
00069         isIgnoringElementContentWhitespace()
00070         ) {
00071         child = employeeList.item(5);
00072       childName = child.getNodeName();
00073       assertEquals("nodeName1","address",childName);
00074       
00075         }
00076         
00077                 else {
00078                         child = employeeList.item(12);
00079       childName = child.getNodeName();
00080       assertEquals("nodeName2","#text",childName);
00081       
00082                 }
00083         
00084    }


The documentation for this class was generated from the following file:
Generated on Thu Feb 14 19:47:06 2002 for DOM Level 1 Core Test Suite by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001