01: /*
02: * $Id: StaxXMLInputSource.java,v 1.2 2006/04/01 06:01:47 jeffsuttor Exp $
03: */
04:
05: /*
06: * The contents of this file are subject to the terms
07: * of the Common Development and Distribution License
08: * (the License). You may not use this file except in
09: * compliance with the License.
10: *
11: * You can obtain a copy of the license at
12: * https://glassfish.dev.java.net/public/CDDLv1.0.html.
13: * See the License for the specific language governing
14: * permissions and limitations under the License.
15: *
16: * When distributing Covered Code, include this CDDL
17: * Header Notice in each file and include the License file
18: * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
19: * If applicable, add the following below the CDDL Header,
20: * with the fields enclosed by brackets [] replaced by
21: * you own identifying information:
22: * "Portions Copyrighted [year] [name of copyright owner]"
23: *
24: * [Name of File] [ver.__] [Date]
25: *
26: * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
27: */
28:
29: package com.sun.xml.stream;
30:
31: import javax.xml.stream.XMLEventReader;
32: import javax.xml.stream.XMLStreamReader;
33: import com.sun.xml.stream.xerces.xni.parser.XMLInputSource;
34:
35: /**
36: *
37: * @author Neeraj
38: *
39: * This class wraps XMLInputSource and is also capable of telling wether application
40: * returned XMLStreamReader or not when XMLResolver.resolveEnity
41: * was called.
42: */
43: public class StaxXMLInputSource {
44:
45: XMLStreamReader fStreamReader;
46: XMLEventReader fEventReader;
47: XMLInputSource fInputSource;
48:
49: /** Creates a new instance of StaxXMLInputSource */
50: public StaxXMLInputSource(XMLStreamReader streamReader) {
51: fStreamReader = streamReader;
52: }
53:
54: /** Creates a new instance of StaxXMLInputSource */
55: public StaxXMLInputSource(XMLEventReader eventReader) {
56: fEventReader = eventReader;
57: }
58:
59: public StaxXMLInputSource(XMLInputSource inputSource) {
60: fInputSource = inputSource;
61:
62: }
63:
64: public XMLStreamReader getXMLStreamReader() {
65: return fStreamReader;
66: }
67:
68: public XMLEventReader getXMLEventReader() {
69: return fEventReader;
70: }
71:
72: public XMLInputSource getXMLInputSource() {
73: return fInputSource;
74: }
75:
76: public boolean hasXMLStreamOrXMLEventReader() {
77: return (fStreamReader == null) && (fEventReader == null) ? false
78: : true;
79: }
80: }
|