You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Adam Funk <a2...@ducksburg.com> on 2010/02/03 15:16:34 UTC

Re: CXF loses whitespace text nodes on the client side?

On 2010-01-25, Daniel Kulp wrote:

>
> Well, if anything, it's an issue either with the StAX parser or with JAXB, not 
> really CXF.   Would you be in a position to create a small test case using 
> just JAXB?
>
> Basically, do something like:  (pseudo code, probably not correct)
>
> JAXBContext ctx = JAXBContext.newInstance(TextWithNodes.class);
>
> XMLStreamReader reader = ... create a reader for you message
>
> Object o = ctx.createUnmarshaller().unmarshal(reader);
>
> And check out that object to see if that has the problem.   In theory, it 
> should as that's pretty much all we do.    The issue is whether the reader is 
> reporting the whitespace or not.     You could also try debugging that  a bit:
>
>
> while (int event = reader.next() != XMLStreamReader.END_DOCUMENT) {
>     System.out.println(event);
>     if (event ==  XMLStreamReader.TEXT) {
>       System.out.println("text: " + reader.getCharacters();
>    }
> }
>
> or similar just to see if the reader is reporting the whitespace texts.

Thanks.  We did something like that.  We know the XMLStreamReader is
reporting the whitespace (since it's the same implementation that we
use elsewhere, without losing it), so we think the DOMHandler is
dropping the whitespace-only text nodes.

Is there any way to configure it not to do this?  Or can anyone
recommend a more suitable DOMHandler?


Re: CXF loses whitespace text nodes on the client side?

Posted by Daniel Kulp <dk...@apache.org>.
You'll probably need to put a breakpoint in the XMLStreamReader's 
getCharacters or next() methods and get the stack trace at where the 
whitespace blocks are returned.   I don't think this is in CXF at all.   I 
think it's down in JAXB which there isn't much we can do about other than 
create a small JAXB only testcase and log it with them.

Dan


On Wed February 3 2010 9:16:34 am Adam Funk wrote:
> On 2010-01-25, Daniel Kulp wrote:
> > Well, if anything, it's an issue either with the StAX parser or with
> > JAXB, not really CXF.   Would you be in a position to create a small test
> > case using just JAXB?
> >
> > Basically, do something like:  (pseudo code, probably not correct)
> >
> > JAXBContext ctx = JAXBContext.newInstance(TextWithNodes.class);
> >
> > XMLStreamReader reader = ... create a reader for you message
> >
> > Object o = ctx.createUnmarshaller().unmarshal(reader);
> >
> > And check out that object to see if that has the problem.   In theory, it
> > should as that's pretty much all we do.    The issue is whether the
> > reader is reporting the whitespace or not.     You could also try
> > debugging that  a bit:
> >
> >
> > while (int event = reader.next() != XMLStreamReader.END_DOCUMENT) {
> >     System.out.println(event);
> >     if (event ==  XMLStreamReader.TEXT) {
> >       System.out.println("text: " + reader.getCharacters();
> >    }
> > }
> >
> > or similar just to see if the reader is reporting the whitespace texts.
> 
> Thanks.  We did something like that.  We know the XMLStreamReader is
> reporting the whitespace (since it's the same implementation that we
> use elsewhere, without losing it), so we think the DOMHandler is
> dropping the whitespace-only text nodes.
> 
> Is there any way to configure it not to do this?  Or can anyone
> recommend a more suitable DOMHandler?
> 

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog