I have some code written that basically looks like below.  I want to
design a Module, Method, Class, Whatever to make each xml component
accessible by a method and the ability to set attribs, params, clear
params, attribs, etc.  I know how to implement the code to do all of
this, but I don't have any experience in created object oriented
implementations (background is all scripting, and some C so used to
making functions).  Would appreciate any advice on how to make this OO.

#1/usr/bin/ruby

require 'rubygems'
require 'xml_struct'
require 'uuidtools'

setuprequest = lambda { |a|

    XMLVER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"

    msguuid = UUID.random_create.to_s

    rqstuuid = UUID.random_create.to_s

    a.MyWrpWrp = {:xmlns => "mtvnCWWrpReq"}

    a.MyWrpWrp.MyWrpVer="1.0"

    a.MyWrpWrp.MsgUUID="#{msguuid}"

    a.MyWrpWrp.YoYoParms.SrcID

    a.MyWrpWrp.YoYoParms.TestInd

    a.MyWrpWrp.Wrp.WrpParms

    a.MyWrpWrp.Wrp.WrpParms.ApplID

    a.MyWrpWrp.Wrp.WrpParms.WrpID

    a.MyWrpWrp.Wrp.WrpParms.WrpVer

    a.MyWrpWrp.Wrp.WrpParms.RqstUUID="#{rqstuuid}"

    a.MyWrpWrp.Wrp.WrpParms.RoutingID

    a.MyWrpWrp.Wrp.WrpParms.Src.CustDefMsgSrc1

    a.MyWrpWrp.Wrp.BigWrap.LilWrap

    a.MyWrpWrp.Wrp.BigWrap.LilWrap.Mom

    a.MyWrpWrp.Wrp.BigWrap.LilWrap.Dad

    a.MyWrpWrp.Wrp.MsgData

    return a
}

request = XmlStruct.new

setuprequest.call(request)

puts request.to_s

Thanks,

Nathan

-- 
Posted via http://www.ruby-forum.com/.