473,397 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

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 4984

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Balaras | last post by:
Hi, Can sombody here please help me a bit with a regular expression. I have a xml file where I need to strip the CDATA sections of any contained data. Eg. <xml> <tag><]></tag>...
8
by: Xah Lee | last post by:
what does it mean when a style tag gives something like the following? <style type="text/css" media="screen,projection">/*<!]>*/</style> is this standard? Xah xah@xahlee.org ∑...
6
by: Cade Perkins | last post by:
How can the CDATA ending delimiter "]]>" be represented within a CDATA section itself? Consider an XML document that is intended to contain an embedded, uninterpreted XML example. Generally,...
10
by: Jon Noring | last post by:
Out of curiosity, may a CDATA section appear within an attribute value with datatype CDATA? And if so, how about other attribute value datatypes which accept the XML markup characters? To me,...
11
by: ericms | last post by:
Can anybody show me how to insert a CDATA section using XPathNavigator ? I have tried the follwing with no luck: XmlDocument docNav = new XmlDocument(); docNav.LoadXml(xmlString);...
1
by: soccerdad | last post by:
I've got a class hierarchy generated from a .xsd schema file using the XSD.EXE tool. One of the elements will have its "inner text" set to a CDATA block. The XSD.EXE tool exposed a "Value" property...
12
by: Peter Michaux | last post by:
Hi, I am experimenting with some of the Ruby on Rails JavaScript generators and see something I haven't before. Maybe it is worthwhile? In the page below the script is enclosed in //<!]> ...
7
by: Max | last post by:
Hello everyone! Can anyone help me to convert the CDATA expression "CDATA ::= (Char* - (Char* ']]>' Char*)" to Javascript Regular Expression? Thanks, Max
6
by: dkyadav80 | last post by:
Hi sir, I'm new about xml, javascript. I have two selection field(html) first is city and second is state. the city and state values should be store in xml file. when user select city then all...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.