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
8Copyright (c) 2001-2004 World Wide Web Consortium,
9(Massachusetts Institute of Technology, Institut National de
10Recherche en Informatique et en Automatique, Keio University). All
11Rights Reserved. This program is distributed under the W3C's Software
12Intellectual Property License. This program is distributed in the
13hope that it will be useful, but WITHOUT ANY WARRANTY; without even
14the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15PURPOSE.
16See W3C License http://www.w3.org/Consortium/Legal/ for more details.
17
18*/
19
20package org.w3c.domts.level1.core;
21
22import org.w3c.dom.*;
23
24
25import org.w3c.domts.DOMTestCase;
26import org.w3c.domts.DOMTestDocumentBuilderFactory;
27
28
29
30/**
31 *     Retrieve the third "acronym" element and evaluate Node.attributes.
32* @author Curt Arnold
33* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096</a>
34* @see <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=236">http://www.w3.org/Bugs/Public/show_bug.cgi?id=236</a>
35* @see <a href="http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html">http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html</a>
36* @see <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=184">http://www.w3.org/Bugs/Public/show_bug.cgi?id=184</a>
37*/
38public final class hc_nodeelementnodeattributes extends DOMTestCase {
39
40   /**
41    * Constructor.
42    * @param factory document factory, may not be null
43    * @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
44    */
45   public hc_nodeelementnodeattributes(final DOMTestDocumentBuilderFactory factory)  throws org.w3c.domts.DOMTestIncompatibleException {
46      super(factory);
47
48    //
49    //   check if loaded documents are supported for content type
50    //
51    String contentType = getContentType();
52    preload(contentType, "hc_staff", false);
53    }
54
55   /**
56    * Runs the test case.
57    * @throws Throwable Any uncaught exception causes test to fail
58    */
59   public void runTest() throws Throwable {
60      Document doc;
61      NodeList elementList;
62      Element testAddr;
63      NamedNodeMap addrAttr;
64      Node attrNode;
65      String attrName;
66      java.util.Collection attrList = new java.util.ArrayList();
67
68      java.util.Collection htmlExpected = new java.util.ArrayList();
69      htmlExpected.add("title");
70      htmlExpected.add("class");
71
72      java.util.Collection expected = new java.util.ArrayList();
73      expected.add("title");
74      expected.add("class");
75      expected.add("dir");
76
77      doc = (Document) load("hc_staff", false);
78      elementList = doc.getElementsByTagName("acronym");
79      testAddr = (Element) elementList.item(2);
80      addrAttr = testAddr.getAttributes();
81      for (int indexN10070 = 0; indexN10070 < addrAttr.getLength(); indexN10070++) {
82          attrNode = (Node) addrAttr.item(indexN10070);
83    attrName = attrNode.getNodeName();
84      attrList.add(attrName);
85        }
86
87      if (("text/html".equals(getContentType()))) {
88          assertEqualsIgnoreCase("attrNames_html", htmlExpected, attrList);
89} else {
90          assertEquals("attrNames", expected, attrList);
91      }
92
93    }
94   /**
95    *  Gets URI that identifies the test.
96    *  @return uri identifier of test
97    */
98   public String getTargetURI() {
99      return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_nodeelementnodeattributes";
100   }
101   /**
102    * Runs this test from the command line.
103    * @param args command line arguments
104    */
105   public static void main(final String[] args) {
106        DOMTestCase.doMain(hc_nodeelementnodeattributes.class, args);
107   }
108}
109
110