From: Peter Zotov Date: 2009-03-26T02:52:03+09:00 Subject: Re: Parsing xml Quoting "Arun Kumar" : > Peter Zotov wrote: >> Quoting "Arun Kumar" : >> >>> Hi, >>> Is there any way in Ruby to parse an xml file without using REXML or any >>> other libraries. >> >> Of course. You can write a finite state machine, read XML from file >> and parse as you want. > > Thanks. Can u please give me details of it. It is described nicely in Wikipedia: http://en.wikipedia.org/wiki/Finite_state_machine As a clue, I can recommend you define following states: "text", "opening tag", "tag attribute", "tag attribute value", "closing tag". E. g. when you are in "text" state and get "<" symbol at input sequence, you change state to "opening tag" or "closing tag"... I still have one question: why you don't use REXML? -- WBR, Peter Zotov