2019년 10월 24일 목요일

TXMLDocument 이용하여 XML 만들기 연습입니다.

사용법에 대한 이해가 부족하여 정리하였습니다.


그림과 같은 결과를 얻기위한 소스입니다.

procedure TForm1.FormCreate(Sender: TObject);
var LNodeElement, NodeChild, NodeGChild: IXMLNode;
begin
XMLDoc.Active:= True;

XMLDoc.Version:='1.0';
XMLDoc.StandAlone:='yes';

XMLDoc.DocumentElement:= XMLDoc.CreateNode('DATAPACKET', ntElement, '');
XMLDoc.DocumentElement.Attributes['Version']:= '2.0';

LNodeElement:= XMLDoc.DocumentElement.AddChild('METADATA');

NodeChild:= LNodeElement.AddChild('FIELDS');

NodeGChild:= NodeChild.AddChild('FIELD', -1);
NodeGChild.Attributes['attrname']:= 'Name';
NodeGChild.Attributes['fieldtype']:= 'string';
NodeGChild.Attributes['WIDTH']:= '24';

NodeChild:= LNodeElement.AddChild('PARAMS',-1);
NodeChild.Attributes['DEFAULT_ORDER']:= '1';
NodeChild.Attributes['PRIMARY_KEY']:= '1';
NodeChild.Attributes['LCID']:= '2057';

LNodeElement:= XMLDoc.DocumentElement.AddChild('ROWDATA');
NodeChild:= LNodeElement.AddChild('ROW', -1);
NodeChild.Attributes['Name']:= 'Argentina';
NodeChild.Attributes['Capital']:= 'Buenos Aires';
NodeChild.Attributes['Continent']:= 'South America';
NodeChild.Attributes['Area']:= '2777815';
NodeChild.Attributes['Population']:= '32300003';

NodeChild:= LNodeElement.AddChild('ROW', -1);
NodeChild.Attributes['Name']:= 'Bolivia';
NodeChild.Attributes['Capital']:= 'La Paz';
NodeChild.Attributes['Continent']:= 'South America';
NodeChild.Attributes['Area']:= '1098575';
NodeChild.Attributes['Population']:= '7300000';

XMLDoc.SaveToFile('./dest.xml');
Application.ProcessMessages;
memo1.Lines.LoadFromFile('./dest.xml');
end;

tensorflow gpu 사용하기에서

 tensorflow 설치시 주의해야 한다. # Anything above 2.10 is not supported on the GPU on Windows Native python - m pip install "tensorflow<2.11...