[yunqa.de] Re: DIHtmlParser: Empty Attribute Problem

  • From: Delphi Inspiration <delphi@xxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Fri, 06 Apr 2012 22:15:16 +0200

On 06.04.2012 12:15, Modularity wrote:

> I have the exact same problem, except I'm not using the Writer but
> writing myself the output using the following code:
> case FHtmlParser.HtmlTag.TagID of
>   ...
>   // All other HTML codes
>   else WriteLn(FHtmlParser.HtmlTag.GetCode(qtAlways));
> end;
> And I get the following piece of code for empty attributes for images:
> '<img border="0" alt hspace="1" vspace="1" src="lib/find-replace.png">'
> I hope there is something I can do about it as this generates error with
> the epub ebook validation tools.

At the level of TDIHtmlTag level, there is nothing you can do without
changing the DIHtmlParser source code. This should be possible without
breaking backwards compatibility by adding to the TDIHtmlTag.GetCode()
function an additional EmptyHtmlAttribValues argument which defaults to
False. I will look into this in detail for the next version.

Without changing sources, TDIHtmlWriterPlugin if of course a possible
workaround, as you already mentioned: Write the tag, retrieve the data,
and clear it again before you write the next tag.

Delphi Inspiration mailing list

Other related posts: