You basically need to feed SAX events into a ReceivingContentHandler which in turn pushes events into a TinyBuilder. So it will be something like this:
Configuration config = new Configuration();
PipelineConfiguration pipe = config.makePipelineConfiguration();
TinyBuilder builder = new TinyBuilder();
ReceivingContentHandler rch = new ReceivingContentHandler();
.. feed SAX events to rch ...
NodeInfo doc = builder.getCurrentRoot();
I can't be sure this is complete, I may have omitted some detail.


Michael Kay

From: Erik Vanherck []
Sent: 07 April 2010 13:29
Subject: [saxon] Constructing a tiny tree from SAX events



I was looking at TinyTree to buffer an XML in memory which needs to be kept for some time until some other work  completes and then needs to be passed in to Saxon. Using DOM or even going back to serialized bytes would mean a significant overhead, in terms of constructing both representations as well as memory, not to mention the performance hit Saxons transformation would take. Configuration.buildDocument() is exactly what I was looking for from an inputstream but I got one code path which is a SAX handler receiving events and couldn’t figure out what the proper API is to construct a tinytree in a push order. Any hints would be much appreciated.


Wih kind regards,


Erik Vanherck

Product Delivery Manager


Phone: +32 3 821 01 70

Office Fax: +32 3 821 01 71


Inventive Designers' Email Disclaimer:

This message has been scanned for viruses and
dangerous content, and is believed to be clean.