Called by the parser to give the application a locator for locating the origin of document events. SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this
(self, locator)
| 53 | self._locator = None |
| 54 | |
| 55 | def setDocumentLocator(self, locator): |
| 56 | """Called by the parser to give the application a locator for |
| 57 | locating the origin of document events. |
| 58 | |
| 59 | SAX parsers are strongly encouraged (though not absolutely |
| 60 | required) to supply a locator: if it does so, it must supply |
| 61 | the locator to the application by invoking this method before |
| 62 | invoking any of the other methods in the DocumentHandler |
| 63 | interface. |
| 64 | |
| 65 | The locator allows the application to determine the end |
| 66 | position of any document-related event, even if the parser is |
| 67 | not reporting an error. Typically, the application will use |
| 68 | this information for reporting its own errors (such as |
| 69 | character content that does not match an application's |
| 70 | business rules). The information returned by the locator is |
| 71 | probably not sufficient for use with a search engine. |
| 72 | |
| 73 | Note that the locator will return correct information only |
| 74 | during the invocation of the events in this interface. The |
| 75 | application should not attempt to use it at any other time.""" |
| 76 | self._locator = locator |
| 77 | |
| 78 | def startDocument(self): |
| 79 | """Receive notification of the beginning of a document. |