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-2004 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 * Removing a child node from an attribute in an entity reference
32 * should result in an NO_MODIFICATION_ALLOWED_ERR DOMException.
34 * @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1734834066</a>
35 * @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1734834066')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-1734834066')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])</a>
37 public final class attrremovechild1 extends DOMTestCase {
41 * @param factory document factory, may not be null
42 * @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
44 public attrremovechild1(final DOMTestDocumentBuilderFactory factory) throws org.w3c.domts.DOMTestIncompatibleException {
48 // check if loaded documents are supported for content type
50 String contentType = getContentType();
51 preload(contentType, "staff", true);
56 * @throws Throwable Any uncaught exception causes test to fail
58 public void runTest() throws Throwable {
60 EntityReference entRef;
65 doc = (Document) load("staff", true);
66 entRef = doc.createEntityReference("ent4");
67 assertNotNull("createdEntRefNotNull", entRef);
68 entElement = (Element) entRef.getFirstChild();
69 assertNotNull("entElementNotNull", entElement);
70 attrNode = entElement.getAttributeNode("domestic");
71 textNode = (Text) attrNode.getFirstChild();
72 assertNotNull("attrChildNotNull", textNode);
75 boolean success = false;
77 removedNode = attrNode.removeChild(textNode);
78 } catch (DOMException ex) {
79 success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR);
81 assertTrue("setValue_throws_NO_MODIFICATION_ERR", success);
85 * Gets URI that identifies the test.
86 * @return uri identifier of test
88 public String getTargetURI() {
89 return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/attrremovechild1";
92 * Runs this test from the command line.
93 * @param args command line arguments
95 public static void main(final String[] args) {
96 DOMTestCase.doMain(attrremovechild1.class, args);