xcode 将 XML 转换为 .plist
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2844663/
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
Convert XML to .plist
提问by Dror Sabbag
I have an XML exported from Oracle DB, which will be downloaded into my application main bundle.
我有一个从 Oracle DB 导出的 XML,它将被下载到我的应用程序主包中。
i would like to convert this XML file into .plist file so i can assign the values into NSDictionary and NSArrays..
我想将此 XML 文件转换为 .plist 文件,以便我可以将值分配给 NSDictionary 和 NSArrays..
Is there a way to get this to work? or is there a better way to work with an external XML file?
有没有办法让它发挥作用?还是有更好的方法来处理外部 XML 文件?
note that one of the fields in the XML is a full HTML content
请注意,XML 中的字段之一是完整的 HTML 内容
example:
例子:
<main>
<DATA_RECORD>
<ID>ID1</ID>
<NO>1234512</NO>
<TYPE>NEW</TYPE>
<TYPE_NO>0</TYPE_NO>
<TEXT_ID>TEXT1</TEXT_ID>
<TEXT><HTML>some html goes here</HTML></TEXT>
</DATA_RECORD>
</main>
采纳答案by dierre
What about this?
那这个呢?
You can try plutil
你可以试试plutil
plutil -convert xml1 il_tuo_file_binario.plist
PS: I've edited because I did read .plist to XML in my mind the first time.
PS:我编辑是因为我第一次在脑海中读到了 .plist 到 XML。
回答by D K
You could use a program like Oxygen (free 30-day trial at oxygenxml.com) to convert your XML file to JSON, and then use the OSX Terminal command line to convert the JSON file to PLIST.
您可以使用 Oxygen 之类的程序(在oxygenxml.com 上免费试用 30 天)将您的 XML 文件转换为 JSON,然后使用 OSX 终端命令行将 JSON 文件转换为 PLIST。
plutil -convert xml1 blahblah.json -o blahblah.plist
That should do it.... :)
那应该这样做....:)