/* * Runs the test case. */ void runTest() { Document doc; EntityReference entRef; CharacterData entText; doc = (Document) baseT::load("staff", true); entRef = doc.createEntityReference(SA::construct_from_utf8("ent3")); baseT::assertNotNull(entRef, __LINE__, __FILE__); entText = (CharacterData) entRef.getFirstChild(); baseT::assertNotNull(entText, __LINE__, __FILE__); { boolean success = false; try { entText.setNodeValue(SA::construct_from_utf8("newValue")); } catch (const DOMException& ex) { success = (ex.code() == DOMException::NO_MODIFICATION_ALLOWED_ERR); } assertTrue(success); } }
/* * Runs the test case. */ void runTest() { Document doc; NodeList genderList; Node genderNode; EntityReference entRef; Node entNode; Element entElement; CharacterData entElementText; int nodeType; doc = (Document) baseT::load("staff", true); genderList = doc.getElementsByTagName(SA::construct_from_utf8("gender")); genderNode = genderList.item(2); entNode = genderNode.getFirstChild(); baseT::template skipIfNot<EntityReference>(entNode); entRef = (EntityReference) genderNode.getFirstChild(); baseT::assertNotNull(entRef, __LINE__, __FILE__); nodeType = (int) entRef.getNodeType(); if (baseT::equals(1, nodeType)) { entRef = doc.createEntityReference(SA::construct_from_utf8("ent4")); baseT::assertNotNull(entRef, __LINE__, __FILE__); } entElement = (Element) entRef.getFirstChild(); baseT::assertNotNull(entElement, __LINE__, __FILE__); entElementText = (CharacterData) entElement.getFirstChild(); baseT::assertNotNull(entElementText, __LINE__, __FILE__); { boolean success = false; try { entElementText.setNodeValue(SA::construct_from_utf8("newValue")); } catch (const DOMException& ex) { success = (ex.code() == DOMException::NO_MODIFICATION_ALLOWED_ERR); } assertTrue(success); } }