|
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
|