Skip to main content
Help us improve Python packaging – donate today!

Primarily proivdes zope3 interface definitions for lxml

Project Description

This package provides zope interfaces for lxml objects. Far from being complete but a starting point.


Interfaces are here:

>>> import gocept.lxml.interfaces

There is an interface for lxml.etree elements:

>>> import lxml.etree
>>> xml = lxml.etree.fromstring('<a/>')
>>> gocept.lxml.interfaces.IElement.providedBy(xml)

And for objectifieds:

>>> import lxml.objectify
>>> obj = lxml.objectify.fromstring('<a><str>holla</str></a>')
>>> gocept.lxml.interfaces.IElement.providedBy(obj)
>>> gocept.lxml.interfaces.IObjectified.providedBy(obj)
>>> gocept.lxml.interfaces.IElement.providedBy(obj.str)
>>> gocept.lxml.interfaces.IObjectified.providedBy(obj.str)

Objectified parsers

There is a helper for creating objectifieds from file handles in gocept.lxml.objectify. Open a file:

>>> import os.path
>>> import gocept.lxml.objectify
>>> filename = os.path.join(
...     os.path.dirname(__file__),
...     'ftesting.zcml')
>>> xml_file = file(filename)

And parse it:

>>> xml = gocept.lxml.objectify.fromfile(xml_file)
>>> xml
<Element {}configure at ...>

This really is objectified:

>>> gocept.lxml.interfaces.IObjectified.providedBy(xml)
>>> xml.include.get('package')

For convinience fromstring is also defined in gocept.lxml.objectify:

>>> xml = gocept.lxml.objectify.fromstring('<a><b/></a>')
>>> xml
<Element a at ...>
>>> gocept.lxml.interfaces.IObjectified.providedBy(xml)


0.2.1 (2008-02-14)

  • Lifted dependency on lxml<2.0dev so lxml 2 can be used now.

Release history Release notifications

This version
History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
gocept.lxml-0.2.1.tar.gz (3.8 kB) Copy SHA256 hash SHA256 Source None Feb 14, 2008

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page