You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Soeren Schmidt (JIRA)" <xe...@xml.apache.org> on 2015/04/22 11:50:05 UTC

[jira] [Commented] (XERCESJ-1654) Add support for properties set by JAXP in the JDK (secure-processing, accessExternalDTD and entityExpansionLimit)

    [ https://issues.apache.org/jira/browse/XERCESJ-1654?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14506737#comment-14506737 ] 

Soeren Schmidt commented on XERCESJ-1654:
-----------------------------------------

In my code the missing accessExternalDTD property seems to cause an error. When using "localhost" everything works fine but when using the computer's name (gk4252) the transformation fails and an error shows up:

{code}
Compiler warnings:
  WARNING:  'org.apache.xerces.jaxp.SAXParserImpl: Property 'http://javax.xml.XMLConstants/property/accessExternalDTD' is not recognized.'
ERROR:  'Could not compile stylesheet'
FATAL ERROR:  'http://gk4252:9000/xsl/cars.xsl'
           :http://gk4252:9000/xsl/cars.xsl'

! @6m02jp98m - Internal server error, for (GET) [/internal.vehicels.xml] ->

Caused by: javax.xml.transform.TransformerConfigurationException: http://gk4252:9000/xsl/cars.xsl
        at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:989) ~[na:1.7.0_60]
        at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:764) ~[na:1.7.0_60]
        …
Caused by: java.io.FileNotFoundException: http://gk4252:9000/xsl/cars.xsl
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1624) ~[na:1.7.0_60]
        at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source) ~[xercesImpl-2.11.0.jar:na]
        at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source) ~[xercesImpl-2.11.0.jar:na]
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) ~[xercesImpl-2.11.0.jar:na]
        at org.apache.xerces
{code}

> Add support for properties set by JAXP in the JDK (secure-processing, accessExternalDTD and  entityExpansionLimit)
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1654
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1654
>             Project: Xerces2-J
>          Issue Type: New Feature
>    Affects Versions: 2.11.0
>         Environment: Problem noticed with:
> * jdk1.7.0_71.jdk
> * jdk1.8.0_25.jdk
>            Reporter: Vincent Massol
>
> I have tons of the following warnings in my console when doing an XSLT transformation:
> {noformat}
> Warning:  org.apache.xerces.parsers.SAXParser: Feature 'http://javax.xml.XMLConstants/feature/secure-processing' is not recognized.
> Warning:  org.apache.xerces.parsers.SAXParser: Property 'http://javax.xml.XMLConstants/property/accessExternalDTD' is not recognized.
> Warning:  org.apache.xerces.parsers.SAXParser: Property 'http://www.oracle.com/xml/jaxp/properties/entityExpansionLimit' is not recognized.
> {noformat}
> Code:
> {code}
>     /**
>      * Parse and pretty pint a XML content.
>      *
>      * @param content the XML content to format
>      * @return the formated version of the passed XML content
>      * @throws TransformerFactoryConfigurationError when failing to create a
>      *             {@link TransformerFactoryConfigurationError}
>      * @throws TransformerException when failing to transform the content
>      * @since 5.2M1
>      */
>     public static String formatXMLContent(String content) throws TransformerFactoryConfigurationError,
>         TransformerException
>     {
>         Transformer transformer = TransformerFactory.newInstance().newTransformer();
>         transformer.setOutputProperty(OutputKeys.INDENT, "yes");
>         transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
>         StreamResult result = new StreamResult(new StringWriter());
>         StreamSource source = new StreamSource(new StringReader(content));
>         transformer.transform(source, result);
>         return result.getWriter().toString();
>     }
> {code}
> According to what I read at https://issues.apache.org/jira/browse/RAT-158 and at http://docs.oracle.com/javase/tutorial/jaxp/limits/limits.html this seems to have been caused by some changes introduced in the JDK and that XercesJ doesn't support yet.
> Thus this issue is about adding support for them.
> Thanks!



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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