dom4j - 1.6.1

Clover coverage report - dom4j - 1.6.1
Coverage timestamp: ma mei 16 2005 14:23:01 GMT+01:00
FRAMES NO FRAMES

file stats: | LOC: | 219 |  | Methods: | 31
| NCLOC: | 118 |  | Classes: | 1

Source file | Conditionals | Statements | Methods | TOTAL

DOMProcessingInstruction.java

0%

2,8%

3,2%

2,9%

1 |  | /*
2 |  | * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
3 |  | *
4 |  | * This software is open source.
5 |  | * See the bottom of this file for the licence.
6 |  | */
7 |  |
8 |  | package org.dom4j.dom;
9 |  |
10 |  | import java.util.Map;
11 |  |
12 |  | import org.dom4j.Element;
13 |  | import org.dom4j.tree.DefaultProcessingInstruction;
14 |  |
15 |  | import org.w3c.dom.DOMException;
16 |  | import org.w3c.dom.Document;
17 |  | import org.w3c.dom.NamedNodeMap;
18 |  | import org.w3c.dom.NodeList;
19 |  |
20 |  | /**
21 |  | * <p>
22 |  | * <code>DOMProcessingInstruction</code> implements a ProcessingInstruction
23 |  | * node which supports the W3C DOM API.
24 |  | * </p>
25 |  | *
26 |  | * @author <a href="mailto:jstrachan@apache.org">James Strachan </a>
27 |  | * @version $Revision: 1.12 $
28 |  | */
29 |  | public class DOMProcessingInstruction extends DefaultProcessingInstruction
30 |  | implements org.w3c.dom.ProcessingInstruction {
31 | 0 | public DOMProcessingInstruction(String target, Map values) {
32 | 0 | super(target, values);
33 |  | }
34 |  |
35 | 12 | public DOMProcessingInstruction(String target, String values) {
36 | 12 | super(target, values);
37 |  | }
38 |  |
39 | 0 | public DOMProcessingInstruction(Element parent, String target, String val) {
40 | 0 | super(parent, target, val);
41 |  | }
42 |  |
43 |  | // org.w3c.dom.Node interface
44 |  | // -------------------------------------------------------------------------
45 | 0 | public boolean supports(String feature, String version) {
46 | 0 | return DOMNodeHelper.supports(this, feature, version);
47 |  | }
48 |  |
49 | 0 | public String getNamespaceURI() {
50 | 0 | return DOMNodeHelper.getNamespaceURI(this);
51 |  | }
52 |  |
53 | 0 | public String getPrefix() {
54 | 0 | return DOMNodeHelper.getPrefix(this);
55 |  | }
56 |  |
57 | 0 | public void setPrefix(String prefix) throws DOMException {
58 | 0 | DOMNodeHelper.setPrefix(this, prefix);
59 |  | }
60 |  |
61 | 0 | public String getLocalName() {
62 | 0 | return DOMNodeHelper.getLocalName(this);
63 |  | }
64 |  |
65 | 0 | public String getNodeName() {
66 | 0 | return getName();
67 |  | }
68 |  |
69 |  | // already part of API
70 |  | //
71 |  | // public short getNodeType();
72 | 0 | public String getNodeValue() throws DOMException {
73 | 0 | return DOMNodeHelper.getNodeValue(this);
74 |  | }
75 |  |
76 | 0 | public void setNodeValue(String nodeValue) throws DOMException {
77 | 0 | DOMNodeHelper.setNodeValue(this, nodeValue);
78 |  | }
79 |  |
80 | 0 | public org.w3c.dom.Node getParentNode() {
81 | 0 | return DOMNodeHelper.getParentNode(this);
82 |  | }
83 |  |
84 | 0 | public NodeList getChildNodes() {
85 | 0 | return DOMNodeHelper.getChildNodes(this);
86 |  | }
87 |  |
88 | 0 | public org.w3c.dom.Node getFirstChild() {
89 | 0 | return DOMNodeHelper.getFirstChild(this);
90 |  | }
91 |  |
92 | 0 | public org.w3c.dom.Node getLastChild() {
93 | 0 | return DOMNodeHelper.getLastChild(this);
94 |  | }
95 |  |
96 | 0 | public org.w3c.dom.Node getPreviousSibling() {
97 | 0 | return DOMNodeHelper.getPreviousSibling(this);
98 |  | }
99 |  |
100 | 0 | public org.w3c.dom.Node getNextSibling() {
101 | 0 | return DOMNodeHelper.getNextSibling(this);
102 |  | }
103 |  |
104 | 0 | public NamedNodeMap getAttributes() {
105 | 0 | return null;
106 |  | }
107 |  |
108 | 0 | public Document getOwnerDocument() {
109 | 0 | return DOMNodeHelper.getOwnerDocument(this);
110 |  | }
111 |  |
112 | 0 | public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild,
113 |  | org.w3c.dom.Node refChild) throws DOMException {
114 | 0 | checkNewChildNode(newChild);
115 |  |
116 | 0 | return DOMNodeHelper.insertBefore(this, newChild, refChild);
117 |  | }
118 |  |
119 | 0 | public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild,
120 |  | org.w3c.dom.Node oldChild) throws DOMException {
121 | 0 | checkNewChildNode(newChild);
122 |  |
123 | 0 | return DOMNodeHelper.replaceChild(this, newChild, oldChild);
124 |  | }
125 |  |
126 | 0 | public org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild)
127 |  | throws DOMException {
128 | 0 | return DOMNodeHelper.removeChild(this, oldChild);
129 |  | }
130 |  |
131 | 0 | public org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild)
132 |  | throws DOMException {
133 | 0 | checkNewChildNode(newChild);
134 |  |
135 | 0 | return DOMNodeHelper.appendChild(this, newChild);
136 |  | }
137 |  |
138 | 0 | private void checkNewChildNode(org.w3c.dom.Node newChild)
139 |  | throws DOMException {
140 | 0 | throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
141 |  | "PI nodes cannot have children");
142 |  | }
143 |  |
144 | 0 | public boolean hasChildNodes() {
145 | 0 | return DOMNodeHelper.hasChildNodes(this);
146 |  | }
147 |  |
148 | 0 | public org.w3c.dom.Node cloneNode(boolean deep) {
149 | 0 | return DOMNodeHelper.cloneNode(this, deep);
150 |  | }
151 |  |
152 | 0 | public void normalize() {
153 | 0 | DOMNodeHelper.normalize(this);
154 |  | }
155 |  |
156 | 0 | public boolean isSupported(String feature, String version) {
157 | 0 | return DOMNodeHelper.isSupported(this, feature, version);
158 |  | }
159 |  |
160 | 0 | public boolean hasAttributes() {
161 | 0 | return DOMNodeHelper.hasAttributes(this);
162 |  | }
163 |  |
164 |  | // org.w3c.dom.ProcessingInstruction interface
165 |  | // -------------------------------------------------------------------------
166 |  | // public String getTarget();
167 | 0 | public String getData() {
168 | 0 | return getText();
169 |  | }
170 |  |
171 | 0 | public void setData(String data) throws DOMException {
172 | 0 | if (isReadOnly()) {
173 | 0 | throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
174 |  | "This ProcessingInstruction is read only");
175 |  | } else {
176 | 0 | setText(data);
177 |  | }
178 |  | }
179 |  |
180 |  | // Implementation methods
181 |  | // -------------------------------------------------------------------------
182 |  | }
183 |  |
184 |  | /*
185 |  | * Redistribution and use of this software and associated documentation
186 |  | * ("Software"), with or without modification, are permitted provided that the
187 |  | * following conditions are met:
188 |  | *
189 |  | * 1. Redistributions of source code must retain copyright statements and
190 |  | * notices. Redistributions must also contain a copy of this document.
191 |  | *
192 |  | * 2. Redistributions in binary form must reproduce the above copyright notice,
193 |  | * this list of conditions and the following disclaimer in the documentation
194 |  | * and/or other materials provided with the distribution.
195 |  | *
196 |  | * 3. The name "DOM4J" must not be used to endorse or promote products derived
197 |  | * from this Software without prior written permission of MetaStuff, Ltd. For
198 |  | * written permission, please contact dom4j-info@metastuff.com.
199 |  | *
200 |  | * 4. Products derived from this Software may not be called "DOM4J" nor may
201 |  | * "DOM4J" appear in their names without prior written permission of MetaStuff,
202 |  | * Ltd. DOM4J is a registered trademark of MetaStuff, Ltd.
203 |  | *
204 |  | * 5. Due credit should be given to the DOM4J Project - http://www.dom4j.org
205 |  | *
206 |  | * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS ``AS IS'' AND
207 |  | * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
208 |  | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
209 |  | * ARE DISCLAIMED. IN NO EVENT SHALL METASTUFF, LTD. OR ITS CONTRIBUTORS BE
210 |  | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
211 |  | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
212 |  | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
213 |  | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
214 |  | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
215 |  | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
216 |  | * POSSIBILITY OF SUCH DAMAGE.
217 |  | *
218 |  | * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
219 |  | */