harsh gupta created XALANJ-2575:
-----------------------------------
Summary: getAssociatedStylesheet in TransformerFactoryImpl.java
throwing exception if DOCTYPE and PI to include stylesheet both exist in XML
Key: XALANJ-2575
URL: https://issues.apache.org/jira/browse/XALANJ-2575
Project: XalanJ2
Issue Type: Bug
Security Level: No security risk; visible to anyone (Ordinary problems in
Xalan projects. Anybody can view the issue.)
Components: JAXP
Affects Versions: 2.7.1
Environment: Windows 7 or any windows operating system
Reporter: harsh gupta
Assignee: Steven J. Hathaway
Priority: Critical
Please take a look at the code of getAssociatedStylesheet(Source source, String
media, String title, String charset) throws TransformerConfigurationException
in src\org\apache\xalan\processor\TransformerFactoryImpl.java file:
The definition of above function is ignoring the XMLReader I've passed in as a
argument through source parameter (which is essentially a SAXSource object).
The above function is creating a new XMLReader after creating a new
SAXParserFactory object. Because of this, the problem that we are facing is,
that while parsing the input XML file, it goes on parsing the DOCTYPE section
and the external DTD specified through Public ID and System ID. Now since, our
XMLReader is not used to parse the XML file, the EntityResolver registered with
the reader isn't used, and hence external DTD is not resolved, and therefore
getAssociatedStylesheet function fails with an exception.
However, if you take a look at the other function public Templates
newTemplates(Source source) throws TransformerConfigurationException in
TransformerFactoryImpl class. This function specifically checks, if the source
argument passed in is a SAXSource, and if it is, then if XMLReader is present
in the source, then it doesn't create the new XMLReader object.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]