Re: [xml] Get the atribute name



Jonas schrieb:
I'm using Python, and I've coded:

------------------------
from lxml import etree

parser = etree.XMLParser(ns_clean=True)
tree = etree.parse("file.xml", parser)

locale = tree.find('localeDisplayNames')
for i in locale.iterdescendants():
   print i.tag, i.text

Hi Jonas, your reply was off-list. (The list doesn't set the Reply-To
header as it should, losing some traffic like that.)

I don't know this Python interface. What I've learnt from googling is
that there is Daniel's unpythonesque interface, documentation for which
can be obtained at [1], and a more pythonesque interface called lxml,
which is what you're using [2].

[1] http://mikekneller.com/kb/python/libxml2python/part1
[2] http://codespeak.net/lxml/tutorial.html

These links should help you solve the problem.

Cheers,

Michael Ludwig



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]