Updated D Benchmarks
bearophile
bearophileHUGS at lycos.com
Sun Mar 15 14:01:33 PDT 2009
naryl:
> I think this will suffice:
> $ sed 's/<[^>]*>//g; /^$/d' < data | sed 'N; N; N; N; N; N; s/\n/ /g'
A Python version a little more resilient to changes in that file:
from xml.dom.minidom import parse
results1 = parse("results.xml").getElementsByTagName("results")
results = results1[0].getElementsByTagName("result")
# print field names (assuming a tidy XML file)
for node in results[0].childNodes:
if node.nodeType != node.TEXT_NODE:
print node.localName,
print
# print data
for result in results:
for node in result.childNodes:
if node.nodeType != node.TEXT_NODE:
print node.firstChild.data,
print
Bye,
bearophile
More information about the Digitalmars-d
mailing list