DELPHI中如何调用XSD去验证XML的合法性? 谢谢各位大大了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 var SchemaDoc, XmlDoc: IXMLDOMDocument2; SchemaCache: IXMLDOMSchemaCollection; Error: IXMLDOMParseError;begin // Load the data XmlDoc := CoDOMDocument40.Create; XmlDoc.async := False; XmlDoc.load('D:\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; (特急)如何用delphi生成xml文件? 在线求救!!!!再求两个函数 能否在程序里直接调用DOS命令? 怎么用FastReport怎么设计这样的报表! 关于分布式中传送更新数据加密的问题,在线等待! 请大家帮我看看,出现这样的问题是怎么会事呀? 离去(都看看吧, 看看一个即将绝望的人) 关于TreeView试例中在Delphi自带的Demo文件夹中有吗? 在DELPHI5中有否一个组件,可以制作出类似于OBJECT INSPECTOR的东西 怎样彻底删除表中的数据? 有谁知道杭州彩通网络技术有限公司的? 调用WebService参数的问题
SchemaDoc, XmlDoc: IXMLDOMDocument2;
SchemaCache: IXMLDOMSchemaCollection;
Error: IXMLDOMParseError;
begin
// Load the data
XmlDoc := CoDOMDocument40.Create;
XmlDoc.async := False;
XmlDoc.load('D:\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;