[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

How to add CDATA section in XML file?

Re Qu

6/26/2008 12:43:00 PM


Dear all,

I am fairly new to ruby and am trying to create a CDATA section in an
XML file. Here is an example of what I am trying to produce:

<Data>
<![CDATA[<TestFlowModel
xmlns:xsi="http://www.w3.org/2001/XMLSchema-inst...
xmlns:xsd="http://www.w3.org/2001/XMLSc...
namespace="TestFlow1"
xmlns="http://schemas.xx.com/testtool/TestFlowModel...

<TestFlow definitionid="ad000000-0000-0000-0000-100000000001"
name="APPLY_SEQUENCE_INVALID_DATA" startstep="Sequence1.Section1.Step1">
<Tests>
<Test id="00000000-0000-0000-0000-100000000001" name="Test1" >
<TestElements>
<Expectation id="00000000-0000-0000-0000-200000000001"/>
<Expectation id="00000000-0000-0000-0000-200000000002"/>
<Input id="00000000-0000-0000-0000-300000000001"/>
<Input id="00000000-0000-0000-0000-300000000002"/>
</TestElements>
<Navigation>
<Action id="00000000-0000-0000-0000-400000000001"/>
</Navigation>
</Test>
</Tests>
</TestFlow>
</TestFlowModel>]]>
</Data>


I have been able to add the section using CData.new. But I get an error
when trying to add the remaining XML. I thought this code might work:

$xmldata = e11 = Element.new("TestFlowModel")
cdata = CData.new($xmldata)

But unfortunately this gives me a "Object#type is deprecated; use
Object#class" error.

Any ideas on how I can achieve this? Thank you in advance
--
Posted via http://www.ruby-....