From: Robert Klemme Date: 2007-12-12T16:55:08+09:00 Subject: Re: using if block_given? method. On 12.12.2007 04:44, dare ruby wrote: > Hi everybody, > > I have created a simple parser. i have used @tag method to store tag > start and tag end. my requirement is how to read attributes and its > values when it has more than one attributes like, > This is the input string, > > > > I need output like > > tag start : aaa > attribute name: size > attribute value : 100 > attribute name : name > attribute value : size > tag end : aaa > > i have read character by character and i have executed tag start and tag > end. > i have read attribute naes and values also but my program actually not > displaying it properly like my output is > > tag start : aaa > attribute name : name > attribute value : size > tag end : aaa > > my program is actually rewritting the old ones. i have used @tag to > store tag start and tag end and i have called thosed using if > block_given? method. i have used parse_attribute, parse_attribute_value > method to read attribute names and values. How tyo make it work properly > when multiple atrribute names and values are given. I am not really sure what you are asking here but in case you are parsing XML: did you consider using an XML parser, for example REXML in stream mode? robert