LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-09-2009, 08:34 AM   #1
naveenisback
Member
 
Registered: Jun 2009
Posts: 80
Blog Entries: 1

Rep: Reputation: 16
xml string parsing program in c language


Hi techies,


I have one xml string as follows.

<?xml version="1.0"?>
<BatteryInformation>
<PowerMode>On AC</PowerMode>
<ChargeStatus>No system battery</ChargeStatus>
<BatteryLifePercent>NA</BatteryLifePercent>
<BatteryRemainingLifeTime>NA</BatteryRemainingLifeTime>
</BatteryInformation>

I have to parse it and have to get the elements On AC, NO system battery, NA, NA and hav to staore in a buffer. I want a c program to do this. can i use DOM or COM in unix
 
Old 07-10-2009, 12:21 AM   #2
naveenisback
Member
 
Registered: Jun 2009
Posts: 80

Original Poster
Blog Entries: 1

Rep: Reputation: 16
xml string parsing program in c language

Hi frenz,


I hav a xml document in a string like this.
<?xml version='1.0'?>
<PowerSchemes>
<line>Presentation
</line>
<line>MaxPowerSaver
</line>
<line>ipm
</line>
<line>ipmplus
</line>
<line>ipm+
</line>
<line>working
</line>
<line>working</line>
</PowerSchemes>


i hav to pesae this string to get elements like Maxpowersaver, ipm, ipmplus, woprking.. I hav to store these elements in a structure. I want a C program to parse this. i dont need shell script or commands. I kno we can use DOM concept in windows. is there any APIs to parse.
 
Old 07-10-2009, 12:32 AM   #3
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
libxml seems to be pretty much the standard in C.
 
Old 07-10-2009, 01:03 AM   #4
harry edwards
Member
 
Registered: Nov 2007
Location: Lincolnshire, UK
Distribution: CentOS, Fedora, and Suse
Posts: 365

Rep: Reputation: 48
This is a respected xml parsing library for C http://expat.sourceforge.net/
 
Old 07-10-2009, 06:45 AM   #5
naveenisback
Member
 
Registered: Jun 2009
Posts: 80

Original Poster
Blog Entries: 1

Rep: Reputation: 16
xml parsing

HI to all,

i want to write a xmlparser program in c language. I kno we can use DOM in windows. Is there any method like this. or can I use same DOM concept here.


thanx in advance.
 
Old 07-10-2009, 08:15 AM   #6
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
I have merged all of your related threads---since the first 2 both had replies, and the 3rd is closely related.

In the future, please keep everything in one thread and don't post duplicates.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help in parsing XML file madhi Programming 12 07-10-2009 01:36 AM
parsing xml file from a C program golden_boy615 Programming 1 03-14-2009 09:35 AM
Parsing XML file sneha hendre Linux - Newbie 2 09-15-2008 10:55 PM
XML parsing in C irfanhab Programming 3 05-06-2006 12:47 AM
xml parsing with xsl crabboy Programming 2 03-22-2004 01:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration