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-2003 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 *     The tagName parameter in the "createElement(tagName)"
32 *    method is case-sensitive for XML documents.
33 *    Retrieve the entire DOM document and invoke its
34 *    "createElement(tagName)" method twice.  Once for tagName
35 *    equal to "acronym" and once for tagName equal to "ACRONYM"
36 *    Each call should create a distinct Element node.  The
37 *    newly created Elements are then assigned attributes
38 *    that are retrieved.
39 *    Modified on 27 June 2003 to avoid setting an invalid style
40 *    values and checked the node names to see if they matched expectations.
41* @author Curt Arnold
42* @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547</a>
43* @see <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=243">http://www.w3.org/Bugs/Public/show_bug.cgi?id=243</a>
44*/
45public final class hc_documentcreateelementcasesensitive extends DOMTestCase {
46
47   /**
48    * Constructor.
49    * @param factory document factory, may not be null
50    * @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
51    */
52   public hc_documentcreateelementcasesensitive(final DOMTestDocumentBuilderFactory factory)  throws org.w3c.domts.DOMTestIncompatibleException {
53      super(factory);
54
55    //
56    //   check if loaded documents are supported for content type
57    //
58    String contentType = getContentType();
59    preload(contentType, "hc_staff", true);
60    }
61
62   /**
63    * Runs the test case.
64    * @throws Throwable Any uncaught exception causes test to fail
65    */
66   public void runTest() throws Throwable {
67      Document doc;
68      Element newElement1;
69      Element newElement2;
70      String attribute1;
71      String attribute2;
72      String nodeName1;
73      String nodeName2;
74      doc = (Document) load("hc_staff", true);
75      newElement1 = doc.createElement("ACRONYM");
76      newElement2 = doc.createElement("acronym");
77      newElement1.setAttribute("lang", "EN");
78      newElement2.setAttribute("title", "Dallas");
79      attribute1 = newElement1.getAttribute("lang");
80      attribute2 = newElement2.getAttribute("title");
81      assertEquals("attrib1", "EN", attribute1);
82      assertEquals("attrib2", "Dallas", attribute2);
83      nodeName1 = newElement1.getNodeName();
84      nodeName2 = newElement2.getNodeName();
85      assertEqualsAutoCase("element", "nodeName1", "ACRONYM", nodeName1);
86        assertEqualsAutoCase("element", "nodeName2", "acronym", nodeName2);
87        }
88   /**
89    *  Gets URI that identifies the test.
90    *  @return uri identifier of test
91    */
92   public String getTargetURI() {
93      return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/hc_documentcreateelementcasesensitive";
94   }
95   /**
96    * Runs this test from the command line.
97    * @param args command line arguments
98    */
99   public static void main(final String[] args) {
100        DOMTestCase.doMain(hc_documentcreateelementcasesensitive.class, args);
101   }
102}
103
104