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 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
18 See W3C License http://www.w3.org/Consortium/Legal/ for more details.
23 package org.w3c.domts.level2.core;
28 import org.w3c.domts.DOMTestCase;
29 import org.w3c.domts.DOMTestDocumentBuilderFactory;
34 * The method getElementsByTagNameNS returns a NodeList of all the Elements with
35 * a given local name and namespace URI in the order in which they are encountered
36 * in a preorder traversal of the Document tree.
39 * Create a new element having a local name="employeeId" belonging to the namespace "test"
40 * and append it to this document. Invoke the getElementsByTagNameNS method on a this
41 * Document object with the values of namespaceURI=* and localName="elementId". This
42 * should return a nodeList of 6 item. Check the length of the nodeList returned.
45 * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core">http://www.w3.org/TR/DOM-Level-2-Core/core</a>
46 * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS</a>
48 public final class documentgetelementsbytagnameNS02 extends DOMTestCase {
52 * @param factory document factory, may not be null
53 * @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
55 public documentgetelementsbytagnameNS02(final DOMTestDocumentBuilderFactory factory) throws org.w3c.domts.DOMTestIncompatibleException {
57 org.w3c.domts.DocumentBuilderSetting[] settings =
58 new org.w3c.domts.DocumentBuilderSetting[] {
59 org.w3c.domts.DocumentBuilderSetting.namespaceAware
61 DOMTestDocumentBuilderFactory testFactory = factory.newInstance(settings);
62 setFactory(testFactory);
65 // check if loaded documents are supported for content type
67 String contentType = getContentType();
68 preload(contentType, "staffNS", true);
73 * @throws Throwable Any uncaught exception causes test to fail
75 public void runTest() throws Throwable {
81 doc = (Document) load("staffNS", true);
82 docElem = doc.getDocumentElement();
83 element = doc.createElementNS("test", "employeeId");
84 appendedChild = docElem.appendChild(element);
85 childList = doc.getElementsByTagNameNS("*", "employeeId");
86 assertSize("documentgetelementsbytagnameNS02", 6, childList);
89 * Gets URI that identifies the test.
90 * @return uri identifier of test
92 public String getTargetURI() {
93 return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/documentgetelementsbytagnameNS02";
96 * Runs this test from the command line.
97 * @param args command line arguments
99 public static void main(final String[] args) {
100 DOMTestCase.doMain(documentgetelementsbytagnameNS02.class, args);