TXMLDocumentDOMVendor (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

The following example uses the DOMVendor property.

Code

procedure Test_DOMVendor;
const
  HTAB = #9;
var
  LDocument: TXMLDocument;
  LVendor: TDOMVendor;
  I: Integer;
begin
  LDocument := TXMLDocument.Create(nil);

  { Get document vendor. }
  LVendor := LDocument.DOMVendor;
  if LVendor <> nil then
    Writeln('Document DOM vendor is ''' + LVendor.Description + '''.')
  else
    Writeln('Document has no DOM vendor.');

  { Display registered DOM vendors with this application. }
  Writeln('Number of registered DOM vendors with this application is ' +
    IntToStr(DOMVendors.Count) + '.');
  for I := 0 to DOMVendors.Count - 1 do
  begin
    LVendor := DOMVendors.Vendors[I];
    Writeln(HTAB + LVendor.Description);
  end;

  { Find a specific registered DOM vendor. }
  LVendor := DOMVendors.Find('MSXML');
  if LVendor <> nil then
  begin
    { Set document DOM vendor. }
    LDocument.DOMVendor := LVendor;
    Writeln('Document DOM vendor is ''' +
      LDocument.DOMVendor.Description + '''.');
  end
  else
    Writeln('Could not find DOM vendor.');

  LDocument.Free;
end;

Uses