[jdom-interest] Processing Instructions after the root element / BugFix

Anli Shundi anli.shundi at nue.et-inf.uni-siegen.de
Tue Jul 4 08:45:37 PDT 2000


Hi,

While using JDOM trying to implement C14n canonicalization
standard I saw that processing instructions after the root element
cause an EmptyStack exception.

Adding the following at SAXHandler::endElement after stack.pop
solves the problem:

  stack.pop();

  //add the following 
  if (stack.empty()) {
   atRoot = true; //needed at SAXHandler::processingInstruction
  }

Illustrating Example:

<?pi  first?>
<root> Hello he <?middle value?> said. 
</root>
<?pi  this PI but not a Comment will cause an empty stack exception?>

Best thanks for the JDOM,

Anli Shundi

Institute for Data Communications Systems
University of Siegen
Germany





More information about the jdom-interest mailing list