elementhasattribute02public final class elementhasattribute02 extends org.w3c.domts.DOMTestCase The method hasAttribute returns true when an attribute with a given name is specified
on this element or has a default value, false otherwise
Invoke the hasAttribute method to on an element with default attributes and verify if it
returns true. |
Constructors Summary |
---|
public elementhasattribute02(org.w3c.domts.DOMTestDocumentBuilderFactory factory)Constructor.
org.w3c.domts.DocumentBuilderSetting[] settings =
new org.w3c.domts.DocumentBuilderSetting[] {
org.w3c.domts.DocumentBuilderSetting.validating
};
DOMTestDocumentBuilderFactory testFactory = factory.newInstance(settings);
setFactory(testFactory);
//
// 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/elementhasattribute02";
| public static void | main(java.lang.String[] args)Runs this test from the command line.
DOMTestCase.doMain(elementhasattribute02.class, args);
| public void | runTest()Runs the test case.
Document doc;
Element element;
boolean state;
NodeList elementList;
doc = (Document) load("staffNS", false);
elementList = doc.getElementsByTagName("emp:employee");
element = (Element) elementList.item(0);
assertNotNull("empEmployeeNotNull", element);
state = element.hasAttribute("defaultAttr");
assertTrue("elementhasattribute02", state);
|
|