001: /* $Id: EventHelper.java,v 1.1 2004/06/21 18:59:46 ryan_shoemaker Exp $
002: *
003: * Copyright (c) 2004, Sun Microsystems, Inc.
004: * All rights reserved.
005: *
006: * Redistribution and use in source and binary forms, with or without
007: * modification, are permitted provided that the following conditions are
008: * met:
009: *
010: * * Redistributions of source code must retain the above copyright
011: * notice, this list of conditions and the following disclaimer.
012: *
013: * * Redistributions in binary form must reproduce the above
014: * copyright notice, this list of conditions and the following
015: * disclaimer in the documentation and/or other materials provided
016: * with the distribution.
017: *
018: * * Neither the name of Sun Microsystems, Inc. nor the names of its
019: * contributors may be used to endorse or promote products derived
020: * from this software without specific prior written permission.
021: *
022: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
023: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
024: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
025: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
026: * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
027: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
028: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
029: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
030: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
031: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
032: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
033: */
034: package javanet.staxutils;
035:
036: import javax.xml.namespace.QName;
037: import javax.xml.stream.Location;
038: import javax.xml.stream.XMLStreamException;
039: import javax.xml.stream.events.Characters;
040: import javax.xml.stream.events.EndElement;
041: import javax.xml.stream.events.StartElement;
042: import javax.xml.stream.events.XMLEvent;
043: import java.io.Writer;
044:
045: /**
046: * Partial base class implementation of {@link javax.xml.stream.events.XMLEvent}.
047: *
048: * @author Ryan.Shoemaker@Sun.COM
049: * @version 1.0
050: */
051: abstract class EventHelper implements XMLEvent {
052:
053: private final Location location;
054:
055: protected EventHelper(Location location) {
056: this .location = location;
057: }
058:
059: public Location getLocation() {
060: return location;
061: }
062:
063: public boolean isStartElement() {
064: return false;
065: }
066:
067: public boolean isAttribute() {
068: return false;
069: }
070:
071: public boolean isNamespace() {
072: return false;
073: }
074:
075: public boolean isEndElement() {
076: return false;
077: }
078:
079: public boolean isEntityReference() {
080: return false;
081: }
082:
083: public boolean isProcessingInstruction() {
084: return false;
085: }
086:
087: public boolean isCharacters() {
088: return false;
089: }
090:
091: public boolean isStartDocument() {
092: return false;
093: }
094:
095: public boolean isEndDocument() {
096: return false;
097: }
098:
099: public StartElement asStartElement() {
100: throw new UnsupportedOperationException();
101: }
102:
103: public EndElement asEndElement() {
104: throw new UnsupportedOperationException();
105: }
106:
107: public Characters asCharacters() {
108: throw new UnsupportedOperationException();
109: }
110:
111: public QName getSchemaType() {
112: throw new UnsupportedOperationException();
113: }
114:
115: public abstract void writeAsEncodedUnicode(Writer writer)
116: throws XMLStreamException;
117:
118: public int getEventType() {
119: throw new UnsupportedOperationException();
120: }
121: }
|