Class XMLParser
object --+
|
_BaseParser --+
|
_FeedParser --+
|
XMLParser
- Known Subclasses:
-
XMLParser(self, attribute_defaults=False, dtd_validation=False, load_dtd=False, no_network=True, ns_clean=False, recover=False, remove_blank_text=False, compact=True, resolve_entities=True, remove_comments=False, remove_pis=False, target=None, encoding=None, schema=None)
The XML parser.
Parsers can be supplied as additional argument to various parse
functions of the lxml API. A default parser is always available
and can be replaced by a call to the global function
'set_default_parser'. New parsers can be created at any time
without a major run-time overhead.
The keyword arguments in the constructor are mainly based on the libxml2
parser configuration. A DTD will also be loaded if validation or
attribute default values are requested.
Available boolean keyword arguments:
- attribute_defaults - read default attributes from DTD
- dtd_validation - validate (if DTD is available)
- load_dtd - use DTD for parsing
- no_network - prevent network access for related files (default: True)
- ns_clean - clean up redundant namespace declarations
- recover - try hard to parse through broken XML
- remove_blank_text - discard blank text nodes
- remove_comments - discard comments
- remove_pis - discard processing instructions
- compact - safe memory for short text content (default: True)
- resolve_entities - replace entities by their text value (default: True)
Other keyword arguments:
- encoding - override the document encoding
- target - a parser target object that will receive the parse events
- schema - an XMLSchema to validate against
Note that you should avoid sharing parsers between threads. While this is
not harmful, it is more efficient to use separate parsers. This does not
apply to the default parser.
|
__init__(self,
attribute_defaults=False,
dtd_validation=False,
load_dtd=False,
no_network=True,
ns_clean=False,
recover=False,
remove_blank_text=False,
compact=True,
resolve_entities=True,
remove_comments=False,
remove_pis=False,
target=None,
encoding=None,
schema=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature |
|
|
a new object with type S, a subtype of T
|
|
Inherited from _FeedParser :
close ,
feed
Inherited from _BaseParser :
copy ,
makeelement ,
setElementClassLookup ,
set_element_class_lookup
Inherited from object :
__delattr__ ,
__getattribute__ ,
__hash__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__setattr__ ,
__str__
|
Inherited from _FeedParser :
feed_error_log
Inherited from _BaseParser :
error_log ,
resolvers ,
version
Inherited from object :
__class__
|
__init__(self,
attribute_defaults=False,
dtd_validation=False,
load_dtd=False,
no_network=True,
ns_clean=False,
recover=False,
remove_blank_text=False,
compact=True,
resolve_entities=True,
remove_comments=False,
remove_pis=False,
target=None,
encoding=None,
schema=None)
(Constructor)
|
|
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- Overrides:
object.__init__
|
- Returns: a new object with type S, a subtype of T
- Overrides:
object.__new__
|