01: package net.sf.saxon.pull;
02:
03: import net.sf.saxon.trans.XPathException;
04:
05: /**
06: * A PullConsumer consumes all the events supplied by a PullProvider, doing nothing
07: * with them. The class exists so that PullFilters on the pipeline can produce side-effects.
08: * For example, this class can be used to validate a document, where the side effects are
09: * error messages.
10: */
11:
12: public class PullConsumer {
13:
14: private PullProvider in;
15:
16: public PullConsumer(PullProvider in) {
17: this .in = in;
18: }
19:
20: /**
21: * Consume the input
22: * @throws net.sf.saxon.trans.XPathException
23: */
24:
25: public void consume() throws XPathException {
26: while (true) {
27: if (in.next() == PullProvider.END_OF_INPUT) {
28: return;
29: }
30: }
31: }
32: }
33:
34: //
35: // The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
36: // you may not use this file except in compliance with the License. You may obtain a copy of the
37: // License at http://www.mozilla.org/MPL/
38: //
39: // Software distributed under the License is distributed on an "AS IS" basis,
40: // WITHOUT WARRANTY OF ANY KIND, either express or implied.
41: // See the License for the specific language governing rights and limitations under the License.
42: //
43: // The Original Code is: all this file.
44: //
45: // The Initial Developer of the Original Code is Michael H. Kay.
46: //
47: // Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
48: //
49: // Contributor(s): none.
50: //
|