1 /* 2 This Java source file was generated by test-to-java.xsl 3 and is a derived work from the source document. 4 The source document contained the following notice: 5 6 7 8 Copyright (c) 2001 World Wide Web Consortium, 9 (Massachusetts Institute of Technology, Institut National de 10 Recherche en Informatique et en Automatique, Keio University). All 11 Rights Reserved. This program is distributed under the W3C's Software 12 Intellectual Property License. This program is distributed in the 13 hope that it will be useful, but WITHOUT ANY WARRANTY; without even 14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 15 PURPOSE. 16 17 See W3C License http://www.w3.org/Consortium/Legal/ for more details. 18 19 20 */ 21 22 package tests.org.w3c.dom; 23 24 import org.w3c.dom.DocumentType; 25 import org.w3c.dom.Document; 26 27 import javax.xml.parsers.DocumentBuilder; 28 29 /** 30 * The "getSystemId()" method of a documenttype node contains the system 31 * identifier associated with the external subset. 32 * 33 * Retrieve the documenttype. Apply the "getSystemId()" method. The string 34 * "staffNS.dtd" should be returned. 35 * 36 * @author NIST 37 * @author Mary Brady 38 * @see <a 39 * 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> 40 */ 41 public final class SystemId extends DOMTestCase { 42 43 DOMDocumentBuilderFactory factory; 44 45 DocumentBuilder builder; 46 47 protected void setUp() throws Exception { 48 super.setUp(); 49 try { 50 factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory 51 .getConfiguration1()); 52 builder = factory.getBuilder(); 53 } catch (Exception e) { 54 fail("Unexpected exception" + e.getMessage()); 55 } 56 } 57 58 protected void tearDown() throws Exception { 59 factory = null; 60 builder = null; 61 super.tearDown(); 62 } 63 64 /** 65 * Runs the test case. 66 * 67 * @throws Throwable 68 * Any uncaught exception causes test to fail 69 */ 70 public void testGetSystemId() throws Throwable { 71 Document doc; 72 DocumentType docType; 73 String systemId; 74 75 doc = (Document) load("staffNS", builder); 76 docType = doc.getDoctype(); 77 systemId = docType.getSystemId(); 78 assertURIEquals("systemId", null, null, null, "staffNS.dtd", null, 79 null, null, null, systemId); 80 } 81 82 } 83