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