View Javadoc

1   /*
2    * Copyright 1999,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  package org.apache.commons.feedparser;
18  
19  import org.jdom.*;
20  
21  /***
22   *
23   * @author <a href="mailto:burton@apache.org">Kevin A. Burton (burtonator)</a>
24   * @version $Id: FeedVersion.java 159215 2005-03-27 23:36:16Z burton $
25   */
26  public class FeedVersion {
27  
28      /***
29       * True if this is an Atom feed.
30       */
31      public boolean isAtom;
32  
33      /***
34       * True if this is an RSS feed
35       */
36      public boolean isRSS;
37      
38      /***
39       * True when this is a Friend of a Friend FOAF file.
40       */
41      public boolean isFOAF;
42  
43      public boolean isOPML;
44  
45      public boolean isXFN;
46  
47      /***
48       * True if this is a changes.xml file.
49       */
50      public boolean isChanges;
51  
52      /***
53       * The version of this specification.  If this is RSS 1.0 the version will
54       * be "1.0".  If this is Atom 0.5 the version will be "0.5" (and so
55       * forth). If the version is unknown the value is simply null.  The format
56       * of this is unstructured text and in many situations is mirrored right
57       * form the 'version' attribute in some RSS/Atom specifications.  See
58       * version_major, version_minor, and version_sub for more info.
59       *
60       * 
61       */
62      public String version = null;
63  
64      public int version_major = 0;
65      public int version_minor = 0;
66      public int version_sub = 0;
67  
68      public String toString() {
69  
70          String result = "";
71  
72          if ( isAtom ) 
73              result = "atom"; 
74          else if ( isRSS )
75              result = "rss";
76          else if ( isFOAF )
77              result = "foaf";
78          else if ( isOPML )
79              result = "opml";
80          else if ( isXFN )
81              result = "xfn";
82          else if ( isChanges )
83              result = "changes";
84  
85          return result += ":" + version;
86  
87      }
88      
89  }