Main Page Packages Class Hierarchy Compound List File List Compound Members

# nodereplacechildnodeancestor Class Reference

Inherits DOMTestCase.

List of all members.

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

## Detailed Description

The "replaceChild(newChild,oldChild)" method raises a HIERARCHY_REQUEST_ERR DOMException if the node to put in is one of this node's ancestors.

Retrieve the second employee and attempt to replace one of its children with an ancestor node(root node). An attempt to make such a replacement should raise the desired exception.

Author:
  NIST , Mary Brady

See also:
  http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR']) , http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307 , http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-785887307')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='HIERARCHY_REQUEST_ERR']) , http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307

Definition at line 49 of file nodereplacechildnodeancestor.java.

## Constructor & Destructor Documentation

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

| Definition at line 51 of file nodereplacechildnodeancestor.java.
    00052  {
    00053       super(factory);
    00054
    00055    }

## Member Function Documentation

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

| Reimplemented from DOMTest. Definition at line 85 of file nodereplacechildnodeancestor.java.
    00085                                 {
    00086       return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/nodereplacechildnodeancestor";
    00087    }

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

| Definition at line 88 of file nodereplacechildnodeancestor.java. References DOMTestCase::doMain().
    00088                                           {
    00089         DOMTestCase.doMain(nodereplacechildnodeancestor.class,args);
    00090    }

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

| Reimplemented from DOMTestCase. Definition at line 57 of file nodereplacechildnodeancestor.java. References DOMTestCase::assertTrue(), and DOMTest::load().
    00057                                                     {
    00058       Document doc;
    00059       Node newChild;
    00060       NodeList elementList;
    00061       Node employeeNode;
    00062       NodeList childList;
    00063       Node oldChild;
    00064       Node replacedNode;
    00065       doc = load("staff");
    00066       newChild = doc.getDocumentElement();
    00067       elementList = doc.getElementsByTagName("employee");
    00068       employeeNode = elementList.item(1);
    00069       childList = employeeNode.getChildNodes();
    00070       oldChild = childList.item(0);
    00071
    00072         {
    00073                 boolean success = false;
    00074                 try {
    00075                         replacedNode = employeeNode.replaceChild(newChild,oldChild);
    00076
    00077                 }
    00078                 catch(DOMException ex) {
    00079                         success = (ex.code == DOMException.HIERARCHY_REQUEST_ERR);
    00080                 }
    00081                 assertTrue("nodeReplaceChildNodeAncestorAssert1",success);
    00082         }
    00083
    00084    }

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

- nodereplacechildnodeancestor.java