Discussion:
[jira] [Created] (XALANJ-2597) doctype-system not recognized if transformed to a SAXResult
Dr. Carsten Leue (JIRA)
2015-07-28 15:22:04 UTC
Permalink
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-***@xalan.apache.org
For additional commands, e-mail: dev-***@xalan.apache.org
Dr. Carsten Leue (JIRA)
2015-07-28 15:26:04 UTC
Permalink
[ https://issues.apache.org/jira/browse/XALANJ-2597?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dr. Carsten Leue updated XALANJ-2597:
-------------------------------------
Attachment: xalanBug.zip

Small maven project that illustrates the issue.
The expected handler

com.cleue.xslt.test.XsltTest.MyHandler.startDTD(String, String, String)

is not called.
Post by Dr. Carsten Leue (JIRA)
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
Labels: serialization
Attachments: xalanBug.zip
<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.
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-***@xalan.apache.org
For additional commands, e-mail: dev-***@xalan.apache.org

Loading...