> This is probably a dumb question, but wandering through the API docs
> wasn't enlightening.
> Is there an entry point in the Saxon API that will let me construct a
> new NodeList of "random" nodes. I have an extension function that's
> wandered over a tree and made some annotations in a private data
> structure. Now I want to write another function that can return a set
> of nodes from that tree based on criteria from the annotations.
> The extension function docs say I should return a NodeList to do this,
> but how do I build the NodeList?
I guess you're using 6.5 - this is substantially changed in 7.0, because of
the introduction of sequences.
NodeList is a DOM class, you can write your own implementation of NodeList,
so long as the nodes it contains are Saxon nodes. Alternatively, use Saxon's
implementation of NodeList, which is com.icl.saxon.expr.NodeSetExtent. You
can supply the list of nodes as an array or a Vector. (You also need to
supply a NodeComparer, which is a bit of unnecessary nonsense that I got rid
of in 7.0: effectively, this is the Controller, so supply
You might find it simpler to return an implementation of
com.icl.saxon.NodeEnumeration, which Saxon will call to deliver the nodes
one at a time. This will migrate better to 7.0, where returning an iterator
over the nodes becomes the preferred option.