38 |
if element.name in raw: |
if element.name in raw: |
39 |
element.__class__ = Raw_HTML_Element |
element.__class__ = Raw_HTML_Element |
40 |
|
|
41 |
def parse(data, builtin_namespaces=None, encoding=None): |
def parse(data, builtin_namespaces=None, encoding=None, module=core): |
42 |
if encoding is None: |
if encoding is None: |
43 |
# FIXME: can we get the encoding from the HTML? |
# FIXME: can we get the encoding from the HTML? |
44 |
encoding = 'latin1' |
encoding = 'latin1' |
45 |
if type(data) is type(''): |
if type(data) is type(''): |
46 |
data = unicode(data, encoding) |
data = unicode(data, encoding) |
47 |
parser = _parse_in_progress() |
parser = _parse_in_progress(module) |
48 |
if builtin_namespaces is not None: |
if builtin_namespaces is not None: |
49 |
parser.namespaces.append(builtin_namespaces) |
parser.namespaces.append(builtin_namespaces) |
50 |
parser.feed(data) |
parser.feed(data) |