hc_attrinsertbefore6public final class hc_attrinsertbefore6 extends org.w3c.domts.DOMTestCase Attempt to append a text node from another document to an attribute which should result
in a WRONG_DOCUMENT_ERR. |
Constructors Summary |
---|
public hc_attrinsertbefore6(org.w3c.domts.DOMTestDocumentBuilderFactory factory)Constructor.
super(factory);
//
// check if loaded documents are supported for content type
//
String contentType = getContentType();
preload(contentType, "hc_staff", true);
preload(contentType, "hc_staff", true);
|
Methods Summary |
---|
public java.lang.String | getTargetURI()Gets URI that identifies the test.
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_attrinsertbefore6";
| public static void | main(java.lang.String[] args)Runs this test from the command line.
DOMTestCase.doMain(hc_attrinsertbefore6.class, args);
| public void | runTest()Runs the test case.
Document doc;
NodeList acronymList;
Node testNode;
NamedNodeMap attributes;
Attr titleAttr;
String value;
Node textNode;
Node retval;
Node refChild = null;
Document otherDoc;
doc = (Document) load("hc_staff", true);
otherDoc = (Document) load("hc_staff", true);
acronymList = doc.getElementsByTagName("acronym");
testNode = acronymList.item(3);
attributes = testNode.getAttributes();
titleAttr = (Attr) attributes.getNamedItem("title");
textNode = otherDoc.createTextNode("terday");
{
boolean success = false;
try {
retval = titleAttr.insertBefore(textNode, refChild);
} catch (DOMException ex) {
success = (ex.code == DOMException.WRONG_DOCUMENT_ERR);
}
assertTrue("throw_WRONG_DOCUMENT_ERR", success);
}
|
|