documentcreateattributeNS04public final class documentcreateattributeNS04 extends org.w3c.domts.DOMTestCase The method createAttributeNS raises a NAMESPACE_ERR if the specified qualified name
is malformed.
Invoke the createAttributeNS method on this Document object with a valid value for
namespaceURI, and malformed qualifiedNames. Check if the a NAMESPACE_ERR was thrown. |
Constructors Summary |
---|
public documentcreateattributeNS04(org.w3c.domts.DOMTestDocumentBuilderFactory factory)Constructor.
super(factory);
//
// check if loaded documents are supported for content type
//
String contentType = getContentType();
preload(contentType, "staffNS", false);
|
Methods Summary |
---|
public java.lang.String | getTargetURI()Gets URI that identifies the test.
return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentcreateattributeNS04";
| public static void | main(java.lang.String[] args)Runs this test from the command line.
DOMTestCase.doMain(documentcreateattributeNS04.class, args);
| public void | runTest()Runs the test case.
Document doc;
Attr attribute;
String namespaceURI = "http://www.w3.org/DOM/Test/Level2";
String qualifiedName;
java.util.List qualifiedNames = new java.util.ArrayList();
qualifiedNames.add("_:");
qualifiedNames.add(":0a");
qualifiedNames.add(":");
qualifiedNames.add("a:b:c");
qualifiedNames.add("_::a");
doc = (Document) load("staffNS", false);
for (int indexN1004E = 0; indexN1004E < qualifiedNames.size(); indexN1004E++) {
qualifiedName = (String) qualifiedNames.get(indexN1004E);
{
boolean success = false;
try {
attribute = doc.createAttributeNS(namespaceURI, qualifiedName);
} catch (DOMException ex) {
success = (ex.code == DOMException.NAMESPACE_ERR);
}
assertTrue("documentcreateattributeNS04", success);
}
}
|
|