RFR 8172974 [JAXP] XALAN: Wrong result when transforming namespace unaware StAX Input
Langer, Christoph
christoph.langer at sap.com
Wed Jan 18 21:55:03 UTC 2017
Hi Joe,
generally, you are right, XSLT requires namespace support. For parsing the stylesheet, it is definitely a hard requirement. Otherwise this would not make sense at all. For instance xsl directives are in the xsl namespace. That requirement is what the FAQ you are referencing [1] is talking about.
As for the InputSource which is to be processed, it is probably also not a right to use non namespace aware parsing. But still it's not forbidden. For instance, the JavaDoc for SAXSource [2] states this:
"Note that XSLT requires namespace support. Attempting to transform an input source that is not generated with a namespace-aware parser may result in errors. Parsers can be made namespace aware by calling the SAXParserFactory.setNamespaceAware(boolean awareness) method."
So, I agree, we are in the error space here. But still I think the result of non namespace aware parsing should be the same for all types of input source. And at the moment it is the same for DOMSource and SAXSource but not for StAXSource. From that point of view I think my fix makes sense (along with the other cleanups).
Best regards
Christoph
[1] https://xml.apache.org/xalan-j/faq.html#faq-N10207
[2] https://docs.oracle.com/javase/8/docs/api/javax/xml/transform/sax/SAXSource.html
> -----Original Message-----
> From: huizhe wang [mailto:huizhe.wang at oracle.com]
> Sent: Mittwoch, 18. Januar 2017 22:12
> To: Langer, Christoph <christoph.langer at sap.com>; core-libs-
> dev at openjdk.java.net
> Subject: Re: RFR 8172974 [JAXP] XALAN: Wrong result when transforming
> namespace unaware StAX Input
>
> Hi Christoph,
>
> Xalan requires the underlying parser to be namespace aware. Please refer
> to https://xml.apache.org/xalan-j/faq.html#faq-N10207
>
> Thanks,
> Joe
>
> On 1/18/2017 8:26 AM, Langer, Christoph wrote:
> > Hi,
> >
> > please review a change for JAXP.
> >
> > Bug: https://bugs.openjdk.java.net/browse/JDK-8172974
> > Webrev: http://cr.openjdk.java.net/~clanger/webrevs/8172974.0/
> >
> > When enhancing the test for https://bugs.openjdk.java.net/browse/JDK-
> 8023653, I saw that there's still an issue with StAXInputSource which is not
> namespace aware. This needs a small update in
> src/java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/ref/sax2dt
> m/SAX2DTM2.java. Furthermore, I added the fixed warnings and formattings
> from the proposal http://cr.openjdk.java.net/~clanger/webrevs/8023653.0/ to
> this webrev, as 8023653 is an enhancement and might not go in in the near
> future.
> >
> > I also enhanced the TransformerTest to utilize data providers now and test a
> comprehensive matrix of XALAN input.
> >
> > Thanks in advance and Best regards
> > Christoph
> >
More information about the core-libs-dev
mailing list