Junior Nunes
Junior Nunes

Reputation: 11

Read Tag Name (Node NAme) XMl VBA

I have the following XML file content:

<HldgVal>
<Amt Ccy="BRL">25641.94</Amt>
<Sgn>true</Sgn>

The "BRL" indicated is the Currency for the amount 25641.94, however, when I try to read the tag Amt Ccy="BRL" in order to get the currency symbol, I just get the node name "AMT" instead of Amt Ccy="BRL".

I am using the following code :

MoedaCaixa = fundoElement2.ChildNodes.Item(1).FirstChild.nodeName

Does anyone knows how to get the full name "Amt Ccy="BRL"" so that I can read the currency?

Thanks in advance

Upvotes: 1

Views: 1109

Answers (2)

Leandro Coelho
Leandro Coelho

Reputation: 11

AMT is the node name and Ccy is the node attribute. What you want is the node attribute value. Try this:

MoedaCaixa = fundoElement2.Attributes.getNamedItem("BRL").Text

Upvotes: 1

Wojciech Wojtulewski
Wojciech Wojtulewski

Reputation: 187

AMT is node name Ccy is node attribute

Upvotes: 1

Related Questions