E
Elite_liu
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.Button1Click(Sender: TObject);
var
aNode, aValueNode: IXMLNode;
wStr: widestring;
begin
//+++++++++++++++++++++++++++++++++++++
//用TXmlDocument实现创建一个Xml文档
with XMLDocument1.XMLdo
begin
Add('<?xml version="1.0"
standalone="yes"?>');
Add('<ExportNew>');
Add('<savenight>');
Add('<name>savenight</name>');
Add('<sex>man</sex>');
Add('</savenight>');
Add('</ExportNew>');
end;
XMLDocument1.Active := true;
XMLDocument1.SaveToFile('d:/test.xml');
//下面是添加节点,但是没有添加进来为何?
aNode := XMLDocument1.DocumentElement.AddChild('stock');
aValueNode := aNode.AddChild('name');
aValueNode.Text := 'lhj';
aValueNode := aNode.AddChild('sex');
aValueNode.Text := 'man';
end;
var
aNode, aValueNode: IXMLNode;
wStr: widestring;
begin
//+++++++++++++++++++++++++++++++++++++
//用TXmlDocument实现创建一个Xml文档
with XMLDocument1.XMLdo
begin
Add('<?xml version="1.0"
standalone="yes"?>');
Add('<ExportNew>');
Add('<savenight>');
Add('<name>savenight</name>');
Add('<sex>man</sex>');
Add('</savenight>');
Add('</ExportNew>');
end;
XMLDocument1.Active := true;
XMLDocument1.SaveToFile('d:/test.xml');
//下面是添加节点,但是没有添加进来为何?
aNode := XMLDocument1.DocumentElement.AddChild('stock');
aValueNode := aNode.AddChild('name');
aValueNode.Text := 'lhj';
aValueNode := aNode.AddChild('sex');
aValueNode.Text := 'man';
end;