From: Brian Cowdery Date: 2006-05-20T06:06:21+09:00 Subject: Parsing XML into a complete domain object Recently at work we've decided to attempt to build a basic XML driven automation framework to work with Watir (a web development testing library for ruby). I cant figure out how to loop through each level of the REXML document to extract the data needed to build the complete object. It seems that if i try to use any iterators on a root.elements[] object it converts it to text so i can't nest another iterator or loop to access the innards. my only recourse has been to resort to a ton of nested while loops which is ugly when compared to most other ruby loops. eg. i = 1 while root.elements['cases'].elements[i] != nil n = 1 while root.elements['cases'].elements['test-case'] != nil #more loops here. continue down the chain until i can build the #object from the inside out. i = i+i end i = i+i end my xml looks like this somehow i have to get THAT modeled into an object script object contains test-cases, test-cases contain test-steps etc.... Any thoughts? (sorry for the long post... its kinda hard to explain without showing EVERYTHING. -- Posted via http://www.ruby-forum.com/.