Home | History | Annotate | Download | only in core
      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 Copyright (c) 2001 World Wide Web Consortium,
     10 (Massachusetts Institute of Technology, Institut National de
     11 Recherche en Informatique et en Automatique, Keio University).  All
     12 Rights Reserved.  This program is distributed under the W3C's Software
     13 Intellectual Property License.  This program is distributed in the
     14 hope that it will be useful, but WITHOUT ANY WARRANTY; without even
     15 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     16 PURPOSE.
     17 
     18 See W3C License http://www.w3.org/Consortium/Legal/ for more details.
     19 
     20 
     21 */
     22 
     23 package org.w3c.domts.level2.core;
     24 
     25 import org.w3c.dom.*;
     26 
     27 
     28 import org.w3c.domts.DOMTestCase;
     29 import org.w3c.domts.DOMTestDocumentBuilderFactory;
     30 
     31 
     32 
     33 /**
     34  *  The method removeNamedItemNS removes a node specified by local name and namespace
     35  *
     36  *  Retreive an attribute node and then remove from the NamedNodeMap.  Verify if the attribute
     37  *  node was actually remove from the node map.
     38 * @author IBM
     39 * @author Neil Delima
     40 * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D58B193">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D58B193</a>
     41 */
     42 public final class namednodemapremovenameditemns01 extends DOMTestCase {
     43 
     44    /**
     45     * Constructor.
     46     * @param factory document factory, may not be null
     47     * @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
     48     */
     49    public namednodemapremovenameditemns01(final DOMTestDocumentBuilderFactory factory)  throws org.w3c.domts.DOMTestIncompatibleException {
     50 
     51       org.w3c.domts.DocumentBuilderSetting[] settings =
     52           new org.w3c.domts.DocumentBuilderSetting[] {
     53 org.w3c.domts.DocumentBuilderSetting.namespaceAware
     54         };
     55         DOMTestDocumentBuilderFactory testFactory = factory.newInstance(settings);
     56         setFactory(testFactory);
     57 
     58     //
     59     //   check if loaded documents are supported for content type
     60     //
     61     String contentType = getContentType();
     62     preload(contentType, "staffNS", true);
     63     }
     64 
     65    /**
     66     * Runs the test case.
     67     * @throws Throwable Any uncaught exception causes test to fail
     68     */
     69    public void runTest() throws Throwable {
     70       Document doc;
     71       NamedNodeMap attributes;
     72       Node element;
     73       Attr attribute;
     74       NodeList elementList;
     75       doc = (Document) load("staffNS", true);
     76       elementList = doc.getElementsByTagNameNS("http://www.nist.gov", "address");
     77       element = elementList.item(1);
     78       attributes = element.getAttributes();
     79       attribute = (Attr) attributes.removeNamedItemNS("http://www.nist.gov", "domestic");
     80       attribute = (Attr) attributes.getNamedItemNS("http://www.nist.gov", "domestic");
     81       assertNull("namednodemapremovenameditemns01", attribute);
     82       }
     83    /**
     84     *  Gets URI that identifies the test.
     85     *  @return uri identifier of test
     86     */
     87    public String getTargetURI() {
     88       return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapremovenameditemns01";
     89    }
     90    /**
     91     * Runs this test from the command line.
     92     * @param args command line arguments
     93     */
     94    public static void main(final String[] args) {
     95         DOMTestCase.doMain(namednodemapremovenameditemns01.class, args);
     96    }
     97 }
     98 
     99