Extract values from Hash map

N

Naresh Ramaswamy

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>
<TXN value = '1'>
<SEND request = 'INVITE'>
<MODIFY_1 header = 'from' tag='12345'/>
<MODIFY_2 header = 'req_line' mname = 'InVIte' uri =
'tel:[email protected]' />
<MODIFY_3 header = 'req_line' mname = 'REGister' />
<REMOVE header = 'call_id' />
</SEND>
</TXN>
******************************************

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top