tags:

views:

45

answers:

1

Hello, 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\Apple Computer\Safari\History.plist");

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

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

A: 

Hi,

try this and everyhing should be fine ;-)

xmd.Load(...)

The one you have used loads the xml data from a string not from a file.

Dennis
it still gives me the same error... maybe apple serialze safari's plists somehow?
Oran
1.) Can you confirm, that the xml is well-formed? Try to open it with an xml editor. 2.) Make sure that the file is there. 3.) Make sure there is no blank line before the root element 4.) What about security? Has you app the privilege to open the file? (Maybe when your app is a web-service or website it doesn't have the privilege)
Dennis
1. no, i cant open it with an xml editor, however it opens up perfectly well with plist editor...
Oran
2. the file is there3.i dont know how to make sure there is no blank line4.the program has permission
Oran