On Sat, 2006-05-20 at 06:06 +0900, Brian Cowdery wrote: > my xml looks like this > <script> > <project-name></project-name> > <start-url></start-url> > > <test-case id="1"> > <test-step id="1"> > <test> > <interaction>double click</interaction> > <element> > <name>button 1</type> > <type>button</type> > <element> > </test> > <check> > <element> > <name>Page title</type> > <type>text</type> > <element> > </check> > </test-step> > > <test-step id="2"> > ... > </test-step> > </test-case> > > <test-case id="2"> > ... > </test-case> > </script> > > somehow i have to get THAT modeled into an object > script object contains test-cases, test-cases contain test-steps etc.... Looks like an ideal DigestR[1] opportunity, if you're able to get Libxml-ruby installed too(*): #!/usr/local/bin/ruby require 'xml/digestr' require 'pp' class Script attr_accessor :name, :starturl, :testcases def initialize; @testcases = []; end end class TestCase attr_accessor :id, :steps def initialize; @steps = []; end end class TestStep attr_accessor :id, :tests, :checks def initialize; @tests, @checks = [], []; end end class Check attr_accessor :elements def initialize; @elements = []; end end class Test < Check attr_accessor :interaction end class Element attr_accessor :name, :type end d = XML::Digester.new(true) d.add_object_create('/script', Script) d.add_call_method('/script/project-name', :name=) d.add_call_param('/script/project-name') d.add_call_method('/script/start-url', :starturl=) d.add_call_param('/script/start-url') d.add_object_create('/script/test-case', TestCase) d.add_set_properties('/script/test-case') d.add_link('/script/test-case') { |sc,tc| sc.testcases << tc } d.add_object_create('/script/test-case/test-step', TestStep) d.add_set_properties('/script/test-case/test-step') d.add_link('/script/test-case/test-step') { |tc,ts| tc.steps << ts } d.add_object_create('/script/test-case/test-step/test', Test) d.add_link('/script/test-case/test-step/test') { |ts, t| ts.tests << t } d.add_call_method('/script/test-case/test-step/test/interaction', :interaction=) d.add_call_param('/script/test-case/test-step/test/interaction') d.add_object_create('/script/test-case/test-step/check', Check) d.add_link('/script/test-case/test-step/test') { |ts, t| ts.checks << t } d.add_object_create('*/element', Element) d.add_link('*/element') { |p, ele| p.elements << ele } d.add_call_method('*/element/name', :name=) d.add_call_param('*/element/name') d.add_call_method('*/element/type', :type=) d.add_call_param('*/element/type') script = d.parse_file('watir.xml') pp script __END__ This outputs (with the data you posted, with some mismatched close tags fixed up): #<Script:0xb7e8d64c @name="My Project", @starturl="http://localhost:3000/", @testcases= [#<TestCase:0xb7edcaec @id="1", @steps= [#<TestStep:0xb7edae90 @checks= [#<Test:0xb7ed9978 @elements=[#<Element:0xb7ed7dbc @name="button 1", @type="button">], @interaction="double click">], @id="1", @tests= [#<Test:0xb7ed9978 @elements=[#<Element:0xb7ed7dbc @name="button 1", @type="button">], @interaction="double click">]>, #<TestStep:0xb7e63ff0 @checks=[], @id="2", @tests=[]>]>, #<TestCase:0xb7e63a14 @id="2", @steps=[]>]> Which I think is what you're after? [1]: http://digestr.rubyforge.org/ (*): If you can't/won't install native extensions, DigestR's API is intended to be mostly compatible with an older, REXML-based (IIRC) digester at http://rubyforge.org/projects/xmldigester -- Ross Bamford - rosco / roscopeco.REMOVE.co.uk