1 56 57 package org.jdom; 58 59 66 public class IllegalAddException extends IllegalArgumentException { 67 68 private static final String CVS_ID = 69 "@(#) $RCSfile: IllegalAddException.java,v $ $Revision: 1.25 $ $Date: 2004/02/06 09:28:30 $ $Name: $"; 70 71 81 IllegalAddException(Element base, Attribute added, String reason) { 82 super(new StringBuffer () 83 .append("The attribute \"") 84 .append(added.getQualifiedName()) 85 .append("\" could not be added to the element \"") 86 .append(base.getQualifiedName()) 87 .append("\": ") 88 .append(reason) 89 .toString()); 90 } 91 92 102 IllegalAddException(Element base, Element added, String reason) { 103 super(new StringBuffer () 104 .append("The element \"") 105 .append(added.getQualifiedName()) 106 .append("\" could not be added as a child of \"") 107 .append(base.getQualifiedName()) 108 .append("\": ") 109 .append(reason) 110 .toString()); 111 } 112 113 121 IllegalAddException(Element added, String reason) { 122 super(new StringBuffer () 123 .append("The element \"") 124 .append(added.getQualifiedName()) 125 .append("\" could not be added as the root of the document: ") 126 .append(reason) 127 .toString()); 128 } 129 130 140 IllegalAddException(Element base, ProcessingInstruction added, 141 String reason) { 142 super(new StringBuffer () 143 .append("The PI \"") 144 .append(added.getTarget()) 145 .append("\" could not be added as content to \"") 146 .append(base.getQualifiedName()) 147 .append("\": ") 148 .append(reason) 149 .toString()); 150 } 151 152 160 IllegalAddException(ProcessingInstruction added, 161 String reason) { 162 super(new StringBuffer () 163 .append("The PI \"") 164 .append(added.getTarget()) 165 .append("\" could not be added to the top level of the document: ") 166 .append(reason) 167 .toString()); 168 } 169 170 180 IllegalAddException(Element base, Comment added, String reason) { 181 super(new StringBuffer () 182 .append("The comment \"") 183 .append(added.getText()) 184 .append("\" could not be added as content to \"") 185 .append(base.getQualifiedName()) 186 .append("\": ") 187 .append(reason) 188 .toString()); 189 } 190 191 192 201 IllegalAddException(Element base, CDATA added, String reason) { 202 super(new StringBuffer () 203 .append("The CDATA \"") 204 .append(added.getText()) 205 .append("\" could not be added as content to \"") 206 .append(base.getQualifiedName()) 207 .append("\": ") 208 .append(reason) 209 .toString()); 210 } 211 212 213 223 IllegalAddException(Element base, Text added, String reason) { 224 super(new StringBuffer () 225 .append("The Text \"") 226 .append(added.getText()) 227 .append("\" could not be added as content to \"") 228 .append(base.getQualifiedName()) 229 .append("\": ") 230 .append(reason) 231 .toString()); 232 } 233 234 242 IllegalAddException(Comment added, String reason) { 243 super(new StringBuffer () 244 .append("The comment \"") 245 .append(added.getText()) 246 .append("\" could not be added to the top level of the document: ") 247 .append(reason) 248 .toString()); 249 } 250 251 261 IllegalAddException(Element base, EntityRef added, String reason) { 262 super(new StringBuffer () 263 .append("The entity reference\"") 264 .append(added.getName()) 265 .append("\" could not be added as content to \"") 266 .append(base.getQualifiedName()) 267 .append("\": ") 268 .append(reason) 269 .toString()); 270 } 271 272 282 IllegalAddException(Element base, Namespace added, String reason) { 283 super(new StringBuffer () 284 .append("The namespace xmlns") 285 .append((added.getPrefix() == null || 286 added.getPrefix().equals("")) ? "=" 287 : ":" + added.getPrefix() + "=") 288 .append("\"") 289 .append(added.getURI()) 290 .append("\" could not be added as a namespace to \"") 291 .append(base.getQualifiedName()) 292 .append("\": ") 293 .append(reason) 294 .toString()); 295 } 296 297 305 IllegalAddException(DocType added, String reason) { 306 super(new StringBuffer () 307 .append("The DOCTYPE ") 308 .append(added.toString()) 309 .append(" could not be added to the document: ") 310 .append(reason) 311 .toString()); 312 } 313 314 320 public IllegalAddException(String reason) { 321 super(reason); 322 } 323 } 324 | Popular Tags |