You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by "Mark Lundquist (JIRA)" <ji...@apache.org> on 2006/09/05 00:49:24 UTC

[jira] Created: (COCOON-1907) Entity resolution in imported XSLT stylesheets does not use catalog

Entity resolution in imported XSLT stylesheets does not use catalog
-------------------------------------------------------------------

                 Key: COCOON-1907
                 URL: http://issues.apache.org/jira/browse/COCOON-1907
             Project: Cocoon
          Issue Type: Bug
          Components: * Cocoon Core
    Affects Versions: 2.1.9
            Reporter: Mark Lundquist


I have a stylesheet A.xslt containing 

    <xsl:import href="B.xslt"/>

B.xslt, in turn, has a DTD with external entities defined:

<!DOCTYPE stylesheet
[
 <!ENTITY % HTMLlat1 PUBLIC
   "-//W3C//ENTITIES Latin 1 for XHTML//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent">
 %HTMLlat1;
 <!ENTITY % HTMLspecial PUBLIC
    "-//W3C//ENTITIES Special for XHTML//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent">
  %HTMLspecial;
]>

In Cocoon running a machine that is disconnected from the Internet, an exception is thrown:

java.net.UnknownHostException: www.w3.org
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:153)
        at java.net.Socket.connect(Socket.java:452)
        at java.net.Socket.connect(Socket.java:402)
        at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)
        at sun.net.www.http.HttpClient.<init>(HttpClient.java:306)
        at sun.net.www.http.HttpClient.<init>(HttpClient.java:267)
        at sun.net.www.http.HttpClient.New(HttpClient.java:339)
        at sun.net.www.http.HttpClient.New(HttpClient.java:320)
        at sun.net.www.http.HttpClient.New(HttpClient.java:315)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:521)
        at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:498)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:626)
        at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
        at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
        at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
        at org.apache.xerces.impl.XMLDTDScannerImpl.startPE(Unknown Source)
        at org.apache.xerces.impl.XMLDTDScannerImpl.skipSeparator(Unknown Source)
        at org.apache.xerces.impl.XMLDTDScannerImpl.scanDecls(Unknown Source)
        at org.apache.xerces.impl.XMLDTDScannerImpl.scanDTDInternalSubset(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
        at org.apache.xalan.processor.ProcessorInclude.parse(ProcessorInclude.java:284)
        at org.apache.xalan.processor.ProcessorInclude.startElement(ProcessorInclude.java:150)
        at org.apache.xalan.processor.StylesheetHandler.startElement(StylesheetHandler.java:623)
        at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
        at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
        at org.apache.excalibur.xml.impl.JaxpParser.parse(JaxpParser.java:315)
        at org.apache.excalibur.xmlizer.DefaultXMLizer.toSAX(DefaultXMLizer.java:128)
        at org.apache.cocoon.components.xslt.TraxProcessor.sourceToSAX(TraxProcessor.java:301)
        at org.apache.cocoon.components.xslt.TraxProcessor.getTransformerHandlerAndValidity(TraxProcessor.java:239)
        at org.apache.cocoon.transformation.TraxTransformer.setup(TraxTransformer.java:330)
        at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.setupPipeline(AbstractProcessingPipeline.java:397)
....

If the external entities are defined in A.xslt, the exception is not thrown, and the entities are resolved correctly using the catalog.

This is using the default resolver configuration, and it happens with both Xalan and Saxon.  I actually first noticed this bug in a Cocoon 2.1.6 application, but never characterized and reported it until now.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (COCOON-1907) Entity resolution in imported XSLT stylesheets does not use catalog

Posted by "Andrew Stevens (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/COCOON-1907?page=comments#action_12432630 ] 
            
Andrew Stevens commented on COCOON-1907:
----------------------------------------

I'm not sure if it's related, but back in June I mailed the xerces list asking about a similar problem with entity resolving - basically, I was calling setURIResolver(new CatalogResolver()) on my TransformerFactory but was still getting an exception thrown by HttpURLConnection for the URL in my document's system ID despite it being in the catalog.  This wasn't even using Cocoon, just plain JAXP, but the stack trace I was getting has a lot in common with yours (the section referring to XMLEntityManager, XMLDTDScannerImpl, XMLDocumentScannerImpl$DTDDispatcher, XMLDocumentFragmentScannerImpl, XML11Configuration, ...)

The reply I received at the time was "It looks like Xalan does not propagate this resolver to the parser instances it creates (and I'm not sure that it should)." with the suggestion that I "try passing in a SAXSource instead [of a StreamSource + StringReader] and explicitly set the entity resolver on the XMLReader to be the CatalogResolver."

I don't know how Xalan/Saxon handle the imports, but perhaps it's a similar problem with them not propogating the resolver to the parser they use to read the imported file?  In which case, it may be worth asking about on the Xalan/Saxon mailing lists and see if they have any ideas how to work around it in Cocoon's transformer?


> Entity resolution in imported XSLT stylesheets does not use catalog
> -------------------------------------------------------------------
>
>                 Key: COCOON-1907
>                 URL: http://issues.apache.org/jira/browse/COCOON-1907
>             Project: Cocoon
>          Issue Type: Bug
>          Components: * Cocoon Core
>    Affects Versions: 2.1.9
>            Reporter: Mark Lundquist
>
> I have a stylesheet A.xslt containing 
>     <xsl:import href="B.xslt"/>
> B.xslt, in turn, has a DTD with external entities defined:
> <!DOCTYPE stylesheet
> [
>  <!ENTITY % HTMLlat1 PUBLIC
>    "-//W3C//ENTITIES Latin 1 for XHTML//EN"
>    "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent">
>  %HTMLlat1;
>  <!ENTITY % HTMLspecial PUBLIC
>     "-//W3C//ENTITIES Special for XHTML//EN"
>     "http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent">
>   %HTMLspecial;
> ]>
> In Cocoon running a machine that is disconnected from the Internet, an exception is thrown:
> java.net.UnknownHostException: www.w3.org
>         at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:153)
>         at java.net.Socket.connect(Socket.java:452)
>         at java.net.Socket.connect(Socket.java:402)
>         at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
>         at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)
>         at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)
>         at sun.net.www.http.HttpClient.<init>(HttpClient.java:306)
>         at sun.net.www.http.HttpClient.<init>(HttpClient.java:267)
>         at sun.net.www.http.HttpClient.New(HttpClient.java:339)
>         at sun.net.www.http.HttpClient.New(HttpClient.java:320)
>         at sun.net.www.http.HttpClient.New(HttpClient.java:315)
>         at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:521)
>         at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:498)
>         at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:626)
>         at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
>         at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
>         at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
>         at org.apache.xerces.impl.XMLDTDScannerImpl.startPE(Unknown Source)
>         at org.apache.xerces.impl.XMLDTDScannerImpl.skipSeparator(Unknown Source)
>         at org.apache.xerces.impl.XMLDTDScannerImpl.scanDecls(Unknown Source)
>         at org.apache.xerces.impl.XMLDTDScannerImpl.scanDTDInternalSubset(Unknown Source)
>         at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source)
>         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>         at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
>         at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
>         at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
>         at org.apache.xalan.processor.ProcessorInclude.parse(ProcessorInclude.java:284)
>         at org.apache.xalan.processor.ProcessorInclude.startElement(ProcessorInclude.java:150)
>         at org.apache.xalan.processor.StylesheetHandler.startElement(StylesheetHandler.java:623)
>         at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
>         at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
>         at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
>         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
>         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>         at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
>         at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
>         at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
>         at org.apache.excalibur.xml.impl.JaxpParser.parse(JaxpParser.java:315)
>         at org.apache.excalibur.xmlizer.DefaultXMLizer.toSAX(DefaultXMLizer.java:128)
>         at org.apache.cocoon.components.xslt.TraxProcessor.sourceToSAX(TraxProcessor.java:301)
>         at org.apache.cocoon.components.xslt.TraxProcessor.getTransformerHandlerAndValidity(TraxProcessor.java:239)
>         at org.apache.cocoon.transformation.TraxTransformer.setup(TraxTransformer.java:330)
>         at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.setupPipeline(AbstractProcessingPipeline.java:397)
> ....
> If the external entities are defined in A.xslt, the exception is not thrown, and the entities are resolved correctly using the catalog.
> This is using the default resolver configuration, and it happens with both Xalan and Saxon.  I actually first noticed this bug in a Cocoon 2.1.6 application, but never characterized and reported it until now.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira