Open an XML document at the specified I{url}. First, the document attempted to be retrieved from the I{object cache}. If not found, it is downloaded and parsed using the SAX parser. The result is added to the cache for the next open(). @param url: A
(self, url)
| 60 | """ |
| 61 | |
| 62 | def open(self, url): |
| 63 | """ |
| 64 | Open an XML document at the specified I{url}. |
| 65 | First, the document attempted to be retrieved from |
| 66 | the I{object cache}. If not found, it is downloaded and |
| 67 | parsed using the SAX parser. The result is added to the |
| 68 | cache for the next open(). |
| 69 | @param url: A document url. |
| 70 | @type url: str. |
| 71 | @return: The specified XML document. |
| 72 | @rtype: I{Document} |
| 73 | """ |
| 74 | cache = self.cache() |
| 75 | id = self.mangle(url, 'document') |
| 76 | d = cache.get(id) |
| 77 | if d is None: |
| 78 | d = self.download(url) |
| 79 | cache.put(id, d) |
| 80 | self.plugins.document.parsed(url=url, document=d.root()) |
| 81 | return d |
| 82 | |
| 83 | def download(self, url): |
| 84 | """ |