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