XML解析到plist iPhone SDK
请您帮我解析此 XML 代码:
<?xml version="1.0" encoding="utf-8"?>
<stuff>
<parts>
<part id='327'>
<name>Logitech MX500</name>
<serial>618163558491989</serial>
<account>ASDALSKD</account>
<number>987 789 456</number>
<alarm>alarm1</alarm>
</part>
<part id='846'>
<name>Logitech MX510</name>
<serial>871351434945431</serial>
<account>KJSDAKLJFA</account>
<number>454 564 131</number>
<alarm>alarm2</alarm>
</part>
</parts>
<info>Information</info>
</stuff>
并将数据保存到 plist 文件 stuff.plist 中,格式如下:
327 NSArray
Name NSString Logitech MX500
Serial NSString 618163558491989
Account NSString ASDALSKD
Number NSString 987 789 456
Alarm NSString alarm1
846 NSArray
Name NSString Logitech MX510
Serial NSString 871351434945431
Account NSString KJSDAKLJFA
Number NSString 454 564 131
Alarm NSString alarm2
Could you, please, help me with parsing of this XML code:
<?xml version="1.0" encoding="utf-8"?>
<stuff>
<parts>
<part id='327'>
<name>Logitech MX500</name>
<serial>618163558491989</serial>
<account>ASDALSKD</account>
<number>987 789 456</number>
<alarm>alarm1</alarm>
</part>
<part id='846'>
<name>Logitech MX510</name>
<serial>871351434945431</serial>
<account>KJSDAKLJFA</account>
<number>454 564 131</number>
<alarm>alarm2</alarm>
</part>
</parts>
<info>Information</info>
</stuff>
And save data to plist file stuff.plist in this format:
327 NSArray
Name NSString Logitech MX500
Serial NSString 618163558491989
Account NSString ASDALSKD
Number NSString 987 789 456
Alarm NSString alarm1
846 NSArray
Name NSString Logitech MX510
Serial NSString 871351434945431
Account NSString KJSDAKLJFA
Number NSString 454 564 131
Alarm NSString alarm2
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论