Create data in xml from txt file

Baodtkeklruuk

New Member
I want to creat this xml file from a txt file... i do thisCode:\[code\] FXml := TNativeXml.CreateName('Root'); FXml.XmlFormat := xfReadable; open the file AssignFile(TFile,'user.txt'); Reset(TFile); while not eof(TFile) do begin Readln(TFile,text); r := Pos(' ',t2); t2 := Trim(Copy(text,1,Length(text))); t1 := Trim(Copy(t2,0,r)); FXml.Root.NodeNew('row'); FXml.Root.NodeByName('row').WriteAttributeString('user',t2); FXml.Root.NodeByName('row').WriteAttributeString('pin',t1); end; FXml.SaveToFile('new.xml'); FXml.free;\[/code\]something i do wrong with nodebyname but what... Thank you...
 
Back
Top