469,643 Members | 1,452 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,643 developers. It's quick & easy.

CDATA in XMLout

Hi@ll !

I have an application where the items of each XML value are placed in an
array like this:

my $result = transfer({ FIELD1 => 'value1',
FIELD2 => 0,
FIELD3 => "something other"
....

the function api itselfs does something like this:
sub transfer {
my ($arg) = @_
....

my $body = XMLout($arg,
someothervalue => 1,
andanothervalue => 2);

The result of this is something like this:
<request>
<FIELD1>value1</FIELD1>
<FIELD2>0</FIELD2>
<FIELD3>something other</FIELD3>
....
</request>

This works fantastic until today where i have to put more than plain text to
e.g. the FIELD3.
Now it is so that i have to paste a complete html side to the server where
this call is send to. The server itself only accepted the html data if it is
sent by an CDATA call.

I've done the following:
1.) wrote a template.html file where a complete html side is stored in.
2.) added the following:
open(CONTENT, '../includes/template1.html');
@content = <CONTENT>;
3.) modified the "my $result" like this:
my $result = transfer({ FIELD1 => 'value1',
FIELD2 => 0,
FIELD3 => "<![CDATA[ @content ]]>";

If i execute the script now the result looks like this:
<request>
<FIELD1>value1</FIELD1>
<FIELD2>0</FIELD2>
<FIELD3>&lt;![CDATA[ **the complete html template with encoded
source** ]]&gt;</FIELD3>
....

Can someone give me any hint how i can escape the < so that the XML Parser
don't touch it ?! The \ doesn't work very well :-(

kind regards
stefan

Jul 19 '05 #1
1 4786

"Stefan Schmidt" <Un******@gmx.de> wrote in message
news:bs**********@news-in.kamp.net...
Hi@ll !
Can someone give me any hint how i can escape the < so that the XML Parser
don't touch it ?! The \ doesn't work very well :-(

kind regards
stefan


Try using the option: NoEscape => 1 in your XMLout call. Should work, but
not tested it.

Andy R
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Balaras | last post: by
8 posts views Thread by Xah Lee | last post: by
6 posts views Thread by Cade Perkins | last post: by
12 posts views Thread by Peter Michaux | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.