Following is my code wherein I am reading from an XML file
require ‘xmlconfigfile’
data = XmlConfigFile.new(‘script_data.xml’)
data.no_hash_key_element_path = true
data.expand_attributes = true
senddata =
data.get_parameters("/TEST_SCRIPT/TXN[@value=‘1’]/SEND[@request=‘INVITE’]/*")
p senddata
OUTPUT is as follows*
{“MODIFY_2.uri”=>“tel:[email protected]”, “MODIFY_1”=>nil,
“MODIFY_3.mname”=>“REGister”, “MODIFY_3.header”=>“req_line”,
“MODIFY_2”=>nil, “MODIFY_3”=>nil, “MODIFY_1.header”=>“from”,
“REMOVE.header”=>“call_id”, “MODIFY_2.mname”=>“InVIte”,
“MODIFY_1.tag”=>“12345”, “MODIFY_2.header”=>“req_line”, “REMOVE”=>nil}
script_data.xml(XML File) is as follows******
<TEST_SCRIPT>
<MODIFY_1 header = ‘from’ tag=‘12345’/>
<MODIFY_2 header = ‘req_line’ mname = ‘InVIte’ uri =
‘tel:[email protected]’ />
<MODIFY_3 header = ‘req_line’ mname = ‘REGister’ />
Query:
How can I get the hash values such that when I call “MODIFY_2.uri” it
must return “tel:[email protected]” and so on…,
Thanks,
Naresh