Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 7th, 2012  |  syntax: None  |  size: 1.29 KB  |  hits: 5  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. struct ebay_parsed_data ebay_parsed_data_buf;
  2.  
  3. struct ebay_html_element ebay_html_parser_elements[]=
  4. {
  5.         { .tag="span",  .name="id",     .content="v4-24",       .data=&ebay_parsed_data_buf.item_price },
  6.         { .tag="span",  .name="haha",   .content="trouducul" }
  7. };
  8.  
  9.  
  10.  
  11. void ebay_walk_data(xmlNode *node_const)
  12. {
  13.         xmlNode *node_curr=NULL;
  14.         xmlNode *attr_curr=NULL;
  15.         int i=0;
  16.  
  17.         for(node_curr=node_const ; node_curr ; node_curr=node_curr->next)
  18.         {
  19.                 if(node_curr->name == NULL)
  20.                         continue;
  21.  
  22.                 if(node_curr->children == NULL)
  23.                         continue;
  24.  
  25.                 for(attr_curr=node_curr->properties ; attr_curr ; attr_curr=attr_curr->next)
  26.                 {
  27.                         for(i=0 ; i < sizeof(ebay_html_parser_elements) / sizeof(struct ebay_html_element) ; i++)
  28.                         {
  29.  
  30.                                 if(
  31.                                 strcmp((char *) node_curr->name, ebay_html_parser_elements[i].tag) == 0 &&
  32.                                 strcmp((char *) attr_curr->name, ebay_html_parser_elements[i].name) == 0 &&
  33.                                 strcmp((char *) attr_curr->children->content, ebay_html_parser_elements[i].content) == 0 &&
  34.                                 strcmp((char *) attr_curr->children->name, "text" ) == 0
  35.                                 )
  36.                                 {
  37.                                         printf("%d -> %d\n", sizeof(*(ebay_html_parser_elements[i].data)), sizeof(float) );
  38.                                         //*((float *)ebay_html_parser_elements[i].data)=atof(node_curr->children->content);
  39.                                 }
  40.                         }
  41.                 }
  42.  
  43.                 ebay_walk_data(node_curr->children);
  44.         }
  45. }