01: package net.sf.saxon.event;
02:
03: import net.sf.saxon.om.SequenceIterator;
04: import net.sf.saxon.om.Item;
05: import net.sf.saxon.om.NodeInfo;
06: import net.sf.saxon.trans.XPathException;
07:
08: /**
09: * Copies a sequence, supplied as a SequenceIterator, to a push pipeline, represented by
10: * a SequenceReceiver
11: */
12: public class SequenceCopier {
13:
14: private SequenceCopier() {
15: }
16:
17: public static void copySequence(SequenceIterator in,
18: SequenceReceiver out) throws XPathException {
19: out.open();
20: while (true) {
21: Item item = in.next();
22: if (item == null) {
23: break;
24: }
25: out.append(item, 0, NodeInfo.ALL_NAMESPACES);
26: }
27: out.close();
28: }
29: }
30:
31: //
32: // The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
33: // you may not use this file except in compliance with the License. You may obtain a copy of the
34: // License at http://www.mozilla.org/MPL/
35: //
36: // Software distributed under the License is distributed on an "AS IS" basis,
37: // WITHOUT WARRANTY OF ANY KIND, either express or implied.
38: // See the License for the specific language governing rights and limitations under the License.
39: //
40: // The Original Code is: all this file.
41: //
42: // The Initial Developer of the Original Code is Michael H. Kay.
43: //
44: // Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
45: //
46: // Contributor(s): none.
47: //
|