Python XML API's that preserve XML comments?

D

Dan Stromberg

Are there any python XML parsing API's that preserve comments -
preferrably that come with python 2.5.1?
 
B

Ben Finney

Dan Stromberg said:
Are there any python XML parsing API's that preserve comments

(I think you mean "python XML parsing libraries"; it's the library,
not the API, that preserves comments or not.)

I don't have an answer, but this may help to get more information.
The XML 1.0 specification allows for, but does not require, retention
of comments for access by the application:

2.5 Comments

[Definition: .... an XML processor MAY, but need not, make it
possible for an application to retrieve the text of comments. ...]

<URL:http://www.w3.org/TR/REC-xml/#sec-comments>
 
S

Stefan Behnel

Dan said:
Are there any python XML parsing API's that preserve comments -

Try lxml.

http://codespeak.net/lxml

preferrably that come with python 2.5.1?

It doesn't come with Python 2.5.1, but it's compatible to ElementTree, which
is part of the stdlib. So you can have a fallback to the stdlib if lxml is not
installed (though this will loose comments then).

Stefan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top