/** * Runs the test case. * * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; NodeList genderList; Node genderNode; Node entText; EntityReference entReference; Node appendedChild; doc = (Document) load("staff", true); genderList = doc.getElementsByTagName("gender"); genderNode = genderList.item(2); entReference = doc.createEntityReference("ent3"); assertNotNull("createdEntRefNotNull", entReference); appendedChild = genderNode.appendChild(entReference); entText = entReference.getFirstChild(); assertNotNull("entTextNotNull", entText); { boolean success = false; try { ((CharacterData) /*Node */ entText).deleteData(1, 3); } catch (DOMException ex) { success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR); } assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR", success); } }
/** * Receive notivication of a entityReference. * * @param name name of the entity reference */ public void entityReference(String name) throws org.xml.sax.SAXException { append(m_doc.createEntityReference(name)); }
@Override public EntityReference createEntityReference(String name) throws DOMException { return doc.createEntityReference(name); }