/** * 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 entity; String encodingName; doc = (Document) load("external_barfoo", false); docType = doc.getDoctype(); entitiesMap = docType.getEntities(); entity = (Entity) entitiesMap.getNamedItem("ent5"); encodingName = entity.getXmlEncoding(); assertNull("entitygetxmlencoding02", encodingName); }
/** * Runs the test case. * * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; DocumentType docType; Entity entity; NamedNodeMap entitymap; String textContent; doc = (Document) load("hc_staff", true); docType = doc.getDoctype(); entitymap = docType.getEntities(); entity = (Entity) entitymap.getNamedItem("delta"); { boolean success = false; try { entity.setTextContent("NA"); } catch (DOMException ex) { success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR); } assertTrue("nodesettextcontent13", success); } }
public boolean enter(Entity entity) { String name = entity.getNodeName(); String pubId = entity.getPublicId(); String sysId = entity.getSystemId(); String notation = entity.getNotationName(); buffer.append("<!ENTITY "); buffer.append(name); if (pubId != null) { buffer.append(" PUBLIC \""); buffer.append(pubId); buffer.append("\""); } if (sysId != null) { buffer.append(" SYSTEM \""); buffer.append(sysId); buffer.append("\""); } if (notation != null) { buffer.append(" NDATA "); buffer.append(notation); } buffer.append(">"); return true; }