Parse a document from a string, returning the document node.
(self, string)
| 214 | return doc |
| 215 | |
| 216 | def parseString(self, string): |
| 217 | """Parse a document from a string, returning the document node.""" |
| 218 | parser = self.getParser() |
| 219 | try: |
| 220 | parser.Parse(string, True) |
| 221 | self._setup_subset(string) |
| 222 | except ParseEscape: |
| 223 | pass |
| 224 | doc = self.document |
| 225 | self.reset() |
| 226 | self._parser = None |
| 227 | return doc |
| 228 | |
| 229 | def _setup_subset(self, buffer): |
| 230 | """Load the internal subset if there might be one.""" |