Delphi与XML文档
同步程序案例
procedure TGetOrderThread.PostDB(webnr:WideString);
var
Err: String;
SetWebnr:WideString;
xmlDoc: IXMLDocument;
root: IXMLNode;
rowc: IXMLNode;//记录数
rows: IXMLNodeList;//主记录列表
row: IXMLNode;
drows: IXMLNodeList;//明细列表
drow: IXMLNode;
i,j,slhj,jlhj:integer;
djhj:real;
begin
//同步数据
xmlDoc := TXMLDocument.Create(nil);
try
xmlDoc.XML.Text:=Webnr;
xmlDoc.Active:=true;
root:=xmlDoc.DocumentElement;
rowc:=root.ChildNodes.FindNode('RowC');
if (rowc.NodeValue>0) and DBconn then
begin
rows:=root.ChildNodes.FindNode('RowS').ChildNodes;
//showmessage('记录数:'+rowc.NodeValue);
for i:=0 to rows.Count-1 do
begin
ADOConn.BeginTrans;
try
row:=rows.Nodes[i];
drows:=row.ChildNodes.FindNode('Drows').ChildNodes;
//showmessage(row.ChildValues['billno']+
// ' 明细记录数:'+inttostr(drows.Count));//显示订单号
if SHelper.Active then SHelper.Close;
SHelper.SQL.Text:=Format(selectStr,[row.ChildValues['billno']]);
SHelper.Open;
jlhj:=0;
slhj:=0;
djhj:=0;
&nb
相关文档:
wsdl.xml文件
<?xml version="1.0" encoding="UTF-8" ?>
<definitions name="MobilePhoneService"
targetNamespace="www.mobilephoneservice.com/MobilePhoneService-interface"
xmlns="http://schemas.xmlsoap.org/wsdl/"
  ......
xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<mobile-list>
<mobile type="Nokia2652">
<wap2>false</wap2>
<width>115</width>
</mobile>
<mobile type="Nokia2650">
......
<%
'
Set http=Server.CreateObject("Microsoft.XMLHTTP")
http.Open "GET","http://127.0.0.1/1.xml",False
http.send
Dim xml
Set xml = Server.CreateObject("Microsoft.XMLDOM")
xml.async = False
'xml.load (Server.MapPath("1.xml")) '如果不是远程文件直接这一步
xml.Load(http.ResponseXML)
Dim t ......