Components of XML processor
Stage 1: In this stage, the application parses and validates the source document; recognizes and searches for relevant information based on its location or its tagging in the source document; extracts the relevant information when it is located; and, optionally, maps and binds the retrieved information to business objects.
Stage 2: Business logic handling. This is the stage in which the actual processing of the input information takes place. It might result in the generation of output information.
Stage 3: XML output processing. In this stage, the application constructs a model of the document to be generated with the Document Object Model (DOM). It then either applies XSLT style sheets or directly serializes to XML.
Event switcher:- The event switcher receives a stream of tokens from the parser and sorts them according to function, like a switchboard telephone operator of old. Some tokens signal that a change in behaviour is necessary. These are called events. One event may be that a processing instruction with a target keyword significant to the XML processor has been found. Another may be that a <title> element has been seen, signalling the need for a font change. What the events are and how they are handled are up to the particular processor. On receiving an event, it routes processing to a subroutine, which is called an event handler or sometimes a call-back procedure. This is often all that the XML processor needs to do, but sometimes more complex processing is required, such as building and operating on an internal tree model.
Tree representation:- The tree representation can take many forms, but there are two main types.
i)The first is a simple structure consisting of a hierarchy of node lists. This is the kind of structure you would find in a non-object- oriented approach.
ii)The other kind is called an object model, where every node is represented as an object. In a programming phrase, an object is a package of data and routines in a rigid, cloudy framework. This style is preferred for large programs, because it minimizes certain types of bugs and is usually easier to visualize. Object trees are expensive in terms of speed and memory, but for many applications this is an acceptable trade-off for convenience of development.
Tree processor :- The tree processor is the part of the program that operates on the tree model. It can be anything from a validity checker to a full-blown transformation engine. It traverses the tree, usually in a methodical, depth-first order in which it goes to the end of a branch and backtracks to find the last unchecked node. Often, its actions are controlled by a list of rules, where a rule is some description of how to handle a piece of the tree. For example, the tree processor may use the rules from a stylesheet to translate XML markup into formatted text.
- answered 6 years ago
- B Butts