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:
8 Copyright (c) 2001 World Wide Web Consortium,
9 (Massachusetts Institute of Technology, Institut National de
10 Recherche en Informatique et en Automatique, Keio University). All
11 Rights Reserved. This program is distributed under the W3C's Software
12 Intellectual Property License. This program is distributed in the
13 hope that it will be useful, but WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 See W3C License http://www.w3.org/Consortium/Legal/ for more details.
20 package org.w3c.domts.level1.core;
25 import org.w3c.domts.DOMTestCase;
26 import org.w3c.domts.DOMTestDocumentBuilderFactory;
31 * The "setValue()" method for an attribute causes the
32 * DOMException NO_MODIFICATION_ALLOWED_ERR to be raised
33 * if the node is readonly.
34 * Create an entity reference using document.createEntityReference()
35 * Get the "domestic" attribute from the entity
36 * reference and execute the "setValue()" method.
37 * This causes a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
39 * @see <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])</a>
40 * @see <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core#ID-221662474">http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core#ID-221662474</a>
41 * @see <a href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core#xpointer(id('ID-221662474')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core#xpointer(id('ID-221662474')/setraises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])</a>
42 * @see <a href="http://www.w3.org/DOM/updates/REC-DOM-Level-1-19981001-errata.html">http://www.w3.org/DOM/updates/REC-DOM-Level-1-19981001-errata.html</a>
43 * @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-221662474</a>
44 * @see <a href="http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrsetvaluenomodificationallowederr.xml">http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrsetvaluenomodificationallowederr.xml</a>
46 public final class attrsetvaluenomodificationallowederrEE extends DOMTestCase {
50 * @param factory document factory, may not be null
51 * @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
53 public attrsetvaluenomodificationallowederrEE(final DOMTestDocumentBuilderFactory factory) throws org.w3c.domts.DOMTestIncompatibleException {
57 // check if loaded documents are supported for content type
59 String contentType = getContentType();
60 preload(contentType, "staff", true);
65 * @throws Throwable Any uncaught exception causes test to fail
67 public void runTest() throws Throwable {
69 EntityReference entRef;
71 NamedNodeMap attrList;
76 doc = (Document) load("staff", true);
77 genderList = doc.getElementsByTagName("gender");
78 gender = genderList.item(2);
79 assertNotNull("genderNotNull", gender);
80 entRef = doc.createEntityReference("ent4");
81 assertNotNull("entRefNotNull", entRef);
82 appendedChild = gender.appendChild(entRef);
83 entElement = (Element) entRef.getFirstChild();
84 assertNotNull("entElementNotNull", entElement);
85 attrList = entElement.getAttributes();
86 attrNode = attrList.getNamedItem("domestic");
89 boolean success = false;
91 ((Attr) /*Node */attrNode).setValue("newvalue");
92 } catch (DOMException ex) {
93 success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR);
95 assertTrue("setValue_throws_NO_MODIFICATION", success);
99 boolean success = false;
101 attrNode.setNodeValue("newvalue2");
102 } catch (DOMException ex) {
103 success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR);
105 assertTrue("setNodeValue_throws_NO_MODIFICATION", success);
109 * Gets URI that identifies the test.
110 * @return uri identifier of test
112 public String getTargetURI() {
113 return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrsetvaluenomodificationallowederrEE";
116 * Runs this test from the command line.
117 * @param args command line arguments
119 public static void main(final String[] args) {
120 DOMTestCase.doMain(attrsetvaluenomodificationallowederrEE.class, args);