Main Page   Packages   Class Hierarchy   Compound List   File List   Compound Members  

nodereplacechildinvalidnodetype Class Reference

Inherits DOMTestCase.

List of all members.

Public Methods

 nodereplacechildinvalidnodetype (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 this node is of a type that does not allow children of the type "newChild" to be inserted.

Retrieve the root node and attempt to replace one of its children with a newly created Attr node. An Element node cannot have children of the "Attr" type, therefore the desired exception should be raised.

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 50 of file nodereplacechildinvalidnodetype.java.


Constructor & Destructor Documentation

nodereplacechildinvalidnodetype::nodereplacechildinvalidnodetype DOMTestDocumentBuilderFactory    factory [inline]
 

Definition at line 52 of file nodereplacechildinvalidnodetype.java.

00053  {
00054       super(factory);
00055 
00056    }


Member Function Documentation

String nodereplacechildinvalidnodetype::getTargetURI   [inline, virtual]
 

Reimplemented from DOMTest.

Definition at line 84 of file nodereplacechildinvalidnodetype.java.

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

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

Definition at line 87 of file nodereplacechildinvalidnodetype.java.

References DOMTestCase::doMain().

00087                                           {
00088         DOMTestCase.doMain(nodereplacechildinvalidnodetype.class,args);
00089    }

void nodereplacechildinvalidnodetype::runTest   [inline, virtual]
 

Reimplemented from DOMTestCase.

Definition at line 58 of file nodereplacechildinvalidnodetype.java.

References DOMTestCase::assertTrue(), and DOMTest::load().

00058                                                     {
00059       Document doc;
00060       Element rootNode;
00061       Node newChild;
00062       NodeList elementList;
00063       Node oldChild;
00064       Node replacedChild;
00065       doc = load("staff");
00066       rootNode = doc.getDocumentElement();
00067       newChild = doc.createAttribute("newAttribute");
00068       elementList = doc.getElementsByTagName("employee");
00069       oldChild = elementList.item(1);
00070       
00071         {
00072                 boolean success = false;
00073                 try {
00074                         replacedChild = rootNode.replaceChild(newChild,oldChild);
00075       
00076                 }
00077                 catch(DOMException ex) {
00078                         success = (ex.code == DOMException.HIERARCHY_REQUEST_ERR);
00079                 }
00080                 assertTrue("nodeReplaceChildInvalidNodeTypeAssert1",success);
00081         }
00082 
00083    }


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