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 java.util.Date;
20 import java.util.Locale;
21
22 /**
23 *
24 * Provides a MetaData event listener for RSS 0.9x, RSS 1.0, 2.0 and Atom
25 * metadata values.
26 *
27 * Each format provides mechanisms to represent copyright strings, dates,
28 * modified times, etc. This interface provides a generic implementation for
29 * each.
30 *
31 * @author <a href="mailto:burton@apache.org">Kevin A. Burton (burtonator)</a>
32 * @version $Id: MetaFeedParserListener.java 373614 2006-01-30 22:31:21Z mvdb $
33 */
34 public interface MetaFeedParserListener {
35
36 public void onCopyright( FeedParserState state, String content ) throws FeedParserException;
37 public void onCopyrightEnd() throws FeedParserException;
38
39 /**
40 *
41 * --- ATOM SUPPORT ---
42 *
43 * The "atom:created" element's content indicates the time that the entry
44 * was created. Entries MAY contain an atom:created element, but MUST NOT
45 * contain more than one. When this element is present, its content MUST be
46 * a W3C Date-Time string [[ref]]. The date SHOULD be expressed in the "UTC"
47 * time zone [[reword?]].
48 *
49 * If atom:created is not present, CONSUMERS MUST consider its value to be
50 * the same as that of atom:modified.
51 *
52 * http://www.mnot.net/drafts/draft-nottingham-atom-format-00.html#rfc.section.3.2.8
53 *
54 * --- RSS 2.0 SUPPORT ---
55 *
56 * <pubDate> is an optional sub-element of <item>.
57 *
58 * Its value is a date, indicating when the item was published. If it's a
59 * date in the future, aggregators may choose to not display the item until
60 * that date.
61 *
62 * <pubDate>Sun, 19 May 2002 15:21:36 GMT</pubDate>
63 *
64 * http://feedvalidator.org/docs/rss2.html#ltpubdategtSubelementOfLtitemgt
65 *
66 * --- RSS 1.0 SUPPORT ---
67 *
68 * We use dc:date which is ISO 8601 compliant.
69 *
70 * http://www.w3.org/TR/NOTE-datetime
71 * http://web.resource.org/rss/1.0/modules/dc/
72 *
73 *
74 */
75 public void onCreated( FeedParserState state, Date date ) throws FeedParserException;
76 public void onCreatedEnd() throws FeedParserException;
77
78 /**
79 * http://www.mnot.net/drafts/draft-nottingham-atom-format-00.html#rfc.section.3.2.7
80 *
81 *
82 */
83 public void onIssued( FeedParserState state, String content ) throws FeedParserException;
84 public void onIssuedEnd() throws FeedParserException;
85
86 /**
87 * RSS 2.0 category. Dublin Core.
88 */
89 public void onSubject( FeedParserState state, String content ) throws FeedParserException;
90 public void onSubjectEnd() throws FeedParserException;
91
92 /**
93 * Called when we've found an xml:lang or a dc:lang on Atom and RSS feeds.
94 *
95 *
96 */
97 public void onLocale( FeedParserState state, Locale locale ) throws FeedParserException;
98 public void onLocaleEnd() throws FeedParserException;
99
100 /**
101 * Used to represent RSS 2.0 GUIDs and atom:id constructs. For Atom
102 * isPermalink should be ignored.
103 *
104 *
105 */
106 public void onGUID( FeedParserState state,
107 String value,
108 boolean isPermalink ) throws FeedParserException;
109
110 public void onGUIDEnd() throws FeedParserException;
111
112 /**
113 * Called when a generator contruct is found within Atom or RSS 2.0
114 *
115 *
116 */
117 public void onGenerator( FeedParserState state, String content ) throws FeedParserException;
118 public void onGeneratorEnd() throws FeedParserException;
119
120 /**
121 * Provided for author information across RSS 2.0, atom, dc:creator in RSS
122 * 1.0. Both email, and resource may be null if not specified.
123 *
124 * TODO: what does RSS 0.91, 0.9, etc provide?
125 *
126 * NOTE that this is not yet 100% compatible with FOAF person constructs.
127 * FOAF provides additional metadata including title, firstName, surname,
128 * nick, etc which we don't provide with this method. We'll probably add
129 * additional events for this in the future.
130 *
131 *
132 */
133 public void onAuthor( FeedParserState state,
134 String name,
135 String email,
136 String resource ) throws FeedParserException;
137
138 public void onAuthorEnd() throws FeedParserException;
139
140 public void onComments( FeedParserState state,
141 String resource ) throws FeedParserException;
142
143 public void onCommentsEnd() throws FeedParserException;
144
145 public void onCommentsFeed( FeedParserState state,
146 String resource ) throws FeedParserException;
147
148 public void onCommentsFeedEnd() throws FeedParserException;
149
150 }