Dr. Carsten Leue created XALANJ-2597:
----------------------------------------

             Summary: doctype-system not recognized if transformed to a 
SAXResult
                 Key: XALANJ-2597
                 URL: https://issues.apache.org/jira/browse/XALANJ-2597
             Project: XalanJ2
          Issue Type: Bug
      Security Level: No security risk; visible to anyone (Ordinary problems in 
Xalan projects.  Anybody can view the issue.)
          Components: Serialization
    Affects Versions: 2.7.2
         Environment: Tested on JAVA 1.6 - 1.8
            Reporter: Dr. Carsten Leue
            Assignee: Steven J. Hathaway


My XSLT contains a doctype declaration like so:

        <xsl:output method="html" version="1.0" encoding="UTF-8"
                omit-xml-declaration="yes" indent="yes" 
doctype-system="about:legacy-compat"
                media-type="text/html" />

When executing a transform and serializing this to a SAXResult with a 
LexicalHandler attached, the startDTD method on the lexical handler is not 
called. 

Some debugging in the Xalan classes shows that 
org.apache.xml.serializer.SerializerBase.setDoctypeSystem(String) is invoked 
during the transformation process, but the implementation does not persist the 
parameter in the m_doctypeSystem field. This field is however used by 
org.apache.xml.serializer.SerializerBase.getDoctypeSystem() to read the doctype 
back.

In comparison, the streaming implementation of the serializer sets this value:
                if (OutputKeys.DOCTYPE_SYSTEM.equals(name)) {
                    this.m_doctypeSystem = val;

The
org.apache.xml.serializer.ToXMLSAXHandler.startElement(String, String, String, 
Attributes)

relies on this value to be set to pass it on to the lexical handler.
             String doctypeSystem = getDoctypeSystem();
             if (doctypeSystem != null && m_lexHandler != null)

So it looks like org.apache.xml.serializer.ToXMLSAXHandler or one of its super 
classes should handle the "doctype-system" property explicitly.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@xalan.apache.org
For additional commands, e-mail: dev-h...@xalan.apache.org

Reply via email to