ILITParserHost Interface

This is the host to a content parser. Both content files and metadata must be parsed by the Litgen.dll client, and fed to this interface as a stream of Tag, Text, and EndChildren notifications.

ILITParserHost and ILITTag are used together to express a stream of structured content as a nested hierarchy. That is, opening and closing tags must be correctly nested and balanced. For example, the following HTML snippet:

     <b><span class="foo">Test</span></b>

should be presented to Litgen.dll with the following calls (reference counting, interface conversions, and error checking hidden for clarity):

  pParserHost->NewTag(&pTag);
  pTag->SetName(L"b", 1);
  pParserHost->Tag(pTag, TRUE);
  pParserHost->NewTag(&pTag);
  pTag->SetName(L"span", 4);
  pTag->AddAttribute(L"class", 5, L"foo", 3);
  pParserHost->Tag(pTag, TRUE);
  pParserHost->Text(L"Test", 4);
  pParserHost->EndChildren();
  pParserHost->EndChildren();

ILITParserHost is designed to fit smoothly into a tree-walking parser. The most straightforward conversion is obviously from HTML- and XML-like formats. Note, however, that any linear content markup format can be re-expressed in this form.

In addition to the methods inherited from ILITHost, the ILITParserHost interface exposes the following methods.

Method Description
GetId Returns the manifest ID of the item being parsed.
GetFilename Returns the filename of the item being parsed.
GetMimeType Returns the mime type of the item being parsed.
NewTag Creates a new, empty tag.
Tag Accepts notification of a tag in the content stream.
Text Accepts notification of text in the content stream.
EndChildren Accepts notification of the end of a tag’s children.
ExternalStylesheet Accepts notification of an external style sheet that is specified independently from the document structure.
Finish Finalizes the content.

© 2000 Microsoft Corporation. All rights reserved. Terms of use.