29 Public method to write an XBEL bookmark file. |
29 Public method to write an XBEL bookmark file. |
30 |
30 |
31 @param fileNameOrDevice name of the file to write (string) |
31 @param fileNameOrDevice name of the file to write (string) |
32 or device to write to (QIODevice) |
32 or device to write to (QIODevice) |
33 @param root root node of the bookmark tree (BookmarkNode) |
33 @param root root node of the bookmark tree (BookmarkNode) |
|
34 @return flag indicating success (boolean) |
34 """ |
35 """ |
35 if isinstance(fileNameOrDevice, QIODevice): |
36 if isinstance(fileNameOrDevice, QIODevice): |
36 f = fileNameOrDevice |
37 f = fileNameOrDevice |
37 else: |
38 else: |
38 f = QFile(fileNameOrDevice) |
39 f = QFile(fileNameOrDevice) |
45 def __write(self, root): |
46 def __write(self, root): |
46 """ |
47 """ |
47 Private method to write an XBEL bookmark file. |
48 Private method to write an XBEL bookmark file. |
48 |
49 |
49 @param root root node of the bookmark tree (BookmarkNode) |
50 @param root root node of the bookmark tree (BookmarkNode) |
|
51 @return flag indicating success (boolean) |
50 """ |
52 """ |
51 self.writeStartDocument() |
53 self.writeStartDocument() |
52 self.writeDTD("<!DOCTYPE xbel>") |
54 self.writeDTD("<!DOCTYPE xbel>") |
53 self.writeStartElement("xbel") |
55 self.writeStartElement("xbel") |
54 self.writeAttribute("version", "1.0") |
56 self.writeAttribute("version", "1.0") |