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-2004 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 org.w3c.domts.level2.core;
24
25import org.w3c.dom.*;
26
27
28import org.w3c.domts.DOMTestCase;
29import org.w3c.domts.DOMTestDocumentBuilderFactory;
30
31
32
33/**
34 *  Using the method getNamedItemNS, retreive the entity "ent1" and notation "notation1"
35 *  from a NamedNodeMap of this DocumentTypes entities and notations.
36 *  Both should be null since entities and notations are not namespaced.
37* @author IBM
38* @author Neil Delima
39* @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS</a>
40* @see <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=259">http://www.w3.org/Bugs/Public/show_bug.cgi?id=259</a>
41* @see <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=407">http://www.w3.org/Bugs/Public/show_bug.cgi?id=407</a>
42* @see <a href="http://lists.w3.org/Archives/Member/w3c-dom-ig/2003Nov/0016.html">http://lists.w3.org/Archives/Member/w3c-dom-ig/2003Nov/0016.html</a>
43*/
44public final class namednodemapgetnameditemns01 extends DOMTestCase {
45
46   /**
47    * Constructor.
48    * @param factory document factory, may not be null
49    * @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
50    */
51   public namednodemapgetnameditemns01(final DOMTestDocumentBuilderFactory factory)  throws org.w3c.domts.DOMTestIncompatibleException {
52
53      org.w3c.domts.DocumentBuilderSetting[] settings =
54          new org.w3c.domts.DocumentBuilderSetting[] {
55org.w3c.domts.DocumentBuilderSetting.namespaceAware
56        };
57        DOMTestDocumentBuilderFactory testFactory = factory.newInstance(settings);
58        setFactory(testFactory);
59
60    //
61    //   check if loaded documents are supported for content type
62    //
63    String contentType = getContentType();
64    preload(contentType, "staffNS", false);
65    }
66
67   /**
68    * Runs the test case.
69    * @throws Throwable Any uncaught exception causes test to fail
70    */
71   public void runTest() throws Throwable {
72      Document doc;
73      DocumentType docType;
74      NamedNodeMap entities;
75      NamedNodeMap notations;
76      Entity entity;
77      Notation notation;
78      String entityName;
79      String notationName;
80      String nullNS = null;
81
82      doc = (Document) load("staffNS", false);
83      docType = doc.getDoctype();
84      entities = docType.getEntities();
85      assertNotNull("entitiesNotNull", entities);
86      notations = docType.getNotations();
87      assertNotNull("notationsNotNull", notations);
88      entity = (Entity) entities.getNamedItemNS(nullNS, "ent1");
89      assertNull("entityNull", entity);
90      notation = (Notation) notations.getNamedItemNS(nullNS, "notation1");
91      assertNull("notationNull", notation);
92      }
93   /**
94    *  Gets URI that identifies the test.
95    *  @return uri identifier of test
96    */
97   public String getTargetURI() {
98      return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/namednodemapgetnameditemns01";
99   }
100   /**
101    * Runs this test from the command line.
102    * @param args command line arguments
103    */
104   public static void main(final String[] args) {
105        DOMTestCase.doMain(namednodemapgetnameditemns01.class, args);
106   }
107}
108
109