我必须像这样解析一个xml文件
<?xml version="1.0" encoding="UTF-8"?>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:camt.054.001.04 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:iso:std:iso:20022:tech:xsd:camt.054.001.04 camt.054.001.04.xsd">
<BkToCstmrDbtCdtNtfctn>
<Ntfctn>
<Ntry>
<NtryDtls>
<Btch><NbOfTxs>11</NbOfTxs></Btch>
<TxDtls>
<Refs><AcctSvcrRef>170920CH026MFE07</AcctSvcrRef><Prtry><Ref>170920CH026MFE07</Ref></Prtry></Refs>
<Amt Ccy="CHF">50.00</Amt>
<CdtDbtInd>CRDT</CdtDbtInd>
<BkTxCd><Domn><Cd>PMNT</Cd><Fmly><Cd>RCDT</Cd><SubFmlyCd>ATXN</SubFmlyCd></Fmly></Domn></BkTxCd>
<RltdPties><Dbtr><Nm>Dupond Jacques</Nm><PstlAdr><AdrLine>Avenue de la Gare 16</AdrLine><AdrLine>1950 Sion</AdrLine></PstlAdr></Dbtr><DbtrAcct><Id><IBAN>CH0210565000H01320398</IBAN></Id></DbtrAcct></RltdPties>
<RltdAgts>
<DbtrAgt><FinInstnId><ClrSysMmbId><MmbId>765</MmbId></ClrSysMmbId><Nm>Banque Cantonale du Valais</Nm><PstlAdr><AdrLine>Place des Cèdres 8</AdrLine><AdrLine>1951 Sion/Sitten</AdrLine></PstlAdr></FinInstnId></DbtrAgt>
</RltdAgts>
<RmtInf><Strd><CdtrRefInf><Tp><CdOrPrtry><Prtry>ISR Reference</Prtry></CdOrPrtry></Tp><Ref>010000000039630008930301504</Ref></CdtrRefInf><AddtlRmtInf>?REJECT?0</AddtlRmtInf></Strd></RmtInf>
<RltdDts><AccptncDtTm>2017-09-20T20:00:00</AccptncDtTm></RltdDts>
</TxDtls>
<TxDtls>
<Refs><AcctSvcrRef>170920CH026O37E1</AcctSvcrRef><EndToEndId>NOTPROVIDED</EndToEndId><Prtry><Tp>01</Tp><Ref>170920CH026O37E1</Ref></Prtry></Refs>
<Amt Ccy="CHF">30.00</Amt>
<CdtDbtInd>CRDT</CdtDbtInd>
<BkTxCd><Domn><Cd>PMNT</Cd><Fmly><Cd>RCDT</Cd><SubFmlyCd>ATXN</SubFmlyCd></Fmly></Domn></BkTxCd>
<RltdPties>
<Dbtr><Nm>Monsieur Gilbert Dayer und</Nm><PstlAdr><AdrLine>Madame Laurence Darabie</AdrLine><AdrLine>1967 Bramois</AdrLine></PstlAdr></Dbtr>
<DbtrAcct><Id><IBAN>CH0700556031023502008</IBAN></Id></DbtrAcct>
</RltdPties>
<RltdAgts>
<DbtrAgt>
<FinInstnId>
<ClrSysMmbId><MmbId>765</MmbId></ClrSysMmbId>
<Nm>Banque Cantonale du Valais</Nm>
<PstlAdr><AdrLine>Place des Cèdres 8</AdrLine><AdrLine>1951 Sion/Sitten</AdrLine></PstlAdr>
</FinInstnId>
</DbtrAgt>
</RltdAgts>
<RmtInf><Strd><CdtrRefInf><Tp><CdOrPrtry><Prtry>ISR Reference</Prtry></CdOrPrtry></Tp><Ref>010000000018630005104202604</Ref></CdtrRefInf><AddtlRmtInf>?REJECT?0</AddtlRmtInf></Strd></RmtInf>
<RltdDts><AccptncDtTm>2017-09-20T20:00:00</AccptncDtTm></RltdDts>
</TxDtls>
</NtryDtls>
</Ntry>
</Ntfctn>
我必须在节点 TxDtls 之间获取信息。我希望各得一个。那可能吗?
我试过这个
Public Sub getNom()
Dim oXML As MSXML2.DOMDocument
Dim oNode As MSXML2.IXMLDOMNode
Dim oNodeList As MSXML2.IXMLDOMNodeList
Dim oSubNode As MSXML2.IXMLDOMNode
Dim name, value As String
Set oXML = New MSXML2.DOMDocument
oXML.async = False
oXML.Load (txtNomFichier) '"C:\XMLFileXMLIndent.xml"
' 1 niveau plus bas
For Each oNode In oXML.SelectNodes("//TxDtls")
Debug.Print oNode.Text
Next
End Sub
通过这个,它成为每个节点 TxDtls 的所有行。但是如何获取 TxDtls 的每个子节点?谢谢你的帮助。