I need to create a simple XML parser using a state machine. I know I'm going to be user push_back when i get a valid tag and pop_back to start verifying the tag when I reach </ but I am unsure as to how to go about creating the state machine for this. The problem I am having is the fact that since I am reading char by char, if I get the char < , I always have to read again to see if the / is there or what. Anyone got a heads up on how to create a complex parser using a state machine like this?