Func ReadXmlData($fileName)
;MsgBox("文件名","文件名",$fileName)
If Not FileExists($fileName) Then
MsgBox(4096,"提示","数据文件不存在或已被修改,请重新选择!")
Return False
Else
Dim $objXML = ObjCreate("Microsoft.XMLDOM")
Dim $isFind = $objXML.load($fileName)
Dim $Root = $objXML.documentElement
Dim $temp = $Root.childNodes.item(0).selectSingleNode("Message_Data").text
Dim $headNode = $Root.childNodes.item(1).childNodes.item(0).childNodes.item(0)
;get data form_head
$PRE_ENTRY_ID = $headNode.selectSingleNode("PRE_ENTRY_ID").text
$I_E_FLAG = $headNode.selectSingleNode("I_E_FLAG").text
$I_E_PORT = $headNode.selectSingleNode("I_E_PORT").text
$MANUAL_NO = $headNode.selectSingleNode("MANUAL_NO").text
$CONTR_NO = $headNode.selectSingleNode("CONTR_NO").text
$I_E_DATE = $headNode.selectSingleNode("I_E_DATE").text
$D_DATE = $headNode.selectSingleNode("D_DATE").text
$TRADE_NAME = $headNode.selectSingleNode("TRADE_NAME").text
;MsgBox("标志","标题",$TRADE_NAME)
$TRADE_CO = $headNode.selectSingleNode("TRADE_CO").text
$OWNER_CODE = $headNode.selectSingleNode("OWNER_CODE").text
$OWNER_NAME = $headNode.selectSingleNode("OWNER_NAME").text
$AGENT_CODE = $headNode.selectSingleNode("AGENT_CODE").text
$AGENT_NAME = $headNode.selectSingleNode("AGENT_NAME").text
$TRAF_MODE = $headNode.selectSingleNode("TRAF_MODE").text
$TRAF_NAME = $headNode.selectSingleNode("TRAF_NAME").text
$VOYAGE_NO = $headNode.selectSingleNode("VOYAGE_NO").text
$BILL_NO = $headNode.selectSingleNode("BILL_NO").text
$TRADE_MODE = $headNode.selectSingleNode("TRADE_MODE").text
$CUT_MODE = $headNode.selectSingleNode("CUT_MODE").text
$LICENSE_NO = $headNode.selectSingleNode("LICENSE_NO").text
$TRADE_COUNTRY = $headNode.selectSingleNode("TRADE_COUNTRY").text
$DISTINATE_PORT = $headNode.selectSingleNode("DISTINATE_PORT").text
$DISTRICT_CODE = $headNode.selectSingleNode("DISTRICT_CODE").text
$APPR_NO = $headNode.selectSingleNode("APPR_NO").text
$TRANS_MODE = $headNode.selectSingleNode("TRANS_MODE").text
$PACK_NO = $headNode.selectSingleNode("PACK_NO").text
$WRAP_TYPE = $headNode.selectSingleNode("WRAP_TYPE").text
$GROSS_WT = $headNode.selectSingleNode("GROSS_WT").text
$NET_WT = $headNode.selectSingleNode("NET_WT").text
$EX_SOURCE = $headNode.selectSingleNode("EX_SOURCE").text
$NOTE_S= $headNode.selectSingleNode("NOTE_S").text
;get data form_list
Dim $listNode = $Root.childNodes.item(1).childNodes.item(1)
$listLength = $listNode.childNodes.length
Dim $array1[$listLength][20]
$listArray = $array1
For $i = 0 To $listLength - 1
$listArray[$i][0] = $listNode.childNodes.item($i).selectSingleNode("CONTR_ITEM").text
$listArray[$i][1] = $listNode.childNodes.item($i).selectSingleNode("CODE_T").text
$listArray[$i][2] = $listNode.childNodes.item($i).selectSingleNode("CODE_S").text
$listArray[$i][3] = $listNode.childNodes.item($i).selectSingleNode("G_NAME").text
$listArray[$i][4] = $listNode.childNodes.item($i).selectSingleNode("G_MODEL").text
$listArray[$i][5] = $listNode.childNodes.item($i).selectSingleNode("G_QTY").text
$listArray[$i][6] = $listNode.childNodes.item($i).selectSingleNode("G_UNIT").text
$listArray[$i][7] = $listNode.childNodes.item($i).selectSingleNode("DECL_PRICE ").text
$listArray[$i][8] = $listNode.childNodes.item($i).selectSingleNode("TRADE_TOTAL").text
$listArray[$i][9] = $listNode.childNodes.item($i).selectSingleNode("TRADE_CURR").text
$listArray[$i][10] = $listNode.childNodes.item($i).selectSingleNode("QTY_CONV").text
$listArray[$i][11] = $listNode.childNodes.item($i).selectSingleNode("UNIT_1").text
$listArray[$i][12] = $listNode.childNodes.item($i).selectSingleNode("GOODS_ID").text
$listArray[$i][13] = $listNode.childNodes.item($i).selectSingleNode("PRDT_NO").text
$listArray[$i][14] = $listNode.childNodes.item($i).selectSingleNode("QTY_2").text
$listArray[$i][15] = $listNode.childNodes.item($i).selectSingleNode("UNIT_2").text
$listArray[$i][16] = $listNode.childNodes.item($i).selectSingleNode("ORIGIN_COUNTRY").text
$listArray[$i][17] = $listNode.childNodes.item($i).selectSingleNode("DUTY_MODE").text
Next
If Not($Root.childNodes.item(1).childNodes.item(5).childNodes.length == 0) Then
;get data cert_list
Dim $certNode = $Root.childNodes.item(1).childNodes.item(5)
$certLength = $certNode.childNodes.Length
Dim $array2[$certLength][2]
$certArray = $array2
For $i = 0 To $certLength - 1
$certArray[$i][0] = $certNode.childNodes.item($i).selectSingleNode("DOCU_CODE").text
$certArray[$i][1] = $certNode.childNodes.item($i).selectSingleNode("CERT_CODE").text
Next
EndIf
If Not($Root.childNodes.item(1).childNodes.item(4).childNodes.length == 0) Then
;get data containernumber
Dim $containerNode = $Root.childNodes.item(1).childNodes.item(4)
$containerLength = $containerNode .childNodes.Length
Dim $array3[$containerLength][3]
$containerArray = $array3
For $i = 0 To $containerLength - 1
$containerArray[$i][0] = $containerNode.childNodes.item($i).selectSingleNode("CONTAINER_NO").text
$containerArray[$i][1] = $containerNode.childNodes.item($i).selectSingleNode("CONTAINER_MODEL").text
$containerArray[$i][2] = $containerNode.childNodes.item($i).selectSingleNode("CONTAINER_WT").text
Next
EndIf
Return True
EndIf
EndFunc |