
Untitled
By: a guest on
Aug 7th, 2012 | syntax:
None | size: 1.29 KB | hits: 5 | expires: Never
struct ebay_parsed_data ebay_parsed_data_buf;
struct ebay_html_element ebay_html_parser_elements[]=
{
{ .tag="span", .name="id", .content="v4-24", .data=&ebay_parsed_data_buf.item_price },
{ .tag="span", .name="haha", .content="trouducul" }
};
void ebay_walk_data(xmlNode *node_const)
{
xmlNode *node_curr=NULL;
xmlNode *attr_curr=NULL;
int i=0;
for(node_curr=node_const ; node_curr ; node_curr=node_curr->next)
{
if(node_curr->name == NULL)
continue;
if(node_curr->children == NULL)
continue;
for(attr_curr=node_curr->properties ; attr_curr ; attr_curr=attr_curr->next)
{
for(i=0 ; i < sizeof(ebay_html_parser_elements) / sizeof(struct ebay_html_element) ; i++)
{
if(
strcmp((char *) node_curr->name, ebay_html_parser_elements[i].tag) == 0 &&
strcmp((char *) attr_curr->name, ebay_html_parser_elements[i].name) == 0 &&
strcmp((char *) attr_curr->children->content, ebay_html_parser_elements[i].content) == 0 &&
strcmp((char *) attr_curr->children->name, "text" ) == 0
)
{
printf("%d -> %d\n", sizeof(*(ebay_html_parser_elements[i].data)), sizeof(float) );
//*((float *)ebay_html_parser_elements[i].data)=atof(node_curr->children->content);
}
}
}
ebay_walk_data(node_curr->children);
}
}