XML is here: http://www.treasury.gov/resource-center/data-chart-center/interest-rates/Datasets/ltcompositeindex.xml
But I am using a proxy on my server, cross-domain/same-origin is not an issue.开发者_Python百科
It's organized by "Quote Date" and I need to get the most current rate which is always last, I think. Any idea for the best way to get it? A timestamp won't work because today's date could be a weekend or holiday. In this simplified example of the data I would only like to print,
"Date: 12-OCT-11, Rate: 2.87"
Thanks!
<G_QUOTE_DATE>
<QUOTE_DATE>11-OCT-11</QUOTE_DATE>
<RATE_TYPE>BC_20year</RATE_TYPE>
<G_RATE>
<RATE>1000.87</RATE>
</G_RATE>
</G_QUOTE_DATE>
<G_QUOTE_DATE>
<QUOTE_DATE>12-OCT-11</QUOTE_DATE>
<RATE_TYPE>BC_20year</RATE_TYPE>
<G_RATE>
<RATE>2.87</RATE>
</G_RATE>
</G_QUOTE_DATE>
Try an XPath like this:
//QUOTE_DATE[last()]/G_RATE/RATE
精彩评论