001: /*
002: * Copyright (c) 2006, John Kristian
003: * All rights reserved.
004: *
005: * Redistribution and use in source and binary forms, with or without
006: * modification, are permitted provided that the following conditions are met:
007: *
008: * * Redistributions of source code must retain the above copyright
009: * notice, this list of conditions and the following disclaimer.
010: *
011: * * Redistributions in binary form must reproduce the above copyright
012: * notice, this list of conditions and the following disclaimer in the
013: * documentation and/or other materials provided with the distribution.
014: *
015: * * Neither the name of StAX-Utils nor the names of its contributors
016: * may be used to endorse or promote products derived from this
017: * software without specific prior written permission.
018: *
019: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
020: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
021: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
022: * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
023: * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
024: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
025: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
026: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
027: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
028: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
029: * POSSIBILITY OF SUCH DAMAGE.
030: *
031: */
032: package javanet.staxutils;
033:
034: import javax.xml.namespace.NamespaceContext;
035: import javax.xml.stream.XMLStreamException;
036: import javax.xml.stream.XMLStreamWriter;
037:
038: /**
039: * Abstract class for writing filtered XML streams. This class provides methods
040: * that merely delegate to the contained stream. Subclasses should override some
041: * of these methods, and may also provide additional methods and fields.
042: *
043: * @author <a href="mailto:jk2006@engineer.com">John Kristian</a>
044: */
045: public abstract class StreamWriterDelegate implements XMLStreamWriter {
046:
047: protected StreamWriterDelegate(XMLStreamWriter out) {
048: this .out = out;
049: }
050:
051: protected XMLStreamWriter out;
052:
053: public Object getProperty(String name)
054: throws IllegalArgumentException {
055: return out.getProperty(name);
056: }
057:
058: public NamespaceContext getNamespaceContext() {
059: return out.getNamespaceContext();
060: }
061:
062: public void setNamespaceContext(NamespaceContext context)
063: throws XMLStreamException {
064: out.setNamespaceContext(context);
065: }
066:
067: public void setDefaultNamespace(String uri)
068: throws XMLStreamException {
069: out.setDefaultNamespace(uri);
070: }
071:
072: public void writeStartDocument() throws XMLStreamException {
073: out.writeStartDocument();
074: }
075:
076: public void writeStartDocument(String version)
077: throws XMLStreamException {
078: out.writeStartDocument(version);
079: }
080:
081: public void writeStartDocument(String encoding, String version)
082: throws XMLStreamException {
083: out.writeStartDocument(encoding, version);
084: }
085:
086: public void writeDTD(String dtd) throws XMLStreamException {
087: out.writeDTD(dtd);
088: }
089:
090: public void writeProcessingInstruction(String target)
091: throws XMLStreamException {
092: out.writeProcessingInstruction(target);
093: }
094:
095: public void writeProcessingInstruction(String target, String data)
096: throws XMLStreamException {
097: out.writeProcessingInstruction(target, data);
098: }
099:
100: public void writeComment(String data) throws XMLStreamException {
101: out.writeComment(data);
102: }
103:
104: public void writeEmptyElement(String localName)
105: throws XMLStreamException {
106: out.writeEmptyElement(localName);
107: }
108:
109: public void writeEmptyElement(String namespaceURI, String localName)
110: throws XMLStreamException {
111: out.writeEmptyElement(namespaceURI, localName);
112: }
113:
114: public void writeEmptyElement(String prefix, String localName,
115: String namespaceURI) throws XMLStreamException {
116: out.writeEmptyElement(prefix, localName, namespaceURI);
117: }
118:
119: public void writeStartElement(String localName)
120: throws XMLStreamException {
121: out.writeStartElement(localName);
122: }
123:
124: public void writeStartElement(String namespaceURI, String localName)
125: throws XMLStreamException {
126: out.writeStartElement(namespaceURI, localName);
127: }
128:
129: public void writeStartElement(String prefix, String localName,
130: String namespaceURI) throws XMLStreamException {
131: out.writeStartElement(prefix, localName, namespaceURI);
132: }
133:
134: public void writeDefaultNamespace(String namespaceURI)
135: throws XMLStreamException {
136: out.writeDefaultNamespace(namespaceURI);
137: }
138:
139: public void writeNamespace(String prefix, String namespaceURI)
140: throws XMLStreamException {
141: out.writeNamespace(prefix, namespaceURI);
142: }
143:
144: public String getPrefix(String uri) throws XMLStreamException {
145: return out.getPrefix(uri);
146: }
147:
148: public void setPrefix(String prefix, String uri)
149: throws XMLStreamException {
150: out.setPrefix(prefix, uri);
151: }
152:
153: public void writeAttribute(String localName, String value)
154: throws XMLStreamException {
155: out.writeAttribute(localName, value);
156: }
157:
158: public void writeAttribute(String namespaceURI, String localName,
159: String value) throws XMLStreamException {
160: out.writeAttribute(namespaceURI, localName, value);
161: }
162:
163: public void writeAttribute(String prefix, String namespaceURI,
164: String localName, String value) throws XMLStreamException {
165: out.writeAttribute(prefix, namespaceURI, localName, value);
166: }
167:
168: public void writeCharacters(String text) throws XMLStreamException {
169: out.writeCharacters(text);
170: }
171:
172: public void writeCharacters(char[] text, int start, int len)
173: throws XMLStreamException {
174: out.writeCharacters(text, start, len);
175: }
176:
177: public void writeCData(String data) throws XMLStreamException {
178: out.writeCData(data);
179: }
180:
181: public void writeEntityRef(String name) throws XMLStreamException {
182: out.writeEntityRef(name);
183: }
184:
185: public void writeEndElement() throws XMLStreamException {
186: out.writeEndElement();
187: }
188:
189: public void writeEndDocument() throws XMLStreamException {
190: out.writeEndDocument();
191: }
192:
193: public void flush() throws XMLStreamException {
194: out.flush();
195: }
196:
197: public void close() throws XMLStreamException {
198: out.close();
199: }
200:
201: }
|