Main Page   Packages   Class Hierarchy   Compound List   File List   Compound Members  

elementinuseattributeerr Class Reference

Inherits DOMTestCase.

List of all members.

Public Methods

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

Static Public Methods

void main (String[] args)


Detailed Description

The "setAttributeNode(newAttr)" method raises an "INUSE_ATTRIBUTE_ERR DOMException if the "newAttr" is already an attribute of another element.

Retrieve the last child of the second employee and append a newly created element. The "createAttribute(name)" and "setAttributeNode(newAttr)" methods are invoked to create and add a new attribute to the newly created Element. The "setAttributeNode(newAttr)" method is once again called to add the new attribute causing an exception to be raised since the attribute is already an attribute of another element.

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='INUSE_ATTRIBUTE_ERR']) , http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-887236154 , http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-887236154')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR'])

Definition at line 52 of file elementinuseattributeerr.java.


Constructor & Destructor Documentation

elementinuseattributeerr::elementinuseattributeerr DOMTestDocumentBuilderFactory    factory [inline]
 

Definition at line 54 of file elementinuseattributeerr.java.

00055  {
00056       super(factory);
00057 
00058    }


Member Function Documentation

String elementinuseattributeerr::getTargetURI   [inline, virtual]
 

Reimplemented from DOMTest.

Definition at line 91 of file elementinuseattributeerr.java.

00091                                 {
00092       return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementinuseattributeerr";
00093    }

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

Definition at line 94 of file elementinuseattributeerr.java.

References DOMTestCase::doMain().

00094                                           {
00095         DOMTestCase.doMain(elementinuseattributeerr.class,args);
00096    }

void elementinuseattributeerr::runTest   [inline, virtual]
 

Reimplemented from DOMTestCase.

Definition at line 60 of file elementinuseattributeerr.java.

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

00060                                                     {
00061       Document doc;
00062       Attr newAttribute;
00063       NodeList addressElementList;
00064       Element testAddress;
00065       Element newElement;
00066       Attr attrAddress;
00067       Node appendedChild;
00068       Attr setAttr1;
00069       Attr setAttr2;
00070       doc = load("staff");
00071       addressElementList = doc.getElementsByTagName("address");
00072       testAddress = (Element)addressElementList.item(1);
00073       newElement = doc.createElement("newElement");
00074       appendedChild = testAddress.appendChild(newElement);
00075       newAttribute = doc.createAttribute("newAttribute");
00076       setAttr1 = newElement.setAttributeNode(newAttribute);
00077       
00078         {
00079                 boolean success = false;
00080                 try {
00081                         setAttr2 = testAddress.setAttributeNode(newAttribute);
00082       
00083                 }
00084                 catch(DOMException ex) {
00085                         success = (ex.code == DOMException.INUSE_ATTRIBUTE_ERR);
00086                 }
00087                 assertTrue("throw_INUSE_ATTRIBUTE_ERR",success);
00088         }
00089 
00090    }


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