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=22422>.
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=22422

ToSAXHandler.startDTD(String, String, String) does nothing but it should do something

           Summary: ToSAXHandler.startDTD(String, String, String) does
                    nothing but it should do something
           Product: XalanJ2
           Version: CurrentCVS
          Platform: All
               URL: http://www.engr.mun.ca/~naeim/xalan-bug-tosaxhandler.zip
        OS/Version: All
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: Xalan
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]
                CC: [EMAIL PROTECTED]


NOTE: This is a bug in org.apache.xml.serializer but is submitted under the 
Xalan Component of XalanJ2 per Brian Minchau's suggestion.

NOTE: As of the Aug 14 2003 nightly build of XalanJ2 this bug still persists.

Description
-----------

Look at the abstract class org.apache.xml.serializer.ToSAXHandler. The method 
startDTD(String, String, String) of this class does nothing but I'm proposing 
that it should remember the publicId and systemId like this:

public void startDTD(String name, String publicId, String systemId) throws 
SAXException {
  setDoctypeSystem(systemId);
  setDoctypePublic(publicId);
}

This is similar to the current implementation of 
org.apache.xml.serializer.ToStream.startDTD(String, String, String)


Look at org.apache.xml.serializer.ToXMLSAXHandler.startElement(String, String, 
String, Attributes). startDTD(String, String, String) is called on m_lexHandler 
if the following are true:

1. There is at least one element in the document
2. The LexicalHandler is set (!= null)
3. The doctypeSystem is set (!= null)

With the current implementation of ToSAXHandler.startDTD(String, String, 
String), condition #3 is never met and therefore startDTD(String, String, 
String) is never called on the LexicalHandler.


Consequences
------------

This makes any SAXResult that uses a LexicalHandler only partially functional 
because startDTD is never called on its LexicalHandler as per the SAX contract.


How to reproduce the bug?
-------------------------

As an example, download http://www.engr.mun.ca/~naeim/xalan-bug-tosaxhandler.zip

Build and run (ant build.xml is provided, just run the default target.) After 
successfully running, compare bugdst_sax.xml and bugdst_stream.xml. You will 
notice that the former, created with a SAXResult, does not include a <!
DOCTYPE ...> definition as it should. The latter, created with a StreamResult, 
does.

Reply via email to