Meteorの更新

Meteorの現状の問題点その7でelementメソッドの結果を
キャッシュする方向を考えていたけれど、方針を変更。
混合内容の要素((X)HTMLのtrタグ等)をループさせる場合、
elementの返り値をElement#newでコピーして利用する。

以前掲載したtest_xml.rbは次のようにも書けます。

#!bin ruby
# -* coding: UTF-8 -*-
require 'meteor' 

pf = Meteor::ParserFactory.build(Meteor::Parser.XML,"test.xml", "UTF-8")
ps = pf.getParser
#puts ps.document
elm1 = ps.element("test","manbo","manbo")
elm1.attribute("id2","cc")
co_ps = ps.child(elm1)
elm5_ = co_ps.element("tech")
10000.times { |i|
  co_ps.attribute("manbo",i.to_s)
  elm5 = Element.new(elm5_)
  elm5.attribute("eco","ema")
  elm5.content(i.to_s)
  co_ps.print
}
co_ps.flush
ps.print
puts ps.document