I am trying to extract some data from a large XML output, could someone help me extract the TotalMilliseconds for just the 99 percentile.
I am trying to do this in Python using the ElementTree parser.
I am currently trying to do something like this which finds the 99th percentile and then tries to find the TotalMilliseconds from the root of that level.
But this returns nothing, in debug I can see it gets into the 99 clause but I am bit lost on where I go from there.
for item in root.findall('./TimeSpan/Latency/Bucket/Percentile'):
if item.text == "99":
totalMs = item.find('TotalMilliseconds').text
print(totalMs)
<TimeSpan>
<Latency>
<Bucket>
<Percentile>96</Percentile>
<ReadMilliseconds>55.378</ReadMilliseconds>
<WriteMilliseconds>105.115</WriteMilliseconds>
<TotalMilliseconds>98.546</TotalMilliseconds>
</Bucket>
<Bucket>
<Percentile>97</Percentile>
<ReadMilliseconds>59.552</ReadMilliseconds>
<WriteMilliseconds>109.733</WriteMilliseconds>
<TotalMilliseconds>104.649</TotalMilliseconds>
</Bucket>
<Bucket>
<Percentile>98</Percentile>
<ReadMilliseconds>64.891</ReadMilliseconds>
<WriteMilliseconds>116.998</WriteMilliseconds>
<TotalMilliseconds>111.300</TotalMilliseconds>
</Bucket>
<Bucket>
<Percentile>99</Percentile>
<ReadMilliseconds>81.629</ReadMilliseconds>
<WriteMilliseconds>131.931</WriteMilliseconds>
<TotalMilliseconds>125.176</TotalMilliseconds>
</Bucket>
</Latency>
</TimeSpan>