DOM L1 test suite: broken testcase

Hi, 

These is an error in
processinginstructionsetdatanomodificationallowederrEE test case: a
ClassCastException is thrown when expandEntityReferences is set to true.
 
I am using a generated java code to explain:
[[
      doc = load("staff");
      genderList = doc.getElementsByTagName("gender");
      gender = genderList.item(2);
      entRef = doc.createEntityReference("ent4");
      appendedChild = gender.appendChild(entRef);
      entRef = gender.getFirstChild();
      piNode = (ProcessingInstruction)entRef.getLastChild();
]]

The code retrieves the 3rd "gender" element that has an original value
of "&ent4;". This value is expanded (since expandEntityRef is set to
true) to the value of "ent4": 
==
<entElement domestic='Yes'>Element data</entElement><?PItarget PIdata?>
==
Thus, the line gender.getFirstChild() will return "entElement" and the
next line entRef.getLastChild() will return a Text node (hence the
exception).

The fix is to change a line gender.getFirstChild() to
gender.getLastChild() to retrieve the node which represents the newly
created entity reference. 

processinginstructionsetdatanomodificationallowederrEE.xml:
<firstChild interface="Node" var="entRef" obj="gender"/>
change to:
<lastChild interface="Node" var="entRef" obj="gender"/>


Thanks,
-- 
Elena Litani / IBM Toronto

Received on Wednesday, 17 April 2002 15:28:41 UTC