如何创造“新”使用 Delphi XSD 数据绑定向导的函数
当您想要创建应用程序中的所有数据时,调用生成的 New... 函数为空文档创建 TXMLDocument 实例:
<前><代码>变量 库存列表:IXMLStockListType; 开始 库存列表 := 新库存列表; _di_IStockListType StockList = NewStockListType();
但是,我在 Delphi 生成的 26833 行代码中没有得到任何 New... 函数导入临床文档的 XSD 时架构。
那么,是什么触发了这些新功能的产生呢?
According to Embarcadero's documentation
Call the generated New... function to create the TXMLDocument instance for an empty document when you want to create all the data in your application:
var StockList: IXMLStockListType; begin StockList := Newstocklist; _di_IStockListType StockList = NewStockListType();
However, I don't get any New... functions in the 26833 lines of code Delphi generated when importing the XSD for the Clinical Document Architecture .
So, what triggers the generation of these New functions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您的 XSD 文档在根级别包含多个 xs:element(或 simpletype、complextype...)节点,则向导无法确定您的 xml 文档的根级别元素最终是什么。在这种情况下,您必须自己编写Newxxx语句:
尝试导入一个遵循xsd的xml文档,您将看到将生成newxxx函数。
更新
如果您检查 documentElementType 以获得要用作根元素的类型,则new、load 和 get 函数被创建。如果您不这样做,您将收到此警告:
If your XSD document contains multiple xs:element (or simpletype,complextype,...) nodes at the root level, the wizard can't determine what the root level element will eventually be of your xml document. In that case you must write the Newxxx statement yourself:
Try to import an xml document that adheres to the xsd and you will see that the newxxx function will be generated.
UPDATE
If you check the documentElementType for the Type you want to use as root element, the new, load and get functions are created. If you don't do that you will get this warning: