def parse_string(self, string, source_string=None): path = create_tempfile(string) if source_string is not None: source_path = create_tempfile(source_string) return path, self.parse(path, source_path=source_path) else: return path, self.parse(path)
def parse_string(self, string, source_string=None, locale=None): path = create_tempfile(string) locale = locale or self.locale if source_string is not None: source_path = create_tempfile(source_string) return path, self.parse(path, source_path=source_path, locale=locale) else: return path, self.parse(path, locale=locale)
def create_nonexistant_resource(self, path): source_path = create_tempfile(dedent(""" <!ENTITY SourceString "Source String"> """)) source_resource = silme.SilmeResource(DTDParser, source_path) return silme.SilmeResource( DTDParser, path, source_resource=source_resource )