如何在iPad中解析XML文件时处理CDATA标记 [英] How to handle the CDATA tag while parsing an XML file in iPad

查看:120
本文介绍了如何在iPad中解析XML文件时处理CDATA标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个应用程序,我需要解析一些包含CDATA标记的XML文件。解析普通的xml非常简单,但是我遇到了检索CDATA标签内部数据的问题。

I am working on an application where I need to parse some XML files that consists CDATA tags. Parsing ordinary xml is quite straight forward but I am facing problems to retrieve data that is inside the CDATA tag.

解析器:foundCDATA:方法。

请建议一种解析CDATA标签的方法。

Please suggest a way to parse the CDATA tag.

推荐答案

如果你需要从CDATA中提取字符串,你可以在foundCDATA中使用这个块:

If you need to extract the string from CDATA, you could use this block in foundCDATA:

NSMutableString *lStr = [[NSMutableString alloc] initWithData:CDATABlock encoding:NSUTF8StringEncoding];

这篇关于如何在iPad中解析XML文件时处理CDATA标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆