On 2/16/07, ara.t.howard / noaa.gov <ara.t.howard / noaa.gov> wrote: > On Sat, 17 Feb 2007, Tim Pease wrote: > > > On 2/16/07, ara.t.howard / noaa.gov <ara.t.howard / noaa.gov> wrote: > >> > >> NAME > >> > >> xx > >> > >> > > > > For some reason I want a Mexican beer at lunch now ;) > > > > Clever use of method missing, though. Can this package generate XML > > tags that contain a dash '-' character? > > > > TwP > > > > harp:~ > cat a.rb > require "xx" > include XX::XML > > legs = 1,2,3,4 > > doc = xml_{ > _('furniture:table'){ > legs.each do |leg| > _ "furniture:leg-#{ leg }", leg > end > } > } > > puts doc.pretty > > > harp:~ > ruby a.rb > <?xml version='1.0'?> > <furniture:table> > <furniture:leg-1>1</furniture:leg-1> > <furniture:leg-2>2</furniture:leg-2> > <furniture:leg-3>3</furniture:leg-3> > <furniture:leg-4>4</furniture:leg-4> > </furniture:table> > > > cheers. > So simple! The XML namespace example should have clued me in -- need more coffee. As Tim Becker mentioned, this is a lot like Markaby, but it fixes some of Markaby's shortcomings -- mainly support for valid XML tag characters not currently allowed in method_missing and/or symbols. Thanks Ara. Thanks Dan. TwP