0

is there a way I can access the CDATA Value in a xml string using KissXML?

My obj-c code:

for(DDXMLElement* itemElement in xmlItems)
{
 //get CDATA
}

String looks like this:

<item>
<title></title>
<link></link>
<description><![CDATA[<a href="">Link</a>description<a href="">another link</a> task]]>   </description>
</item>
btype
  • 1,593
  • 19
  • 32

1 Answers1

0

CDATA should manifest in the DOM tree as text, so just iterate the children of the element node looking for nodes whose -kind property is DDXMLTextKind.

NSMutableString* content = [[NSMutableString alloc] init];
for (DDXMLNode* child in [parent children])
{
    if ([child kind] == DDXMLTextKind)
    {
        [content append: [child stringValue]];
    }
}

might do it, I haven't compiled or tested the above, but you can.

JeremyP
  • 84,577
  • 15
  • 123
  • 161