Main Page   Packages   Class Hierarchy   Compound List   File List   Compound Members  

nodeinsertbeforeinvalidnodetype Class Reference

Inherits DOMTestCase.

List of all members.

Public Methods

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

Static Public Methods

void main (String[] args)


Detailed Description

The "insertBefore(newChild,refChild)" 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 insert 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-952280727 , http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-952280727')/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-952280727

Definition at line 50 of file nodeinsertbeforeinvalidnodetype.java.


Constructor & Destructor Documentation

nodeinsertbeforeinvalidnodetype::nodeinsertbeforeinvalidnodetype DOMTestDocumentBuilderFactory    factory [inline]
 

Definition at line 52 of file nodeinsertbeforeinvalidnodetype.java.

00053  {
00054       super(factory);
00055 
00056    }


Member Function Documentation

String nodeinsertbeforeinvalidnodetype::getTargetURI   [inline, virtual]
 

Reimplemented from DOMTest.

Definition at line 84 of file nodeinsertbeforeinvalidnodetype.java.

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

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

Definition at line 87 of file nodeinsertbeforeinvalidnodetype.java.

References DOMTestCase::doMain().

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

void nodeinsertbeforeinvalidnodetype::runTest   [inline, virtual]
 

Reimplemented from DOMTestCase.

Definition at line 58 of file nodeinsertbeforeinvalidnodetype.java.

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

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


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