|
ParserImplementation
Implementation of in parser statemachine
The parser is implemented as a MContentHandler object with a state member. There are multiple state classes. The MContentHandler always has one state, when it encounters an xml tag or content, it inputs it into the state. If the state can accept it, it will process the xml of content, and if not, it leaves with KErrArgument. The parser is passed in an xml rpc result object which is used to store the data which is parsed out of the xml. Each state is passed in this result object on creation. There are special kinds of state which will parse values in the Xml. These have a CValue member. If this CValue member is non-NULL they own it, and should delete is on destruction, but this should only happen on exceptional cases. In a normal case, when a state receives it's endTag it passes the value of what it just found to it's parent state. They parent state then assumes ownership of the value. The MContentHandler moves to the parent state, and the current state is destroyed. The processing of tags will usually change the state of the parser, and as such change the state member of MContentHandler derivative. The processing of tags usually just append the content to a content buffer, which is then processed on receipt of the endtag. The state member of the MContentHandler is owned by the MContentHandler. The parent state of that member is owned by the member, and the member will delete it in exceptional circumstances. In normal circumstance, the endTag will transition the state machine to be in the parent state, and as this time the current state will be deleted and state member of MContentHandler set to the parent state. |