0
你好,我想從xml解析一個特定的信息。在那個XML代碼中,我想讀取美元的ForexBuying。我得到MSGBOX時,它的美元,但我想看到它ForexBuyingxml用vbscript解析
我很新在VBScript請幫我
Sub GetExchangeRate()
Dim xmlDoc, Currencyy, plot, ForexBuying
Set xmlDoc = CreateObject("Msxml2.DOMDocument")
xmlDoc.load("......\exchange.xml")
Set Currencyy = xmlDoc.getElementsByTagName("CurrencyName")
If Currencyy.length > 0 Then
For Each x In Currencyy
If x.text="US DOLLAR" Then
MsgBox(x.Text)
End If
Next
Else
MsgBox("Parse Error")
End If
End Sub
Call GetExchangeRate()
XML:
<Tarih_Date Tarih="01.10.2014" Date="10/01/2014" Bulten_No="2014/189">
<Currency CrossOrder="0" Kod="USD" CurrencyCode="USD">
<Unit>1</Unit>
<Isim>ABD DOLARI</Isim>
<CurrencyName>US DOLLAR</CurrencyName>
<ForexBuying>2.2829</ForexBuying>
<ForexSelling>2.2871</ForexSelling>
<BanknoteBuying>2.2813</BanknoteBuying>
<BanknoteSelling>2.2905</BanknoteSelling>
<CrossRateUSD>1</CrossRateUSD>
<CrossRateOther></CrossRateOther>
</Currency>
<Currency CrossOrder="1" Kod="AUD" CurrencyCode="AUD">
<Unit>1</Unit>
<Isim>AVUSTRALYA DOLARI</Isim>
<CurrencyName>AUSTRALIAN DOLLAR</CurrencyName>
<ForexBuying>1.9833</ForexBuying>
<ForexSelling>1.9962</ForexSelling>
<BanknoteBuying>1.9742</BanknoteBuying>
<BanknoteSelling>2.0082</BanknoteSelling>
<CrossRateUSD>1.1484</CrossRateUSD>
<CrossRateOther></CrossRateOther>
</Currency>
</Tarih_Date>
一般暗示,沒有'Optio時使用'Dim'沒有任何好處n在腳本的第一行顯示。你*絕對應該*在腳本的第一行中。 – Tomalak 2014-10-01 17:27:18