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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
08-21-2007, 06:09 AM
|
#1
|
|
LQ Newbie
Registered: Aug 2006
Posts: 11
Rep:
|
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
|
|
|
|
08-21-2007, 07:29 AM
|
#2
|
|
Member
Registered: Apr 2007
Distribution: Gentoo
Posts: 337
Rep:
|
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>"
?
|
|
|
|
08-21-2007, 07:30 AM
|
#3
|
|
LQ Newbie
Registered: Aug 2006
Posts: 11
Original Poster
Rep:
|
Quote:
Originally Posted by reverse
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
|
|
|
|
08-21-2007, 07:33 AM
|
#4
|
|
LQ Newbie
Registered: Aug 2006
Posts: 11
Original Poster
Rep:
|
Yes exactly.
Please reply me
Thanks for response
|
|
|
|
08-21-2007, 11:17 AM
|
#5
|
|
Guru
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298
Rep:
|
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.
|
|
|
|
08-21-2007, 12:03 PM
|
#6
|
|
Member
Registered: Apr 2002
Location: Windsor, ON, CA
Distribution: Ubuntu
Posts: 740
Rep:
|
Mods should delete this, I've replied to his other thread already in Programming with, I hope, what he's looking for.
|
|
|
|
08-21-2007, 12:47 PM
|
#7
|
|
Moderator
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,817
Rep: 
|
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
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 02:07 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|