1 7 8 package org.dom4j.dtd; 9 10 19 public class ExternalEntityDecl { 20 21 private String name; 22 23 24 private String publicID; 25 26 27 private String systemID; 28 29 public ExternalEntityDecl() { 30 } 31 32 public ExternalEntityDecl(String name, String publicID, String systemID) { 33 this.name = name; 34 this.publicID = publicID; 35 this.systemID = systemID; 36 } 37 38 43 public String getName() { 44 return name; 45 } 46 47 53 public void setName(String name) { 54 this.name = name; 55 } 56 57 62 public String getPublicID() { 63 return publicID; 64 } 65 66 72 public void setPublicID(String publicID) { 73 this.publicID = publicID; 74 } 75 76 81 public String getSystemID() { 82 return systemID; 83 } 84 85 91 public void setSystemID(String systemID) { 92 this.systemID = systemID; 93 } 94 95 public String toString() { 96 StringBuffer buffer = new StringBuffer ("<!ENTITY "); 97 98 if (name.startsWith("%")) { 99 buffer.append("% "); 100 buffer.append(name.substring(1)); 101 } else { 102 buffer.append(name); 103 } 104 105 if (publicID != null) { 106 buffer.append(" PUBLIC \""); 107 buffer.append(publicID); 108 buffer.append("\" "); 109 110 if (systemID != null) { 111 buffer.append("\""); 112 buffer.append(systemID); 113 buffer.append("\" "); 114 } 115 } else if (systemID != null) { 116 buffer.append(" SYSTEM \""); 117 buffer.append(systemID); 118 buffer.append("\" "); 119 } 120 121 buffer.append(">"); 122 123 return buffer.toString(); 124 } 125 } 126 127 163 | Popular Tags |