<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns:GetTrans>
<ns:return>
<ns:return>code: 123
msg: DOWNLOADED SUCCESSFULLY
Benef Name: Sofi Anna
Benef COntact No: null 123
Benef Address: Tokyo
Benef Account No: 123456789
Sender Name: Ronaldo sis
Sender Address: jpn
Sender Contact No: 12345678 null
Authorized Date: 2014-03-27
Remarks: null
Remit Type: cash
AMount: $5000.0
Branch Details : abc York</ns:return>
<ns:return>code: 123
msg: DOWNLOADED SUCCESSFULLY=
Benef Name: Selena Gomez
Benef COntact No: 123
Benef Address: New York
Benef Account No: 987654321
Sender Name: Messi sis
Sender Address: Banglore
Sender Contact No: 987654321
Authorized Date: 2015-01-20
Remarks: null
Remit Type: cash
AMount: $10000.0
Branch Details : Canada Brisben
</ns:return>
</ns:GetTrans>
</soapenv:Body>
</soapenv:Envelope>
我在XML中的APIserver有这些响应...如何从各列获取每个数据,因为它没有元素和同一节点中的所有数据?我必须插入到SQL中:
Benefname Benef address Amount
Sofi Tokyo 50000
Selena Japan 10000
嗨,我解决方案的方式不同。复制+粘贴您的xml代码并创建veri.xml
我是asp代码vbscript
<% @ LANGUAGE = VBScript %>
<%
Set objFSO = CreateObject("Scripting.FileSystemObject")
rootPath = Server.MapPath("veri.xml")
Set objFile = objFSO.OpenTextFile(rootPath,1)%>
<%
'Null value skipline
objFile.SkipLine
objFile.SkipLine
objFile.SkipLine
objFile.SkipLine
objFile.SkipLine
'____
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
strLine=replace(strLine,"<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"">","")
strLine=replace(strLine,"<soapenv:Body>","")
strLine=replace(strLine,"<ns:GetTrans>","")
strLine=replace(strLine,"<ns:return>","")
strLine=replace(strLine,"</soapenv:Body>","")
strLine=replace(strLine,"</ns:GetTrans>","")
strLine=replace(strLine,"</ns:return>","")
strLine=replace(strLine,"</soapenv:Envelope>","")
strLine=replace(strLine," code",";code")
alanlar = Split(strLine, ";")
adet = Ubound(alanlar)
For i = 0 To adet
response.write ("<br>")
Response.Write alanlar(i)
Next
Loop
objFile.Close
%>
结果
你可以自己配置