1 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: 6 7 8 9 10 11 Copyright (c) 2001 World Wide Web Consortium, 12 13 (Massachusetts Institute of Technology, Institut National de 14 15 Recherche en Informatique et en Automatique, Keio University). All 16 17 Rights Reserved. This program is distributed under the W3C's Software 18 19 Intellectual Property License. This program is distributed in the 20 21 hope that it will be useful, but WITHOUT ANY WARRANTY; without even 22 23 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 24 25 PURPOSE. 26 27 28 29 See W3C License http://www.w3.org/Consortium/Legal/ for more details. 30 31 32 33 34 */ 35 36 package org.w3c.domts.level2.core; 37 38 import org.w3c.dom.*; 39 40 41 import org.w3c.domts.DOMTestCase; 42 import org.w3c.domts.DOMTestDocumentBuilderFactory; 43 44 45 46 /** 47 * The method hasAttributes returns whether this node (if it is an element) has any attributes. 48 * Retrieve the docType node. Since this is not an element node check if hasAttributes returns 49 * null. 50 * @author IBM 51 * @author Neil Delima 52 * @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> 53 */ 54 public final class nodehasattributes02 extends DOMTestCase { 55 56 /** 57 * Constructor. 58 * @param factory document factory, may not be null 59 * @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration 60 */ 61 public nodehasattributes02(final DOMTestDocumentBuilderFactory factory) throws org.w3c.domts.DOMTestIncompatibleException { 62 super(factory); 63 64 // 65 // check if loaded documents are supported for content type 66 // 67 String contentType = getContentType(); 68 preload(contentType, "staffNS", false); 69 } 70 71 /** 72 * Runs the test case. 73 * @throws Throwable Any uncaught exception causes test to fail 74 */ 75 public void runTest() throws Throwable { 76 Document doc; 77 DocumentType docType; 78 boolean hasAttributes; 79 doc = (Document) load("staffNS", false); 80 docType = doc.getDoctype(); 81 hasAttributes = docType.hasAttributes(); 82 assertFalse("nodehasattributes02", hasAttributes); 83 } 84 /** 85 * Gets URI that identifies the test. 86 * @return uri identifier of test 87 */ 88 public String getTargetURI() { 89 return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/nodehasattributes02"; 90 } 91 /** 92 * Runs this test from the command line. 93 * @param args command line arguments 94 */ 95 public static void main(final String[] args) { 96 DOMTestCase.doMain(nodehasattributes02.class, args); 97 } 98 } 99 100