elementinvalidcharacterexceptionpublic final class elementinvalidcharacterexception extends org.w3c.domts.DOMTestCase The "setAttribute(name,value)" method raises an
"INVALID_CHARACTER_ERR DOMException if the specified
name contains an invalid character.
Retrieve the last child of the first employee and
call its "setAttribute(name,value)" method with
"name" containing an invalid character. |
Constructors Summary |
---|
public elementinvalidcharacterexception(org.w3c.domts.DOMTestDocumentBuilderFactory factory)Constructor.
super(factory);
//
// check if loaded documents are supported for content type
//
String contentType = getContentType();
preload(contentType, "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/elementinvalidcharacterexception";
| public static void | main(java.lang.String[] args)Runs this test from the command line.
DOMTestCase.doMain(elementinvalidcharacterexception.class, args);
| public void | runTest()Runs the test case.
Document doc;
NodeList elementList;
Element testAddress;
doc = (Document) load("staff", true);
elementList = doc.getElementsByTagName("address");
testAddress = (Element) elementList.item(0);
{
boolean success = false;
try {
testAddress.setAttribute("invalid^Name", "value");
} catch (DOMException ex) {
success = (ex.code == DOMException.INVALID_CHARACTER_ERR);
}
assertTrue("throw_INVALID_CHARACTER_ERR", success);
}
|
|