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