Justin Bailey wrote: > Have you seen the xml builder project? It's along the same lines but gives a > much cleaner syntax. Your example could be done along these lines: > > xml.GovTalkMessage :xmlns => "http ..." { |xml| > xml.EnvelopeVersion "2.0" > xml.Header { > xml.MessageDetails { > etc, etc > } > } > } > > Check it out http://rubyforge.org/projects/builder/ I don't like the reuse of xml inside of each of the blocks. IIRC it is why I dislike the CGI library. Visually it looks like everything gets appended right to xml, although thinking twice I know that the block scope is actually where the xml addition takes place. xml.MyTag :xmlns+."..." { |xml| xml.ATag "2.0" xml.BTag { xml.CTag { xml.DTAG { ....etc.... } } } } The above makes me think I am getting: <MyTag> <ATag /> <BTag /> <CTag /> <DTag /> </MyTag> My brain thinks this at first because of the reuse of "xml". Now thinking twice I realize that the scope takes precedence, and my brain conforms. It seems like the following would be more approriate, although it would be more typing: xml.MyTag :xmlns+."..." { |xml| xml.ATag "2.0" xml.BTag { |btag| btag.CTag { |ctag| ctag.DTAG { |dtag| ....etc.... } } } } This way I can easily visually tell that what the hiearchy looks like in my xml document w/o having to count tabs or curly braces. Zach