#!/usr/bin/env python

import libxml2
import sys

def strip_bookmarks (node, titles=0, hrefs=0):
	while (node != None):
		if (node.name == 'title'):
			node.setContent ('Title' + `titles`)
			titles+=1

		if (node.name == 'bookmark'):
			node.setProp ('href', 'Href' + `hrefs`)
			hrefs += 1
		
		if (node.children != None):
			strip_bookmarks (node.children, titles+1, hrefs+1)
		
		node = node.next

doc = libxml2.parseFile (sys.argv[1])

node = doc.getRootElement ()
strip_bookmarks (node)

doc.saveFile ('stripped_bookmarks.xbel')
