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