xalan-dev 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 Tue, 06 Aug 2013 10:35:17 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-tp40396.html
Sent from the Xalan - Dev mailing list archive at Nabble.com.

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

View raw message