希望得到超出我经验的帮助。我有以下的plist。我希望提取的信息大约有四分之一," A / Amemiya-1984-Tobit-00.pdf"。搜索球拍文件显示xml/plist
。但是,因为我之前没有使用解析XML或plist,所以我被困住了。如果有人能让我开始,我会非常感激。完整的解决方案也非常受欢非常感谢你。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>$archiver</key>
<string>NSKeyedArchiver</string>
<key>$objects</key>
<array>
<string>$null</string>
<dict>
<key>$class</key>
<dict>
<key>CF$UID</key>
<integer>7</integer>
</dict>
<key>NS.keys</key>
<array>
<dict>
<key>CF$UID</key>
<integer>2</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>3</integer>
</dict>
</array>
<key>NS.objects</key>
<array>
<dict>
<key>CF$UID</key>
<integer>4</integer>
</dict>
<dict>
<key>CF$UID</key>
<integer>5</integer>
</dict>
</array>
</dict>
<string>relativePath</string>
<string>aliasData</string>
<string>A/Amemiya-1984-Tobit-00.pdf</string>
<dict>
<key>$class</key>
<dict>
<key>CF$UID</key>
<integer>6</integer>
</dict>
<key>NS.data</key>
<data>
AAAAAAF8AAIAAAxNYWNpbnRvc2ggSEQAAAAAAAAAAAAAAAAAAAAA
AAAAQkQAAf////8ZQW1lbWl5YS0xOTg0LVRvYml0LTAwLnBkZgAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////
/wAAAAAAAAAAAAAAAAABAAMAAAogY3UAAAAAAAAAAAAAAAAAAUEA
AAIAOi86VXNlcnM6Z2hvZXRrZXI6QmliRGVza1BhcGVyczpBOkFt
ZW1peWEtMTk4NC1Ub2JpdC0wMC5wZGYADgA0ABkAQQBtAGUAbQBp
AHkAYQAtADEAOQA4ADQALQBUAG8AYgBpAHQALQAwADAALgBwAGQA
ZgAPABoADABNAGEAYwBpAG4AdABvAHMAaAAgAEgARAASADhVc2Vy
cy9naG9ldGtlci9CaWJEZXNrUGFwZXJzL0EvQW1lbWl5YS0xOTg0
LVRvYml0LTAwLnBkZgATAAEvAAAVAAIAD///AAA=
</data>
</dict>
<dict>
<key>$classes</key>
<array>
<string>NSMutableData</string>
<string>NSData</string>
<string>NSObject</string>
</array>
<key>$classname</key>
<string>NSMutableData</string>
</dict>
<dict>
<key>$classes</key>
<array>
<string>NSDictionary</string>
<string>NSObject</string>
</array>
<key>$classname</key>
<string>NSDictionary</string>
</dict>
</array>
<key>$top</key>
<dict>
<key>root</key>
<dict>
<key>CF$UID</key>
<integer>1</integer>
</dict>
</dict>
<key>$version</key>
<integer>100000</integer>
</dict>
</plist>
答案 0 :(得分:1)
我非常不确定,但我会采取我认为你的意思:这个文件包含存档数据,你想解码'数据'块。是吗?
如果是这样,我很遗憾地报告说这个问题与plist无关。具体而言,plist格式是将结构化数据序列化为文件的一种方式。当您使用plist解码器时,它会告诉您有一个字典,其中键'$ archiver'与字符串'NSKeyed Archiver'相关联,字符串'$ objects'与包含字符串和字符串的数组相关联字典......等等,直到你得到你感兴趣的部分,你会得知关键'NS.Data'与数据相关
“AAAAAAF8AAIAAAxNYWNpbnRvc2ggSEQAAAAAAAAAAAAAAAAAAAAAAA AAAAQkQAAf //// 8ZQW1lbWl5YS0xOTg0LVRvYml0LTAwLnBkZgAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA //// / wAAAAAAAAAAAAAAAAABAAMAAAogY3UAAAAAAAAAAAAAAAAAAUEA AAIAOi86VXNlcnM6Z2hvZXRrZXI6QmliRGVza1BhcGVyczpBOkFt ZW1peWEtMTk4NC1Ub2JpdC0wMC5wZGYADgA0ABkAQQBtAGUAbQBp AHkAYQAtADEAOQA4ADQALQBUAG8AYgBpAHQALQAwADAALgBwAGQA ZgAPABoADABNAGEAYwBpAG4AdABvAHMAaAAgAEgARAASADhVc2Vy cy9naG9ldGtlci9CaWJEZXNrUGFwZXJzL0EvQW1lbWl5YS0xOTg0 LVRvYml0LTAwLnBkZgATAAEvAAAVAAIAD /// AAA = “
......你已经知道了。也就是说,plist格式描述了结构,但没有指定这些字符串的含义。
现在,说到这一点,确实看起来该字符串是base64编码的。让我们尝试用base64解码它......
...是的,它看起来像是base64编码的。它出来了
“| Macintosh HDBD ???? Amemiya-1984-Tobit-00.pdf ???? CUA:/:用户:ghoetker:BibDeskPapers:A:雨宫-1984-托比特-00.pdf4Amemiya-1984-托比特-00.pdf Macintosh HD8Users / ghoetker / BibDeskPapers / A / Amemiya-1984-Tobit-00.pdf / ??%“
这会回答你的问题吗?