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

DocumentGeteEementById

public final class DocumentGeteEementById extends DOMTestCase
The method getElementById returns the element whose ID is given by elementId. If not such element exists, returns null. Invoke the getElementById method on this Document object with an invalid elementId. This should return a null element.
author
IBM
author
Neil Delima
see
http://www.w3.org/TR/DOM-Level-2-Core/core
see
http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBId

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 voidtestGetElementById()
Runs the test case.

throws
Throwable Any uncaught exception causes test to fail

        Document doc;
        Element element;
        String elementId = "---";
        doc = (Document) load("staffNS", builder);
        element = doc.getElementById(elementId);
        assertNull("documentgetelementbyid01", element);