html - How to use libtidy with tidyParseBuffer()? -
I'm trying to clean some HTML with libtidy (C language), the problem is:
I want to create a TidyDoc (a tree-like structure) with TidyParseBuffer ().
I have no problem with tidyParseFile (); About tidyParseBuffer (): I'm sure that I read the file properly and the TidyBuffer structure that I give to tidyParseBuffer () is filled properly.
Any thoughts?
Here is the code:
// declaration tidyInput = malloc (TidyBuffer); TidyOutput = malloc (TidyBuffer); Do {len = fread (pbInputData, 1, nInputData, h-> File); TidyBufAttach (tidyInput, (zero *) pbInputData, len); TDPers Buffer (H-> Dock, TDI Input); // Doctor is tidydoc} while (lane> = nInputData); TidyOptSetBool (h-> Doc, TidyForceOutput, Yes); Clean Savfile (Handler-> Doctor, "C: // Test. XHTML");
I have simplified the code.
The problem arises from the fact that you are trying to break the contents of a file Are calling each segment in buffer and calling tidyParseBuffer ()
for each segment.
The tidyParseXxx ()
function is powered by parsing the whole input in a single call, so you should take a look at what you want to do.
Comments
Post a Comment