AddChild değil Add diye bir metod olması lazım. Sanırım XMLDataBinding ile oluşturduğunuz unitte bir eksiklik var, bunun nedeni oluştururken kullandığınız XML dosyasında sadece 1 SLIP tag'i olması olabilir. Elinizde XSLT dosyası varsa unit'i onu kullanarak oluşturmayı deneyin.
İlk mesajda örnek olarak verdiğiniz XML dosyasını kullanarak oluşturduğum unit
Kod: Tümünü seç
<?xml version="1.0" encoding="ISO-8859-9" ?>
- <MATERIAL_SLIPS>
- <SLIP DBOP="INS">
<GROUP>3</GROUP>
<TYPE>12</TYPE>
<NUMBER>DENEME 1</NUMBER>
</SLIP>
- <SLIP DBOP="INS">
<GROUP>3</GROUP>
<TYPE>12</TYPE>
<NUMBER>DENEME 2</NUMBER>
</SLIP>
- <SLIP DBOP="INS">
<GROUP>3</GROUP>
<TYPE>12</TYPE>
<NUMBER>DENEME 3</NUMBER>
</SLIP>
</MATERIAL_SLIPS>
Kod: Tümünü seç
type
{ Forward Decls }
IXMLMATERIAL_SLIPSType = interface;
IXMLSLIPType = interface;
{ IXMLMATERIAL_SLIPSType }
IXMLMATERIAL_SLIPSType = interface(IXMLNodeCollection)
['{D4AC861B-F7FA-4556-B9FA-2305699438E9}']
{ Property Accessors }
function Get_SLIP(Index: Integer): IXMLSLIPType;
{ Methods & Properties }
function Add: IXMLSLIPType;
function Insert(const Index: Integer): IXMLSLIPType;
property SLIP[Index: Integer]: IXMLSLIPType read Get_SLIP; default;
end;
{ IXMLSLIPType }
IXMLSLIPType = interface(IXMLNode)
['{B367C48A-F46A-4118-AAFD-C3A9B4086DC9}']
{ Property Accessors }
function Get_DBOP: WideString;
function Get_GROUP: Integer;
function Get_TYPE_: Integer;
function Get_NUMBER: WideString;
procedure Set_DBOP(Value: WideString);
procedure Set_GROUP(Value: Integer);
procedure Set_TYPE_(Value: Integer);
procedure Set_NUMBER(Value: WideString);
{ Methods & Properties }
property DBOP: WideString read Get_DBOP write Set_DBOP;
property GROUP: Integer read Get_GROUP write Set_GROUP;
property TYPE_: Integer read Get_TYPE_ write Set_TYPE_;
property NUMBER: WideString read Get_NUMBER write Set_NUMBER;
end;
{ Forward Decls }
TXMLMATERIAL_SLIPSType = class;
TXMLSLIPType = class;
{ TXMLMATERIAL_SLIPSType }
TXMLMATERIAL_SLIPSType = class(TXMLNodeCollection, IXMLMATERIAL_SLIPSType)
protected
{ IXMLMATERIAL_SLIPSType }
function Get_SLIP(Index: Integer): IXMLSLIPType;
function Add: IXMLSLIPType;
function Insert(const Index: Integer): IXMLSLIPType;
public
procedure AfterConstruction; override;
end;
{ TXMLSLIPType }
TXMLSLIPType = class(TXMLNode, IXMLSLIPType)
protected
{ IXMLSLIPType }
function Get_DBOP: WideString;
function Get_GROUP: Integer;
function Get_TYPE_: Integer;
function Get_NUMBER: WideString;
procedure Set_DBOP(Value: WideString);
procedure Set_GROUP(Value: Integer);
procedure Set_TYPE_(Value: Integer);
procedure Set_NUMBER(Value: WideString);
end;
{ Global Functions }
function GetMATERIAL_SLIPS(Doc: IXMLDocument): IXMLMATERIAL_SLIPSType;
function LoadMATERIAL_SLIPS(const FileName: WideString): IXMLMATERIAL_SLIPSType;
function NewMATERIAL_SLIPS: IXMLMATERIAL_SLIPSType;
olarak oluşturuldu ve ben de
Kod: Tümünü seç
var
XMLMaterialSlips : IXMLMaterial_SlipsType;
XMLDocument : IXMLDocument;
i : integer;
begin
XMLMaterialSlips := NewMATERIAL_SLIPS;
for i := 0 to 10 do
with XMLMaterialSlips.Add do begin
DBOP := 'INS';
GROUP := 3;
TYPE_ := i;
NUMBER := 'deneme '+inttostr(i);
end;
XMLDocument := LoadXMLData(FormatXMLData(XMLMaterialSlips.XML));
XMLDocument.Version := '1.0';
XMLDocument.Encoding := 'iSO-8859-9';
XMLDocument.SaveToFile('C:\yeniXML.xml');
XMLDocument:=nil;
yazarak şöyle
Kod: Tümünü seç
<?xml version="1.0" encoding="iSO-8859-9"?>
<MATERIAL_SLIPS>
<SLIP DBOP="INS">
<GROUP>3</GROUP>
<TYPE>0</TYPE>
<NUMBER>deneme 0</NUMBER>
</SLIP>
<SLIP DBOP="INS">
<GROUP>3</GROUP>
<TYPE>1</TYPE>
<NUMBER>deneme 1</NUMBER>
</SLIP>
<SLIP DBOP="INS">
<GROUP>3</GROUP>
<TYPE>2</TYPE>
<NUMBER>deneme 2</NUMBER>
</SLIP>
<SLIP DBOP="INS">
<GROUP>3</GROUP>
<TYPE>3</TYPE>
<NUMBER>deneme 3</NUMBER>
</SLIP>
<SLIP DBOP="INS">
<GROUP>3</GROUP>
<TYPE>4</TYPE>
<NUMBER>deneme 4</NUMBER>
</SLIP>
.
.
.
bir sonuç aldım.
İyi Çalışmalar