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 9Copyright (c) 2001 World Wide Web Consortium, 10(Massachusetts Institute of Technology, Institut National de 11Recherche en Informatique et en Automatique, Keio University). All 12Rights Reserved. This program is distributed under the W3C's Software 13Intellectual Property License. This program is distributed in the 14hope that it will be useful, but WITHOUT ANY WARRANTY; without even 15the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 16PURPOSE. 17 18See W3C License http://www.w3.org/Consortium/Legal/ for more details. 19 20 21*/ 22 23package tests.org.w3c.dom; 24 25import org.w3c.dom.DocumentType; 26import org.w3c.dom.Document; 27import org.w3c.dom.DOMImplementation; 28 29import javax.xml.parsers.DocumentBuilder; 30 31/** 32 * The method getInternalSubset() returns the public identifier of the external subset. 33 * 34 * Create a new DocumentType node with the value "SYS" for its systemId and PUB for 35 * its publicId. Check the value of the systemId and pbulicId attributes. 36* @author IBM 37* @author Neil Delima 38* @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-systemId">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-systemId</a> 39*/ 40public final class DocumentTypeSystemId extends DOMTestCase { 41 DOMDocumentBuilderFactory factory; 42 43 DocumentBuilder builder; 44 45 protected void setUp() throws Exception { 46 super.setUp(); 47 try { 48 factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory 49 .getConfiguration1()); 50 builder = factory.getBuilder(); 51 } catch (Exception e) { 52 fail("Unexpected exception" + e.getMessage()); 53 } 54 } 55 56 protected void tearDown() throws Exception { 57 factory = null; 58 builder = null; 59 super.tearDown(); 60 } 61 62 63 /** 64 * Runs the test case. 65 * @throws Throwable Any uncaught exception causes test to fail 66 */ 67 public void testGetSystemId() throws Throwable { 68 Document doc; 69 DocumentType docType; 70 DOMImplementation domImpl; 71 String publicId; 72 String systemId; 73 doc = (Document) load("staffNS", builder); 74 domImpl = doc.getImplementation(); 75 docType = domImpl.createDocumentType("l2:root", "PUB", "SYS"); 76 publicId = docType.getPublicId(); 77 systemId = docType.getSystemId(); 78 assertEquals("documenttypepublicid01", "PUB", publicId); 79 assertEquals("documenttypesystemid01", "SYS", systemId); 80 } 81 82} 83 84