I am trying to clear HTML code using libtidy (C language), the problem is that:
I want to build a TidyDoc (tree structure) with tidyParseBuffer ().
I have no problem with tidyParseFile (); about tidyParseBuffer (): I am sure that I read the file correctly and that the TidyBuffer structure that I provide tidyParseBuffer () is correctly filled.
Any ideas?
here is the code:
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);
} while (len >= nInputData);
tidyOptSetBool(h->doc, TidyForceOutput, yes);
tidySaveFile(handler->doc, "C://test.xhtml");
I have simplified the code.
source
share