I'm trying to clean some HTML with libtidy (C language), the problem is:
I want to construct a TidyDoc (a tree-like structure) with tidyParseBuffer().
I have no problem with tidyParseFile(); about tidyParseBuffer(): I'm sure I read the file properly and that the TidyBuffer structure I give to tidyParseBuffer() is correctly filled.
Any ideas?
here is the code:
//declaration
tidyInput = malloc(sizeof(TidyBuffer));
tidyOutput = malloc(sizeof(TidyBuffer));
do {
len = fread(pbInputData, 1, nInputData, h->file);
tidyBufAttach(tidyInput, (void*)pbInputData, len);
tidyParseBuffer(h->doc, tidyInput); // doc is the TidyDoc
} while (len >= nInputData);
tidyOptSetBool(h->doc, TidyForceOutput, yes);
tidySaveFile(handler->doc, "C://test.xhtml");
I did simplify the code.