[XML-SIG] XML Parsing Newbie
stefan_ml at behnel.de
Wed Nov 26 10:23:54 CET 2008
Mark Tolonen wrote:
> "Rbrennan" wrote
>> I am trying to parse:
>> <?xml version="1.0" encoding="UTF-8"?>
>> I want to grab the value of threads which is 100, runs which is 1,
>> duration which is 200, process which is 400, and rampup which is 500.
> you will probably find ElementTree a much more useful xml library:
> from xml.etree import ElementTree
> tree =
> print tree.find('config/threads').text
There's also lxml.objectify, which seems well adapted to your data.
>>> from lxml import objectify
>>> server = objectify.parse('thefile.xml').getroot()
Note how it shows 100, not '100'.
More information about the XML-SIG