001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: package org.apache.commons.digester.rss;
019:
020: import java.io.PrintWriter;
021: import java.io.Serializable;
022:
023: /**
024: * <p>Implementation object representing an <strong>item</strong> in the
025: * <em>Rich Site Summary</em> DTD, version 0.91. This class may be subclassed
026: * to further specialize its behavior.</p>
027: */
028:
029: public class Item implements Serializable {
030:
031: // ------------------------------------------------------------- Properties
032:
033: /**
034: * The item description (1-500 characters).
035: */
036: protected String description = null;
037:
038: public String getDescription() {
039: return (this .description);
040: }
041:
042: public void setDescription(String description) {
043: this .description = description;
044: }
045:
046: /**
047: * The item link (1-500 characters).
048: */
049: protected String link = null;
050:
051: public String getLink() {
052: return (this .link);
053: }
054:
055: public void setLink(String link) {
056: this .link = link;
057: }
058:
059: /**
060: * The item title (1-100 characters).
061: */
062: protected String title = null;
063:
064: public String getTitle() {
065: return (this .title);
066: }
067:
068: public void setTitle(String title) {
069: this .title = title;
070: }
071:
072: // -------------------------------------------------------- Package Methods
073:
074: /**
075: * Render this channel as XML conforming to the RSS 0.91 specification,
076: * to the specified writer.
077: *
078: * @param writer The writer to render output to
079: */
080: void render(PrintWriter writer) {
081:
082: writer.println(" <item>");
083:
084: writer.print(" <title>");
085: writer.print(title);
086: writer.println("</title>");
087:
088: writer.print(" <link>");
089: writer.print(link);
090: writer.println("</link>");
091:
092: if (description != null) {
093: writer.print(" <description>");
094: writer.print(description);
095: writer.println("</description>");
096: }
097:
098: writer.println(" </item>");
099:
100: }
101:
102: }
|