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 Copyright (c) 2004 World Wide Web Consortium, 8 (Massachusetts Institute of Technology, Institut National de 9 Recherche en Informatique et en Automatique, Keio University). All 10 Rights Reserved. This program is distributed under the W3C's Software 11 Intellectual Property License. This program is distributed in the 12 hope that it will be useful, but WITHOUT ANY WARRANTY; without even 13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 14 PURPOSE. 15 See W3C License http://www.w3.org/Consortium/Legal/ for more details. 16 17 */ 18 19 package tests.org.w3c.dom; 20 21 import javax.xml.parsers.DocumentBuilder; 22 23 import org.w3c.dom.DOMException; 24 import org.w3c.dom.Document; 25 import org.w3c.dom.DocumentType; 26 import org.w3c.dom.NamedNodeMap; 27 28 /** 29 * An attempt to add remove an entity using removeNamedItemNS should result in a 30 * NO_MODIFICATION_ERR or a NOT_FOUND_ERR. 31 * 32 * @author Curt Arnold 33 * @see <a 34 * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1788794630">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1788794630</a> 35 * @see <a 36 * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-removeNamedItemNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-removeNamedItemNS</a> 37 */ 38 public final class HCEntitiesRemoveNamedItemNS extends DOMTestCase { 39 40 DOMDocumentBuilderFactory factory; 41 42 DocumentBuilder builder; 43 44 protected void setUp() throws Exception { 45 super.setUp(); 46 try { 47 factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory 48 .getConfiguration1()); 49 builder = factory.getBuilder(); 50 } catch (Exception e) { 51 fail("Unexpected exception" + e.getMessage()); 52 } 53 } 54 55 protected void tearDown() throws Exception { 56 factory = null; 57 builder = null; 58 super.tearDown(); 59 } 60 61 /** 62 * Runs the test case. 63 * 64 * @throws Throwable 65 * Any uncaught exception causes test to fail 66 */ 67 // Assumes validation. 68 // public void testRemoveNamedItemNS() throws Throwable { 69 // Document doc; 70 // NamedNodeMap entities; 71 // DocumentType docType; 72 // 73 // doc = (Document) load("hc_staff", builder); 74 // docType = doc.getDoctype(); 75 // 76 // if (!(("text/html".equals(getContentType())))) { 77 // assertNotNull("docTypeNotNull", docType); 78 // entities = docType.getEntities(); 79 // assertNotNull("entitiesNotNull", entities); 80 // 81 // try { 82 // entities.removeNamedItemNS( 83 // "http://www.w3.org/1999/xhtml", "alpha"); 84 // fail("throw_NO_MOD_OR_NOT_FOUND_ERR"); 85 // 86 // } catch (DOMException ex) { 87 // switch (ex.code) { 88 // case 7: 89 // break; 90 // case 8: 91 // break; 92 // default: 93 // throw ex; 94 // } 95 // } 96 // } 97 // } 98 99 } 100