From 170c76ca080de87a403d2e87a5b7452fc82e51f0 Mon Sep 17 00:00:00 2001 From: cmdln Date: Sun, 26 Sep 2010 17:00:25 -0400 Subject: [PATCH] I don't think Beautiful soup is up to cracking oo3's xml format; it doesn't respect nesting. --- export_notes.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/export_notes.py b/export_notes.py index 8d5063a..1e053f6 100755 --- a/export_notes.py +++ b/export_notes.py @@ -1,2 +1,25 @@ #!/usr/bin/python +import gzip +from BeautifulSoup import BeautifulStoneSoup +import sys + + +def __main(oo_file): + g = open(oo_file) + o = open('output.xml', 'w') + try: + soup = BeautifulStoneSoup(g) + count = 0 + for item in soup.outline.root: + if item.parent != soup.outline.root: + continue + count = count + 1 + print count + finally: + g.close() + o.close() + + +if __name__ == "__main__": + __main(sys.argv[1])