From: Andrew Cox Date: 2005-06-10T07:38:26+09:00 Subject: Combining XmlMarkup objects? Is it possible to create an XmlMarkup object and then populate the nodes within another method? What I'm trying to do is create an XmlMarkup object, start it off .... and then add nodes to it in another method. Here's the basic code (that isn't exactly working). The log_results method will be called from another location. What I want the final result to look like is something like: PASSED FAILED What I've been able to do is attach the internal nodes to the @xml variable, but I can't get them inside a containing node. In the code below, @results does have all of the XML in it, but I can't figure out how to stick it into the @xml object. Is this even possible? The initialize method is called first (obviously) and the log_results method is called several times from another class and then finally the end_log method is called. == def initialize(fileName, logsToKeep, maxLogSize, xmlFileName ) @logfile = File.new(xmlFileName, "w") @xml = XmlMarkup.new(:target=>@logfile, :indent=>2) @xml.instruct! #insert processing instruction @results = XmlMarkup.new end def log_results(name, input, expected, test_status) r = XmlMarkup.new(:target=>@results, :indent=>2) r.result(:testcase => name) do r.status(test_status) end #results tag end #log_results def end_log @xml.results do @results end @logfile.close end #end_log == Drew Cox