473,749 Members | 2,451 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How extract data from a file xml parsed with pyrxp

1 New Member
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>
  24.  
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
1 1987
bvdet
2,851 Recognized Expert Moderator Specialist
Just so you will know, tags cannot contain spaces. XML tutorial

pyRXP looks interesting.

-BV
Feb 5 '09 #2

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

Similar topics

2
4443
by: ben moretti | last post by:
hi i'm learning python, and one area i'd use it for is data management in scientific computing. in the case i've tried i want to reformat a data file from a normalised list to a matrix with some sorted columns. to do this at the moment i am using perl, which is very easy to do, and i want to see if python is as easy. so, the data i am using is some epiphyte population abundance data for particular sites, and it looks like this:
2
1981
by: SeSe | last post by:
Hi, every one, happy new year! I am working on XML with Python. I wonder if there is any XML Schema<-> Python Object mapping tools so that we can convert one to another. Thanks. -SeSe
2
4411
by: Jim Williams | last post by:
**** Post for FREE via your newsreader at post.usenet.com **** I'm working on a 3d engine system. I need to save/load data in the systems objects to/from XML files. When I say objects, I mean C++ objects. (These generally correspond to scene objects, but that consideration isn't important as far as loading/saving goes.) I think I have a reasonable grasp of XML, it's method of data representation, and parsing XML files.
10
8655
by: Robert Schultz | last post by:
I have a C/C++ file that I simply want to 'extract' a function from. Something like: extract <function name> <c or cpp file> I want it to return from the beginning of the function, to the end. I tried cscope, and that will find the function, but it won't tell me how many lines it is or extract it for me. Any ideas on what I could use?
5
3069
by: Milos Prudek | last post by:
I perform a XML-RPC call by calling xmlrpclibBasicAuth which in turn calls xmlrpclib. This call of course sends a HTTP request with correct HTTP headers. The response is correctly parsed by xmlrpclib, and I get my desired values. However, I also need to get the raw HTTP headers from the HTTP response. There is a cookie in the HTTP response and I need to read that cookie. How could I do that?
8
2840
by: Fabian Braennstroem | last post by:
Hi, I would like to remove certain lines from a log files. I had some sed/awk scripts for this, but now, I want to use python with its re module for this task. Actually, I have two different log files. The first file looks like: ...
0
1342
by: Rama Jayapal | last post by:
I am pretty new to VB, so please forgive the simplistic question. This is using VB .NET 2005 My form has three objects on it: a TextBox named URL, a Button named Extract and a WebBrowser named AxWebBrowser1. The goal is to have the user enter a URL in the TextBox and then hit the Extract button and then to get the links from the web page they entered. So far I have:
0
2049
by: napolpie | last post by:
DISCUSSION IN USER nappie writes: Hello, I'm Peter and I'm new in python codying and I'm using parsying to extract data from one meteo Arpege file. This file is long file and it's composed by word and number arguments like this: GRILLE EURAT5 Coin Nord-Ouest : 46.50/ 0.50 Coin Sud-E Hello, I'm Peter and I'm new in python codying and I'm using parsying to extract data from one meteo Arpege file.
7
2113
by: JoeC | last post by:
I am trying to create a windows program that reads binary graphics as a resource. This has nothing to do with win32 but conversion of data with memcpy. graphic::graphic(UINT uiResID, HINSTANCE hinstance){ size = 32; bitData.clear(); void * p = NULL; // point to the data int end; BYTE data;
0
8997
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9568
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9389
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8257
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6801
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6079
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4709
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4881
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.