将.plist文件解析为纯XML C# [英] Parsing .plist Files to plain XML C#

查看:382
本文介绍了将.plist文件解析为纯XML C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用c#读取我的Apple Safari历史记录,该历史记录存储在plist文件中,但是我总是收到错误消息,并且不确定执行此操作的正确方法. 我尝试执行的代码是这样的:

I'm trying to read my Apple Safari history with c#, which is stored in a plist file, however I always get an error and I'm not sure what the correct way is to do it. The code I tried to execute is this:

XmlDocument xmd = new XmlDocument();
xmd.LoadXml(@"C:\Users\Oran\AppData\Roaming\AppleComputer\Safari\History.plist");

,我总是收到以下错误: "Data at the root level is invalid. Line 1, position 1."

and I always get the following error: "Data at the root level is invalid. Line 1, position 1."

有人知道此代码有什么问题吗,并建议阅读plist文件的最佳方法是什么?

Does anyone know whats wrong with this code and recommend what is the best way to read plist files?

推荐答案

Apple Safari history.plist看起来像是二进制plist.我找到了一个很棒的项目:

It looks like that Apple Safari history.plist is binary plist. I've found a great project:

https://github.com/animetrics/PlistCS

自述文件:

这是C#属性列表(plist)序列化库(MIT 执照).它支持plist的XML和二进制版本 格式.

This is a C# Property List (plist) serialization library (MIT license). It supports both XML and binary versions of the plist format.

这篇关于将.plist文件解析为纯XML C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆