[xml] HowTo: Offline LibXML searchable mailing list archive



Consider this a mini howto to make the Libxml2 archives searchable and
accessible offline on your PC. This is very handy to have when developing
with LibXML2 and can help you avoid asking questions already covered. You
do not need a real mail account for this to work, but if you use a real
account and then subscribe to the LibXML mail list you will automatically
stay up to date. These instructions will work for any platform Mozilla
Thunderbird runs on, but many of the specifics are Windows since that is
the platform I primarily use.

1.  Download and unzip all the archive files (
http://mail.gnome.org/archives/xml/ ) to a folder on your local hard
drive.

2. Write a script to read each .txt archive file and combine it into one
huge text file called "INBOX". See example Window script below. If this is
too much trouble you can download a reasonably up-to-date file at 
http://www.lowing.org/INBOX.zip (just unzip it and follow the rest of the
instructions). I also put up the XSLT mail group to
http://www.lowing.org/INBOX-XSLT.zip

3. Download and install Mozilla Thunderbird
(http://www.mozilla.org/products/thunderbird/) email client.

4. Create a new Email account. I recommend using the same credentials you
used to subscribe to the mailing list (
http://mail.gnome.org/mailman/listinfo/xml ) so new messages will wind up
in the same inbox.

5. Close Thunderbird and navigate to the folder where your Thunderbird
inbox resides ( http://www.mozilla.org/support/thunderbird/profile ). On
Windows this will be under your user profile in a path like:

 "C:\Documents and Settings\<User Name>\Application
Data\Thunderbird\Profiles\default\<random text>\Mail\<mail server>"

6. Copy the "INBOX" file created in step 2 into the Thunderbird account
folder and overwrite the existing Inbox file.

7. Open Thunderbird and open the inbox for that account. It will take a
minute to index the contents. I also recommend editing your preferences to
colorize nested messages (
http://www.mozilla.org/support/thunderbird/tips#app_quotelevels ).


Windows code to build the big inbox. Copy  the code below to a new text
file called "bigbox.vbs" located in the same folder you unzipped the
archive file to in step 1:

'-------START OF CODE-----------------------------------------------
'-------------------------------------------------------------------
Dim objFSO
Dim objFolder, objSubFolder, objFolders
Dim objFiles, objFile, objFileStream
Dim CurrentPath, strFileText, strName, strMIME
Dim TABS, blnRecursive
'Define Constants
Const ForReading = 1
Const ForWriting = 2
Const TriStDef = -2

TABS = " " 'How many spaces to replace each tab
blnRecursive = "False" 'Make This recursive to convert files in subfolders


'Getting the current folder
Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
CurrentPath = objFSO.GetParentFolderName(WScript.ScriptFullName)
Set objFolder = objFSO.GetFolder(CurrentPath)

strNewFile = CurrentPath & "\INBOX"
Set objNewFileStream = objFSO.OpenTextFile(strNewFile, ForWriting, True)


'Start Converting Files
Call IterateDirectory(objFolder)


Sub IterateDirectory(objFolder)
 Set objFiles = objFolder.Files
 For Each objFile in objFiles
   If Instr(objFile.Name,".") > 0 Then
    strMIME = MID(objFile.Name,InstrRev(objFile.Name,".") +1,
Len(objFile.Name))
   End If
   strMIME = LCase(strMIME)
   Select Case strMIME
   Case "txt"

   Set objFileStream = objFile.OpenAsTextStream(ForReading, TriStDef)
   strFileText = objFileStream.ReadAll
   objFileStream.Close
   objNewFileStream.WriteLine strFileText

   strFileText = ""
   strMIME = ""
   End Select
 Next
 'Loop Through the rest of the folders if set recursive
 If blnRecursive = "True" Then
  For Each objSubFolder in objFolder.SubFolders
   IterateDirectory(objSubFolder)
  Next
 End If
End Sub

objNewFileStream.Close
Set objFSO = Nothing
Set objFolder = Nothing
Set objFolders = Nothing
Set objFiles = Nothing
Set objFile = Nothing
Set objFileStream = Nothing


WScript.Echo "Done"


'-----------End Code-----------------


Trevor Lowing









[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]