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 createDocumentType with valid values for qualifiedName, publicId and 48 * systemId should create an empty DocumentType node. 49 * 50 * Invoke createDocument on this DOMImplementation with a different valid qualifiedNames 51 * and a valid publicId and systemId. Check if the the DocumentType node was created 52 * with its ownerDocument attribute set to null. 53 * @author IBM 54 * @author Neil Delima 55 * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocType">http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocType</a> 56 */ 57 public final class domimplementationcreatedocumenttype02 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 domimplementationcreatedocumenttype02(final DOMTestDocumentBuilderFactory factory) throws org.w3c.domts.DOMTestIncompatibleException { 65 super(factory); 66 67 // 68 // check if loaded documents are supported for content type 69 // 70 String contentType = getContentType(); 71 preload(contentType, "staffNS", false); 72 } 73 74 /** 75 * Runs the test case. 76 * @throws Throwable Any uncaught exception causes test to fail 77 */ 78 public void runTest() throws Throwable { 79 Document doc; 80 DOMImplementation domImpl; 81 DocumentType newDocType; 82 Document ownerDocument; 83 String publicId = "http://www.w3.org/DOM/Test/dom2.dtd"; 84 String systemId = "dom2.dtd"; 85 String qualifiedName; 86 java.util.List qualifiedNames = new java.util.ArrayList(); 87 qualifiedNames.add("_:_"); 88 qualifiedNames.add("_:h0"); 89 qualifiedNames.add("_:test"); 90 qualifiedNames.add("_:_."); 91 qualifiedNames.add("_:a-"); 92 qualifiedNames.add("l_:_"); 93 qualifiedNames.add("ns:_0"); 94 qualifiedNames.add("ns:a0"); 95 qualifiedNames.add("ns0:test"); 96 qualifiedNames.add("ns:EEE."); 97 qualifiedNames.add("ns:_-"); 98 qualifiedNames.add("a.b:c"); 99 qualifiedNames.add("a-b:c.j"); 100 qualifiedNames.add("a-b:c"); 101 102 doc = (Document) load("staffNS", false); 103 domImpl = doc.getImplementation(); 104 for (int indexN10077 = 0; indexN10077 < qualifiedNames.size(); indexN10077++) { 105 qualifiedName = (String) qualifiedNames.get(indexN10077); 106 newDocType = domImpl.createDocumentType(qualifiedName, publicId, systemId); 107 assertNotNull("domimplementationcreatedocumenttype02_newDocType", newDocType); 108 ownerDocument = newDocType.getOwnerDocument(); 109 assertNull("domimplementationcreatedocumenttype02_ownerDocument", ownerDocument); 110 } 111 } 112 /** 113 * Gets URI that identifies the test. 114 * @return uri identifier of test 115 */ 116 public String getTargetURI() { 117 return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationcreatedocumenttype02"; 118 } 119 /** 120 * Runs this test from the command line. 121 * @param args command line arguments 122 */ 123 public static void main(final String[] args) { 124 DOMTestCase.doMain(domimplementationcreatedocumenttype02.class, args); 125 } 126 } 127 128