S
Stefan Schmidt
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><![CDATA[ **the complete html template with encoded
source** ]]></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
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><![CDATA[ **the complete html template with encoded
source** ]]></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