Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #88749

Help with ElementTree

Date 2015-04-09 13:59 -0400
Subject Help with ElementTree
From Larry Martell <larry.martell@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.179.1428602356.12925.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Help with ElementTree Larry Martell <larry.martell@gmail.com> - 2015-04-09 13:59 -0400

csiph-web