RE: [tidy] looking to use html-tidy for parsing

There is no way you can do this with tidy.exe (that I know of), but if you
are talking code-wise, here's how:
 
static void RecurseImages(TidyNode node) {
   TidyAttr attr;
 
   node=tidyGetChild(node);
 
   while(node) {
      if(tidyNodeIsIMG(node)) {
         attr=tidyAttrGetSRC(node);
         printf("image found on line %d: %s\n", tidyNodeLine(node),
tidyAttrValue(attr));
      }
      else RecurseImages(node);
      
      node=tidyGetNext(node);
   }
}
 
int main(void) {
   TidyDoc tdoc=tidyCreate();
   tidyParseFile(tdoc, "page.html");
 
   RecurseImages(tidyGetBody(tidyDoc));
 
   tidyRelease(tdoc);
 
   return 0;
}






  _____  

http://www.int64.org <http://www.int64.org/>  - When 4GiB of RAM just isn't
enough.
 

  _____  

From: html-tidy-request@w3.org [mailto:html-tidy-request@w3.org] On Behalf
Of Henrique
Sent: Sunday, April 04, 2004 1:22 PM
To: html-tidy@w3.org
Subject: [tidy] looking to use html-tidy for parsing


I'm trying to use html-tidy to parse an html file to print all 'img' tags
and the contents of the 'src' attribute.
Can someone point me in the right direction?
 
 

Received on Sunday, 4 April 2004 20:51:30 UTC