This XML is to parsed through the Libxml in C.
="1.0"="utf-8"
<ArrayOfPDSCustomerinfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
<PDSCustomerinfo>
<Resp>000</Resp>
</PDSCustomerinfo>
<PDSCustomerinfo>
<CommodityId>1</CommodityId>
<CommodityName>SUGAR</CommodityName>
<CommodityDetails>Normal,1100,2000,28-01-2013,27-02-2013,Special,200,1000,28-01-2013,28-01-2013</CommodityDetails>
</PDSCustomerinfo>
<PDSCustomerinfo>
<CommodityId>2</CommodityId>
<CommodityName>WHEAT</CommodityName>
<CommodityDetails>Normal,200,1000,28-01-2013,27-02-2013</CommodityDetails>
</PDSCustomerinfo>
<PDSCustomerinfo>
<CommodityId>3</CommodityId>
<CommodityName>PULSES</CommodityName>
<CommodityDetails>Normal,300,1000,28-01-2013,27-02-2013</CommodityDetails>
</PDSCustomerinfo>
<PDSCustomerinfo>
<CommodityId>4</CommodityId>
<CommodityName>RICE</CommodityName>
<CommodityDetails>Normal,400,1000,28-01-2013,27-02-2013</CommodityDetails>
</PDSCustomerinfo>
</ArrayOfPDSCustomerinfo>
This is the function by which I am trying to parse this XML.
Function:
static void custXmlParse(xmlNode * a_node)
{
xmlNode *cur_node = NULL;
xmlChar *value = NULL;
for (cur_node = a_node; cur_node; cur_node = cur_node->next)
{
if (cur_node->type == XML_ELEMENT_NODE)
{
if(strcmp(cur_node->name,"Resp")==0)
{
value = xmlNodeGetContent(cur_node);
printf("%s\n", value);
}
}
agentXmlParse(cur_node->children);
}
}
here in the output the node 'CommodityDetails' value is missing. I had google a lot for the solution but I am not founding teh solution. Please help me to sort out this mess. Thanks in advance.