xalan-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From harshg <har....@gmail.com>
Subject getAssociatedStylesheet in TransformerFactoryImpl.java throwing exception if DOCTYPE and PI to include stylesheet both exist in XML
Date Mon, 19 Aug 2013 08:34:01 GMT
Please take a look at the code of getAssociatedStylesheet(Source source,
String media, String title, String charset) throws
TransformerConfigurationException in TransformerFactoryImpl class: 

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

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. 

Is this a bug? Any thoughts? 

Harsh Gupta 
Adobe Systems

View this message in context: http://apache-xml-project.6118.n7.nabble.com/getAssociatedStylesheet-in-TransformerFactoryImpl-java-throwing-exception-if-DOCTYPE-and-PI-to-incluL-tp40442.html
Sent from the Xalan - J - Users mailing list archive at Nabble.com.

View raw message