急,关于ASP读取XML文件(50分)

  • 主题发起人 主题发起人 小白菜
  • 开始时间 开始时间

小白菜

Unregistered / Unconfirmed
GUEST, unregistred user!
我的XML文件内容是:
----------------------------------------------------------------------
<?xml version=&quot;1.0&quot;
encoding=&quot;GB2312&quot;?>
<xml xmlns:s=&quot;uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882&quot;
xmlns:dt=&quot;uuid:C2F41010-65B3-11d1-A29F-00AA00C14882&quot;
xmlns:rs=&quot;urn:schemas-microsoft-com:rowset&quot;
xmlns:z=&quot;#RowsetSchema&quot;>
<row bk_id=&quot;1&quot;
sender=&quot;the-sender &quot;
bagt_code=&quot;test&quot;
bagt_name=&quot;&quot;
bagt_attn=&quot;aaa &quot;
bagt_tel=&quot;
&quot;
bk_type=&quot;A&quot;
shref_no=&quot;&quot;
f_liner=&quot;&quot;
contract_no=&quot;
&quot;
f_ves=&quot;&quot;
f_voy=&quot;&quot;
etd_pol=&quot;&quot;
sh_name=&quot;&quot;
cn_name=&quot;&quot;
nt_name=&quot;&quot;
por_code=&quot;
&quot;
por=&quot;&quot;
via_code=&quot;&quot;
via=&quot;
&quot;
pol_code=&quot;
&quot;
pol=&quot;&quot;
pod_code=&quot;
&quot;
pod=&quot;&quot;
final_code=&quot;
&quot;
final_dest=&quot;&quot;
del_code=&quot;
&quot;
del=&quot;&quot;
cargo_num=&quot;&quot;
cargo_pack=&quot;&quot;
cargo_wgt=&quot;0&quot;
cargo_meas=&quot;0&quot;
cargo_desc=&quot;&quot;
chn_desc=&quot;&quot;
charge_measwgt=&quot;&quot;
cargo_type=&quot;0&quot;
marks=&quot;&quot;
descript=&quot;&quot;
freight=&quot;
&quot;
lclbk_no=&quot;&quot;
sp_danger=&quot;
&quot;
sp_reefer=&quot;
&quot;
sp_awk=&quot;
&quot;
bk_req=&quot;&quot;
other_req=&quot;&quot;
stuff_mode=&quot;
&quot;
m_loada=&quot;
&quot;
m_loadb=&quot;
&quot;
stloc_code=&quot;
&quot;
cust_mode=&quot;
&quot;
bk_indate=&quot;&quot;
cnnum=&quot;0&quot;
isend=&quot;
&quot;/>
<row bk_id=&quot;2&quot;
sender=&quot;the-sender &quot;
bagt_code=&quot;dv-jx&quot;
bagt_name=&quot;&quot;
bagt_attn=&quot;
&quot;
bagt_tel=&quot;
&quot;
bk_type=&quot;A&quot;
shref_no=&quot;&quot;
f_liner=&quot;&quot;
contract_no=&quot;
&quot;
f_ves=&quot;&quot;
f_voy=&quot;&quot;
etd_pol=&quot;&quot;
sh_name=&quot;&quot;
cn_name=&quot;&quot;
nt_name=&quot;&quot;
por_code=&quot;
&quot;
por=&quot;&quot;
via_code=&quot;&quot;
via=&quot;
&quot;
pol_code=&quot;cnsha&quot;
pol=&quot;shanghai&quot;
pod_code=&quot;
&quot;
pod=&quot;&quot;
final_code=&quot;
&quot;
final_dest=&quot;&quot;
del_code=&quot;
&quot;
del=&quot;&quot;
cargo_num=&quot;&quot;
cargo_pack=&quot;&quot;
cargo_wgt=&quot;&quot;
cargo_meas=&quot;&quot;
cargo_desc=&quot;&quot;
chn_desc=&quot;&quot;
charge_measwgt=&quot;&quot;
cargo_type=&quot;0&quot;
marks=&quot;&quot;
descript=&quot;&quot;
freight=&quot;
&quot;
lclbk_no=&quot;&quot;
sp_danger=&quot;
&quot;
sp_reefer=&quot;
&quot;
sp_awk=&quot;
&quot;
bk_req=&quot;&quot;
other_req=&quot;&quot;
stuff_mode=&quot;
&quot;
m_loada=&quot;
&quot;
m_loadb=&quot;
&quot;
stloc_code=&quot;
&quot;
cust_mode=&quot;
&quot;
bk_indate=&quot;&quot;
cnnum=&quot;&quot;
isend=&quot;
&quot;/>
</xml>
---------------------------------------------------------------
我的ASP程序是:
----------------------------------------------------------------
Set objxml = Server.CreateObject(&quot;MSXML.DOMDocument&quot;)
objXML.load(Server.MapPath(&quot;files/e_bkinfo.xml&quot;))
set nodeList=objxml.selectSingleNode(&quot;//xml&quot;).ChildNodes
i=0
For Each node In NodeList
set bk_id=node.attributes.getNamedItem(&quot;bk_id&quot;)
set sender=node.attributes.getNamedItem(&quot;sender&quot;)
set bagt_code=node.attributes.getNamedItem(&quot;bagt_code&quot;)
set bagt_name=node.attributes.getNamedItem(&quot;bagt_name&quot;)
set bagt_attn=node.attributes.getNamedItem(&quot;bagt_attn&quot;)
set bagt_tel=node.attributes.getNamedItem(&quot;bagt_tel&quot;)
set bk_type=node.attributes.getNamedItem(&quot;bk_type&quot;)
set shref_no=node.attributes.getNamedItem(&quot;shref_no&quot;)
set f_liner=node.attributes.getNamedItem(&quot;f_liner&quot;)
set contract_no=node.attributes.getNamedItem(&quot;contract_no&quot;)
set f_ves=node.attributes.getNamedItem(&quot;f_ves&quot;)
set f_voy=node.attributes.getNamedItem(&quot;f_voy&quot;)
set etd_pol=node.attributes.getNamedItem(&quot;etd_pol&quot;)
set sh_name=node.attributes.getNamedItem(&quot;sh_name&quot;)
set cn_name=node.attributes.getNamedItem(&quot;cn_name&quot;)
set nt_name=node.attributes.getNamedItem(&quot;nt_name&quot;)
set por_code=node.attributes.getNamedItem(&quot;por_code&quot;)
set por=node.attributes.getNamedItem(&quot;por&quot;)
set via_code=node.attributes.getNamedItem(&quot;via_code&quot;)
set via=node.attributes.getNamedItem(&quot;via&quot;)
set pol_code=node.attributes.getNamedItem(&quot;pol_code&quot;)
set pol=node.attributes.getNamedItem(&quot;pol&quot;)
set pod_code=node.attributes.getNamedItem(&quot;pod_code&quot;)
set pod=node.attributes.getNamedItem(&quot;pod&quot;)
set final_code=node.attributes.getNamedItem(&quot;final_code&quot;)
set final_dest=node.attributes.getNamedItem(&quot;final_dest&quot;)
set del_code=node.attributes.getNamedItem(&quot;del_code&quot;)
set del=node.attributes.getNamedItem(&quot;del&quot;)
set cargo_num=node.attributes.getNamedItem(&quot;cargo_num&quot;)
set cargo_pack=node.attributes.getNamedItem(&quot;cargo_pack&quot;)
set cargo_wgt=node.attributes.getNamedItem(&quot;cargo_wgt&quot;)
set cargo_meas=node.attributes.getNamedItem(&quot;cargo_meas&quot;)
set cargo_desc=node.attributes.getNamedItem(&quot;cargo_desc&quot;)
set chn_desc=node.attributes.getNamedItem(&quot;chn_desc&quot;)
set charge_measwgt=node.attributes.getNamedItem(&quot;charge_measwgt&quot;)
set cargo_type=node.attributes.getNamedItem(&quot;cargo_type&quot;)
set marks=node.attributes.getNamedItem(&quot;marks&quot;)
set descript=node.attributes.getNamedItem(&quot;descript&quot;)
set freight=node.attributes.getNamedItem(&quot;freight&quot;)
set lclbk_no=node.attributes.getNamedItem(&quot;lclbk_no&quot;)
set sp_danger=node.attributes.getNamedItem(&quot;sp_danger&quot;)
set sp_reefer=node.attributes.getNamedItem(&quot;sp_reefer&quot;)
set sp_awk=node.attributes.getNamedItem(&quot;sp_awk&quot;)
set bk_req=node.attributes.getNamedItem(&quot;bk_req&quot;)
set other_req=node.attributes.getNamedItem(&quot;other_req&quot;)
set stuff_mode=node.attributes.getNamedItem(&quot;stuff_mode&quot;)
set m_loada=node.attributes.getNamedItem(&quot;m_loada&quot;)
set m_loadb=node.attributes.getNamedItem(&quot;m_loadb&quot;)
set stloc_code=node.attributes.getNamedItem(&quot;stloc_code&quot;)
set cust_mode=node.attributes.getNamedItem(&quot;cust_mode&quot;)
set bk_indate=node.attributes.getNamedItem(&quot;bk_indate&quot;)
set cnnum=node.attributes.getNamedItem(&quot;cnnum&quot;)
set isend=node.attributes.getNamedItem(&quot;isend&quot;)
response.write bk_id.text
response.write sender.text
.
.
.
====================================================
有没办法把&quot;set 字段=node.attributes.getNamedItem(&quot;字段&quot;)&quot;
这部分写个函数,然后调用一下,就不会写那么多的set那么,这样写程序很长,又麻烦了
 
自己坐回沙发
 
晕,已经一天怎么还没人帮忙啊,
 
后退
顶部