attrgetownerelement01public final class attrgetownerelement01 extends org.w3c.domts.DOMTestCase The "getOwnerElement()" will return the Element node this attribute is attached to or
null if this attribute is not in use.
Retreive the default attribute defaultAttr and check its owner element. Verify if the name
the nodeName of the returned ownerElement is emp:employee. |
Constructors Summary |
---|
public attrgetownerelement01(org.w3c.domts.DOMTestDocumentBuilderFactory factory)Constructor.
org.w3c.domts.DocumentBuilderSetting[] settings =
new org.w3c.domts.DocumentBuilderSetting[] {
org.w3c.domts.DocumentBuilderSetting.namespaceAware,
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/attrgetownerelement01";
| public static void | main(java.lang.String[] args)Runs this test from the command line.
DOMTestCase.doMain(attrgetownerelement01.class, args);
| public void | runTest()Runs the test case.
Document doc;
Attr attr;
Element element;
Element ownerElement;
String ownerElementName;
NodeList elementList;
NamedNodeMap attributes;
String nullNS = null;
doc = (Document) load("staffNS", false);
elementList = doc.getElementsByTagNameNS("http://www.nist.gov", "employee");
element = (Element) elementList.item(1);
attributes = element.getAttributes();
attr = (Attr) attributes.getNamedItemNS(nullNS, "defaultAttr");
ownerElement = attr.getOwnerElement();
ownerElementName = ownerElement.getNodeName();
assertEquals("attrgetownerelement01", "emp:employee", ownerElementName);
|
|