Understanding the PageProcessor

Release 1.0 - ...

Unlike its predecessors, the Smartsite PageProcessor is built on standard Xml technology, the .NET framework's XmlTextReader class. This class processes Xml in "firehose" cursor mode, similar to the SAX parser, and unlike the XML DOM parser: 

The SAX API was one of the first attempts in the XML community to solve the problem of parsing large XML documents. The SAX parser uses a streaming model that moves through a document piece by piece and doesn't retain a copy of the nodes once they are traversed. A client implements a set of interfaces that are called by the parser when it passes over nodes in the document. Methods are called for the document, elements, attributes, and other types of nodes. This type of API is called a "push model" because the document information is pushed from the parser to the client. The middle part of Figure 1 illustrates the SAX approach to parsing.

The downside of this approach is that keeping track of the current context of an element or attribute in a complex document can be difficult. The client code must provide some sort of state model to guide its actions. Another limitation is that the client must implement all interface methods, and the methods are always called by the parser, regardless of whether the client is interested in them.

Microsoft recognized the state of parsers in the XML world and designed an efficient XML API that was also simple to use. Microsoft borrowed a concept from the "firehose" cursor used in ADO. The XmlReader abstract class describes an interface that provides a read-only, forward-only cursor model over the nodes in an XML document. It is called a "pull model" because the client pulls the data from the XmlReader a piece at a time and has control of moving the cursor along the document. The bottom part of Figure 1 contrasts the access methods of the XmlReader with those of the DOM and the SAX models.

(Source: http://www.peachpit.com/articles/article.asp?p=23776&rl=1)

 

Topics