From: Robert Klemme Date: 2005-05-02T04:49:27+09:00 Subject: Re: parsing xml documents using rexml "Derek" schrieb im Newsbeitrag news:001901c54e3d$713334c0$a0b21cd3@dhaskin... Hi, I'm new to ruby. I want to use ruby to process an xml file. At the moment I am using the REXML but are open to other xml parsers. In the xml file below how would I go about processing the section
in the following way: - - when the tag is detected perform a method "copy". within the "copy" method extract other child tags within the current element. - when the tag is detected perform a method "mkdir". within the "mkdir" method extract other tags within the current element. I've looked at using XPATH, and have been able to extract specific information but have not worked out how to do it. here is a sample xml file: - This can state one or multiple applications Person from development who create this file This is a sample File group xml
//myPath/to/File.txt target directory path goes here //myPath/to/File2.txt target directory path goes here relative/Path
Without an actual implementation I think you need two levels of iteration here: you iterate through all "copy" and "mkdir" elements that are childs of "details" and then for each of them you need to collect specific child data. That's the way I would try to approach this. HTH Kind regards robert