I am trying to write a Firefox 3 add-on which will enable me to easily re-tag bookmarks. For example I have some bookmarks tagged "development" and some tagged "Development" and I would like a way to easily update all the "delelopment" tags to "Development". Unfortunately I can not find an add-on to do this so I thought I would create my own. 

Having not developed an add-on before I've managed to grasp the basics and discovered that FireFox stores all bookmarks in an SQLite database called Places.sqlite. Within that database there is a table called moz\_bookmarks which contains all the bookmarks, tags and folders within the bookmarks directory. The structure of the bookmark folders and their child bookmarks is represented using a foreign key id which points to the parent folder's id in the same table which again recursses upwards to that parent folder's Id until it hits the bookmarks root. 

However, where I become stuck is how the tags you apply in firefox are related to the bookmarks. Each tag has a type = 2 and parent ID = 4. However I can see no correlation between this and an actual bookmarks that use the tag. If I add a bookmark in firefox to no particular folder but give it 2 or 3 tags then it's parent folder ID is 5 which corresponds to "unfiled" but I can see no further correlation to the tags associated with it. 

I have found this [Wiki page on the structure](http://www.forensicswiki.org/index.php?title=Mozilla_Firefox_3_History_File_Format) but it does not really help.

It's driving me nuts :( Please help...