[ 
https://issues.apache.org/jira/browse/CXF-2829?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12872236#action_12872236
 ] 

Daniel Kulp commented on CXF-2829:
----------------------------------



I think I see the issue.   Testing a fix now.   


We cannot rely on the StreamReader created from  
XMLInputFactory.createStreamReader(source) for a variety of reasons:

1) For some optimizations that we do, we need direct access to the "current" 
node being read.   Without that, certain operations would be significantly 
slower.

2) Not all the parsers implement everything we require in their "DOM wrapping 
StreamReader" things.   For example, woodstox doesn't implement the "String 
getNamespaceURI(String prefix)" method (always returns null) which is needed 
when processing qname types.    



> W3CDOMStreamReader is not compatible with wstx XMLEventReader
> -------------------------------------------------------------
>
>                 Key: CXF-2829
>                 URL: https://issues.apache.org/jira/browse/CXF-2829
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.2.8
>         Environment: Mule 2.2.6-snapshot in proxy mode, and WS-Security 
> (wss4j)
> WSTX 4.0.8
>            Reporter: sebastien chatel
>            Priority: Minor
>
> If you create an XMLEventReader from a W3CDOMStreamReader (with the woodstox 
> library), it will fail because XMLEventAllocator doesnt accept Attribute 
> XMLEvent :
> Caused by: com.ctc.wstx.exc.WstxException: Internal error: should not get [13]
>       at 
> com.ctc.wstx.evt.DefaultEventAllocator.allocate(DefaultEventAllocator.java:256)
>       at 
> org.codehaus.stax2.ri.Stax2EventReaderImpl.createNextEvent(Stax2EventReaderImpl.java:411)
>       at 
> org.codehaus.stax2.ri.Stax2EventReaderImpl.nextEvent(Stax2EventReaderImpl.java:255)
> Here is the comment in wstx source code :
> -------------8<-------------8<-------------8<-------------8<-------------8<-------------
>             /* Following 2 types should never get in here; they are directly
>              * handled by the reader, and can only be accessed via start
>              * element.
>              */
>         case NAMESPACE:
>         case ATTRIBUTE:
>             throw new WstxException("Internal error: should not get "
>                                     
> +ErrorConsts.tokenTypeDesc(r.getEventType()));
> -------------8<-------------8<-------------8<-------------8<-------------8<-------------
> To create a XMLStreamReader from a DOM Document or Node, i recommand to 
> simply use XMLInputFactory.createStreamReader(source), where source is a 
> DOMSource.
> I think it's better to rely on stax implementation to create a StreamReader 
> from a DOM Node.

-- 
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