[FRPythoneers] looking for help with elementtree

Sean Gillies sgillies at frii.com
Fri Jun 27 14:51:02 MDT 2003


Hi,

Just subscribed today and am looking forward to contributing to
the discussions.  First, I have a question.

I am having fun using ElementTree in a project but have
run into a problem.  Maybe one of you has run across and
solved it?

After reading in an element tree from XML, I get
an element from the tree like this:

    properties = tree.find('PROPERTIES')

If I wrap properties in an ElementTree and write, the XML
output is:

<PROPERTIES><ENVELOPE minx="-106" maxx="-105" miny="40" maxy="41"/>
...</PROPERTIES>

If I execute code like this:

     for child in properties:
         print child.tag

Then it does print out

     ...
     ENVELOPE
     ...

evidently there is an ENVELOPE element?

however, I am not able to find the ENVELOPE element under
PROPERTIES:

     properties.find('ENVELOPE')

returns None.

How can find() return None when I am finding an element tagged 
'ENVELOPE'
when iterating over properties?

cheers,
Sean


--
Sean Gillies
sgillies at frii dot com
http://www.frii.com/~sgillies




More information about the FRPythoneers mailing list