I get a list as XmlNodeList
from xml document. I can get innertext values using GetElementsByTagName
. But I need read value from inner a tag. Want to read just "USD" in "Currency CrossOrder="0" Kod="USD" CurrencyCode="USD"" part.
<Currency CrossOrder="0"
Kod="USD"
CurrencyCode="USD">
<Unit>1</Unit>
<Isim>ABD DOLARI</Isim>
<CurrencyName>US DOLLAR</CurrencyName>
<ForexBuying>4.0707</ForexBuying>
<ForexSelling>4.0780</ForexSelling>
<BanknoteBuying>4.0678</BanknoteBuying>
<BanknoteSelling>4.0841</BanknoteSelling>
<CrossRateUSD />
<CrossRateOther />
</Currency>
<Currency CrossOrder="1"
Kod="AUD"
CurrencyCode="AUD">
<Unit>1</Unit>
<Isim>AVUSTRALYA DOLARI</Isim>
<CurrencyName>AUSTRALIAN DOLLAR</CurrencyName>
<ForexBuying>3.1389</ForexBuying>
<ForexSelling>3.1594</ForexSelling>
<BanknoteBuying>3.1245</BanknoteBuying>
<BanknoteSelling>3.1784</BanknoteSelling>
<CrossRateUSD>1.2938</CrossRateUSD>
<CrossRateOther />
</Currency>
For XmlReader
, <Currency CrossOrder="0" Kod="USD" CurrencyCode="USD">
is a node of Element
type.
CurrencyCode
is an attribute in this node.
If you want to get "USD", you are getting the value of CurrencyCode
attribute.
Try XmlReader.GetAttribute
method.
See Microsoft docs.