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  
20  /**
21   * Generic content module designed to be compatible with xhtml:body, Atom
22   * content, as well as RSS 1.0 mod_content module.
23   * 
24   * @author <a href="mailto:burton@apache.org">Kevin A. Burton (burtonator)</a>
25   * @version $Id: ContentFeedParserListener.java 373614 2006-01-30 22:31:21Z mvdb $
26   */
27  public interface ContentFeedParserListener {
28  
29      /**
30       *
31       * Called when new content is found.
32       * 
33       * @param type (Atom) Content constructs MAY have a "type" attribute, whose
34       * value indicates the media type of the content. When present, this attribute's
35       * value MUST be a registered media type [RFC2045]. If not present, its value
36       * MUST be considered to be "text/plain".  3.1.2 "mode" Attribute
37       * 
38       * @param mode (Atom) Content constructs MAY have a "mode" attribute, whose
39       * value indicates the method used to encode the content. When present, this
40       * attribute's value MUST be listed below. If not present, its value MUST be
41       * considered to be "xml".
42       * 
43       * "xml":
44       * 
45       * A mode attribute with the value "xml" indicates that the element's content is
46       * inline xml (for example, namespace-qualified XHTML).
47       * 
48       * "escaped":
49       * 
50       * A mode attribute with the value "escaped" indicates that the element's
51       * content is an escaped string. Processors MUST unescape the element's content
52       * before considering it as content of the indicated media type.
53       * 
54       * "base64":
55       * 
56       * A mode attribute with the value "base64" indicates that the element's content is
57       * base64-encoded [RFC2045]. Processors MUST decode the element's content before
58       * considering it as content of the the indicated media type.
59       * 
60       * @param format (RSS 1.0 mod_content) Required. An empty element with an
61       * rdf:resource attribute that points to a URI representing the format of the
62       * content:item. Suggested best practice is to use the list of RDDL natures.
63       *
64       * @param encoding (RSS 1.0 mod_content) Optional. An empty element with an
65       * rdf:resource attribute that points to a URI representing the encoding of the
66       * content:item. An encoding is a reversable method of including content within
67       * the RSS file.
68       *
69       * @param value String value of the found content.  if this is Base64
70       * encoded content we do NOT decode the value but return it as a string.
71       * This is done because the content might be binary and returning as a
72       * string would be invalid.
73       * 
74       * @param isSummary True if this is just a summary of the content and not
75       * the full content.  This is only known for Atom feeds.
76       * 
77       * 
78       */
79      public void onContent( FeedParserState state,
80                             String type,
81                             String format,
82                             String encoding,
83                             String mode,
84                             String value,
85                             boolean isSummary ) throws FeedParserException;
86  
87      public void onContentEnd() throws FeedParserException;
88  
89  }
90