entityName = entity1.getNodeName(); assertEquals("entityName", "ent4", entityName); child = entity1.getFirstChild(); assertNotNull("notnull", child); childName = child.getNodeName();
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; DocumentType docType; NamedNodeMap entitiesMap; Entity alphaEntity; Text alphaText; Text removed; doc = (Document) load("hc_staff", true); docType = doc.getDoctype(); entitiesMap = docType.getEntities(); alphaEntity = (Entity) entitiesMap.getNamedItem("alpha"); assertNotNull("alphaEntityNotNull", alphaEntity); alphaText = (Text) alphaEntity.getFirstChild(); assertNotNull("alphaTextNotNull", alphaText); { boolean success = false; try { removed = (Text) alphaEntity.removeChild(alphaText); } catch (DOMException ex) { success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR); } assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR", success); } } /**
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; DocumentType docType; NamedNodeMap entitiesMap; Entity ent4; Element span; Node removed; doc = (Document) load("hc_staff", true); docType = doc.getDoctype(); entitiesMap = docType.getEntities(); ent4 = (Entity) entitiesMap.getNamedItem("ent4"); assertNotNull("ent4NotNull", ent4); span = (Element) ent4.getFirstChild(); assertNotNull("spanNotNull", span); { boolean success = false; try { removed = ent4.removeChild(span); } catch (DOMException ex) { success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR); } assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR", success); } } /**
ent = (Entity) entitiesMap.getNamedItem("alpha"); assertNotNull("alphaEntity", ent); oldChild = (Text) ent.getFirstChild(); assertNotNull("alphaText", oldChild); cdata = doc.createCDATASection("CDATASection");