I hope someone can enlighten me.

I'm trying to understand why ResultTreeHandler has a startDocument() method
with an empty body.  I essentially ignores all calls to its startDocument()
method.

It does however go to great lengths to generate a startDocument() call to
the ContentHandler that it contains.

Can't one just require that users of ResultTreeHandler have paired calls to
startDocument() and endDocument()?

ResultTreeHandler.startDocument() could do what
ResultTreeHandler.flushDocEvent() does and then one wouldn't have to keep
doing internal checking if ResultTreeHandler should call flushDocEvent().

Is there some sort of subtle ordering issue going on here?  Perhaps with
events that occur before startDocument(), or maybe something to do  with
SerializerSwitcher, that switches the underlying ContentHandler from XML to
HTML depending on the first element ( <html> or not)?

One such asymmetric place is
org.apache.xalan.transformer.TransformerImpl.transformNode(int node), that
only calls endDocument() on ResultTreeHandler.
        try
        {
          this.applyTemplateToNode(null, null, node);
        }
        finally
        {
          xctxt.popContextNodeList();
        }
        // m_stylesheetRoot.getStartRule().execute(this);

        // System.out.println("Done with applyTemplateToNode - "
+Thread.currentThread().getName());
        if (null != m_resultTreeHandler)
        {
          m_resultTreeHandler.endDocument();
        }



Brian Minchau
XSLT Development, IBM Toronto
e-mail:        [EMAIL PROTECTED]

Reply via email to