cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From (Stephen R. Savitzky)
Subject Re: An internal processor architecture for Cocoon2 ?
Date Tue, 11 Jan 2000 18:14:03 GMT
"Clark C. Evans" <> writes:

> The Ricoh PIA system also looks like it could
> be provided as a processor architecture.  

Indeed.  I've just started pawing through the Cocoon code, to find that the
Processor interface is (currently) DOM-in, DOM-out, making a PIA-derived
Processor almost completely trivial. 

> On Wed, 29 Dec 1999, Stefano Mazzocchi wrote:
> > SAX will be used as the transport for Cocoon2, this 
> > is, in my mind, rock solid at this point.

... but since the PIA's document processor also has SAX-compatible
interfaces, this works too.  There are, however, some problems with SAX 1.0;
for example, comments and entity references aren't preserved.  This makes it
difficult to do XML-to-XML transformations (e.g., sometimes you need to pass
entity references to the client instead of expanding them on the server).

> > There will be ways to wrap your own components 
> > (producer, processor, etc...) with SAX2DOM and 
> > DOM2SAX adapters that will be provided to you.
> Yes.  This the way to go.

The interface we use is actually a DOM-compatible adaptation of SAX that
looks like a tree constructor.  The basic operations include:

  // DOM compatible:
   putNode(Node aNode); // Import the node and its children
   startNode(Node aNode); // Import a shallow copy of the node.
			  // ... and start accumulating children 

  // SAX compatible:
   startElement(String nodeName, NamedNodeMap attrs);
   putCharCata(short nodeType, String nodeName, 
	       char[] buffer, int start, int length);
This works very well because you never actually have to have a complete DOM
Document tree unless you need to do global transformations

Stephen R. Savitzky  <>  <>
Platform for Information Applications:      <>
Chief Software Scientist, Ricoh Silicon Valley, Inc. Calif. Research Center
 voice: 650.496.5710  front desk: 650.496.5700  fax: 650.854.8740 
  home: <> URL:

View raw message