01: /* $Id: StAXReaderToContentHandler.java,v 1.1 2004/06/21 18:57:53 ryan_shoemaker Exp $
02: *
03: * Copyright (c) 2004, Sun Microsystems, Inc.
04: * All rights reserved.
05: *
06: * Redistribution and use in source and binary forms, with or without
07: * modification, are permitted provided that the following conditions are
08: * met:
09: *
10: * * Redistributions of source code must retain the above copyright
11: * notice, this list of conditions and the following disclaimer.
12: *
13: * * Redistributions in binary form must reproduce the above
14: * copyright notice, this list of conditions and the following
15: * disclaimer in the documentation and/or other materials provided
16: * with the distribution.
17: *
18: * * Neither the name of Sun Microsystems, Inc. nor the names of its
19: * contributors may be used to endorse or promote products derived
20: * from this software without specific prior written permission.
21: *
22: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26: * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33: */
34: package javanet.staxutils;
35:
36: import javax.xml.stream.XMLStreamException;
37:
38: /**
39: * Common API's for adapting StAX events from {@link javax.xml.stream.XMLStreamReader}
40: * and {@link javax.xml.stream.XMLEventReader} into SAX events on the specified
41: * {@link org.xml.sax.ContentHandler}.
42: *
43: * @author Ryan.Shoemaker@Sun.COM
44: * @version 1.0
45: */
46: public interface StAXReaderToContentHandler {
47:
48: /**
49: * Perform the conversion from StAX events to SAX events.
50: *
51: * <p>
52: * The StAX parser must be pointing at the start element or the start document.
53: * The method reads the parser until it hits the corresponding end element,
54: * and turns the complete sub-tree into the equivalent of the SAX events.
55: *
56: * <p>
57: * The receiver of the SAX event will see this sub-tree as if it were
58: * a whole document.
59: *
60: * <p>
61: * When this method returns successfully, the parser is at the next token
62: * of the end element.
63: *
64: * @throws XMLStreamException
65: * if any errors are encountered while parsing XML from the
66: * XMLStreamReader or firing events on the ContentHandler.
67: */
68: public void bridge() throws XMLStreamException;
69: }
|