Ver Mensaje Individual
  #1  
Antiguo 09-09-2017
cmfab cmfab is offline
Miembro
 
Registrado: jun 2010
Posts: 419
Reputación: 14
cmfab Va por buen camino
Creando interface XML con XML DataBinding

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:

Código Delphi [-]

      1
      "SERV1"
      "SERVICIO1"
      2
      "SERV2"
      "SERVICIO2"      

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.

Código Delphi [-]
{ 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.
Responder Con Cita