Help with ElementTree

Larry Martell larry.martell at gmail.com
Thu Apr 9 13:59:08 EDT 2015


I have an XML file that looks like this (this is just the pertinent
part, the file is huge):

<?xml version="1.0"?>
<Root>
  <Doc Type="CCI">
    <Node Name="SystemConfig" Section="yes">
        <Node Name="Environment">
           <Parameter Name="ToolName">
              <Value>
                 <Default>KA21</Default>
                 <Current>KA21</Current>
             </Value>
           </Parameter>
         </Node>
      </Node>

    <Node Name="Events" Section="yes">
       <Parameter Name="LastEventExportTime">
         <Value>
           <Default>00:00:00</Default>
           <Current>15/03/2014 05:56:00</Current>
         </Value>
       </Parameter>
    </Node>
  </Doc>
</Root>

I would like to use ElementTree to get 2 values from this:

SystemConfig.Environment.ToolName.Current
Events.LastEventExportTime.Current

I've been trying for hours to get ElementTree to give me these 2
values, but nothing I do seems to work. Can anyone help me with this?

Thanks!
-larry



More information about the Python-list mailing list