<?xml version="1.0" encoding="UTF-8" ?>
<rdf:RDF xmlns="http://usefulinc.com/ns/doap#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><Project><name>gocept.lxml</name>
<shortdesc>Primarily proivdes zope3 interface definitions for lxml</shortdesc>
<description>==============================
Interface Definitions For lxml
==============================

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

Interfaces
==========

Interfaces are here:    

&gt;&gt;&gt; import gocept.lxml.interfaces

There is an interface for lxml.etree elements:

&gt;&gt;&gt; import lxml.etree
&gt;&gt;&gt; xml = lxml.etree.fromstring('&lt;a/&gt;')
&gt;&gt;&gt; gocept.lxml.interfaces.IElement.providedBy(xml)
True

And for objectifieds:

&gt;&gt;&gt; import lxml.objectify
&gt;&gt;&gt; obj = lxml.objectify.fromstring('&lt;a&gt;&lt;str&gt;holla&lt;/str&gt;&lt;/a&gt;')
&gt;&gt;&gt; gocept.lxml.interfaces.IElement.providedBy(obj)
True
&gt;&gt;&gt; gocept.lxml.interfaces.IObjectified.providedBy(obj)
True
&gt;&gt;&gt; gocept.lxml.interfaces.IElement.providedBy(obj.str)
True
&gt;&gt;&gt; gocept.lxml.interfaces.IObjectified.providedBy(obj.str)
True


Objectified parsers
===================

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

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

And parse it:

&gt;&gt;&gt; xml = gocept.lxml.objectify.fromfile(xml_file)
&gt;&gt;&gt; xml
&lt;Element {http://namespaces.zope.org/zope}configure at ...&gt;

This really is objectified:

&gt;&gt;&gt; gocept.lxml.interfaces.IObjectified.providedBy(xml)
True
&gt;&gt;&gt; xml.include.get('package')
'zope.app.component'


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

&gt;&gt;&gt; xml = gocept.lxml.objectify.fromstring('&lt;a&gt;&lt;b/&gt;&lt;/a&gt;')
&gt;&gt;&gt; xml
&lt;Element a at ...&gt;
&gt;&gt;&gt; gocept.lxml.interfaces.IObjectified.providedBy(xml)
True

Changes
=======

0.2.1 (2008-02-14)
++++++++++++++++++

- Lifted dependency on lxml&lt;2.0dev so lxml 2 can be used now.</description>
<homepage rdf:resource="http://pypi.python.org/pypi/gocept.lxml" />
<maintainer><foaf:Person><foaf:name>Christian Zagrodnick</foaf:name>
<foaf:mbox_sha1sum>88c4add050b0c67a4c17a2d28bb886524aa54a9a</foaf:mbox_sha1sum></foaf:Person></maintainer>
<release><Version><revision>0.2.1</revision></Version></release>
</Project></rdf:RDF>