473,396 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

parse xml file:

51
Hello everybody,

i'd like to parse xml file which include records of the following type:
each record has varied number of fields with either numerical or string value.
it may also include other sub_records from lower hierarchy.

the example below refers to a single node. it specifies all it's sub nodes.
a sub_node can also be leaf if it doesn't have any sub_nodes of itself.

Expand|Select|Wrap|Line Numbers
  1. <node name="coalse" size="0x4.0" >
  2.   <field parameter="cause_d"  size=".0"  size2=".1" size3=".132" descr="" />
  3.   <field read="cause"  offset=".1"  size=".1" descr="" />  
  4.   <field dump="cause"  offset=".2"  size=".1" descr="" />    
  5.   <field line="cnt_coalse_cause"  offset=".3"  size=".1" descr="" />      
  6.   <field name="t0_cause1"  offset=".4"  size=".1" descr="" />      
  7.   <field name="t0_cause2"  offset=".5"  size=".1" descr="" />      
  8.   <field name="t1_cause1"  offset=".6"  size=".1" descr="" />      
  9.   <field name="t1_cause2"  offset=".7"  size=".1" descr="" />      
  10.   <field name="t2_cause1"  offset=".8"  size=".1" descr="" />      
  11.   <field name="t2_cause2"  offset=".9"  size=".1" descr="" />      
  12.   <field name="t3_cause1"  offset=".10"  size=".1" descr="" />      
  13.   <field name="t3_cause2"  offset=".11"  size=".1" descr="" />      
  14.   <field name="t4_cause1"  offset=".12"  size=".1" descr="" />      
  15.   <field name="t4_cause2"  offset=".13"  size=".1" descr="" />      
  16.   <field name="t5_cause1"  offset=".14"  size=".1" descr="" />      
  17.   <field name="t5_cause2"  offset=".15"  size=".1" descr="" />                          
  18. </node>
  19.  

thanks for the help,
Jan 28 '08 #1
2 1659
KevinADC
4,059 Expert 2GB
What have you tried and where are you stuck? All you did was post a vague description of what you want to do: "parse xml file". You can use an xml parser which is probably your best approach. Search CPAN for XML modules.
Jan 28 '08 #2
zcabeli
51
what i wanted is to get direction about which xml package should i use.
my xml file is not simple xml (as it can be shown in the demonstration of my first comment), because some fields are define within node brackets.
< field name = "sdfs" size = ".1" value="0" offset= "0x232" line = "21" />
and some other records are defined in the following format:
<node name = "dfaws" .. >
...
...
...
</node>

thanks,
Jan 29 '08 #3

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

Similar topics

1
by: chuck amadi | last post by:
By the way list is there a better way than using the readlines() to > > >parse the mail data into a file , because Im using > > >email.message_from_file it returns > > >all the data i.e reads one...
22
by: Ram Laxman | last post by:
Hi all, I have a text file which have data in CSV format. "empno","phonenumber","wardnumber" 12345,2234353,1000202 12326,2243653,1000098 Iam a beginner of C/C++ programming. I don't know how to...
3
by: slylos | last post by:
I've got a section of code in my app that keeps track of how much time an employee has accrued, which equals out to 1.33 days of PTO per month. I'm trying to store the time accrued so far in an...
6
by: trevor | last post by:
Incorrect values when using float.Parse(string) I have discovered a problem with float.Parse(string) not getting values exactly correct in some circumstances(CSV file source) but in very similar...
5
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C++ programming. FYI Although I have called...
1
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C programming. FYI Although I have called this...
11
by: Peter Pei | last post by:
One bad design about elementtree is that it has different ways parsing a string and a file, even worse they return different objects: 1) When you parse a file, you can simply call parse, which...
2
by: Lawrence Krubner | last post by:
Imagine a template system that works by getting a file, as a string, and then putting it through eval(), something like this: $formAsString = $controller->command("readFileAndReturnString",...
6
by: =?Utf-8?B?RGF2aWRN?= | last post by:
Hello, I have an XML file generated from a third party application that I would like to parse. Ideally, I plan on having a windows service setup to scan various folders for XML files and parse the...
5
by: goldtech | last post by:
SAX XML Parse Python error message Hi, My first attempt at SAX, but have an error message I need help with. I cite the error message, code, and xml below. Be grateful if anyone can tell me...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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...

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.