[ 
https://issues.apache.org/activemq/browse/SM-993?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_39879
 ] 

Guillaume Nodet commented on SM-993:
------------------------------------

I can reproduce the error without saxon btw.

Could you try with the following patch and see what it gives? It seems to solve 
the test case, but  i'd like you to try it in your real environment.

{code:title=Patch on servicemix-core}
Index: org/apache/servicemix/jbi/jaxp/StaxSource.java
===================================================================
--- org/apache/servicemix/jbi/jaxp/StaxSource.java      (revision 563801)
+++ org/apache/servicemix/jbi/jaxp/StaxSource.java      (working copy)
@@ -60,6 +60,7 @@
     protected void parse() throws SAXException {
         try {
             while (true) {
+                streamReader.next();
                 switch (streamReader.getEventType()) {
                 // Attributes are handled in START_ELEMENT
                 case XMLStreamConstants.ATTRIBUTE:
@@ -142,7 +143,6 @@
                     break;
                 }
                 }
-                streamReader.next();
             }
         } catch (XMLStreamException e) {
             SAXParseException spe;
{code}

> StaxSource + FragmentStreamReader interference with TRaX
> --------------------------------------------------------
>
>                 Key: SM-993
>                 URL: https://issues.apache.org/activemq/browse/SM-993
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-core
>    Affects Versions: 3.1.1
>         Environment: JDK5
>            Reporter: Renaud Bruyeron
>         Attachments: patch.txt
>
>
> My use-case is this:
> * a message comes in via an http:endpoint - it is a soap with attachment 
> message, and thus the body is stored in a SoapMessage as a StaxSource, and a 
> FragmentStreamReader is used to cut out the SOAP envelope and only keep the 
> content of the soap message.
> * I try to apply an XSL on this body directly - I notice that it fails 
> (output document is empty)
> * if I switch to saxon (instead of the default TrAx=xalan 2.7.0), it kind of 
> works if I use a StreamResult, but not if I use a DOMResult: saxon complains 
> that something is doing some unspeakable deed with namespaces ;-)
> I narrowed this down to the FragmentStreamReader, and wrote a simple testcase 
> that shows the bug. However I can't see what's throwing off xalan/saxon, I am 
> not familiar enough with Stax, therefore I don't have a fix.
> The testcase includes: an XML document, an XSL stylesheet, and a new testcase 
> in FragmentStreamReaderTest

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to