Extract values from Hash map

Discussion in 'Ruby' started by Naresh Ramaswamy, Feb 16, 2009.

  1. 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:", "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:' />
    <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:" and so on..,

    Thanks,
    Naresh
    --
    Posted via http://www.ruby-forum.com/.
     
    Naresh Ramaswamy, Feb 16, 2009
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Amit Bhatia

    Hash Map slower than Map.

    Amit Bhatia, Oct 8, 2007, in forum: C++
    Replies:
    7
    Views:
    375
    =?UTF-8?B?RXJpayBXaWtzdHLDtm0=?=
    Oct 9, 2007
  2. kl
    Replies:
    7
    Views:
    1,292
    James Kanze
    Jan 1, 2008
  3. navS
    Replies:
    3
    Views:
    518
    Ismo Salonen
    May 9, 2008
  4. rp
    Replies:
    1
    Views:
    539
    red floyd
    Nov 10, 2011
  5. Srijayanth Sridhar
    Replies:
    19
    Views:
    627
    David A. Black
    Jul 2, 2008
Loading...

Share This Page