NSXMLParser - 修改iPhone中的元素 [英] NSXMLParser - modify the elements in iPhone

查看:127
本文介绍了NSXMLParser - 修改iPhone中的元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我查看了 NSXMLParser ,但是,我有一个HTML字符串,我需要修改它的元素。在阅读元素时没有看到任何修改元素的方法。



我不喜欢创建 NSMutableString

有没有办法读取HTML字符串并以优雅的方式修改它的元素?



例如

 < div style =color:grey>< / div> 

将会是

 < div style =color:black>< / div> 

不幸的是我发现不能使用 NSXMLDocument 在iPhone应用程序中。 请参阅github项目KissXML,它是'NSXML库的克隆,工作原理相同。
https://github.com/robbiehanson/KissXML






无耻自我宣传:我的分岔工作方式更好,不是真正的xml
https://github.com/Daij-Djan/KissXML


I have an HTML string that I need to modify its elements.

I looked into NSXMLParser, but didn't see any method to modify the elements while reading them.

I don't like the solution of creating a NSMutableString and adding strings to it.

Is there a way to read HTML string and modify its element in an elegant way?

e.g.,

<div style="color:grey"></div>

will be

<div style="color:black"></div>

Unfortunately I saw that one cannot use NSXMLDocument in an iPhone app.

解决方案

see the github project KissXML which is a 'clone of NSXML library and works the same. https://github.com/robbiehanson/KissXML


shameless self-advert: my fork of it works way better with html that's not real xml https://github.com/Daij-Djan/KissXML

这篇关于NSXMLParser - 修改iPhone中的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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