By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,932 Members | 1,944 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,932 IT Pros & Developers. It's quick & easy.

How extract data from a file xml parsed with pyrxp

P: 1
Hello to everyone!!

I'm a newbie to Python and I have this problem:

I have an xml document like this
Expand|Select|Wrap|Line Numbers
  1. <root>
  2.  <one>
  3.  <two>
  4.    <third>
  5.        some text
  6.    </third>
  7.    <four>
  8.       some text
  9.     <five>
  10.         <six>
  11.          some text
  12.         </six>
  13.         <another six>
  14.          some test
  15.         </another six>
  16.     </five>
  17.    </four>
  18.  </two>
  19.   <eight>
  20.       some text
  21.   </eight>
  22. </one>
  23. </root>
I parsed it using pyrxp. Pyrxp return a tree of tuple. I want to insert the tag and the data in a dictionary where the keys are the tag and the value are the data or a list of dictionary (with key = tag and value = data) if tag have children.

Sorry for my english and for the bad explanation of the problem.

I'm interesting to know how I can extract the tag and the data from the parsed file.

Thank you very much.
Feb 4 '09 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 2.5K+
P: 2,851
Just so you will know, tags cannot contain spaces. XML tutorial

pyRXP looks interesting.

Feb 5 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.