KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > saxon > event > SequenceCopier


1 package net.sf.saxon.event;
2
3 import net.sf.saxon.om.SequenceIterator;
4 import net.sf.saxon.om.Item;
5 import net.sf.saxon.om.NodeInfo;
6 import net.sf.saxon.trans.XPathException;
7
8 /**
9  * 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, SequenceReceiver out) throws XPathException {
18         out.open();
19         while (true) {
20             Item item = in.next();
21             if (item == null) {
22                 break;
23             }
24             out.append(item, 0, NodeInfo.ALL_NAMESPACES);
25         }
26         out.close();
27     }
28 }
29
30 //
31
// The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
32
// you may not use this file except in compliance with the License. You may obtain a copy of the
33
// License at http://www.mozilla.org/MPL/
34
//
35
// Software distributed under the License is distributed on an "AS IS" basis,
36
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
37
// See the License for the specific language governing rights and limitations under the License.
38
//
39
// The Original Code is: all this file.
40
//
41
// The Initial Developer of the Original Code is Michael H. Kay.
42
//
43
// Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
44
//
45
// Contributor(s): none.
46
//
47
Popular Tags