Home | History | Annotate | Download | only in dom
      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 dalvik.annotation.TestTargetClass;
     22 
     23 import javax.xml.parsers.DocumentBuilder;
     24 
     25 import org.w3c.dom.DOMException;
     26 import org.w3c.dom.Document;
     27 import org.w3c.dom.DocumentType;
     28 import org.w3c.dom.NamedNodeMap;
     29 
     30 /**
     31  * An attempt to add remove an entity using removeNamedItemNS should result in a
     32  * NO_MODIFICATION_ERR or a NOT_FOUND_ERR.
     33  *
     34  * @author Curt Arnold
     35  * @see <a
     36  *      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>
     37  * @see <a
     38  *      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>
     39  */
     40 @TestTargetClass(NamedNodeMap.class)
     41 public final class HCEntitiesRemoveNamedItemNS 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 // Assumes validation.
     71 //    public void testRemoveNamedItemNS() throws Throwable {
     72 //        Document doc;
     73 //        NamedNodeMap entities;
     74 //        DocumentType docType;
     75 //
     76 //        doc = (Document) load("hc_staff", builder);
     77 //        docType = doc.getDoctype();
     78 //
     79 //        if (!(("text/html".equals(getContentType())))) {
     80 //            assertNotNull("docTypeNotNull", docType);
     81 //            entities = docType.getEntities();
     82 //            assertNotNull("entitiesNotNull", entities);
     83 //
     84 //            try {
     85 //                entities.removeNamedItemNS(
     86 //                        "http://www.w3.org/1999/xhtml", "alpha");
     87 //                fail("throw_NO_MOD_OR_NOT_FOUND_ERR");
     88 //
     89 //            } catch (DOMException ex) {
     90 //                switch (ex.code) {
     91 //                case 7:
     92 //                    break;
     93 //                case 8:
     94 //                    break;
     95 //                default:
     96 //                    throw ex;
     97 //                }
     98 //            }
     99 //        }
    100 //    }
    101 
    102 }
    103