so we have two types of classesthe context class and multiple state classes the context class maintains the current stateand forwards actions to the state classes the state classes are typically hidden from any other objects that are calling the contextit acts like black box that happens to perform state management internally here' how it looks in umlstate user +process(contextcontext state state +current_state +process(context+process(context+process(state +process(contexta state example to illustrate the state patternlet' build an xml parsing tool the context class will be the parser itself it will take string as input and place the tool in an initial parsing state the various parsing states will eat characterslooking for specific valueand when that value is foundchange to different state the goal is to create tree of node objects for each tag and its contents to keep things manageablewe'll parse only subset of xml tags and tag names we won' be able to handle attributes on tags it will parse text content of tagsbut won' attempt to parse "mixedcontentwhich has tags inside of text here is an example "simplified xmlfile that we'll be able to parsedusty phillips packt publishing python object oriented programming object oriented design objects in python