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:
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
15 See W3C License http://www.w3.org/Consortium/Legal/ for more details.
19 package tests.org.w3c.dom;
21 import dalvik.annotation.TestTargets;
22 import dalvik.annotation.TestLevel;
23 import dalvik.annotation.TestTargetNew;
24 import dalvik.annotation.TestTargetClass;
26 import org.w3c.dom.NamedNodeMap;
27 import org.w3c.dom.Document;
28 import org.w3c.dom.DocumentType;
29 import org.w3c.dom.Element;
30 import org.w3c.dom.DOMException;
32 import javax.xml.parsers.DocumentBuilder;
35 * An attempt to add an element to the named node map returned by notations
36 * should result in a NO_MODIFICATION_ERR or HIERARCHY_REQUEST_ERR.
40 * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D46829EF">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D46829EF</a>
42 * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS</a>
44 @TestTargetClass(NamedNodeMap.class)
45 public final class HCNotationsSetNamedItemNS extends DOMTestCase {
47 DOMDocumentBuilderFactory factory;
49 DocumentBuilder builder;
51 protected void setUp() throws Exception {
54 factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
55 .getConfiguration1());
56 builder = factory.getBuilder();
57 } catch (Exception e) {
58 fail("Unexpected exception" + e.getMessage());
62 protected void tearDown() throws Exception {
72 * Any uncaught exception causes test to fail
75 level = TestLevel.PARTIAL_COMPLETE,
76 notes = "Verifies that setNamedItemNS throws DOMException.",
77 method = "setNamedItemNS",
78 args = {org.w3c.dom.Node.class}
80 public void testNotationsSetNamedItemNS() throws Throwable {
82 NamedNodeMap notations;
86 doc = (Document) load("hc_staff", builder);
87 docType = doc.getDoctype();
89 if (!(("text/html".equals(getContentType())))) {
90 assertNotNull("docTypeNotNull", docType);
91 notations = docType.getNotations();
92 assertNotNull("notationsNotNull", notations);
93 elem = doc.createElementNS("http://www.w3.org/1999/xhtml", "br");
96 notations.setNamedItemNS(elem);
97 fail("throw_HIER_OR_NO_MOD_ERR");
99 } catch (DOMException ex) {