在 iOS 中解析 XML?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1021102/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 16:03:21  来源:igfitidea点击:

Parsing XML in iOS?

iosxmlparsing

提问by diederikh

I need to parse simple XML coming from my webserver and store this in database. How do I do the same?

我需要解析来自我的网络服务器的简单 XML 并将其存储在数据库中。我该怎么做?

回答by diederikh

Please have a look at Touch XML, a Objective-C framework for reading and writing XML. It's usage is similar (drop-in replacement) for Apple's NSXMLDocument (which is not available for the iPhone SDK).

请查看Touch XML,这是一个用于读写XML的 Objective-C 框架。它的用法与 Apple 的 NSXMLDocument(不适用于 iPhone SDK)类似(直接替换)。

回答by zpesk

Apple has two built in solutions for parsing XML data on the iphone:

Apple 有两个内置的解决方案来解析 iPhone 上的 XML 数据:

1) Apple has an objective-c implementation of an XML parser called NSXMLParser. See documentation here.

1) Apple 有一个名为 NSXMLParser 的 XML 解析器的 Objective-C 实现。 请参阅此处的文档。

2) Apple also has a C based implementation of an XML parser called libXML2. See documentation here. - scroll down to see section on XML support

2) Apple 还有一个基于 C 的 XML 解析器实现,称为 libXML2。 请参阅此处的文档。- 向下滚动以查看有关 XML 支持的部分

回答by ravinder521986

you can check here ,might be it will help you. http://homepages.ius.edu/rwisman/C490/html/nsxmlparser.html

你可以在这里查看,可能会对你有所帮助。 http://homepages.ius.edu/rwisman/C490/html/nsxmlparser.html

回答by Tom Bradley

Check out http://www.tbxml.co.ukfor a super-fast, lightweight, easy to use XML parser!

查看http://www.tbxml.co.uk以获得超快速、轻量级、易于使用的 XML 解析器!

回答by Olof

The above mentioned Touch XML, seems to be discountinued. KissXMLis an alternative. It is based on Touch XML, but has more features.

上面提到的Touch XML,好像打折了。KissXML是一种替代方法。它基于Touch XML,但具有更多功能。

GDataXMLcould also be an alternative, its developed by Google.

GDataXML也可以作为替代方案,它由 Google 开发。