LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Closed Thread
 
Search this Thread
Old 08-21-2007, 06:09 AM   #1
gopi_raghu
LQ Newbie
 
Registered: Aug 2006
Posts: 11

Rep: Reputation: 0
XML parser using C language


I am new to parsing XML file using C

I need to parse the XML file and get the values between tags(start and end).I am using expat library(expat.h) and am having C API as fallows

XML_SetElementHandler(parser, startElement, endElement);

static void XMLCALL
startElement(void *userData, const char *name, const char **atts)
{
int i;
int natts;
int *depthPtr = (int *)userData;
const XML_Char **p;

for (i = 0; i < global_depth; i++)
printf(" ");

printf("%s\n", name);
LINE:8 for (i = 0; atts[i]; i += 2)
printf("%s = %s", atts[i], atts[i + 1]);

printf("\n");
// printf("%d\n", global_depth);
global_depth++;

// printf("%s = %s\n", atts[0], atts[1]);
// puts(name);
// *depthPtr += 1;
}

I am trying to print the values between start and end tag but is not printing (LINE no 8 in code).

Any code to get values between start and end tag of XML file ?

Thanks in advance

Last edited by gopi_raghu; 08-21-2007 at 06:10 AM. Reason: spell check
 
Old 08-21-2007, 07:29 AM   #2
reverse
Member
 
Registered: Apr 2007
Distribution: Gentoo
Posts: 337

Rep: Reputation: 30
You should talk to a moderator as to moving your thread to Programming, which is probably better suited for these kind of things.

Do you mean you need to extract "value" from:

Code:
<tag attr>value</tag>"
?
 
Old 08-21-2007, 07:30 AM   #3
gopi_raghu
LQ Newbie
 
Registered: Aug 2006
Posts: 11

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by reverse View Post
You should talk to a moderator as to moving your thread to Programming, which is probably better suited for these kind of things.

Do you mean you need to extract "value" from:

Code:
<tag attr>value</tag>"
?

Exactly

Thanks for response
 
Old 08-21-2007, 07:33 AM   #4
gopi_raghu
LQ Newbie
 
Registered: Aug 2006
Posts: 11

Original Poster
Rep: Reputation: 0
Yes exactly.

Please reply me

Thanks for response
 
Old 08-21-2007, 11:17 AM   #5
reddazz
Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 73
Moved: This thread is more suitable in the Programming Forum and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 08-21-2007, 12:03 PM   #6
95se
Member
 
Registered: Apr 2002
Location: Windsor, ON, CA
Distribution: Ubuntu
Posts: 740

Rep: Reputation: 32
Mods should delete this, I've replied to his other thread already in Programming with, I hope, what he's looking for.
 
Old 08-21-2007, 12:47 PM   #7
crabboy
Moderator
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,823

Rep: Reputation: 120Reputation: 120
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.

http://www.linuxquestions.org/questi...d.php?t=578671
 
  


Closed Thread

Tags
parser, xml


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
checking for XML::Parser... configure: error: XML::Parser perl module is required for kornerr Linux - General 11 11-16-2008 07:24 AM
XML Parser... Prada Linux - Software 2 04-17-2007 11:26 AM
XML Parser bulkman Linux - Software 6 04-29-2005 07:01 AM
xml parser in linux shilpig Programming 1 05-13-2004 11:24 AM
Galeon and XML::Parser virus2099 Slackware 1 01-20-2004 06:11 PM


All times are GMT -5. The time now is 01:12 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration