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

  • From: Modularity <modularity@xxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Fri, 6 Apr 2012 12:15:58 +0200

Hi,

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.

Thanks,

John.



Le 30 juillet 2009 17:37, Mike Dixon <mike@xxxxxxxxxxx> a écrit :

> Thanks, that worked.
>
> > -----Original Message-----
> > From: yunqa-bounce@xxxxxxxxxxxxx
> > [mailto:yunqa-bounce@xxxxxxxxxxxxx] On Behalf Of Delphi Inspiration
> > Sent: Thursday, July 30, 2009 7:40 AM
> > To: yunqa@xxxxxxxxxxxxx; yunqa@xxxxxxxxxxxxx
> > Subject: [yunqa.de] Re: DIHtmlParser: Empty Attribute Problem
> >
> > At 14:53 30.07.2009, Mike Dixon wrote:
> >
> > >I'm using DIHtmlParser and the CharCase and Writer plugin to simply
> > >convert an html page to lowercase before saving the file.
> > >
> > >My Problem is that when I have the following code:
> > >
> > ><img src="foo.gif" alt="" />
> > >
> > >It is converted to:
> > >
> > ><img src="foo.gif" alt/>
> > >
> > >Notice the ="" is missing from the output.
> > >
> > >I've tried setting DIHParser.TrimAttribValues := False; but that did
> > >not help.
> > >
> > >What am I missing?
> >
> > Set the following properties of your TDIHtmlWriterPlugin instances:
> >
> >   TDIHtmlWriterPlugin.EmptyHtmlAttribValues := True;
> >   TDIHtmlWriterPlugin.QuoteHtmlTags := qvAlways;
> >
> > Btw: The automatic "conversion" was choosen because IMO an
> > empty attribute value is equal to no attribute value in terms
> > of HTML. Accordingly, the following two tags represent identical HTML:
> >
> >   <img src=test.png alt="" />
> >   <img src=test.png alt />
> >
> > I could not find the relevant section of the specification
> > right now, but I checked that Firefox renders them exactly
> > the same with explicitly "blank" alternative text. In this,
> > they are different from
> >
> >   <img src=test.png />
> >
> > which is rendered with explicitly "missing" alternative text.
> >
> > Ralf
> >
> > _______________________________________________
> > Delphi Inspiration mailing list
> > yunqa@xxxxxxxxxxxxx
> > //www.freelists.org/list/yunqa
> >
> >
> >
>
> _______________________________________________
> Delphi Inspiration mailing list
> yunqa@xxxxxxxxxxxxx
> //www.freelists.org/list/yunqa
>
>
>
>
>
>

Other related posts: