Main Page Packages Class Hierarchy Compound List File List Compound Members

# elementwrongdocumenterr Class Reference

Inherits DOMTestCase.

List of all members.

## Public Methods
| elementwrongdocumenterr (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

"WRONG_DOCUMENT_ERR DOMException if the "newAttr"

was created from a different document than the one that

created this document.

Retrieve the last employee and attempt to set a new

attribute node for its "employee" element. The new

attribute was created from a document other than the

one that created this element, therefore a

WRONG_DOCUMENT_ERR DOMException should be raised.

This test uses the "createAttribute(newAttr)" method

from the Document interface.

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='WRONG_DOCUMENT_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(.,':')='WRONG_DOCUMENT_ERR'])

Definition at line 65 of file elementwrongdocumenterr.java.

## Constructor & Destructor Documentation

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

| Definition at line 67 of file elementwrongdocumenterr.java.
    00068  {
    00069       super(factory);
    00070
    00071    }

## Member Function Documentation

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

| Reimplemented from DOMTest. Definition at line 99 of file elementwrongdocumenterr.java.
    00099                                 {
    00100       return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/elementwrongdocumenterr";
    00101    }

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

| Definition at line 102 of file elementwrongdocumenterr.java. References DOMTestCase::doMain().
    00102                                           {
    00103         DOMTestCase.doMain(elementwrongdocumenterr.class,args);
    00104    }

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

| Reimplemented from DOMTestCase. Definition at line 73 of file elementwrongdocumenterr.java. References DOMTestCase::assertTrue(), and DOMTest::load().
    00073                                                     {
    00074       Document doc1;
    00075       Document doc2;
    00076       Attr newAttribute;
    00077       NodeList addressElementList;
    00078       Element testAddress;
    00079       Attr attrAddress;
    00080       doc1 = load("staff");
    00081       doc2 = load("staff");
    00082       newAttribute = doc2.createAttribute("newAttribute");
    00083       addressElementList = doc1.getElementsByTagName("address");
    00084       testAddress = (Element)addressElementList.item(4);
    00085
    00086         {
    00087                 boolean success = false;
    00088                 try {
    00089                         attrAddress = testAddress.setAttributeNode(newAttribute);
    00090
    00091                 }
    00092                 catch(DOMException ex) {
    00093                         success = (ex.code == DOMException.WRONG_DOCUMENT_ERR);
    00094                 }
    00095                 assertTrue("elementWrongDocumentErrAssert",success);
    00096         }
    00097
    00098    }

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

- elementwrongdocumenterr.java