Using CDATA for Builder XmlMarkup

Hi All,

I have used Builder XMLMarkup in a ruby script. For one of the xml tags
that i am creating, i want the text to be in CDATA section. How would
get to do this. Below is a tag that i create which has values from a
hash:

x.summary “#{value.split(%r{,\s*})[2]}”

x - is the XMLMarkup builder object that is used to create xml tags.

The builder xmlMarkup API shows example as this:
xml.cdata!(“text to be included in cdata”)

I tried but having issues in passing this cdata! argument to my custom
tag above.

Help much appreciated.

On Mon, Feb 3, 2014 at 5:52 PM, Rochit S. [email protected] wrote:

The builder xmlMarkup API shows example as this:
xml.cdata!(“text to be included in cdata”)

I tried but having issues in passing this cdata! argument to my custom
tag above.

Help much appreciated.

Have you tried with blocks?

x.summary do
x.cdata! “#{value.split(%r{,\s*})[2]}”
end

(untested)

Jesus.

Have you tried with blocks?

x.summary do
x.cdata! “#{value.split(%r{,\s*})[2]}”
end

(untested)

Jesus.

Hey Jesus,

Thanks a lot. It worked like magic :). Dont know why i didnt think of
this. :slight_smile:

Thanks for the help