On Wednesday 19 November 2008 00:33:57 José Matos wrote: > Hi, > instead of a long (and boring) roadmap that no one follows I would like > to > suggest small threads that deal with single issues. > > In this case for lyx2lyx I suggest to use lxml: > http://codespeak.net/lxml/ > > I am aware that this is an external library but it can be easily > installed > and it works for all versions of python that we support. > > Code that illustrates the simplicity of the library will follow > tomorrow.
The following code extracts the file format used in the document ug.lyx from lxml.etree import parse tree = parse('ug.lyx') document = tree.getroot() document.attrib['format'] for part in document: print part.tag Results in: 346 header body > Note that among other advantages the conversion between xml will become > faster than what happens now. > > Any problem with this choice? -- José Abílio