Move to Android N-MR1 SDK.
[android_tools.git] / sdk / sources / android-25 / org / w3c / domts / level2 / core / getElementById01.java
blobdec140c65af9f75dfd3f34343288f487131ad83b
2 /*
3 This Java source file was generated by test-to-java.xsl
4 and is a derived work from the source document.
5 The source document contained the following notice:
9 Copyright (c) 2001-2003 World Wide Web Consortium,
10 (Massachusetts Institute of Technology, Institut National de
11 Recherche en Informatique et en Automatique, Keio University). All
12 Rights Reserved. This program is distributed under the W3C's Software
13 Intellectual Property License. This program is distributed in the
14 hope that it will be useful, but WITHOUT ANY WARRANTY; without even
15 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 PURPOSE.
18 See W3C License http://www.w3.org/Consortium/Legal/ for more details.
23 package org.w3c.domts.level2.core;
25 import org.w3c.dom.*;
28 import org.w3c.domts.DOMTestCase;
29 import org.w3c.domts.DOMTestDocumentBuilderFactory;
33 /**
34 * The "getElementById(elementId)" method for a
35 * Document should return an element whose ID matches elementId.
37 * Invoke method getElementById(elementId) on this document
38 * with elementId equals "CANADA". Method should return an element
39 * whose tag name is "emp:address".
40 * @author NIST
41 * @author Mary Brady
42 * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-104682815">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-104682815</a>
43 * @see <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=383">http://www.w3.org/Bugs/Public/show_bug.cgi?id=383</a>
45 public final class getElementById01 extends DOMTestCase {
47 /**
48 * Constructor.
49 * @param factory document factory, may not be null
50 * @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
52 public getElementById01(final DOMTestDocumentBuilderFactory factory) throws org.w3c.domts.DOMTestIncompatibleException {
54 org.w3c.domts.DocumentBuilderSetting[] settings =
55 new org.w3c.domts.DocumentBuilderSetting[] {
56 org.w3c.domts.DocumentBuilderSetting.validating
58 DOMTestDocumentBuilderFactory testFactory = factory.newInstance(settings);
59 setFactory(testFactory);
62 // check if loaded documents are supported for content type
64 String contentType = getContentType();
65 preload(contentType, "staffNS", false);
68 /**
69 * Runs the test case.
70 * @throws Throwable Any uncaught exception causes test to fail
72 public void runTest() throws Throwable {
73 Document doc;
74 Element element;
75 String tagname;
76 doc = (Document) load("staffNS", false);
77 element = doc.getElementById("CANADA");
78 tagname = element.getTagName();
79 assertEquals("throw_Equals", "emp:address", tagname);
81 /**
82 * Gets URI that identifies the test.
83 * @return uri identifier of test
85 public String getTargetURI() {
86 return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/getElementById01";
88 /**
89 * Runs this test from the command line.
90 * @param args command line arguments
92 public static void main(final String[] args) {
93 DOMTestCase.doMain(getElementById01.class, args);