472,958 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

Which XML?

I've found a lot of XML libraries for Python. Any advices on which
one to use (or *not* to use)? My requirements are: support for XPath,
stability (a must, segfaults are not an option), with DOM API and good
performance desirable.

Thanks for any advice.

--
Bruno Barberi Gnecco <brunobg_at_users.sourceforge.net>
Jun 24 '07 #1
5 1147
On Jun 24, 7:04 pm, Bruno Barberi Gnecco
<brunobgDELETET...@users.sourceforge.netwrote:
I've found a lot of XML libraries for Python. Any advices on which
one to use (or *not* to use)? My requirements are: support for XPath,
stability (a must, segfaults are not an option), with DOM API and good
performance desirable.

Thanks for any advice.

--
Bruno Barberi Gnecco <brunobg_at_users.sourceforge.net>
I use the minidom module for most of my XML work, but I don't think it
has much in the way of XPath. I think lxml might work better for that
sort of thing and I think it's part of ElementTree:

http://codespeak.net/lxml/dev/objectify.html

This guy kind of reviews the major XML modules:

http://www.oreillynet.com/onlamp/blo..._xml_pyth.html

Mike

Jun 25 '07 #2
ky******@gmail.com wrote:
On Jun 24, 7:04 pm, Bruno Barberi Gnecco
<brunobgDELETET...@users.sourceforge.netwrote:
> I've found a lot of XML libraries for Python. Any advices on which
one to use (or *not* to use)? My requirements are: support for XPath,
stability (a must, segfaults are not an option), with DOM API and good
performance desirable.

I use the minidom module for most of my XML work, but I don't think it
has much in the way of XPath. I think lxml might work better for that
sort of thing and I think it's part of ElementTree:

http://codespeak.net/lxml/dev/objectify.html
lxml is not part of ElementTree (only mostly compatible), but it's a must if
you want to have a simple API *and* XPath *and* good performance.

http://codespeak.net/lxml/

The API is not W3C-DOM compatible, but that's rather a plus IMHO.

Stefan
Jun 25 '07 #3
On 25 Jun, 02:04, Bruno Barberi Gnecco
<brunobgDELETET...@users.sourceforge.netwrote:
I've found a lot of XML libraries for Python. Any advices on which
one to use (or *not* to use)? My requirements are: support for XPath,
stability (a must, segfaults are not an option), with DOM API and good
performance desirable.
You might be interested in libxml2dom:

http://www.python.org/pypi/libxml2dom

It uses libxml2 under the covers, meaning that it has good performance
and supports XPath, but I can't always guarantee stability: libxml2
can get quite upset in some situations, but I've worked fairly hard to
avoid triggering them. The module API is similar to PyXML/minidom and
I've found some time to add minimal support for DOM events and SVG,
although there's a long way to go in both of these areas. This is a
project with just me as the developer, although there are a number of
helpful users who have kindly provided bug reports and suggestions for
improvements over the years.

Paul

Jun 25 '07 #4
On Jun 25, 3:47 am, Stefan Behnel <stefan.behnel-n05...@web.dewrote:
kyoso...@gmail.com wrote:
On Jun 24, 7:04 pm, Bruno Barberi Gnecco
<brunobgDELETET...@users.sourceforge.netwrote:
I've found a lot of XML libraries for Python. Any advices on which
one to use (or *not* to use)? My requirements are: support for XPath,
stability (a must, segfaults are not an option), with DOM API and good
performance desirable.
I use the minidom module for most of my XML work, but I don't think it
has much in the way of XPath. I think lxml might work better for that
sort of thing and I think it's part of ElementTree:
http://codespeak.net/lxml/dev/objectify.html

lxml is not part of ElementTree (only mostly compatible), but it's a must if
you want to have a simple API *and* XPath *and* good performance.

http://codespeak.net/lxml/

The API is not W3C-DOM compatible, but that's rather a plus IMHO.

Stefan
Oops, sorry about the mis-information. I mis-read http://effbot.org/zone/element-index.htm

Mike

Jun 25 '07 #5
Paul Boddie wrote:
On 25 Jun, 02:04, Bruno Barberi Gnecco
<brunobgDELETET...@users.sourceforge.netwrote:
> I've found a lot of XML libraries for Python. Any advices on which
one to use (or *not* to use)? My requirements are: support for XPath,
stability (a must, segfaults are not an option), with DOM API and good
performance desirable.

You might be interested in libxml2dom:

http://www.python.org/pypi/libxml2dom

It uses libxml2 under the covers, meaning that it has good performance
and supports XPath, but I can't always guarantee stability: libxml2
can get quite upset in some situations, but I've worked fairly hard to
avoid triggering them.
True, that's actually pretty hard work. lxml also does loads of stuff under
the hood to keep libxml2 happy. But that's what a good Python wrapper is for:
keep the people who use it from worrying about segfaults and memory management
and let them concentrate on their own problems.

It's more important to make the users happy than the libs. :)

Stefan
Jun 25 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Raymond H. | last post by:
Hello, I create a vb4 project which can also naviger on Internet via the WebBrowser control which I put on my form. My question is: if this program is installed on a station having already...
17
by: John Bentley | last post by:
John Bentley: INTRO The phrase "decimal number" within a programming context is ambiguous. It could refer to the decimal datatype or the related but separate concept of a generic decimal number....
3
by: Edward | last post by:
ASP.NET / VB.NET SQL Server 7.0 Our client has insisted that we change our established practice of building SQL in-line and move it all to SPROCs. Not a problem for 80% of the app. However,...
133
by: Jane Withnolastname | last post by:
I have a web page that uses an unordered list (<UL>) and the LH (list header) tag. I know LH is a valid tag because it is clearly defined by the W3C here:...
29
by: guru.slt | last post by:
"the c++ standard library, tutorial and reference" book, it says: ++i is faster than i++. the latter involves a temporary object because it must return the old value/object of i. for this reason,...
17
by: lawrence | last post by:
How is it possible that the question "How do I detect which browser the user has" is missing from this FAQ: http://www.faqts.com/knowledge_base/index.phtml/fid/125 and is only here on this...
65
by: Skybuck Flying | last post by:
Hi, I needed a method to determine if a point was on a line segment in 2D. So I googled for some help and so far I have evaluated two methods. The first method was only a formula, the second...
17
by: clintonG | last post by:
I'm using an .aspx tool I found at but as nice as the interface is I think I need to consider using others. Some can generate C# I understand. Your preferences please... <%= Clinton Gallagher ...
4
by: mflll | last post by:
I am looking into the different techniques of handling arrays of edit boxes in Java Script. The first program below works fine. However, are there better ways of doing this, where the person...
2
by: rn5a | last post by:
A Form has a select list which is populated from a MS-Access database table. The DB table from where the select list is populated has 2 columns - CountryID & CountryName. When the Form is posted,...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.