Hi Folks,
 
 
I am trying to parse XML documents using elementtree.
I have just started with it. Can somebody help me with how to select nodes with a particular atribute set to some value. For example, I have the following file. Now I want to access the founder element of the company whose attribute is set to 'ndtv'. Can somebody help me with this?
 
sample.xml
 

<info>
<company name = 'google'>
 <founder> <one> larry page </one>
 <two> sergey brin</two>
 </founder>
 <focus> search engine </focus>
 
</company>

<company name = 'ndtv'>
<founder> <one>Pranoy Roy </one>
 <two> Radhika Roy</two>
</founder>
<focus> news </focus>
</company>

<company  name = "wipro">
<founder> Azeem Premje </founder>
<focus> IT services </focus>
</company>
</info>


--
To HIM you shall return.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to