Main Page Packages Class Hierarchy Compound List File List Compound Members

# nodereplacechildnewchilddiffdocument Class Reference

Inherits DOMTestCase.

List of all members.

## Public Methods
| nodereplacechildnewchilddiffdocument (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 WRONG_DOCUMENT_ERR DOMException if the "newChild" was created from a different document than the one that created this node.

Retrieve the second employee and attempt to replace one of its children with a node created from a different document. 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='NOT_FOUND_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(.,':')='NOT_FOUND_ERR']) , http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307

Definition at line 50 of file nodereplacechildnewchilddiffdocument.java.

## Constructor & Destructor Documentation

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

| Definition at line 52 of file nodereplacechildnewchilddiffdocument.java.
    00053  {
    00054       super(factory);
    00055
    00056    }

## Member Function Documentation

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

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

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

| Definition at line 89 of file nodereplacechildnewchilddiffdocument.java. References DOMTestCase::doMain().
    00089                                           {
    00090         DOMTestCase.doMain(nodereplacechildnewchilddiffdocument.class,args);
    00091    }

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

| Reimplemented from DOMTestCase. Definition at line 58 of file nodereplacechildnewchilddiffdocument.java. References DOMTestCase::assertTrue(), and DOMTest::load().
    00058                                                     {
    00059       Document doc1;
    00060       Document doc2;
    00061       Node oldChild;
    00062       Node newChild;
    00063       NodeList elementList;
    00064       Node elementNode;
    00065       Node replacedChild;
    00066       doc1 = load("staff");
    00067       doc2 = load("staff");
    00068       newChild = doc1.createElement("newChild");
    00069       elementList = doc2.getElementsByTagName("employee");
    00070       elementNode = elementList.item(1);
    00071       oldChild = elementNode.getFirstChild();
    00072
    00073         {
    00074                 boolean success = false;
    00075                 try {
    00076                         replacedChild = elementNode.replaceChild(newChild,oldChild);
    00077
    00078                 }
    00079                 catch(DOMException ex) {
    00080                         success = (ex.code == DOMException.WRONG_DOCUMENT_ERR);
    00081                 }
    00082                 assertTrue("throw_WRONG_DOCUMENT_ERR",success);
    00083         }
    00084
    00085    }

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

- nodereplacechildnewchilddiffdocument.java