You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Radovanovic, Vladan" <vr...@cghtech.com> on 2009/05/26 20:26:10 UTC

When will CXF treat an element as CDATA?

Please excuse my ignorance but I hope someone can help me out with this simple issue.
I have simple web service that's returning xml document as a response.  I simply can't figure out what document needs to have in order for CXF to surround that response with <![CDATA[   ]] tag?  It seems to me CXF uses XMLStreamWriter.writeCData which is triggered when parser determines that the event is XMLStreamConstants.CDATA but again...what exactly needs to be in that node for parser to treat is as CDATA?

TIA 

RE: When will CXF treat an element as CDATA?

Posted by Ron Grimes <rg...@sinclairoil.com>.
Vladan,
 
I doubt it's CXF. Maybe Xerces? Anyway, I would look at the text wrapped inside CDATA. I'm betting there is a character or two that, if not wrapped in CDATA, would render the xml document invalid. Something that might be interpreted as an extra closing tag that really isn't? I would look for something along those lines. Also, I would make sure that JAXB isn't having trouble marshalling your returned data type into a proper xml representation.
 
Just guessing at possibilities since you didn't enclose the doc with the CDATA content.
 
Ron 

________________________________

From: Radovanovic, Vladan [mailto:vradovanovic@cghtech.com]
Sent: Tue 5/26/2009 10:04 PM
To: users@cxf.apache.org
Subject: RE: When will CXF treat an element as CDATA?



Thanks Ron,

I suspected I wasn't clear enough the first time.
Basically I am trying to find out when does CXF treats data as CDATA and when it does not.  That's the part that I don't know.

In first instance I have build a web service that returns a fairly complex xml document.  That's the instance where CXF surrounds the response with CDATA tag. (I can progressively trim the response document to see exactly what causes this behaviour but I thought I might get a faster response here.)
In the second instance I have a very simple simple response and CXF doesn't surround it with CDATA tag.  (I'd like to know what exactly do I need to do to see CDATA tag in this instance.)


Vladan


________________________________

From: Ron Grimes [mailto:rgrimes@sinclairoil.com]
Sent: Tue 5/26/2009 5:59 PM
To: users@cxf.apache.org
Subject: RE: When will CXF treat an element as CDATA?



Maybe if you explain why you think the data has to be treated as CDATA,
someone might have a better solution. I find it's often better to
describe "what" I'm trying to accomplish, instead of "how" I'm trying to
accomplish it, since the latter might be wrong.

Ron


-----Original Message-----
From: Radovanovic, Vladan [mailto:vradovanovic@cghtech.com]
Sent: Tuesday, May 26, 2009 12:26 PM
To: users@cxf.apache.org
Subject: When will CXF treat an element as CDATA?

Please excuse my ignorance but I hope someone can help me out with this
simple issue.
I have simple web service that's returning xml document as a response.
I simply can't figure out what document needs to have in order for CXF
to surround that response with <![CDATA[   ]] tag?  It seems to me CXF
uses XMLStreamWriter.writeCData which is triggered when parser
determines that the event is XMLStreamConstants.CDATA but again...what
exactly needs to be in that node for parser to treat is as CDATA?

TIA





Re: When will CXF treat an element as CDATA?

Posted by Benson Margulies <bi...@gmail.com>.
You need to tell what data binding you are using. If you are using JAXB, it
makes this decision. If you are using Aegis, I can look at the code and see
if I see any clues.

On Wed, May 27, 2009 at 12:04 AM, Radovanovic, Vladan <
vradovanovic@cghtech.com> wrote:

> Thanks Ron,
>
> I suspected I wasn't clear enough the first time.
> Basically I am trying to find out when does CXF treats data as CDATA and
> when it does not.  That's the part that I don't know.
>
> In first instance I have build a web service that returns a fairly complex
> xml document.  That's the instance where CXF surrounds the response with
> CDATA tag. (I can progressively trim the response document to see exactly
> what causes this behaviour but I thought I might get a faster response
> here.)
> In the second instance I have a very simple simple response and CXF doesn't
> surround it with CDATA tag.  (I'd like to know what exactly do I need to do
> to see CDATA tag in this instance.)
>
>
> Vladan
>
>
> ________________________________
>
> From: Ron Grimes [mailto:rgrimes@sinclairoil.com]
> Sent: Tue 5/26/2009 5:59 PM
> To: users@cxf.apache.org
> Subject: RE: When will CXF treat an element as CDATA?
>
>
>
> Maybe if you explain why you think the data has to be treated as CDATA,
> someone might have a better solution. I find it's often better to
> describe "what" I'm trying to accomplish, instead of "how" I'm trying to
> accomplish it, since the latter might be wrong.
>
> Ron
>
>
> -----Original Message-----
> From: Radovanovic, Vladan [mailto:vradovanovic@cghtech.com]
> Sent: Tuesday, May 26, 2009 12:26 PM
> To: users@cxf.apache.org
> Subject: When will CXF treat an element as CDATA?
>
> Please excuse my ignorance but I hope someone can help me out with this
> simple issue.
> I have simple web service that's returning xml document as a response.
> I simply can't figure out what document needs to have in order for CXF
> to surround that response with <![CDATA[   ]] tag?  It seems to me CXF
> uses XMLStreamWriter.writeCData which is triggered when parser
> determines that the event is XMLStreamConstants.CDATA but again...what
> exactly needs to be in that node for parser to treat is as CDATA?
>
> TIA
>
>
>

RE: When will CXF treat an element as CDATA?

Posted by "Radovanovic, Vladan" <vr...@cghtech.com>.
Thanks Ron, 
 
I suspected I wasn't clear enough the first time.
Basically I am trying to find out when does CXF treats data as CDATA and when it does not.  That's the part that I don't know.
 
In first instance I have build a web service that returns a fairly complex xml document.  That's the instance where CXF surrounds the response with CDATA tag. (I can progressively trim the response document to see exactly what causes this behaviour but I thought I might get a faster response here.)
In the second instance I have a very simple simple response and CXF doesn't surround it with CDATA tag.  (I'd like to know what exactly do I need to do to see CDATA tag in this instance.)
 
 
Vladan
 

________________________________

From: Ron Grimes [mailto:rgrimes@sinclairoil.com]
Sent: Tue 5/26/2009 5:59 PM
To: users@cxf.apache.org
Subject: RE: When will CXF treat an element as CDATA?



Maybe if you explain why you think the data has to be treated as CDATA,
someone might have a better solution. I find it's often better to
describe "what" I'm trying to accomplish, instead of "how" I'm trying to
accomplish it, since the latter might be wrong.

Ron


-----Original Message-----
From: Radovanovic, Vladan [mailto:vradovanovic@cghtech.com]
Sent: Tuesday, May 26, 2009 12:26 PM
To: users@cxf.apache.org
Subject: When will CXF treat an element as CDATA?

Please excuse my ignorance but I hope someone can help me out with this
simple issue.
I have simple web service that's returning xml document as a response.
I simply can't figure out what document needs to have in order for CXF
to surround that response with <![CDATA[   ]] tag?  It seems to me CXF
uses XMLStreamWriter.writeCData which is triggered when parser
determines that the event is XMLStreamConstants.CDATA but again...what
exactly needs to be in that node for parser to treat is as CDATA?

TIA



RE: When will CXF treat an element as CDATA?

Posted by Ron Grimes <rg...@sinclairoil.com>.
Maybe if you explain why you think the data has to be treated as CDATA,
someone might have a better solution. I find it's often better to
describe "what" I'm trying to accomplish, instead of "how" I'm trying to
accomplish it, since the latter might be wrong. 

Ron
 

-----Original Message-----
From: Radovanovic, Vladan [mailto:vradovanovic@cghtech.com] 
Sent: Tuesday, May 26, 2009 12:26 PM
To: users@cxf.apache.org
Subject: When will CXF treat an element as CDATA?

Please excuse my ignorance but I hope someone can help me out with this
simple issue.
I have simple web service that's returning xml document as a response.
I simply can't figure out what document needs to have in order for CXF
to surround that response with <![CDATA[   ]] tag?  It seems to me CXF
uses XMLStreamWriter.writeCData which is triggered when parser
determines that the event is XMLStreamConstants.CDATA but again...what
exactly needs to be in that node for parser to treat is as CDATA?

TIA 

Re: When will CXF treat an element as CDATA?

Posted by Benson Margulies <bi...@gmail.com>.
I don't think that CXF is ever likely to use CDATA. From a data model
standpoint, CDATA is no different from judicious use of &lt;.

If you are using the JAXB data binding, you might try asking them.


On Tue, May 26, 2009 at 4:00 PM, Radovanovic, Vladan <
vradovanovic@cghtech.com> wrote:

> Please excuse my ignorance but I hope someone can help me out with this
> simple issue.
> I have a simple web service that's returning xml document as a response.  I
> simply can't figure out what document needs to have in order for CXF to
> surround that response with <![CDATA[   ]] tag?
>
> Previously I have wrote a similar web service and in that case CXF has
> automatically surrounded the response with <![CDATA[   ]] tag.
>
> It seems to me CXF uses XMLStreamWriter.writeCData which is triggered when
> parser determines that the event is XMLStreamConstants.CDATA but
> again...what exactly needs to be in that node for parser to treat is as
> CDATA?
>
> What am I missing?
>
> TIA
>
>

When will CXF treat an element as CDATA?

Posted by "Radovanovic, Vladan" <vr...@cghtech.com>.
Please excuse my ignorance but I hope someone can help me out with this simple issue.
I have a simple web service that's returning xml document as a response.  I simply can't figure out what document needs to have in order for CXF to surround that response with <![CDATA[   ]] tag?  

Previously I have wrote a similar web service and in that case CXF has automatically surrounded the response with <![CDATA[   ]] tag.

It seems to me CXF uses XMLStreamWriter.writeCData which is triggered when parser determines that the event is XMLStreamConstants.CDATA but again...what exactly needs to be in that node for parser to treat is as CDATA?

What am I missing?

TIA