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 hasAttribute returns true when an attribute with a given name is specified 48 * on this element or has a default value, false otherwise 49 * Invoke the hasAttribute method to check if the documentElement has attributres. 50 * 51* @author IBM 52* @author Neil Delima 53* @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs</a> 54*/ 55public final class elementhasattribute01 extends DOMTestCase { 56 57 /** 58 * Constructor. 59 * @param factory document factory, may not be null 60 * @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration 61 */ 62 public elementhasattribute01(final DOMTestDocumentBuilderFactory factory) throws org.w3c.domts.DOMTestIncompatibleException { 63 64 org.w3c.domts.DocumentBuilderSetting[] settings = 65 new org.w3c.domts.DocumentBuilderSetting[] { 66org.w3c.domts.DocumentBuilderSetting.notNamespaceAware 67 }; 68 DOMTestDocumentBuilderFactory testFactory = factory.newInstance(settings); 69 setFactory(testFactory); 70 71 // 72 // check if loaded documents are supported for content type 73 // 74 String contentType = getContentType(); 75 preload(contentType, "staff", false); 76 } 77 78 /** 79 * Runs the test case. 80 * @throws Throwable Any uncaught exception causes test to fail 81 */ 82 public void runTest() throws Throwable { 83 Document doc; 84 Element element; 85 boolean state; 86 doc = (Document) load("staff", false); 87 element = doc.getDocumentElement(); 88 state = element.hasAttribute(""); 89 assertFalse("elementhasattribute01", state); 90} 91 /** 92 * Gets URI that identifies the test. 93 * @return uri identifier of test 94 */ 95 public String getTargetURI() { 96 return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/elementhasattribute01"; 97 } 98 /** 99 * Runs this test from the command line. 100 * @param args command line arguments 101 */ 102 public static void main(final String[] args) { 103 DOMTestCase.doMain(elementhasattribute01.class, args); 104 } 105} 106 107