001    /*
002     * Copyright 1999,2004 The Apache Software Foundation.
003     * 
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     * 
008     *      http://www.apache.org/licenses/LICENSE-2.0
009     * 
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    
017    package org.apache.commons.feedparser;
018    
019    
020    /**
021     * Generic content module designed to be compatible with xhtml:body, Atom
022     * content, as well as RSS 1.0 mod_content module.
023     * 
024     * @author <a href="mailto:burton@apache.org">Kevin A. Burton (burtonator)</a>
025     * @version $Id: ContentFeedParserListener.java 373614 2006-01-30 22:31:21Z mvdb $
026     */
027    public interface ContentFeedParserListener {
028    
029        /**
030         *
031         * Called when new content is found.
032         * 
033         * @param type (Atom) Content constructs MAY have a "type" attribute, whose
034         * value indicates the media type of the content. When present, this attribute's
035         * value MUST be a registered media type [RFC2045]. If not present, its value
036         * MUST be considered to be "text/plain".  3.1.2 "mode" Attribute
037         * 
038         * @param mode (Atom) Content constructs MAY have a "mode" attribute, whose
039         * value indicates the method used to encode the content. When present, this
040         * attribute's value MUST be listed below. If not present, its value MUST be
041         * considered to be "xml".
042         * 
043         * "xml":
044         * 
045         * A mode attribute with the value "xml" indicates that the element's content is
046         * inline xml (for example, namespace-qualified XHTML).
047         * 
048         * "escaped":
049         * 
050         * A mode attribute with the value "escaped" indicates that the element's
051         * content is an escaped string. Processors MUST unescape the element's content
052         * before considering it as content of the indicated media type.
053         * 
054         * "base64":
055         * 
056         * A mode attribute with the value "base64" indicates that the element's content is
057         * base64-encoded [RFC2045]. Processors MUST decode the element's content before
058         * considering it as content of the the indicated media type.
059         * 
060         * @param format (RSS 1.0 mod_content) Required. An empty element with an
061         * rdf:resource attribute that points to a URI representing the format of the
062         * content:item. Suggested best practice is to use the list of RDDL natures.
063         *
064         * @param encoding (RSS 1.0 mod_content) Optional. An empty element with an
065         * rdf:resource attribute that points to a URI representing the encoding of the
066         * content:item. An encoding is a reversable method of including content within
067         * the RSS file.
068         *
069         * @param value String value of the found content.  if this is Base64
070         * encoded content we do NOT decode the value but return it as a string.
071         * This is done because the content might be binary and returning as a
072         * string would be invalid.
073         * 
074         * @param isSummary True if this is just a summary of the content and not
075         * the full content.  This is only known for Atom feeds.
076         * 
077         * 
078         */
079        public void onContent( FeedParserState state,
080                               String type,
081                               String format,
082                               String encoding,
083                               String mode,
084                               String value,
085                               boolean isSummary ) throws FeedParserException;
086    
087        public void onContentEnd() throws FeedParserException;
088    
089    }
090