You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Dini Omar <zi...@gmail.com> on 2008/07/25 14:55:34 UTC

Adding a CDATA element being converted to < and >

Hi all,

I am trying to build the payload/messagebody for an element. According to
the specific the payload has to be within a CDATA element. I tried to do
this as shown below


private static final String START_TAG=new String("<![CDATA[");
private static final String END_TAG= new String("]]>");
SadFileStub.IEEdifactString theString = new SadFileStub.IEEdifactString();
theString.setIEEdifactString(START_TAG.concat("MESSAGE CONTENT
DATA").concat(END_TAG));

This does not seem to work as the message is coming out as shown below

&lt;![CDATA[MESSAGE CONTENT DATA]]&gt;

Does anyone know why this is happening?

Re: Adding a CDATA element being converted to < and >

Posted by Amila Suriarachchi <am...@gmail.com>.
On Mon, Jul 28, 2008 at 5:56 PM, Dini Omar <zi...@gmail.com> wrote:

> Hi,
>
> Do you mean that i should change it as below
>
> private static final String START_TAG=new String("<![CDATA[");
> private static final String END_TAG= new String("]]>");
> SadFileStub.IEEdifactString theString = new SadFileStub.IEEdifactString();
> theString.setIEEdifactString("MESSAGE CONTENT DATA");
>

yes.

>
>
> Thanks
>
>
>
> On Mon, Jul 28, 2008 at 5:10 AM, Amila Suriarachchi <
> amilasuriarachchi@gmail.com> wrote:
>
>>
>>
>> On Fri, Jul 25, 2008 at 6:25 PM, Dini Omar <zi...@gmail.com> wrote:
>>
>>> Hi all,
>>>
>>> I am trying to build the payload/messagebody for an element. According to
>>> the specific the payload has to be within a CDATA element. I tried to do
>>> this as shown below
>>>
>>>
>>> private static final String START_TAG=new String("<![CDATA[");
>>> private static final String END_TAG= new String("]]>");
>>> SadFileStub.IEEdifactString theString = new
>>> SadFileStub.IEEdifactString();
>>> theString.setIEEdifactString(START_TAG.concat("MESSAGE CONTENT
>>> DATA").concat(END_TAG));
>>>
>>> This does not seem to work as the message is coming out as shown below
>>>
>>> &lt;![CDATA[MESSAGE CONTENT DATA]]&gt;
>>>
>>> Does anyone know why this is happening?
>>>
>>
>> Underline Xml Stream writer replaces any  special  characters with the
>> scape characters. So if you set CDATA part as the string it assumes every
>> thing as the string to be send. In this case you can only set the MESSAGE
>> CONTENT DATA. if there are special characters xml stream writer takes care
>> of.
>>
>> thanks,
>> Amila.
>>
>>
>>
>> --
>> Amila Suriarachchi,
>> WSO2 Inc.
>>
>
>


-- 
Amila Suriarachchi,
WSO2 Inc.

Re: Adding a CDATA element being converted to < and >

Posted by Dini Omar <zi...@gmail.com>.
Hi,

Do you mean that i should change it as below

private static final String START_TAG=new String("<![CDATA[");
private static final String END_TAG= new String("]]>");
SadFileStub.IEEdifactString theString = new SadFileStub.IEEdifactString();
theString.setIEEdifactString("MESSAGE CONTENT DATA");

Thanks


On Mon, Jul 28, 2008 at 5:10 AM, Amila Suriarachchi <
amilasuriarachchi@gmail.com> wrote:

>
>
> On Fri, Jul 25, 2008 at 6:25 PM, Dini Omar <zi...@gmail.com> wrote:
>
>> Hi all,
>>
>> I am trying to build the payload/messagebody for an element. According to
>> the specific the payload has to be within a CDATA element. I tried to do
>> this as shown below
>>
>>
>> private static final String START_TAG=new String("<![CDATA[");
>> private static final String END_TAG= new String("]]>");
>> SadFileStub.IEEdifactString theString = new SadFileStub.IEEdifactString();
>> theString.setIEEdifactString(START_TAG.concat("MESSAGE CONTENT
>> DATA").concat(END_TAG));
>>
>> This does not seem to work as the message is coming out as shown below
>>
>> &lt;![CDATA[MESSAGE CONTENT DATA]]&gt;
>>
>> Does anyone know why this is happening?
>>
>
> Underline Xml Stream writer replaces any  special  characters with the
> scape characters. So if you set CDATA part as the string it assumes every
> thing as the string to be send. In this case you can only set the MESSAGE
> CONTENT DATA. if there are special characters xml stream writer takes care
> of.
>
> thanks,
> Amila.
>
>
>
> --
> Amila Suriarachchi,
> WSO2 Inc.
>

Re: Adding a CDATA element being converted to < and >

Posted by Amila Suriarachchi <am...@gmail.com>.
On Fri, Jul 25, 2008 at 6:25 PM, Dini Omar <zi...@gmail.com> wrote:

> Hi all,
>
> I am trying to build the payload/messagebody for an element. According to
> the specific the payload has to be within a CDATA element. I tried to do
> this as shown below
>
>
> private static final String START_TAG=new String("<![CDATA[");
> private static final String END_TAG= new String("]]>");
> SadFileStub.IEEdifactString theString = new SadFileStub.IEEdifactString();
> theString.setIEEdifactString(START_TAG.concat("MESSAGE CONTENT
> DATA").concat(END_TAG));
>
> This does not seem to work as the message is coming out as shown below
>
> &lt;![CDATA[MESSAGE CONTENT DATA]]&gt;
>
> Does anyone know why this is happening?
>

Underline Xml Stream writer replaces any  special  characters with the scape
characters. So if you set CDATA part as the string it assumes every thing as
the string to be send. In this case you can only set the MESSAGE CONTENT
DATA. if there are special characters xml stream writer takes care of.

thanks,
Amila.



-- 
Amila Suriarachchi,
WSO2 Inc.

Re: Adding a CDATA element being converted to < and >

Posted by WJ Krpelan <kr...@yahoo.com>.
Hi
I know what happened ;-)
you tried to serialize XML by hand
my advice: use an appropriate tool
Cheers



--- On Fri, 7/25/08, Dini Omar <zi...@gmail.com> wrote:

> From: Dini Omar <zi...@gmail.com>
> Subject: Adding a CDATA element being converted to &lt; and &gt
> To: axis-user@ws.apache.org, axis-dev@ws.apache.org
> Date: Friday, July 25, 2008, 2:55 PM
> Hi all,
> 
> I am trying to build the payload/messagebody for an
> element. According to
> the specific the payload has to be within a CDATA element.
> I tried to do
> this as shown below
> 
> 
> private static final String START_TAG=new
> String("<![CDATA[");
> private static final String END_TAG= new
> String("]]>");
> SadFileStub.IEEdifactString theString = new
> SadFileStub.IEEdifactString();
> theString.setIEEdifactString(START_TAG.concat("MESSAGE
> CONTENT
> DATA").concat(END_TAG));
> 
> This does not seem to work as the message is coming out as
> shown below
> 
> &lt;![CDATA[MESSAGE CONTENT DATA]]&gt;
> 
> Does anyone know why this is happening?


      

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org