|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
ExternalEntityDecl.java | 75% | 89,3% | 55,6% | 80% |
|
1 | /* | |
2 | * Copyright 2001-2004 (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 | * $Id: ExternalEntityDecl.java,v 1.7 2004/06/25 08:03:36 maartenc Exp $ | |
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 | 0 | public ExternalEntityDecl() { |
29 | } | |
30 | ||
31 | 8 | public ExternalEntityDecl(String name, String publicID, String systemID) { |
32 | 8 | this.name = name; |
33 | 8 | this.publicID = publicID; |
34 | 8 | this.systemID = systemID; |
35 | } | |
36 | ||
37 | /** Getter for property name. | |
38 | * @return Value of property name. | |
39 | */ | |
40 | 4 | public String getName() { |
41 | 4 | return name; |
42 | } | |
43 | ||
44 | /** Setter for property name. | |
45 | * @param name New value of property name. | |
46 | */ | |
47 | 0 | public void setName(String name) { |
48 | 0 | this.name = name; |
49 | } | |
50 | ||
51 | /** Getter for property publicID. | |
52 | * @return Value of property publicID. | |
53 | */ | |
54 | 4 | public String getPublicID() { |
55 | 4 | return publicID; |
56 | } | |
57 | ||
58 | /** Setter for property publicID. | |
59 | * @param publicID New value of property publicID. | |
60 | */ | |
61 | 0 | public void setPublicID(String publicID) { |
62 | 0 | this.publicID = publicID; |
63 | } | |
64 | ||
65 | /** Getter for property systemID. | |
66 | * @return Value of property systemID. | |
67 | */ | |
68 | 4 | public String getSystemID() { |
69 | 4 | return systemID; |
70 | } | |
71 | ||
72 | /** Setter for property systemID. | |
73 | * @param systemID New value of property systemID. | |
74 | */ | |
75 | 0 | public void setSystemID(String systemID) { |
76 | 0 | this.systemID = systemID; |
77 | } | |
78 | ||
79 | 8 | public String toString() { |
80 | 8 | StringBuffer buffer = new StringBuffer( "<!ENTITY " ); |
81 | ||
82 | 8 | if (name.startsWith("%")) { |
83 | 2 | buffer.append("% "); |
84 | 2 | buffer.append(name.substring(1)); |
85 | } | |
86 | else { | |
87 | 6 | buffer.append(name); |
88 | } | |
89 | ||
90 | 8 | if (publicID != null) { |
91 | 2 | buffer.append(" PUBLIC \""); |
92 | 2 | buffer.append(publicID); |
93 | 2 | buffer.append("\" "); |
94 | 2 | if (systemID != null) { |
95 | 2 | buffer.append("\""); |
96 | 2 | buffer.append(systemID); |
97 | 2 | buffer.append("\" "); |
98 | } | |
99 | } | |
100 | 6 | else if (systemID != null) { |
101 | 6 | buffer.append(" SYSTEM \""); |
102 | 6 | buffer.append(systemID); |
103 | 6 | buffer.append("\" "); |
104 | } | |
105 | 8 | buffer.append(">"); |
106 | 8 | return buffer.toString(); |
107 | } | |
108 | } | |
109 | ||
110 | ||
111 | ||
112 | ||
113 | /* | |
114 | * Redistribution and use of this software and associated documentation | |
115 | * ("Software"), with or without modification, are permitted provided | |
116 | * that the following conditions are met: | |
117 | * | |
118 | * 1. Redistributions of source code must retain copyright | |
119 | * statements and notices. Redistributions must also contain a | |
120 | * copy of this document. | |
121 | * | |
122 | * 2. Redistributions in binary form must reproduce the | |
123 | * above copyright notice, this list of conditions and the | |
124 | * following disclaimer in the documentation and/or other | |
125 | * materials provided with the distribution. | |
126 | * | |
127 | * 3. The name "DOM4J" must not be used to endorse or promote | |
128 | * products derived from this Software without prior written | |
129 | * permission of MetaStuff, Ltd. For written permission, | |
130 | * please contact dom4j-info@metastuff.com. | |
131 | * | |
132 | * 4. Products derived from this Software may not be called "DOM4J" | |
133 | * nor may "DOM4J" appear in their names without prior written | |
134 | * permission of MetaStuff, Ltd. DOM4J is a registered | |
135 | * trademark of MetaStuff, Ltd. | |
136 | * | |
137 | * 5. Due credit should be given to the DOM4J Project - | |
138 | * http://www.dom4j.org | |
139 | * | |
140 | * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS | |
141 | * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT | |
142 | * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |
143 | * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | |
144 | * METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |
145 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
146 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
147 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
148 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
149 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
150 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | |
151 | * OF THE POSSIBILITY OF SUCH DAMAGE. | |
152 | * | |
153 | * Copyright 2001-2004 (C) MetaStuff, Ltd. All Rights Reserved. | |
154 | * | |
155 | * $Id: ExternalEntityDecl.java,v 1.7 2004/06/25 08:03:36 maartenc Exp $ | |
156 | */ |
|