Code below looks correct, but where does that "CDATA"
come into String? Is it just added for testing?
What seems to be happening is that for some reason
content you are getting is already xml-escaped (or is
fed to another xml stream writer); like OutputStream
or Writer passing its content back to xml writer.
-+ Tatu +-
--- Arul Dhesiaseelan <arul_at_fluxcorp.com> wrote:
> Paul,
>
> Here is my custom Stream writer. I just delegate
> writeCData to
> XMLStreamWriter. I will try with a standalone test.
>
> public class MyStreamWriter implements
> XMLStreamWriter {
> private XMLStreamWriter mImpl;
>
> public MyStreamWriter(XMLStreamWriter
> xmlStreamWriter) throws
> XMLStreamException {
> this.mImpl = xmlStreamWriter;
> }
>
> public void writeCData(String s) throws
> XMLStreamException {
> mImpl.writeCData(s);
> }
>
> public void writeCharacters(String s) throws
> XMLStreamException {
> if (shouldUseCData(s)) {
> System.out.println("Using CDATA");
> mImpl.writeCData(s);
> } else {
> mImpl.writeCharacters(s);
> }
> }
>
> private boolean shouldUseCData(String s) {
> if (s.contains("CDATA")) {
> return true;
> } else return false;
> }
> //removed other methods
> }
>
> Am I missing something here?
>
> Thanks!
> Arul
>
> Paul Sandoz wrote:
> > Arul Dhesiaseelan wrote:
> >> Paul,
> >>
> >> Sorry, this error seems to have occurred when the
> CXF service was
> >> down. Now I started both the services and I see
> this error go away.
> >> Lookslike, Jersey is now able to find my custom
> messagebodywriter.
> >>
> >> INFO: Provider classes found:
> >> class rest.jaxb.CDATAProvider
> >>
> >> But when I invoke the REST method, I still see
> this un-encoded CDATA.
> >>
> >> <cell><![CDATA[<div
> class="progressOuterRow"><
> >> div class="progressInnerRow"
> style="width:
> >> 0px;"></div
> >> ><div class="progressText">0/0
>
> >> MB</div></div>]]&g
> >> t;</cell>
> >>
> >> Am I missing something?
> >>
> >
> > It is escaping the CDATA, are you writing the
> CDATA section
> > explicitly? or are you deferring to
> XMLStreamWriter.writeCData? Can
> > you send the wrapper code?
> >
> > It may be a problem with your XMLStreamWriter
> method, or it could be a
> > bug with the XMLStreamWriter implementation. I
> recommend writing a
> > stand alone test using XMLStreamWriter.writeCData
> to verify it is
> > doing the right thing.
> >
> > Paul.
> >
> >> Thanks for all the help.
> >>
> >> Regards,
> >> Arul
> >>
> >>
> >> Paul Sandoz wrote:
> >>> Hi Arul,
> >>>
> >>> That error appears independent of the RESTful
> service, is that the
> >>> case? i.e. this error would be reproducible if
> you wrote some stand
> >>> alone Java code to invoke a CXF JAX-WS Service ?
> >>>
> >>> More specifically the problem appears to be with
> the XML document
> >>> returned from the CXF JAX-WS Service. The client
> is having trouble
> >>> parsing it, most likely for the reason that Tatu
> gives.
> >>>
> >>> Paul.
> >>>
> >>
> >>
> >>
> >>
>
---------------------------------------------------------------------
> >> To unsubscribe, e-mail:
> users-unsubscribe_at_jersey.dev.java.net
> >> For additional commands, e-mail:
> users-help_at_jersey.dev.java.net
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail:
> users-help_at_jersey.dev.java.net
>
>