entRefChild1 = (ProcessingInstruction) entRef.getLastChild(); assertNotNull("entRefChild1NotNull", entRefChild1); entRefPosition = (int) entRef.compareDocumentPosition(entRefChild1);
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; Element docElem; EntityReference entRef1; EntityReference entRef2; Element entRefChild1; ProcessingInstruction entRefChild2; int entRefChild1Position; int entRefChild2Position; Node appendedChild; doc = (Document) load("hc_staff", true); entRef1 = doc.createEntityReference("ent4"); entRef2 = doc.createEntityReference("ent4"); docElem = doc.getDocumentElement(); appendedChild = docElem.appendChild(entRef1); appendedChild = docElem.appendChild(entRef2); entRefChild1 = (Element) entRef1.getFirstChild(); assertNotNull("entRefChild1NotNull", entRefChild1); entRefChild2 = (ProcessingInstruction) entRef2.getLastChild(); assertNotNull("entRefChild2NotNull", entRefChild2); entRefChild1Position = (int) entRefChild1.compareDocumentPosition(entRefChild2); assertEquals("nodecomparedocumentpositionFollowing29", 4, entRefChild1Position); entRefChild2Position = (int) entRefChild2.compareDocumentPosition(entRefChild1); assertEquals("nodecomparedocumentpositionPRECEDING29", 2, entRefChild2Position); } /**
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; Node removed; EntityReference eRef; ProcessingInstruction pi; String entName; doc = (Document) load("hc_staff", true); eRef = doc.createEntityReference("ent4"); pi = (ProcessingInstruction) eRef.getLastChild(); assertNotNull("piNotNull", pi); { boolean success = false; try { removed = eRef.removeChild(pi); } catch (DOMException ex) { success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR); } assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR", success); } } /**
entRefChild2 = (ProcessingInstruction) entRef.getLastChild(); assertNotNull("entRefChild2NotNull", entRefChild2); entRefChild1Position = (int) entRefChild1.compareDocumentPosition(entRefChild2);