Another scheme for document factories...

Jonsm at aol.com Jonsm at aol.com
Tue Oct 13 17:59:07 BST 1998


This works off of the assumption that the host application's document factory
has two modes, a light weight mode where it just builds nodes in memory, and a
heavy weight mode where it has been turned the nodes into a display object or
output to a file. This eliminates the need for a special chaining DF.

James Clark has an interesting API for a document factory in XT (the result
object). It supports a DF can write to a file without constructing a tree in
memory. He achieves node output by recursing after writing the start tag. This
allows only one copy of the document tree to be in memory when processing
large documents.

To allow chaining I've extended this scheme by breaking the document node into
two pieces, the pointers describing the tree structure and the actual data in
the node. My default DF supports rapid stylesheet chaining by implementing a
fastcopy method. This method builds a new tree structure for the node and just
references the original node contents. 

The following syntax allows specifying the DF at each stage of processing....

<?xml version="1.0" encoding="ISO-8859-1"?>
	// give the default DF a new set of bindings
<?xdf bind="objectmap"?>
	// load the stylesheet into memory
	// run the last application, there is none so load the rest of the input
document in light weight mode
	// change the application to xsl 
<?xsl xsl="koala1.xsl"?>
	// reset the DF to default bindings
<?xdf xdf=""?>
	// load the stylesheet into memory
	// run the last application, xsl, this will cause a new tree to be built in
light weight mode	// change the application to xsl 
<?xsl xsl="koala2.xsl"?>
	// set a different DF and give it a set of bindings
<?xdf xdf="myfactory3" bind="objectmap3"?>
	// run the last application, xsl
	// since there are no more PIs  this will cause a new tree to be built in
heavy weight mode
<first tag of document>


<?xml version="1.0" encoding="ISO-8859-1"?>
	// run the last application, there is none so load the rest of the input
document in light weight mode
<?xsl xsl="koala1.xsl"?>
	// run the last application, xsl, , this will cause a new tree to be built in
light weight mode
<?xsl xsl="koala2.xsl"?>
	// set a different DF and give it a set of bindings
<?xdf xdf="myfactory3" bind="objectmap3"?>
	// run the last application, xsl
	// since there are no more PIs  this will cause a new tree to be built in
heavy weight mode
<first tag of document>

<?xml version="1.0" encoding="ISO-8859-1"?>
	// run the last application, there is none so load the rest of the input
document in light weight mode
<?xsl xsl="koala1.xsl"?>
	// run the last application, xsl
	// since there are no more PIs  this will cause a new tree to be built in
heavy weight mode
<first tag of document>


<?xml version="1.0" encoding="ISO-8859-1"?>
	// set a different DF and give it a set of bindings
<?xdf xdf="myfactory3" bind="objectmap3"?>
	// run the last application, the default application
	// since there are no more PIs  this will cause a tree to be built in heavy
weight mode
<first tag of document>


<?xml version="1.0" encoding="ISO-8859-1"?>
	// run the last application, the default application
	// since there are no more PIs  this will cause a  tree to be built in heavy
weight mode
<first tag of document>

Jon Smirl
jonsm at aol.com

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)




More information about the Xml-dev mailing list