Portable XML handling tools for Python

There are two popular Python implementations: the traditional "CPython", and "Jython" which compiles to Java class files and can directly call and be called from Java code. This page is created to collect notes about writing XML handling code that is portable between both of these environments.

Contents:

1. Introduction to the issues

Standard Python includes some basic XML handling code that is written in pure Python, and as such is quite portable. Notable here is the "minidom" library, which is a partial implementation of DOM.

More extensive XML handling, including XPath and XSLT handling, is provided by the "PyXml" library using interfaces to XML handling libraries written in C, and as such is not all immediately portable to Jython. PyXml also contains some pure Python libraries that are part of the 4Suite system that implement most (if not all) of the relevant W3C specifications for DOM, XPath, XSLT, and more.

As I write, it is not clear to me how to select the appropriate bits from PyXml that are pure Python. A desired goal of this page is to record those aspects of PyXml that can be used seamlessly with Jython. For the time being, I am focusing on DOM-related features, but in due course others should also be noted.

Programmers using Jython tend to use the relevant Java libraries directly, resulting (I expect) in code that is not portable to CPython.

2. Resources

3. Sample code

(TBA)


-- GrahamKlyne 2005-11-02 12:54:11

Creative Commons License
The content of this wiki is licensed under the Creative Commons Attribution-ShareAlike 2.0 England & Wales Licence.

OSS Watch is funded by the Joint Information Systems Committee (JISC) and is situated within the Research Technologies Service (RTS) of the University of Oxford.