Using the Tidy HTML Project in Visual C ++ 2010 Windows Forms

I am using VC ++ 2010 Express and I am trying to enable HTML Tidy to do the cleaning of HTML lines of code. I want to make the HTML process as a string (NOT from a file) and save the processed cleared HTML to a string (NOT to the file). The project is a Windows C ++ forms project, the compiler is / CLR.

I tried, once more than I admit, to attach Tidy to my project in many ways. I failed in every attempt, and I'm just not sure where to go from here. The most promising was the TidyManaged .NET shell, but I could not find any documentation to explain how to use it with C ++ (it seems to be intended for C #). Various C ++ wrappers don't work for me at all. The documentation seems to be sorely lacking in how to get them to work.

I’m also ready to make a decision that doesn’t use order at all, but another HTML equivalent cleaning tool. I am worried about the age of Tydi (August 2000) and how effective it is as of today with the newer XHTML standards.

In addition, if possible, I am ready to include the C library in my code directly, without relying on the DLL, but I do not know how to do this or even if it can work.

Any suggestions on how to do this would be greatly appreciated given that this is the HTML we are talking about here (often looking for HTML and XHTML) and NOT XML.

Thanks in advance!

PS - I'm new to C ++: /

+4
source share
1 answer

Almost 48 hours have passed with this problem. Solution found! Here it is...

Using a very simple .NET shell from here http://www.codeproject.com/KB/cs/ZetaHtmlTidy.aspx converted the VC project to VC ++ 2010 ok and compiled as a DLL in order. Below is the code I used to call it:

System::String^ TidyMyHTML(String^ MyHTMLString) { using namespace ZetaHtmlTidy; HtmlTidy tidy; String^ s = tidy.CleanHtml( MyHTMLString, HtmlTidyOptions::ConvertToXhtml ); return s; } 

Hope this post spares someone else from going through the same thing.

EDIT:

With this step, I was able to convert the VC ++ 2008 project files from a neat source attached to the wrapper and update them to VC ++ 2010 project files. Then I was able to compile the neat project (separately from its shell class project) into the libtidy static libraries .lib (for both release and debugging). Then I was able to include my wrapper class in my application and point to include and lib files. The end result was exactly what I wanted, a solution that includes order in my application without requiring a dll dependency. All of this experience has accelerated my learning curve for attaching C libraries to my C ++ applications.

Thanks for the suggestions, and I hope someone finds this post helpful.

+3
source

All Articles