Delphi XE中的数据绑定向导 - 可以配置为映射到MSXML接口吗? [英] Data Binding Wizard in Delphi XE - can It be configured to map to MSXML interfaces?

查看:172
本文介绍了Delphi XE中的数据绑定向导 - 可以配置为映射到MSXML接口吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Delphi XE中的数据绑定向导生成继承自Delphi自己实现的DOM(ADOM XML v4)的类和接口,它似乎不支持对模式的验证 - 验证解析选项仅适用于MSXML供应商类型 - 从VCL源代码中可以看出,还有IDE中的XMLDocument组件的行为。所有验证支持似乎都是基于MSXML实现的,这使得如果您需要模式验证,该向导将无用。我在这里遗漏了什么吗?

有没有办法配置绑定向导(或一些底层的实用程序)来生成基于MSXML的类和接口,这支持验证?

是否有调用/接口支持使用Delphi执行ADOM XML的模式验证,我没有遇到过?



MNG

解决方案

由XML数据绑定向导生成的代码取决于 XMLDoc XMLIntf (文档引用是 TXMLDocument IXMLDocument )。



IXMLDocument TXMLDocument ,这是Delphi支持的XML DOM的通用包装。 TXmlDocument 使用的DOM取决于 DOMVendor属性



如果在激活 DOMVendor code> TXMLDocument 实例(它不是XML数据绑定向导生成DOM中性代码),那么使用的实际XML DOM取决于这两个成员的 XMLDOM单元

  var 
DefaultDOMVendor:string;
DOMVendors:TDOMVendorList;

在你的情况下,看起来MSXML DOM是默认的XML DOM,还是唯一的XML DOM可用。



所以你应该检查 DefaultDOMVendor DOMVendors 列表。



如果您可以使用上述值编辑您的问题,并且可以显示您如何观察MSXML DOM正在被使用的可重现的情况,那肯定会有帮助。



编辑:



您可以在之前运行时使用特定的XML DOM供应商您加载您的XML根节点,或者像这样创建一个新的XML根节点:

  DefaultDOMVendor ='MSXML'; 


The Data Binding Wizard in Delphi XE generates classes and interfaces that inherit from Delphi's own implementation of the DOM (ADOM XML v4), which doesn't appear to support validation against schemas - the 'validate on parse' option only works with the MSXML vendor type - as can be seen from the VCL source code and also the behavior of XMLDocument component in the IDE. All validation support seems to be based on the MSXML implementation, which makes the wizard useless if you need schema validation. Am I missing something here?

Is there a way to configure the binding wizard (or some underlying utility) to generate classes and interfaces based on MSXML, which supports validation?

Or are there calls/interfaces that support schema validation using Delphi's implementation of ADOM XML that I haven't come across?

MNG

解决方案

The code generated by the XML Data Binding Wizard depends on the units XMLDoc and XMLIntf (the document references are TXMLDocument and IXMLDocument).

IXMLDocument is implemented by TXMLDocument, which is the generic wrapper around XML DOMs supported by Delphi. The DOM used by TXmlDocument depends on the value of the DOMVendor property.

If a DOMVendor is not specified when activating a TXMLDocument instance (it isn't as the XML Data Binding Wizard generates DOM neutral code), then the actual XML DOM used depends on these two members of the XMLDOM unit:

var
  DefaultDOMVendor: string;
  DOMVendors: TDOMVendorList;

In your case, it appears that the MSXML DOM is either the default XML DOM, or the only XML DOM available.

So you should check the values of DefaultDOMVendor and the DOMVendors list.

It would certainly help if you can edit your question with the values of the above, and a reproducible case that shows how you observed the MSXML DOM is being used.

Edit:

You can fore the run-time use of a specific XML DOM vendor right before you load your XML root node, or create a new XML root node like this:

DefaultDOMVendor = 'MSXML';

这篇关于Delphi XE中的数据绑定向导 - 可以配置为映射到MSXML接口吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆