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

RecurseImages(tidyGetBody(tidyDoc));

My bad, change the tidyDoc part to tdoc.
You are also missing closing brackets on both of the functions.

You must also link it with tidylib, or compile the tidylib .c files
alongside it.








________________________________

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

-----Original Message-----
From: Henrique _ [mailto:cube_@hotmail.com] 
Sent: Wednesday, April 07, 2004 7:33 AM
To: PhrostByte@socal.rr.com; html-tidy@w3.org
Subject: RE: [tidy] looking to use html-tidy for parsing

thanks a lot but I was trying to compile the .c file and I can't get the
file to compile correctly.I'm doing this on a redhat linux 8 box this is
what I have is this correct?  :
#include <tidy.h>
#include <buffio.h>
#include <stdio.h>

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;



>From: "Cory Nelson" <PhrostByte@socal.rr.com>
>To: "'Henrique'" <cube_@hotmail.com>, <html-tidy@w3.org>
>Subject: RE: [tidy] looking to use html-tidy for parsing
>Date: Sun, 4 Apr 2004 17:51:28 -0700
>
>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?
>
>

_________________________________________________________________
MSN Toolbar provides one-click access to Hotmail from any Web page - FREE
download! http://toolbar.msn.com/go/onm00200413ave/direct/01/

Received on Wednesday, 7 April 2004 12:33:35 UTC