1
2
3
4
5
6
7
8
9
10 package org.dom4j.dtd;
11
12 /*** <p><code>ExternalEntityDecl</code> represents an external entity declaration in a DTD.</p>
13 *
14 * @author <a href="mailto:james.strachan@metastuff.com">James Strachan</a>
15 * @version $Revision: 1.7 $
16 */
17 public class ExternalEntityDecl {
18
19 /*** Holds value of property name. */
20 private String name;
21
22 /*** Holds value of property publicID. */
23 private String publicID;
24
25 /*** Holds value of property systemID. */
26 private String systemID;
27
28 public ExternalEntityDecl() {
29 }
30
31 public ExternalEntityDecl(String name, String publicID, String systemID) {
32 this.name = name;
33 this.publicID = publicID;
34 this.systemID = systemID;
35 }
36
37 /*** Getter for property name.
38 * @return Value of property name.
39 */
40 public String getName() {
41 return name;
42 }
43
44 /*** Setter for property name.
45 * @param name New value of property name.
46 */
47 public void setName(String name) {
48 this.name = name;
49 }
50
51 /*** Getter for property publicID.
52 * @return Value of property publicID.
53 */
54 public String getPublicID() {
55 return publicID;
56 }
57
58 /*** Setter for property publicID.
59 * @param publicID New value of property publicID.
60 */
61 public void setPublicID(String publicID) {
62 this.publicID = publicID;
63 }
64
65 /*** Getter for property systemID.
66 * @return Value of property systemID.
67 */
68 public String getSystemID() {
69 return systemID;
70 }
71
72 /*** Setter for property systemID.
73 * @param systemID New value of property systemID.
74 */
75 public void setSystemID(String systemID) {
76 this.systemID = systemID;
77 }
78
79 public String toString() {
80 StringBuffer buffer = new StringBuffer( "<!ENTITY " );
81
82 if (name.startsWith("%")) {
83 buffer.append("% ");
84 buffer.append(name.substring(1));
85 }
86 else {
87 buffer.append(name);
88 }
89
90 if (publicID != null) {
91 buffer.append(" PUBLIC \"");
92 buffer.append(publicID);
93 buffer.append("\" ");
94 if (systemID != null) {
95 buffer.append("\"");
96 buffer.append(systemID);
97 buffer.append("\" ");
98 }
99 }
100 else if (systemID != null) {
101 buffer.append(" SYSTEM \"");
102 buffer.append(systemID);
103 buffer.append("\" ");
104 }
105 buffer.append(">");
106 return buffer.toString();
107 }
108 }
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156