当我在不同类别中有多个同名节点时,如何使用 NSXMLParser 读取 XML?
我怎样才能使用 NSXMLParser 进行这种类型的 XML 响应,我对两次“点击”感到困惑,它会击中,那么如何使用一个对象来管理流程并保存数据,请帮帮我,
</campaign_summary_response>
<summary> <clicks>6</clicks>
<conversions>1</conversions>
<conversion_rate>0.1666666666666666666666666667</conversion_rate>
<revenue>22.26555000000000</revenue>
<revenue_converted>22.26555000000000</revenue_converted>
<currency_symbol>$</currency_symbol>
<currency_symbol_converted>$</currency_symbol_converted>
</summary>
<campaigns>
<campaign> <offer_id>100</offer_id>
<offer_name>$100 Wendy's Gift Card + Free Frosty</offer_name>
<campaign_id>1781</campaign_id> <vertical_name>Free Stuff</vertical_name>
<price_format>CPA</price_format>
<price>0.0000</price>
<impressions>0</impressions>
<clicks>6</clicks>
<conversions>1</conversions>
<conversion_rate>0.1666666666666666666</conversion_rate>
<revenue>15.0000</revenue>
<revenue_converted>22.26555000000000</revenue_converted>
<epc>2.50000000000000000000000</epc>
<currency_symbol>€</currency_symbol>
<currency_symbol_converted>$</currency_symbol_converted>
</campaign> </campaigns>
</campaign_summary_response>
我如何按照委托方法进行编码
- (void)parser:(NSXMLParser *)parser
didEndElement:(NSString *)elementName
namespaceURI:(NSString *)namespaceURI
qualifiedName:(NSString *)qName {
所以我可以将所有值保存在一个对象中并在显示器上显示。
How can I such type of Response of XML, using NSXMLParser, I am confused about two "clicks", it will hit, so how to manage flow and save data with one object, help me out,
</campaign_summary_response>
<summary> <clicks>6</clicks>
<conversions>1</conversions>
<conversion_rate>0.1666666666666666666666666667</conversion_rate>
<revenue>22.26555000000000</revenue>
<revenue_converted>22.26555000000000</revenue_converted>
<currency_symbol>lt;/currency_symbol>
<currency_symbol_converted>lt;/currency_symbol_converted>
</summary>
<campaigns>
<campaign> <offer_id>100</offer_id>
<offer_name>$100 Wendy's Gift Card + Free Frosty</offer_name>
<campaign_id>1781</campaign_id> <vertical_name>Free Stuff</vertical_name>
<price_format>CPA</price_format>
<price>0.0000</price>
<impressions>0</impressions>
<clicks>6</clicks>
<conversions>1</conversions>
<conversion_rate>0.1666666666666666666</conversion_rate>
<revenue>15.0000</revenue>
<revenue_converted>22.26555000000000</revenue_converted>
<epc>2.50000000000000000000000</epc>
<currency_symbol>€</currency_symbol>
<currency_symbol_converted>lt;/currency_symbol_converted>
</campaign> </campaigns>
</campaign_summary_response>
How do I code following delegate method
- (void)parser:(NSXMLParser *)parser
didEndElement:(NSString *)elementName
namespaceURI:(NSString *)namespaceURI
qualifiedName:(NSString *)qName {
So that i can save all values in one object and show on display.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在
didStartElement
方法中。在
didEndElement
方法中。In
didStartElement
method.In
didEndElement
method.