FileDocCategorySizeDatePackage
GetElementById.javaAPI DocAndroid 1.5 API3238Wed May 06 22:41:06 BST 2009tests.org.w3c.dom

GetElementById

public final class GetElementById extends DOMTestCase
The "getElementById(elementId)" method for a Document should return an element whose ID matches elementId. Invoke method getElementById(elementId) on this document with elementId equals "CANADA". Method should return an element whose tag name is "emp:address".
author
NIST
author
Mary Brady
see
http://www.w3.org/TR/DOM-Level-2-Core/core#ID-104682815
see
http://www.w3.org/Bugs/Public/show_bug.cgi?id=383

Fields Summary
DOMDocumentBuilderFactory
factory
DocumentBuilder
builder
Constructors Summary
Methods Summary
protected voidsetUp()

        super.setUp();
        try {
            factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
                    .getConfiguration1());
            builder = factory.getBuilder();
        } catch (Exception e) {
            fail("Unexpected exception" + e.getMessage());
        }
    
protected voidtearDown()

        factory = null;
        builder = null;
        super.tearDown();
    
public voidtestGetElementById2()
Runs the test case.

throws
Throwable Any uncaught exception causes test to fail

        Document doc;
        Element element;
        doc = (Document) load("staffNS", builder);
        element = doc.getElementById("Cancun");
        assertNull("throw_Null", element);