L
lmqlyn
Unregistered / Unconfirmed
GUEST, unregistred user!
当我在Form上放入一个xmldocument组件时如下执行语句是正常:
xmldocument1.XML.Add('<?xml version="1.0" encoding="gb2312"?>');
xmldocument1.XML.Add('<data/>');
xmldocument1.Active:=true;
aValueNode:=xmldocument1.DocumentElement.AddChild('FileName');
aValueNode.Text:='Test';
aValueNode:=xmldocument1.DocumentElement.AddChild('CreateTime');
aValueNode.Text:=DateTimeToStr(now);
aValueNode:=xmldocument1.DocumentElement.AddChild('Row');
aValueNode.Attributes['rowid']:=ADOStoredProc1.RecNo;
aNode:=aValueNode.AddChild('cProcCode');
aNode.Text:=ADOStoredProc1.Fieldbyname('cProcCode').AsString;
aNode:=aValueNode.AddChild('cEPName');
aNode.Text:=ADOStoredProc1.Fieldbyname('cEPName').AsString;
XMLDocument1.SaveToFile('d:/test.xml');
但是在运行事使用xmldocument1:=Txmldocument.create(nil)创建并执行
xmldocument1.XML.Add('<?xml version="1.0" encoding="gb2312"?>');
xmldocument1.XML.Add('<data/>');
xmldocument1.Active:=true;
aValueNode:=xmldocument1.DocumentElement.AddChild('FileName'); //此处出现地址错误!!
aValueNode.Text:='Test';
aValueNode:=xmldocument1.DocumentElement.AddChild('CreateTime');
aValueNode.Text:=DateTimeToStr(now);
aValueNode:=xmldocument1.DocumentElement.AddChild('Row');
aValueNode.Attributes['rowid']:=ADOStoredProc1.RecNo;
aNode:=aValueNode.AddChild('cProcCode');
aNode.Text:=ADOStoredProc1.Fieldbyname('cProcCode').AsString;
aNode:=aValueNode.AddChild('cEPName');
aNode.Text:=ADOStoredProc1.Fieldbyname('cEPName').AsString;
XMLDocument1.SaveToFile('d:/test.xml');
望高手解决!
xmldocument1.XML.Add('<?xml version="1.0" encoding="gb2312"?>');
xmldocument1.XML.Add('<data/>');
xmldocument1.Active:=true;
aValueNode:=xmldocument1.DocumentElement.AddChild('FileName');
aValueNode.Text:='Test';
aValueNode:=xmldocument1.DocumentElement.AddChild('CreateTime');
aValueNode.Text:=DateTimeToStr(now);
aValueNode:=xmldocument1.DocumentElement.AddChild('Row');
aValueNode.Attributes['rowid']:=ADOStoredProc1.RecNo;
aNode:=aValueNode.AddChild('cProcCode');
aNode.Text:=ADOStoredProc1.Fieldbyname('cProcCode').AsString;
aNode:=aValueNode.AddChild('cEPName');
aNode.Text:=ADOStoredProc1.Fieldbyname('cEPName').AsString;
XMLDocument1.SaveToFile('d:/test.xml');
但是在运行事使用xmldocument1:=Txmldocument.create(nil)创建并执行
xmldocument1.XML.Add('<?xml version="1.0" encoding="gb2312"?>');
xmldocument1.XML.Add('<data/>');
xmldocument1.Active:=true;
aValueNode:=xmldocument1.DocumentElement.AddChild('FileName'); //此处出现地址错误!!
aValueNode.Text:='Test';
aValueNode:=xmldocument1.DocumentElement.AddChild('CreateTime');
aValueNode.Text:=DateTimeToStr(now);
aValueNode:=xmldocument1.DocumentElement.AddChild('Row');
aValueNode.Attributes['rowid']:=ADOStoredProc1.RecNo;
aNode:=aValueNode.AddChild('cProcCode');
aNode.Text:=ADOStoredProc1.Fieldbyname('cProcCode').AsString;
aNode:=aValueNode.AddChild('cEPName');
aNode.Text:=ADOStoredProc1.Fieldbyname('cEPName').AsString;
XMLDocument1.SaveToFile('d:/test.xml');
望高手解决!