【发布时间】:2020-08-10 13:10:39
【问题描述】:
我想在 Delphi 10.4 和 XML 数据绑定向导中使用编辑字段来创建具体数据。
我有 XML 模式,我用它在 Delphi 中创建了下面的代码。
你能帮我看看下面的代码如何创建具体的 XML 文件吗?
这是我从数据绑定向导中得到的:
function NewUnknown: IXMLGetBalance_Type;
begin
Result := NewXMLDocument.GetDocBinding('Unknown', TXMLGetBalance_Type, TargetNamespace) as IXMLGetBalance_Type;
end;
{ TXMLGetBalance_Type }
procedure TXMLGetBalance_Type.AfterConstruction;
begin
RegisterChildNode('consent', TXMLGetBalance_Type_consent);
inherited;
end;
function TXMLGetBalance_Type.Get_Consent: IXMLGetBalance_Type_consent;
begin
Result := ChildNodes['consent'] as IXMLGetBalance_Type_consent;
end;
{ TXMLGetBalance_Type_consent }
function TXMLGetBalance_Type_consent.Get_Type_: UnicodeString;
begin
Result := ChildNodes['type'].Text;
end;
procedure TXMLGetBalance_Type_consent.Set_Type_(Value: UnicodeString);
begin
ChildNodes['type'].NodeValue := Value;
end;
function TXMLGetBalance_Type_consent.Get_Target: UnicodeString;
begin
Result := ChildNodes['target'].Text;
end;
procedure TXMLGetBalance_Type_consent.Set_Target(Value: UnicodeString);
begin
ChildNodes['target'].NodeValue := Value;
end;
function TXMLGetBalance_Type_consent.Get_Id: UnicodeString;
begin
Result := ChildNodes['id'].Text;
end;
procedure TXMLGetBalance_Type_consent.Set_Id(Value: UnicodeString);
begin
ChildNodes['id'].NodeValue := Value;
end;
如何使用此代码创建包含来自编辑字段的数据的具体 XML 文件?
【问题讨论】:
-
非常感谢!我现在明白了。我还有 1 个问题,我正在尝试连接到这样的 API,但它不起作用:request :=(HTTPRio1 as AccountInfo_PT).getBalance(Unk);因为 getBalance() 函数具有参数类型 getBalance ,它的定义在我导入的 WSDL 文件中,所以 getBalance() 函数需要 getBalance 类类型参数,它属于 getBalance_type 类,我如何从 Unk 创建这个 getBalance 参数,它是 IXMLGetBalance_Type ?