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