> From: bill lam
> 
> The same information in xml format is also available from that
> website. 

Yes that makes the x2j specification much simpler. The only potential downside 
is that the full name of the currency is not available in the XML download.

Another optimisation to consider is to convert the table of boxed data to an 
inverted table as per http://www.jsoftware.com/jwiki/Essays/Inverted%20Table

NB. ===============================================================
NB. Script

require 'xml/sax/x2j web/gethttp tables/dsv pack'

NB. Source of exchange rate data...
URL=: 'http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml'

x2jclass 'forex'

'Items' x2jDefn
  /              :=  table                   : table=: ,:'Currency';'Value'
  Cube/Cube/Cube :=  table=: table,cur;rte   : 'cur rte'=: atr'currency rate'
)

Note 'Steps To Run'
CurrencyTable=: makenum process_forex_ gethttp URL
'CHF' pget CurrencyTable
('GBP';'CHF') psel CurrencyTable
)
NB. ===============================================================

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to