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

Class Resolver

object --+
         |
        Resolver
Known Subclasses:

This is the base class of all resolvers.
Instance Methods [hide private]
a new object with type S, a subtype of T
__new__(T, S, ...)
 
resolve(self, system_url, public_id, context)
Override this method to resolve an external source by system_url and public_id. The third argument is an opaque context object.
 
resolve_empty(self, context)
Return an empty input document.
 
resolve_file(self, f, context, base_url=None, close=True)
Return an open file-like object as input document.
 
resolve_filename(self, filename, context)
Return the name of a parsable file as input document.
 
resolve_string(self, string, context, base_url=None)
Return a parsable string as input document.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__new__(T, S, ...)

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

resolve(self, system_url, public_id, context)

 

Override this method to resolve an external source by system_url and public_id. The third argument is an opaque context object.

Return the result of one of the resolve_*() methods.

resolve_empty(self, context)

 

Return an empty input document.

Pass context as parameter.

resolve_file(self, f, context, base_url=None, close=True)

 

Return an open file-like object as input document.

Pass open file and context as parameters. You can pass the base URL or filename of the file through the base_url keyword argument. If the close flag is True (the default), the file will be closed after reading.

Note that using .resolve_filename() is more efficient, especially in threaded environments.

resolve_filename(self, filename, context)

 

Return the name of a parsable file as input document.

Pass filename and context as parameters. You can also pass a URL with an HTTP, FTP or file target.

resolve_string(self, string, context, base_url=None)

 

Return a parsable string as input document.

Pass data string and context as parameters. You can pass the source URL or filename through the base_url keyword argument.