如何使用VBA提取html xml。我想获得“4.2117”的价值。
<ExchangeRatesSeries xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Table>A</Table>
<Currency>euro</Currency>
<Code>EUR</Code>
<Rates>
<Rate>
<No>121/A/NBP/2017</No>
<EffectiveDate>2017-06-26</EffectiveDate>
<Mid>4.2117</Mid>
</Rate>
</Rates>
</ExchangeRatesSeries>
答案 0 :(得分:0)
我使用xhttp resuest从https://api.nbp.pl/api/exchangerates/rates/a/eur/
获取XML并在Output Div中显示结果。
希望这就是你要找的东西。
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var result = JSON.parse(this.responseText);
document.getElementById("output").innerHTML = result['rates'][0]['mid'];
}
};
xhttp.open("GET", "https://api.nbp.pl/api/exchangerates/rates/a/eur/", true);
xhttp.send();
<div id="output">
Please Wait
</div>