2
首先,我是一位大型機程序員。我試圖編寫一個Windows VB腳本來從多個文件中提取信息以用於診斷/調查目的,但是我陷入了困境。 XML是用於直接付款糾紛和外觀(瀏覽器操作)像XML和VBS - 訪問孫子節點
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!-- Generated by Oracle Reports version 10.1.2.3.0 -->
<VocaDocument xsi:noNamespaceSchemaLocation="VOCALINK_DDICAdvice.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Data>
<Document type="DIRECT DEBIT INDEMNITY CLAIM ADVICE REPORT" created="2014-10-31T01:28:02" schemaVersion="1.0">
<CompanyName>Bacs Payment Schemes Limited</CompanyName>
<ReportTitle>DIRECT DEBIT INDEMNITY CLAIM ADVICE REPORT FOR 30/10/2014</ReportTitle>
<ReportProductionDate>2014-10-31T01:28:02</ReportProductionDate>
<ServiceUserNumber>987654</ServiceUserNumber>
<ServiceUserName>THE COMPANY LIMITED</ServiceUserName>
<NumberOfAdvices>1</NumberOfAdvices>
<NewAdvices>
<DDICAdvice>
<SeqNo>2014102903A987654321</SeqNo>
<PayingBankReference>DDICRBOSABC123</PayingBankReference>
<SUNumber>999888</SUNumber>
<SUReference>ABC12300000</SUReference>
<ReasonCode>2</ReasonCode>
<PayerSortCode>123456</PayerSortCode>
<PayerAccount>987654</PayerAccount>
<PayerName>CUSTOMER</PayerName>
<NoOfAdvForClaim>1</NoOfAdvForClaim>
<TotalAmount>122.65</TotalAmount>
<DDCollections>
<DDCollection>
<DateOfDirectDebit>2014-10-16</DateOfDirectDebit>
<Amount>122.65</Amount>
</DDCollection>
</DDCollections>
</DDICAdvice>
<TotalNumberOfNewAdvices>1</TotalNumberOfNewAdvices>
<TotalValueOfDebits>122.65</TotalValueOfDebits>
<DateOfDebit>2014-11-19</DateOfDebit>
</NewAdvices>
<ReasonCodeMeaning>1 = Amount and/or date of Direct Debit differ from Advance Notice.2 = No Advance Notice received by Payer/or the amount quoted is disputed.3 = DDI cancelled by paying bank.4 = Payer has cancelled DDI direct with service user.5 = AUDDIS service users only - No Instruction held. Payer disputes having given authority.6 = AUDDIS service users only - Signature on DDI is fraudulent or not in accordance with account authorised signature(s).7 = Claim raised at service users request after Direct Debit applied to payers account.8 = Service user name disputed. Payer does not recognise service user collecting Direct Debit.</ReasonCodeMeaning>
</Document>
</Data>
</VocaDocument>
英國BACS報告我想輸出是包含特定值 的SeqNo,PayingBankReference,SUReference,ReasonCode,PayerSortCode,PayerAccount一個CSV文件,付款人姓名
附加到此行我希望每個DateOfDirectDebit和金額值。
現在,我可以得到第一個東西沒有問題。我似乎無法得到的是DDCollections/DDCollection子項的循環。任何人都可以給我一些指點嗎?
僅供參考,我使用的每個文件的代碼是(我嘗試了幾種變體):
For Each advice In xmlDoc.documentElement.selectNodes("/VocaDocument/Data/Document/NewAdvices/DDICAdvice")
SeqNo = advice.selectSingleNode("SeqNo").Text
PayingBankReference = advice.selectSingleNode("PayingBankReference").Text
SUReference = advice.selectSingleNode("SUReference").Text
ReasonCode = advice.selectSingleNode("ReasonCode").Text
PayerSortCode= advice.selectSingleNode("PayerSortCode").Text
PayerAccount= advice.selectSingleNode("PayerAccount").Text
PayerName= advice.selectSingleNode("PayerName").Text
TotalAmount = advice.selectSingleNode("TotalAmount").Text
outLine = SeqNo & "," & PayingBankReference & "," & SUReference & "," & ReasonCode & "," & PayerSortCode & "," & PayerAccount & "," & PayerName & ",""" & TotalAmount & """"
For each ddCollection In advice.ChildNodes
if ddCollection.nodeName = "DateOfDirectDebit" then outline = outLine & "," & ddCollection.Text
if ddCollection.nodeName = "Amount" then outline = outLine & ",""" & ddCollection.Text & """"
Next
objTextFile.WriteLine(OutLine)
Next
乾杯,StuartLC。我大部分時間都在那裏,但是我今天看到你的回覆之前無法完成工作。我在循環中使用了「ddCollection.selectSingleNode」,並且工作正常。我現在有一個快樂的客戶,我正在節省大量的時間手動進行提取。 –