001/*
002 * Copyright 2001 (C) MetaStuff, Ltd. All Rights Reserved.
003 * 
004 * This software is open source. 
005 * See the bottom of this file for the licence.
006 * 
007 * $Id: DOMComment.java,v 1.4 2001/06/20 18:59:23 jstrachan Exp $
008 */
009
010package org.dom4j.dom;
011
012import org.dom4j.Comment;
013import org.dom4j.Element;
014import org.dom4j.QName;
015import org.dom4j.tree.DefaultComment;
016
017import org.w3c.dom.Document;
018import org.w3c.dom.DOMException;
019import org.w3c.dom.NamedNodeMap;
020import org.w3c.dom.NodeList;
021
022/** <p><code>DOMText</code> implements a Text node which 
023  * supports the W3C DOM API.</p>
024  *
025  * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
026  * @version $Revision: 1.4 $
027  */
028public class DOMComment extends DefaultComment implements org.w3c.dom.Comment {
029
030    public DOMComment(String text) {
031        super(text);
032    }
033
034    public DOMComment(Element parent,String text) {
035        super(parent, text);
036    }
037
038
039    
040    // org.w3c.dom.Node interface
041    //-------------------------------------------------------------------------        
042    public String getNamespaceURI() {
043        return DOMNodeHelper.getNamespaceURI(this);
044    }
045
046    public String getPrefix() {
047        return DOMNodeHelper.getPrefix(this);
048    }
049    
050    public void setPrefix(String prefix) throws DOMException {
051        DOMNodeHelper.setPrefix(this, prefix);
052    }
053
054    public String getLocalName() {
055        return DOMNodeHelper.getLocalName(this);
056    }
057
058    public String getNodeName() {
059        return getName();
060    }
061    
062    //already part of API  
063    //
064    //public short getNodeType();
065    
066
067    
068    public String getNodeValue() throws DOMException {
069        return DOMNodeHelper.getNodeValue(this);
070    }
071    
072    public void setNodeValue(String nodeValue) throws DOMException {
073        DOMNodeHelper.setNodeValue(this, nodeValue);
074    }
075        
076
077    public org.w3c.dom.Node getParentNode() {
078        return DOMNodeHelper.getParentNode(this);
079    }
080    
081    public NodeList getChildNodes() {
082        return DOMNodeHelper.getChildNodes(this);
083    }
084
085    public org.w3c.dom.Node getFirstChild() {
086        return DOMNodeHelper.getFirstChild(this);
087    }
088
089    public org.w3c.dom.Node getLastChild() {
090        return DOMNodeHelper.getLastChild(this);
091    }
092
093    public org.w3c.dom.Node getPreviousSibling() {
094        return DOMNodeHelper.getPreviousSibling(this);
095    }
096
097    public org.w3c.dom.Node getNextSibling() {
098        return DOMNodeHelper.getNextSibling(this);
099    }
100
101    public NamedNodeMap getAttributes() {
102        return DOMNodeHelper.getAttributes(this);
103    }
104
105    public Document getOwnerDocument() {
106        return DOMNodeHelper.getOwnerDocument(this);
107    }
108
109    public org.w3c.dom.Node insertBefore(
110        org.w3c.dom.Node newChild, 
111        org.w3c.dom.Node refChild
112    ) throws DOMException {
113        return DOMNodeHelper.insertBefore(this, newChild, refChild);
114    }
115
116    public org.w3c.dom.Node replaceChild(
117        org.w3c.dom.Node newChild, 
118        org.w3c.dom.Node oldChild
119    ) throws DOMException {
120        return DOMNodeHelper.replaceChild(this, newChild, oldChild);
121    }
122
123    public org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild) throws DOMException {
124        return DOMNodeHelper.removeChild(this, oldChild);
125    }
126
127    public org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild) throws DOMException {
128        return DOMNodeHelper.appendChild(this, newChild);
129    }
130
131    public boolean hasChildNodes() {
132        return DOMNodeHelper.hasChildNodes(this);
133    }
134
135    public org.w3c.dom.Node cloneNode(boolean deep) {
136        return DOMNodeHelper.cloneNode(this, deep);
137    }
138
139    public void normalize() {
140        DOMNodeHelper.normalize(this);
141    }
142
143    public boolean isSupported(String feature, String version) {
144        return DOMNodeHelper.isSupported(this, feature, version);
145    }
146
147    public boolean hasAttributes() {
148        return DOMNodeHelper.hasAttributes(this);
149    }
150    
151    // org.w3c.dom.CharacterData interface
152    //-------------------------------------------------------------------------        
153    public String getData() throws DOMException {
154        return DOMNodeHelper.getData(this);
155    }
156    
157    public void setData(String data) throws DOMException {
158        DOMNodeHelper.setData(this, data);
159    }
160
161    public int getLength() {
162        return DOMNodeHelper.getLength(this);
163    }
164
165    public String substringData( int offset, int count) throws DOMException {
166        return DOMNodeHelper.substringData(this, offset, count);
167    }
168
169    public void appendData(String arg) throws DOMException {
170        DOMNodeHelper.appendData(this, arg);
171    }
172
173    public void insertData(int offset, String arg) throws DOMException {
174        DOMNodeHelper.insertData(this, offset, arg);
175    }
176
177    public void deleteData(int offset, int count) throws DOMException {
178        DOMNodeHelper.deleteData(this, offset, count);
179    }
180
181    public void replaceData( 
182        int offset, int count, String arg 
183    ) throws DOMException {
184        DOMNodeHelper.replaceData(this, offset, count, arg);
185    }
186}
187
188
189
190
191/*
192 * Redistribution and use of this software and associated documentation
193 * ("Software"), with or without modification, are permitted provided
194 * that the following conditions are met:
195 *
196 * 1. Redistributions of source code must retain copyright
197 *    statements and notices.  Redistributions must also contain a
198 *    copy of this document.
199 *
200 * 2. Redistributions in binary form must reproduce the
201 *    above copyright notice, this list of conditions and the
202 *    following disclaimer in the documentation and/or other
203 *    materials provided with the distribution.
204 *
205 * 3. The name "DOM4J" must not be used to endorse or promote
206 *    products derived from this Software without prior written
207 *    permission of MetaStuff, Ltd.  For written permission,
208 *    please contact dom4j-info@metastuff.com.
209 *
210 * 4. Products derived from this Software may not be called "DOM4J"
211 *    nor may "DOM4J" appear in their names without prior written
212 *    permission of MetaStuff, Ltd. DOM4J is a registered
213 *    trademark of MetaStuff, Ltd.
214 *
215 * 5. Due credit should be given to the DOM4J Project
216 *    (http://dom4j.org/).
217 *
218 * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS
219 * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
220 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
221 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
222 * METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
223 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
224 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
225 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
226 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
227 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
228 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
229 * OF THE POSSIBILITY OF SUCH DAMAGE.
230 *
231 * Copyright 2001 (C) MetaStuff, Ltd. All Rights Reserved.
232 *
233 * $Id: DOMComment.java,v 1.4 2001/06/20 18:59:23 jstrachan Exp $
234 */