001: /*
002: * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003: *
004: * This file is part of Resin(R) Open Source
005: *
006: * Each copy or derived work must preserve the copyright notice and this
007: * notice unmodified.
008: *
009: * Resin Open Source is free software; you can redistribute it and/or modify
010: * it under the terms of the GNU General Public License as published by
011: * the Free Software Foundation; either version 2 of the License, or
012: * (at your option) any later version.
013: *
014: * Resin Open Source is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017: * of NON-INFRINGEMENT. See the GNU General Public License for more
018: * details.
019: *
020: * You should have received a copy of the GNU General Public License
021: * along with Resin Open Source; if not, write to the
022: *
023: * Free Software Foundation, Inc.
024: * 59 Temple Place, Suite 330
025: * Boston, MA 02111-1307 USA
026: *
027: * @author Sam
028: */
029:
030: package com.caucho.quercus.lib.dom;
031:
032: import org.w3c.dom.Node;
033:
034: public class DOMNode<T extends Node> extends DOMWrapper<T> {
035: protected DOMNode(DOMImplementation impl, T delegate) {
036: super (impl, delegate);
037: }
038:
039: Node getDelegate() {
040: return _delegate;
041: }
042:
043: public DOMNode appendChild(DOMNode newChild) throws DOMException {
044: try {
045: return wrap(_delegate.appendChild(newChild.getDelegate()));
046: } catch (org.w3c.dom.DOMException ex) {
047: throw wrap(ex);
048: }
049: }
050:
051: public DOMNode cloneNode(boolean deep) {
052: return wrap(_delegate.cloneNode(deep));
053: }
054:
055: public short compareDocumentPosition(DOMNode other)
056: throws DOMException {
057: try {
058: return _delegate.compareDocumentPosition(other
059: .getDelegate());
060: } catch (org.w3c.dom.DOMException ex) {
061: throw wrap(ex);
062: }
063: }
064:
065: public DOMNamedNodeMap getAttributes() {
066: return wrap(_delegate.getAttributes());
067: }
068:
069: public String getBaseURI() {
070: return _delegate.getBaseURI();
071: }
072:
073: public DOMNodeList getChildNodes() {
074: return wrap(_delegate.getChildNodes());
075: }
076:
077: public Object getFeature(String feature, String version) {
078: return _delegate.getFeature(feature, version);
079: }
080:
081: public DOMNode getFirstChild() {
082: return wrap(_delegate.getFirstChild());
083: }
084:
085: public DOMNode getLastChild() {
086: return wrap(_delegate.getLastChild());
087: }
088:
089: public String getLocalName() {
090: return _delegate.getLocalName();
091: }
092:
093: public String getNamespaceURI() {
094: return _delegate.getNamespaceURI();
095: }
096:
097: public DOMNode getNextSibling() {
098: return wrap(_delegate.getNextSibling());
099: }
100:
101: public String getNodeName() {
102: return _delegate.getNodeName();
103: }
104:
105: public short getNodeType() {
106: return _delegate.getNodeType();
107: }
108:
109: public String getNodeValue() throws DOMException {
110: try {
111: return _delegate.getNodeValue();
112: } catch (org.w3c.dom.DOMException ex) {
113: throw wrap(ex);
114: }
115: }
116:
117: public DOMDocument getOwnerDocument() {
118: return wrap(_delegate.getOwnerDocument());
119: }
120:
121: public DOMNode getParentNode() {
122: return wrap(_delegate.getParentNode());
123: }
124:
125: public String getPrefix() {
126: return _delegate.getPrefix();
127: }
128:
129: public DOMNode getPreviousSibling() {
130: return wrap(_delegate.getPreviousSibling());
131: }
132:
133: public String getTextContent() throws DOMException {
134: try {
135: return _delegate.getTextContent();
136: } catch (org.w3c.dom.DOMException ex) {
137: throw wrap(ex);
138: }
139: }
140:
141: public Object getUserData(String key) {
142: return _delegate.getUserData(key);
143: }
144:
145: public boolean hasAttributes() {
146: return _delegate.hasAttributes();
147: }
148:
149: public boolean hasChildNodes() {
150: return _delegate.hasChildNodes();
151: }
152:
153: public DOMNode insertBefore(DOMNode newChild, DOMNode refChild)
154: throws DOMException {
155: try {
156: return wrap(_delegate.insertBefore(newChild.getDelegate(),
157: refChild.getDelegate()));
158: } catch (org.w3c.dom.DOMException ex) {
159: throw wrap(ex);
160: }
161: }
162:
163: public boolean isDefaultNamespace(String namespaceURI) {
164: return _delegate.isDefaultNamespace(namespaceURI);
165: }
166:
167: public boolean isEqualNode(DOMNode arg) {
168: return _delegate.isEqualNode(arg.getDelegate());
169: }
170:
171: public boolean isSameNode(DOMNode other) {
172: return _delegate.isSameNode(other.getDelegate());
173: }
174:
175: public boolean isSupported(String feature, String version) {
176: return _delegate.isSupported(feature, version);
177: }
178:
179: public String lookupNamespaceURI(String prefix) {
180: return _delegate.lookupNamespaceURI(prefix);
181: }
182:
183: public String lookupPrefix(String namespaceURI) {
184: return _delegate.lookupPrefix(namespaceURI);
185: }
186:
187: public void normalize() {
188: _delegate.normalize();
189: }
190:
191: public DOMNode removeChild(DOMNode oldChild) throws DOMException {
192: try {
193: return wrap(_delegate.removeChild(oldChild.getDelegate()));
194: } catch (org.w3c.dom.DOMException ex) {
195: throw wrap(ex);
196: }
197: }
198:
199: public DOMNode replaceChild(DOMNode newChild, DOMNode oldChild)
200: throws DOMException {
201: try {
202: return wrap(_delegate.replaceChild(newChild.getDelegate(),
203: oldChild.getDelegate()));
204: } catch (org.w3c.dom.DOMException ex) {
205: throw wrap(ex);
206: }
207: }
208:
209: public void setNodeValue(String nodeValue) throws DOMException {
210: try {
211: _delegate.setNodeValue(nodeValue);
212: } catch (org.w3c.dom.DOMException ex) {
213: throw wrap(ex);
214: }
215: }
216:
217: public void setPrefix(String prefix) throws DOMException {
218: try {
219: _delegate.setPrefix(prefix);
220: } catch (org.w3c.dom.DOMException ex) {
221: throw wrap(ex);
222: }
223: }
224:
225: public void setTextContent(String textContent) throws DOMException {
226: try {
227: _delegate.setTextContent(textContent);
228: } catch (org.w3c.dom.DOMException ex) {
229: throw wrap(ex);
230: }
231: }
232:
233: public Object setUserData(String key, Object data) {
234: return _delegate.setUserData(key, data, null);
235: }
236:
237: public String toString() {
238: return getClass().getSimpleName();
239: }
240: }
|