001    /** 
002     * 
003     * Copyright 2004 Protique Ltd
004     * 
005     * Licensed under the Apache License, Version 2.0 (the "License"); 
006     * you may not use this file except in compliance with the License. 
007     * You may obtain a copy of the License at 
008     * 
009     * http://www.apache.org/licenses/LICENSE-2.0
010     * 
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS, 
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
014     * See the License for the specific language governing permissions and 
015     * limitations under the License. 
016     * 
017     **/
018    package org.codehaus.activesoap.util;
019    
020    import javax.xml.stream.XMLStreamWriter;
021    import javax.xml.stream.XMLStreamException;
022    import javax.xml.namespace.NamespaceContext;
023    import java.util.Iterator;
024    import java.util.Collections;
025    
026    /**
027     * An implementation of
028     * @version $Revision: 1.1 $
029     */
030    public class NullXMLStreamWriter implements XMLStreamWriter {
031        private NamespaceContext context = new NamespaceContext() {
032            public String getNamespaceURI(String s) {
033                return null;
034            }
035    
036            public String getPrefix(String s) {
037                return null;
038            }
039    
040            public Iterator getPrefixes(String s) {
041                return Collections.EMPTY_LIST.iterator();
042            }
043        };
044    
045        private static final NullXMLStreamWriter instance = new NullXMLStreamWriter();
046    
047        public static NullXMLStreamWriter getInstance() {
048            return instance;
049        }
050    
051        public void writeStartElement(String s) throws XMLStreamException {
052        }
053    
054        public void writeStartElement(String s, String s1) throws XMLStreamException {
055        }
056    
057        public void writeStartElement(String s, String s1, String s2) throws XMLStreamException {
058        }
059    
060        public void writeEmptyElement(String s, String s1) throws XMLStreamException {
061        }
062    
063        public void writeEmptyElement(String s, String s1, String s2) throws XMLStreamException {
064        }
065    
066        public void writeEmptyElement(String s) throws XMLStreamException {
067        }
068    
069        public void writeEndElement() throws XMLStreamException {
070        }
071    
072        public void writeEndDocument() throws XMLStreamException {
073        }
074    
075        public void close() throws XMLStreamException {
076        }
077    
078        public void flush() throws XMLStreamException {
079        }
080    
081        public void writeAttribute(String s, String s1) throws XMLStreamException {
082        }
083    
084        public void writeAttribute(String s, String s1, String s2, String s3) throws XMLStreamException {
085        }
086    
087        public void writeAttribute(String s, String s1, String s2) throws XMLStreamException {
088        }
089    
090        public void writeNamespace(String s, String s1) throws XMLStreamException {
091        }
092    
093        public void writeDefaultNamespace(String s) throws XMLStreamException {
094        }
095    
096        public void writeComment(String s) throws XMLStreamException {
097        }
098    
099        public void writeProcessingInstruction(String s) throws XMLStreamException {
100        }
101    
102        public void writeProcessingInstruction(String s, String s1) throws XMLStreamException {
103        }
104    
105        public void writeCData(String s) throws XMLStreamException {
106        }
107    
108        public void writeDTD(String s) throws XMLStreamException {
109        }
110    
111        public void writeEntityRef(String s) throws XMLStreamException {
112        }
113    
114        public void writeStartDocument() throws XMLStreamException {
115        }
116    
117        public void writeStartDocument(String s) throws XMLStreamException {
118        }
119    
120        public void writeStartDocument(String s, String s1) throws XMLStreamException {
121        }
122    
123        public void writeCharacters(String s) throws XMLStreamException {
124        }
125    
126        public void writeCharacters(char[] chars, int i, int i1) throws XMLStreamException {
127        }
128    
129        public String getPrefix(String s) throws XMLStreamException {
130            return null;
131        }
132    
133        public void setPrefix(String s, String s1) throws XMLStreamException {
134        }
135    
136        public void setDefaultNamespace(String s) throws XMLStreamException {
137        }
138    
139        public void setNamespaceContext(NamespaceContext namespaceContext) throws XMLStreamException {
140        }
141    
142        public NamespaceContext getNamespaceContext() {
143            return context;
144        }
145    
146        public Object getProperty(String s) throws IllegalArgumentException {
147            return null;
148        }
149    }