1 56 57 package org.jdom; 58 59 68 public class EntityRef extends Content { 69 70 private static final String CVS_ID = 71 "@(#) $RCSfile: EntityRef.java,v $ $Revision: 1.21 $ $Date: 2004/02/27 11:32:57 $ $Name: $"; 72 73 74 protected String name; 75 76 77 protected String publicID; 78 79 80 protected String systemID; 81 82 85 protected EntityRef() {} 86 87 94 public EntityRef(String name) { 95 this(name, null, null); 96 } 97 98 109 public EntityRef(String name, String systemID) { 110 this(name, null, systemID); 111 } 112 113 126 public EntityRef(String name, String publicID, String systemID) { 127 setName(name); 128 setPublicID(publicID); 129 setSystemID(systemID); 130 } 131 132 137 public String getName() { 138 return name; 139 } 140 141 146 public String getValue() { 147 return ""; } 149 150 156 public String getPublicID() { 157 return publicID; 158 } 159 160 166 public String getSystemID() { 167 return systemID; 168 } 169 170 178 public EntityRef setName(String name) { 179 String reason = Verifier.checkXMLName(name); 182 if (reason != null) { 183 throw new IllegalNameException(name, "EntityRef", reason); 184 } 185 this.name = name; 186 return this; 187 } 188 189 197 public EntityRef setPublicID(String publicID) { 198 String reason = Verifier.checkPublicID(publicID); 199 if (reason != null) { 200 throw new IllegalDataException(publicID, "EntityRef", reason); 201 } 202 this.publicID = publicID; 203 return this; 204 } 205 206 214 public EntityRef setSystemID(String systemID) { 215 String reason = Verifier.checkSystemLiteral(systemID); 216 if (reason != null) { 217 throw new IllegalDataException(systemID, "EntityRef", reason); 218 } 219 this.systemID = systemID; 220 return this; 221 } 222 223 230 public String toString() { 231 return new StringBuffer () 232 .append("[EntityRef: ") 233 .append("&") 234 .append(name) 235 .append(";") 236 .append("]") 237 .toString(); 238 } 239 } 240 | Popular Tags |