1 2/* 3This Java source file was generated by test-to-java.xsl 4and is a derived work from the source document. 5The source document contained the following notice: 6 7 8 9 10 11Copyright (c) 2001 World Wide Web Consortium, 12 13(Massachusetts Institute of Technology, Institut National de 14 15Recherche en Informatique et en Automatique, Keio University). All 16 17Rights Reserved. This program is distributed under the W3C's Software 18 19Intellectual Property License. This program is distributed in the 20 21hope that it will be useful, but WITHOUT ANY WARRANTY; without even 22 23the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 24 25PURPOSE. 26 27 28 29See W3C License http://www.w3.org/Consortium/Legal/ for more details. 30 31 32 33 34*/ 35 36package org.w3c.domts.level2.core; 37 38import org.w3c.dom.*; 39 40 41import org.w3c.domts.DOMTestCase; 42import org.w3c.domts.DOMTestDocumentBuilderFactory; 43 44 45 46/** 47 * The method getElementsByTagNameNS returns a NodeList of all the Elements with a given local 48 * name and namespace URI in the order in which they are encountered in a preorder traversal 49 * of the Document tree. 50 * Invoke getElementsByTagNameNS on the documentElement with values for namespaceURI '*' and 51 * localName '*'. Verify if this returns a nodeList of 0 elements. 52 * 53* @author IBM 54* @author Neil Delima 55* @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> 56*/ 57public final class elementgetelementsbytagnamens02 extends DOMTestCase { 58 59 /** 60 * Constructor. 61 * @param factory document factory, may not be null 62 * @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration 63 */ 64 public elementgetelementsbytagnamens02(final DOMTestDocumentBuilderFactory factory) throws org.w3c.domts.DOMTestIncompatibleException { 65 66 org.w3c.domts.DocumentBuilderSetting[] settings = 67 new org.w3c.domts.DocumentBuilderSetting[] { 68org.w3c.domts.DocumentBuilderSetting.namespaceAware 69 }; 70 DOMTestDocumentBuilderFactory testFactory = factory.newInstance(settings); 71 setFactory(testFactory); 72 73 // 74 // check if loaded documents are supported for content type 75 // 76 String contentType = getContentType(); 77 preload(contentType, "staffNS", false); 78 } 79 80 /** 81 * Runs the test case. 82 * @throws Throwable Any uncaught exception causes test to fail 83 */ 84 public void runTest() throws Throwable { 85 Document doc; 86 Element element; 87 NodeList elementList; 88 doc = (Document) load("staffNS", false); 89 element = doc.getDocumentElement(); 90 elementList = element.getElementsByTagNameNS("**", "*"); 91 assertSize("elementgetelementsbytagnamens02", 0, elementList); 92 } 93 /** 94 * Gets URI that identifies the test. 95 * @return uri identifier of test 96 */ 97 public String getTargetURI() { 98 return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementgetelementsbytagnamens02"; 99 } 100 /** 101 * Runs this test from the command line. 102 * @param args command line arguments 103 */ 104 public static void main(final String[] args) { 105 DOMTestCase.doMain(elementgetelementsbytagnamens02.class, args); 106 } 107} 108 109