[yunqa.de] Re: DIHtmlParser and html 5

  • From: Delphi Inspiration <delphi@xxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Wed, 14 Dec 2011 11:01:57 +0100

On 14.12.2011 08:15, Edwin Yip wrote:

> Just realized some of the html files I'm going to handle are html5,
> does dihtmlparser handles new tags introduced in html 5 specs,  such as
> <article>, <section>?

Yes, DIHtmlParser handles all tags, regardless of name, which conform to
the syntax. This also includes the new HTML 5 tags. Applications can
always access the current HTML tag via the TDIHtmlParser.HtmlTag
property and retrieve the tag's name by reading
TDIHtmlParser.HtmlTag.TagName.

Exception: The current version (DIHtmlParser 6.1.1 at the time of this
writing) does not register tag IDs for the new HTML 5 tags when calling
RegisterHtmlTags(). This means that the TDIHtmlParser.HtmlTag.TagID
property is TAG_UNKNOWN_ID for the new HTML 5 tag names.

Workaround: Applications which require that TDIHtmlParser assigns IDs
for the new HTML 5 tag names, can register any tag names with any ID by
calling, for example:

  RegisterTag('TagName1', MAX_TAG_ID + 1);
  RegisterTag('TagName2', MAX_TAG_ID + 2);
  ...

Using MAX_TAG_ID is recommended so default tag IDs registered with
RegisterHtmlTags() will not be overwritten.

Ralf
_______________________________________________
Delphi Inspiration mailing list
yunqa@xxxxxxxxxxxxx
//www.freelists.org/list/yunqa



Other related posts: