DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15141>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15141 endDocument() called twice in DOM to SAX transform Summary: endDocument() called twice in DOM to SAX transform Product: XalanJ2 Version: 2.4 Platform: PC OS/Version: Windows XP Status: NEW Severity: Normal Priority: Other Component: org.apache.xalan.transformer AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] When transforming from a DOM node to SAX endDocument() in org.xml.sax.ContentHandler is wrongly called twice, as demonstrated by the program below. It is first called from org.apache.xml.utils.TreeWalker.traverse and then from org.apache.xalan.transformer.TransformIdentityImpl.transform. import javax.xml.parsers.*; import javax.xml.transform.sax.*; import javax.xml.transform.dom.*; import javax.xml.transform.*; import org.xml.sax.*; import org.xml.sax.helpers.*; import org.w3c.dom.*; public class XalanTest2 { public static void main(String[] args) throws Exception { DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = builderFactory.newDocumentBuilder(); Document document = builder.newDocument(); Element element = document.createElementNS(null, "test"); TransformerFactory transformerFactory = TransformerFactory.newInstance(); // Setup transformer to transform DOM to SAX Transformer transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(element); SAXResult result = new SAXResult(new TestHandler()); transformer.transform(source, result); } private static class TestHandler extends DefaultHandler { public void endDocument() { System.out.println("endDocument() called"); } } }
