procedure TFrmPrintReport.Button3Click(Sender: TObject);
var
  SchemaDoc, XmlDoc: IXMLDOMDocument2;
  SchemaCache: IXMLDOMSchemaCollection;
  Error: IXMLDOMParseError;
begin
    // Load the data
    XmlDoc := CoDOMDocument40.Create;
    XmlDoc.async := False;
    XmlDoc.load('D:\RONGXING\旅客登记II\ReportAir\2007-11-20\SA_0711200845_ZYK.xml');
    // Load the schema doc
    SchemaDoc := CoDOMDocument40.Create;
    SchemaDoc.async := False;
    SchemaDoc.load(ExtractFilePath(Application.Exename) +'tests\manifest.xsd');
    // Register the schema with the cache
    SchemaCache := CoXMLSchemaCache40.Create;
    SchemaCache.add('', schemadoc);
    // Assign the schema cache to the document
    XmlDoc.schemas := schemacache;
    // Validate and report
    Error := xmldoc.validate;
    if Error.errorCode <> S_OK then
      Memo1.Lines.Add(Error.reason)
    else
      Memo1.Lines.Add('验证成功');   
end;

相关文章:

  • 2021-12-23
  • 2021-05-20
  • 2022-12-23
  • 2022-12-23
  • 2021-06-09
  • 2022-12-23
  • 2022-02-22
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-20
  • 2021-12-03
相关资源
相似解决方案