请问,分析一个 XML 文件 (参看底部),想汇总成文档成 1 Ruby The Ruby Way 2 Space The Case for Mars
appPathArray.each do |i|
puts i
doc.elements.each("library/section") { |e| puts e.attributes["name"] }
doc.elements.each("library/section") { |e| puts e.elements["title"].text }
end
问题是,上边代码第三四行,如何控制输出第 i 行?类似 doc.elements.each("library/section") { |e| puts e(i).attributes["name"] } 谢谢
The Ruby Way Hal Fulton Second edition. The book you are now reading. Ain't recursion grand? The Case for Mars Robert Zubrin Pushing toward a second home for the human race. First Man: The Life of Neil A. Armstrong James R. Hansen Definitive biography of the first man on the moon.