001/*
002 * Copyright 2001 (C) MetaStuff, Ltd. All Rights Reserved.
003 * 
004 * This software is open source. 
005 * See the bottom of this file for the licence.
006 * 
007 * $Id: ExternalEntityDecl.java,v 1.2 2001/11/08 15:47:57 jstrachan Exp $
008 */
009
010package org.dom4j.dtd;
011
012/** <p><code>ExternalEntityDecl</code> represents an external entity declaration in a DTD.</p>
013  *
014  * @author <a href="mailto:james.strachan@metastuff.com">James Strachan</a>
015  * @version $Revision: 1.2 $
016  */
017public class ExternalEntityDecl {
018
019    /** Holds value of property name. */
020    private String name;
021    
022    /** Holds value of property publicID. */
023    private String publicID;    
024    
025    /** Holds value of property systemID. */
026    private String systemID;    
027    
028    public ExternalEntityDecl() {
029    }
030
031    public ExternalEntityDecl(String name, String publicID, String systemID) {
032        this.name = name;
033        this.publicID = publicID;
034        this.systemID = systemID;
035    }
036
037    /** Getter for property name.
038     * @return Value of property name.
039     */
040    public String getName() {
041        return name;
042    }
043    
044    /** Setter for property name.
045     * @param name New value of property name.
046     */
047    public void setName(String name) {
048        this.name = name;
049    }    
050    
051    /** Getter for property publicID.
052     * @return Value of property publicID.
053     */
054    public String getPublicID() {
055        return publicID;
056    }
057    
058    /** Setter for property publicID.
059     * @param publicID New value of property publicID.
060     */
061    public void setPublicID(String publicID) {
062        this.publicID = publicID;
063    }
064    
065    /** Getter for property systemID.
066     * @return Value of property systemID.
067     */
068    public String getSystemID() {
069        return systemID;
070    }
071    
072    /** Setter for property systemID.
073     * @param systemID New value of property systemID.
074     */
075    public void setSystemID(String systemID) {
076        this.systemID = systemID;
077    }
078
079    public String toString() {
080        StringBuffer buffer = new StringBuffer( "<!ENTITY " );
081        buffer.append( name );
082        if (publicID != null) {
083            buffer.append(" PUBLIC \"");
084            buffer.append(publicID);
085            buffer.append("\" ");
086            if (systemID != null) {
087                buffer.append(" \"");
088                buffer.append(systemID);
089                buffer.append("\" ");
090            }
091        }
092        else if (systemID != null) {
093            buffer.append(" SYSTEM \"");
094            buffer.append(systemID);
095            buffer.append("\" ");
096        }
097        buffer.append(">");
098        return buffer.toString();
099    }
100}
101
102
103
104
105/*
106 * Redistribution and use of this software and associated documentation
107 * ("Software"), with or without modification, are permitted provided
108 * that the following conditions are met:
109 *
110 * 1. Redistributions of source code must retain copyright
111 *    statements and notices.  Redistributions must also contain a
112 *    copy of this document.
113 *
114 * 2. Redistributions in binary form must reproduce the
115 *    above copyright notice, this list of conditions and the
116 *    following disclaimer in the documentation and/or other
117 *    materials provided with the distribution.
118 *
119 * 3. The name "DOM4J" must not be used to endorse or promote
120 *    products derived from this Software without prior written
121 *    permission of MetaStuff, Ltd.  For written permission,
122 *    please contact dom4j-info@metastuff.com.
123 *
124 * 4. Products derived from this Software may not be called "DOM4J"
125 *    nor may "DOM4J" appear in their names without prior written
126 *    permission of MetaStuff, Ltd. DOM4J is a registered
127 *    trademark of MetaStuff, Ltd.
128 *
129 * 5. Due credit should be given to the DOM4J Project
130 *    (http://dom4j.org/).
131 *
132 * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS
133 * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
134 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
135 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
136 * METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
137 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
138 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
139 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
140 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
141 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
142 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
143 * OF THE POSSIBILITY OF SUCH DAMAGE.
144 *
145 * Copyright 2001 (C) MetaStuff, Ltd. All Rights Reserved.
146 *
147 * $Id: ExternalEntityDecl.java,v 1.2 2001/11/08 15:47:57 jstrachan Exp $
148 */