hi frnds, i want to get the safari history in VB.Net..Safari maintains its history in history.plist file.....I want to know that how to convert this file to XML format??Plz help me out from where to start,,,cz i have no idea..

Recommended Answers

All 5 Replies

I don't use Safari but I have it installed (version 3.2.2 (525.28.1)). I took a quick look at history.plist and it looks like valid XML to me. I also changed the file extension to xml and it opened with my xml editor without errors.

Maybe you don't have to do any conversion at all? Have you tried reading it with VB.NET (XmlReader or whatever you want to do with the file)?

Sorry its not History.plist file its Bookmarks.plist file,Its in binary format..open it .I want to convert it XML format so dat i can retch bookmarks from it......

:-/ Bookmarks.plist seems valid XML too...

No frnd bookmarks file is not in XML format......Cz XML file can be raed in simple format...

If Dir(sFileName) <> "" Then
                FileOpen(FileNum, Application.StartupPath & "\" & IGNORE_LIST_PATH, OpenMode.Input, OpenAccess.Read, OpenShare.Shared)
                Do While Not EOF(FileNum)
                    sInputLine = LineInput(FileNum)
                Loop
End If

When i read the history.plist with the above code,it is raeding..But when i raed the Bookmarks.Plist file...It is raeding,but data returned is not correctly..
have a look again at the Boomarks,Plist..Althought u can view the view contents of the file. Plz raed the file U will come to know what i m sayg??

Worked fine with the following code. Never hit the "breakpoint" lines

Dim sFileName As String
Dim FileNum As Integer
Dim sInputLine As String

sFileName = "C:\Documents and Settings\<user>\Application Data\Apple Computer\Safari\bookmarks.plist"
FileNum = FreeFile()
If Dir(sFileName) <> "" Then
  Try
    FileOpen(FileNum, sFileName, OpenMode.Input, OpenAccess.Read, OpenShare.Shared)
  Catch ex As Exception
    ex = ex ' Breakpoint line
  End Try
  Do While Not EOF(FileNum)
    Try
      sInputLine = LineInput(FileNum)
    Catch ex As Exception
      ex = ex ' Breakpoint line
    End Try
  Loop
End If

' Second way
If My.Computer.FileSystem.FileExists(sFileName) Then
  sInputLine = My.Computer.FileSystem.ReadAllText(sFileName)
End If

I also renamed again bookmarks.plist -> bookmarks.xml and opened it with my xml-editor w/o any problems i.e. the editor marked the content as valid xml.

Have you opened your bookmarks.plist with an hex-editor and checked for "binary" characters (except CR and/or LF chars)? Have you tried to open it with an xml editor? (There are freeware editors in the net if you don't have a suitable editor.)

Also, have you tried to read bookmarks.plist with XmlReader instead as a text file? You can google VB.NET+"how to read xml file" to get sample codes for that.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.