1   /*
2    * Copyright 2001-2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */ 
16  
17  
18  package org.apache.commons.digester.rss;
19  
20  import java.io.PrintWriter;
21  import java.io.Serializable;
22  
23  
24  /***
25   * <p>Implementation object representing an <strong>item</strong> in the
26   * <em>Rich Site Summary</em> DTD, version 0.91.  This class may be subclassed
27   * to further specialize its behavior.</p>
28   */
29  
30  public class Item implements Serializable {
31  
32  
33      // ------------------------------------------------------------- Properties
34  
35  
36      /***
37       * The item description (1-500 characters).
38       */
39      protected String description = null;
40  
41      public String getDescription() {
42          return (this.description);
43      }
44  
45      public void setDescription(String description) {
46          this.description = description;
47      }
48  
49  
50      /***
51       * The item link (1-500 characters).
52       */
53      protected String link = null;
54  
55      public String getLink() {
56          return (this.link);
57      }
58  
59      public void setLink(String link) {
60          this.link = link;
61      }
62  
63  
64      /***
65       * The item title (1-100 characters).
66       */
67      protected String title = null;
68  
69      public String getTitle() {
70          return (this.title);
71      }
72  
73      public void setTitle(String title) {
74          this.title = title;
75      }
76  
77  
78      // -------------------------------------------------------- Package Methods
79  
80  
81      /***
82       * Render this channel as XML conforming to the RSS 0.91 specification,
83       * to the specified writer.
84       *
85       * @param writer The writer to render output to
86       */
87      void render(PrintWriter writer) {
88  
89          writer.println("    <item>");
90  
91          writer.print("      <title>");
92          writer.print(title);
93          writer.println("</title>");
94  
95          writer.print("      <link>");
96          writer.print(link);
97          writer.println("</link>");
98  
99          if (description != null) {
100             writer.print("      <description>");
101             writer.print(description);
102             writer.println("</description>");
103         }
104 
105         writer.println("    </item>");
106 
107     }
108 
109 
110 }