Search code examples
xml-parsingtalend

How to read the attribute value which is within CDATA from XML in Talend


I am trying to read attribute value which is within a CDATA from XML in Talend. I am getting the value along with CDATA and not the value alone. My XML format is :

<root>
   <node attribute="![CDATA[value]]" />
</root>

In Xpath if i give attribute it is retrieving the value as ![CDATA[value]]. I want to get only "value". Is it possible to get the value inside the CDATA?


Solution

  • tMap or tJavaFlex set output value as:

    row1.value.replaceAll("!\\[CDATA\\[","").replaceAll("\\]\\]","")
    

    row1.value - change for You real name