W3C home > Mailing lists > Public > www-dom-ts@w3.org > April 2002

DOM L1 test suite: broken testcase

From: Elena Litani <elitani@ca.ibm.com>
Date: Wed, 17 Apr 2002 12:27:48 -0700
Message-ID: <3CBDCCB4.9F6BD69B@ca.ibm.com>
To: www-dom-ts@w3.org

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

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

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

Elena Litani / IBM Toronto
Received on Wednesday, 17 April 2002 15:28:41 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:34:04 UTC