Skip to main content

Interface Definitions For lxml

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

Interfaces

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)
True

And for objectifieds:

>>> import lxml.objectify
>>> obj = lxml.objectify.fromstring('<a><str>holla</str></a>')
>>> gocept.lxml.interfaces.IElement.providedBy(obj)
True
>>> gocept.lxml.interfaces.IObjectified.providedBy(obj)
True
>>> gocept.lxml.interfaces.IElement.providedBy(obj.str)
True
>>> 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:

>>> 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 {http://namespaces.zope.org/zope}configure at ...>

This really is objectified:

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

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)
True

Changes

0.2.1 (2008-02-14)

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

Metadata

Release files for gocept.lxml 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gocept.lxml 0.2.1
File Size Uploaded Provenance Actions
gocept.lxml-0.2.1.tar.gz 3.8 kB Without provenance Details for gocept.lxml-0.2.1.tar.gz

Release files / gocept.lxml-0.2.1.tar.gz

Download URL gocept.lxml-0.2.1.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
017f6465260e07441c30a7a74e8bb663ded54faab8eae05fa17384ec14962c36
BLAKE2b-256 checksum
How to use checksums
9e759953d6a87b99bc140b7dbd970eddf4f94f3cfc06d8efa1a04026a6480948
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for gocept.lxml 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page