/* * Runs the test case. */ void runTest() { Document doc; NodeList genderList; Node gender; EntityReference entRef; Element entElement; Node entNode; Node appendedChild; doc = (Document) baseT::load("staff", true); genderList = doc.getElementsByTagName(SA::construct_from_utf8("gender")); gender = genderList.item(2); entRef = doc.createEntityReference(SA::construct_from_utf8("ent4")); baseT::assertNotNull(entRef, __LINE__, __FILE__); appendedChild = gender.appendChild(entRef); entNode = entRef.getFirstChild(); baseT::template skipIfNot<Element>(entNode); entElement = (Element) entRef.getFirstChild(); baseT::assertNotNull(entElement, __LINE__, __FILE__); { boolean success = false; try { entElement.removeAttribute(SA::construct_from_utf8("domestic")); } catch (const DOMException& ex) { success = (ex.code() == DOMException::NO_MODIFICATION_ALLOWED_ERR); } assertTrue(success); } }
/* * Runs the test case. */ void runTest() { Document doc; EntityReference newEntRefNode; NodeList newEntRefList; Node child; String name; String value; doc = (Document) baseT::load("staff", true); newEntRefNode = doc.createEntityReference(SA::construct_from_utf8("ent3")); baseT::assertNotNull(newEntRefNode, __LINE__, __FILE__); newEntRefList = newEntRefNode.getChildNodes(); baseT::assertSize(1, newEntRefList, __LINE__, __FILE__); child = newEntRefNode.getFirstChild(); name = child.getNodeName(); baseT::assertEquals("#text", name, __LINE__, __FILE__); value = child.getNodeValue(); baseT::assertEquals("Texas", value, __LINE__, __FILE__); }
/* * 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); } }