Yunqa • The Delphi Inspiration

Delphi Components and Applications

User Tools

Site Tools


wiki:htmlparser:index

DIHtmlParser: Wiki

DIHtmlParser is a component suite to parse, analyze, extract information from, and generate HTML, XHTML, and XML documents for Delphi (Embarcadero, CodeGear, Borland).

Please register and / or log in to edit. Anonymous Wiki edits are disabled to protect against vandalism.

DIHtmlMimeMesage

DIHtmlMimeMessage is an add-on to DIHtmlParser to create MIME messages from existing HTML documents and automatically add required attachment files. It is excellent to send existing HTML documents as e-mails. Example projects demonstrate this with Indy, ICS, Synapse, and other Freeware Delphi Internet components.

DIHtmlMimeMessage was last updated on 2009-08-10 to fix a few minor issues related to Delphi 2009. There are no known problems at the time of this writing.

C++ Builder 6 Solutions

Which folders to use?

Include the Delphi 6 folders into your C++ Builder 6 search path:

  • \DIHtmlParser_Install\D6\
  • \DIHtmlParser_Install\Source\

IDE Installation

Open the \DIHtmlParser_Install\Source\DIHtmlParser_C6.bpk package. C++ Builder will pop up an error message that it “Cannot find resource file DIHtmlParser_C6.res. Recreated.” The file is excluded from DIHtmlParser because it is not important for the library. However, it is normal for C++ Builder to recreate missing package resource files, so just press OK. This will cause package window to show up. Continue to press compile and, finally, install. C++ Builder will notify you that the package has been installed and the new components have been registered.

Compilation Problems

C++ Builder 6 compiles DIHtmlParser applications without errors if if has access to the full DIHtmlParser Source Code. The DIHtmlParser Commercial and Demo editions must instead use the *.hpp files which were auto-generated by Delphi 6. Unfortunately, Delphi adds a few errors to the conversion. Fortunately, they can be easily corrected.

When you compile your project, you will likely encounter one or more of these errors:

Auto-generated code:

#include "DIHtmlParser.h"
#include "DIUnicode.h"

Corrected code:

#include "DIHtmlParser.hpp"
#include "DIUnicode.hpp"

“E2241: VCL style classes need virtual destructors” on these lines, at different places:

__fastcall ~TDIWriter(const unsigned Dummy = (unsigned)(0x0));
 
/* TDIWriter.DestroyNoFlushBuffer */ inline __fastcall ~TDIBinaryWriter(
   const unsigned Dummy = (unsigned)(0x0)) { }

Correct this by removing the tilde signs (~) in both lines:

__fastcall TDIWriter(const unsigned Dummy = (unsigned)(0x0));
 
/* TDIWriter.DestroyNoFlushBuffer */ inline __fastcall TDIBinaryWriter(
   const unsigned Dummy = (unsigned)(0x0)) { }

After fixing the above, some versions of C++ Builder (like XE3) issue the following error in DIHtmlParser.hpp:

[bcc32 Error] DIHtmlParser.hpp: E2238 Multiple declaration for '_fastcall TDIHtmlParser::TDIHtmlParser(TComponent *)'

The two offending lines are:

public:
__fastcall virtual TDIHtmlParser(System::Classes::TComponent* AOwner);
__fastcall virtual TDIHtmlParser(System::Classes::TComponent* const AOwner)/* overload */;

Fix: Comment out the first line like this:

public:
/* __fastcall virtual TDIHtmlParser(System::Classes::TComponent* AOwner); */
__fastcall virtual TDIHtmlParser(System::Classes::TComponent* const AOwner)/* overload */;

The auto-conversion has dropped the const keyword from some property declarations:

__property unsigned LastChildNumber[void * PItem] =
  {read=GetLastChildNumber, write=SetLastChildNumber};
__property unsigned FirstChildNumber[void * PItem] =
  {read=GetFirstChildNumber, write=SetFirstChildNumber};

Fix this by inserting the missing const like here:

__property unsigned LastChildNumber[const void * PItem] =
  {read=GetLastChildNumber, write=SetLastChildNumber};
__property unsigned FirstChildNumber[const void * PItem] =
  {read=GetFirstChildNumber, write=SetFirstChildNumber};

E2209 Unable to open include file

Include files for the precompiled Pascal units are located in the \DIHtmlParser_Install\D6\ directory. Set up your search path accordingly.

For the Pascal source code units in \DIHtmlParser_Install\Source\, C++ Builder automatically creates missing include files when it compiles *.pas units. You can force this if you

  • Compile the DIHtmlParser package as described above.
  • Add the corresponding *.pas file to your project. Then open the Project Manager and move it above the file using it. You can use drag & drop to reorder.
wiki/htmlparser/index.txt · Last modified: 2020/08/28 12:51 by 127.0.0.1