0

I have this XML; https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml and i need to parse to generate a JSON. I have this template

require 'json'
require 'rexml/document'
include REXML

def main(orchAttr, inputMap)
    jsonIn = JSON.parse(inputMap) 
    jsonOut = JSON.parse("{}") 
    
    #XML Example
    #xml_str = jsonIn["response"] 
    #doc = Document.new(xml_str)  
    #city = doc.elements["AddressValidateResponse/Address/City"].text
    #jsonOut["city"] = city
    
    return JSON.generate(jsonOut)
end

but when I did some modifications, I got an error.

I modified this line

#city = doc.elements["AddressValidateResponse/Address/City"].text

with the XML elements

Adriaan
  • 17,741
  • 7
  • 42
  • 75
JDE
  • 1

1 Answers1

0

why don't you use ecb api rest? it's useful for orchestrator process and you can get exchange rate and add to P0015A with a form request https://sdw-wsrest.ecb.europa.eu/help/