2

The following code outputs "EOleException: error during the validation". It is this error: 0xC00CE225 XMLOM_VALIDATE_INVALID Validate failed.

If I add the error handler the exact error message is "XML is neither valid nor invalid as no schema was found".

Does MSXML 6 SAX parser support embedding a DTD?

program TestSAXValidation;

{$APPTYPE CONSOLE}

{$R *.res}

uses
    ActiveX, System.SysUtils, Winapi.msxml;

var
    R: IVBSAXXMLReader;
begin
    CoInitialize(nil);

  try
    R := CoSAXXMLReader60.Create;
    R.putFeature('use-inline-schema', True);
    R.putFeature('schema-validation', True);
    R.putFeature('exhaustive-errors', True);
    R.putFeature('prohibit-dtd', False);
    R.parse('<!DOCTYPE a[<!ELEMENT a (#PCDATA)>]> <a></a>');
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
  ReadLn;
end.
kaboom
  • 612
  • 1
  • 8
  • 15

0 Answers0