Uploaded image for project: 'XalanJ2'
  1. XalanJ2
  2. XALANJ-2597

doctype-system not recognized if transformed to a SAXResult

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.7.2
    • None
    • Serialization
    • Security Level: No security risk; visible to anyone (Ordinary problems in Xalan projects. Anybody can view the issue.)
    • Tested on JAVA 1.6 - 1.8

    Description

      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.

      Attachments

        1. xalanBug.zip
          7 kB
          Dr. Carsten Leue

        Activity

          People

            shathaway Steven J. Hathaway
            cleue Dr. Carsten Leue
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: