cmfab
09-09-2017, 20:59:30
Estimados, buenas tardes a todos !. a ver si alguien puede echarme una mano.
He creado una plantilla de un documento XML para después poder importarlo a un proyecto con el objetivo de crear los objetos y poder leerlo desde una aplicación cliente de un WebServices.
La estructura es sencilla:
<ServiceList>
<id_service>1</id_service>
<alias>"SERV1"</alias>
<name_service>"SERVICIO1"</name_service>
<id_service>2</id_service>
<alias>"SERV2"</alias>
<name_service>"SERVICIO2"</name_service>
</ServiceList
una vez que creo el documento uso la opción de delphi "XML DantaBinding" y lo que me está sucediendo es que los valores de alias y service_name me los toma como una colección o array de tipo de datos Integer al crear la interface.
{ IXMLServiceListType }
IXMLServiceListType = interface(IXMLNode)
['{E1B6D7EE-7CE9-41A7-8CEE-6EC032EC845C}']
{ Property Accessors }
function Get_Id_service: IXMLIntegerList;
function Get_Alias: IXMLIntegerList;
function Get_Name_service: IXMLIntegerList;
{ Methods & Properties }
property Id_service: IXMLIntegerList read Get_Id_service;
property Alias: IXMLIntegerList read Get_Alias;
property Name_service: IXMLIntegerList read Get_Name_service;
end;
{ IXMLIntegerList }
IXMLIntegerList = interface(IXMLNodeCollection)
['{D12E15F7-DC94-4604-84FB-C50DD255BDA1}']
{ Methods & Properties }
function Add(const Value: Integer): IXMLNode;
function Insert(const Index: Integer; const Value: Integer): IXMLNode;
function Get_Item(Index: Integer): Integer;
property Items[Index: Integer]: Integer read Get_Item; default;
end;
{ Forward Decls }
TXMLServiceListType = class;
TXMLIntegerList = class;
{ TXMLServiceListType }
TXMLServiceListType = class(TXMLNode, IXMLServiceListType)
private
FId_service: IXMLIntegerList;
FAlias: IXMLIntegerList;
FName_service: IXMLIntegerList;
protected
{ IXMLServiceListType }
function Get_Id_service: IXMLIntegerList;
function Get_Alias: IXMLIntegerList;
function Get_Name_service: IXMLIntegerList;
public
procedure AfterConstruction; override;
end;
{ TXMLIntegerList }
TXMLIntegerList = class(TXMLNodeCollection, IXMLIntegerList)
protected
{ IXMLIntegerList }
function Add(const Value: Integer): IXMLNode;
function Insert(const Index: Integer; const Value: Integer): IXMLNode;
function Get_Item(Index: Integer): Integer;
end;
Da igual si en el xml tengo las comillas o no, siempre me toma los tres campos como enteros. alguna idea ?. Gracias.
He creado una plantilla de un documento XML para después poder importarlo a un proyecto con el objetivo de crear los objetos y poder leerlo desde una aplicación cliente de un WebServices.
La estructura es sencilla:
<ServiceList>
<id_service>1</id_service>
<alias>"SERV1"</alias>
<name_service>"SERVICIO1"</name_service>
<id_service>2</id_service>
<alias>"SERV2"</alias>
<name_service>"SERVICIO2"</name_service>
</ServiceList
una vez que creo el documento uso la opción de delphi "XML DantaBinding" y lo que me está sucediendo es que los valores de alias y service_name me los toma como una colección o array de tipo de datos Integer al crear la interface.
{ IXMLServiceListType }
IXMLServiceListType = interface(IXMLNode)
['{E1B6D7EE-7CE9-41A7-8CEE-6EC032EC845C}']
{ Property Accessors }
function Get_Id_service: IXMLIntegerList;
function Get_Alias: IXMLIntegerList;
function Get_Name_service: IXMLIntegerList;
{ Methods & Properties }
property Id_service: IXMLIntegerList read Get_Id_service;
property Alias: IXMLIntegerList read Get_Alias;
property Name_service: IXMLIntegerList read Get_Name_service;
end;
{ IXMLIntegerList }
IXMLIntegerList = interface(IXMLNodeCollection)
['{D12E15F7-DC94-4604-84FB-C50DD255BDA1}']
{ Methods & Properties }
function Add(const Value: Integer): IXMLNode;
function Insert(const Index: Integer; const Value: Integer): IXMLNode;
function Get_Item(Index: Integer): Integer;
property Items[Index: Integer]: Integer read Get_Item; default;
end;
{ Forward Decls }
TXMLServiceListType = class;
TXMLIntegerList = class;
{ TXMLServiceListType }
TXMLServiceListType = class(TXMLNode, IXMLServiceListType)
private
FId_service: IXMLIntegerList;
FAlias: IXMLIntegerList;
FName_service: IXMLIntegerList;
protected
{ IXMLServiceListType }
function Get_Id_service: IXMLIntegerList;
function Get_Alias: IXMLIntegerList;
function Get_Name_service: IXMLIntegerList;
public
procedure AfterConstruction; override;
end;
{ TXMLIntegerList }
TXMLIntegerList = class(TXMLNodeCollection, IXMLIntegerList)
protected
{ IXMLIntegerList }
function Add(const Value: Integer): IXMLNode;
function Insert(const Index: Integer; const Value: Integer): IXMLNode;
function Get_Item(Index: Integer): Integer;
end;
Da igual si en el xml tengo las comillas o no, siempre me toma los tres campos como enteros. alguna idea ?. Gracias.