Package lxml :: Module etree :: Class _FeedParser
[hide private]
[frames] | no frames]

Class _FeedParser



 object --+    
          |    
_BaseParser --+
              |
             _FeedParser
Known Subclasses:
XMLParser, HTMLParser

Instance Methods [hide private]
 
__new__(T, S, ...)
Returns: a new object with type S, a subtype of T
 
close(...)
Terminates feeding data to this parser.
 
feed(...)
Feeds data to the parser.

Inherited from _BaseParser: __init__, copy, makeelement, setElementClassLookup, set_element_class_lookup

Inherited from object: __delattr__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from _BaseParser: error_log, resolvers, version

Inherited from object: __class__

Method Details [hide private]

__new__(T, S, ...)

 
Returns:
a new object with type S, a subtype of T

Overrides: _BaseParser.__new__

close(...)

 

Terminates feeding data to this parser. This tells the parser to process any remaining data in the feed buffer, and then returns the root Element of the tree that was parsed.

This method must be called after passing the last chunk of data into the ``feed()`` method. It should only be called when using the feed parser interface, all other usage is undefined.

feed(...)

 

Feeds data to the parser. The argument should be an 8-bit string buffer containing encoded data, although Unicode is supported as long as both string types are not mixed.

This is the main entry point to the consumer interface of a parser. The parser will parse as much of the XML stream as it can on each call. To finish parsing, call the ``close()`` method.

It is not possible to use the parser in any other way after calling the ``feed()`` method. The parser can only be reset by calling ``close()``.