<RmtInf>
<Strd>
<RfrdDocInf>
<Tp>
<CdOrPrtry>
<Cd>CINV</Cd>
</CdOrPrtry>
</Tp>
<Nb>3501870</Nb>
</RfrdDocInf>
<RfrdDocInf>
<Tp>
<CdOrPrtry>
<Prtry>AGJ</Prtry>
</CdOrPrtry>
</Tp>
<Nb>10090187000155438</Nb>
</RfrdDocInf>
<RfrdDocAmt>
<DuePyblAmt Ccy="SEK">5453.29</DuePyblAmt>
</RfrdDocAmt>
</Strd>
<Strd>
<RfrdDocInf>
<Tp>
<CdOrPrtry>
<Cd>CINV</Cd>
</CdOrPrtry>
</Tp>
<Nb>160120</Nb>
</RfrdDocInf>
<RfrdDocInf>
<Tp>
<CdOrPrtry>
<Prtry>AGJ</Prtry>
</CdOrPrtry>
</Tp>
<Nb>10090187000155438</Nb>
</RfrdDocInf>
<AddtlRmtInf>/ARI/</AddtlRmtInf>
</Strd>
</RmtInf>
while (ap.evalXPath() != -1)
{
if (vn.toElement(VTDNav.FIRST_CHILD, "AmtDtls")) {
do {
amtDetails = getXpathValue(vn, ".//TxAmt/Amt/text()");
// System.out.println("amtDetails:::" + amtDetails);
if (amtDetails != null)
creditNotification.setAmount(new BigDecimal(amtDetails));
} while (vn.toElement(VTDNav.NEXT_SIBLING, "AmtDtls"));
}
vn.push();
// System.out.println("transIndex::" + transIndex);
ap1.selectXPath("/Document/BkToCstmrDbtCdtNtfctn/Ntfctn/Ntry/NtryDtls/TxDtls[" + transIndex
+ "]/RmtInf/Strd");
while (ap1.evalXPath() != -1) {
// System.out.println("sCount::::"+sCount);
custInvType = getXpathValue(vn, "RfrdDocInf[1]/Tp/CdOrPrtry/Cd/text()");
// System.out.println("custInvType:::" + custInvType);
creditNotificationFlag = false;
if (custInvType != null
&& custInvType.equalsIgnoreCase(IBS2BankConstants.TYPE_DEBITCREDITNOTIFICATION_CINV)) {
kidNmbr = getXpathValue(vn, "RfrdDocInf[1]/Nb/text()");
// System.out.println("\tskidNmbr::::" + kidNmbr);
// added as an required by IBS team
creditNotification.setMemo3(kidNmbr);
if (kidNmbr != null) {
creditNotification.setKid(kidNmbr);
if (kidNmbr.matches("^\\d{18}")) {
creditNotification
.setCustomerNumber(IBS2BankUtility.getKidsCustomerNumber(kidNmbr));
// logger.debug("custNumber:::" +
// custNumber);
creditNotification.setInvoiceNumber(IBS2BankUtility.getKidsInvoiceNumber(kidNmbr));
// logger.debug("custInvoice:::" +
// custInvoice);
} else if (kidNmbr.matches("^\\d{10}")) {
creditNotification.setInvoiceNumber(IBS2BankUtility.getKidsInvoiceNumber(kidNmbr));
}
}
}
String prtryCodeType = getXpathValue(vn, "RfrdDocInf[2]/Tp/CdOrPrtry/Prtry/text()");
// System.out.println("prtryCodeType :::" +
// prtryCodeType);
if (prtryCodeType != null
&& prtryCodeType.equalsIgnoreCase(IBS2BankConstants.PROPRIETARY_CODE_AGJ)) {
// added as an required by IBS team
creditNotification.setMemo4(getXpathValue(vn, "RfrdDocInf[2]/Nb/text()"));
}
credNotificationList.add(creditNotification);
}
ap1.resetXPath();
vn.pop();
}
我已经更新了XML和代码推送(文本)是用于保存当前位置的状态,第二个同时使用,因为RmtInf
有多个Strd
,我想遍历它。现在上面的代码工作,但它需要花费大量的时间来解析XML文件大小为600 MB。VTD-XML获得子节点和元素
请编辑您发布的,而不是增加额外的信息发表评论。 – hotzst
你可以编辑你的文章,让我更容易看到你的java代码吗? –
由于您正在使用vtd-xml扩展,您是否拥有一个巨大的文档(即大于2 GB)? –