burton      2004/02/26 15:16:29

  Modified:    feedparser SPECIFICATIONS TODO
               feedparser/src/java/org/apache/commons/feedparser
                        AtomFeedParser.java DefaultFeedParserListener.java
                        FeedParserListener.java
                        ModContentFeedParserListener.java
                        RSSFeedParser.java XHTMLFeedParserListener.java
  Added:       feedparser/src/java/org/apache/commons/feedparser
                        ContentFeedParserListener.java
  Log:
  support for Atom content API
  
  Revision  Changes    Path
  1.2       +3 -1      jakarta-commons-sandbox/feedparser/SPECIFICATIONS
  
  Index: SPECIFICATIONS
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/feedparser/SPECIFICATIONS,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SPECIFICATIONS    18 Feb 2004 20:05:19 -0000      1.1
  +++ SPECIFICATIONS    26 Feb 2004 23:16:28 -0000      1.2
  @@ -7,4 +7,6 @@
   
   http://diveintomark.org/archives/2003/12/19/atom-autodiscovery
   
  -http://diveintomark.org/rfc/draft-pilgrim-atom-autodiscovery-02.html
  \ No newline at end of file
  +http://diveintomark.org/rfc/draft-pilgrim-atom-autodiscovery-02.html
  +
  +http://www.mnot.net/drafts/draft-nottingham-atom-format-02.html
  \ No newline at end of file
  
  
  
  1.4       +13 -0     jakarta-commons-sandbox/feedparser/TODO
  
  Index: TODO
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/feedparser/TODO,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TODO      19 Feb 2004 02:26:26 -0000      1.3
  +++ TODO      26 Feb 2004 23:16:28 -0000      1.4
  @@ -23,3 +23,16 @@
   
   - Test cases shouldn't use absolute paths.
   
  +- Migrate to Apache 2.0 license?
  +
  +    http://www.apache.org/dev/apply-license.html
  +
  +- We need a generic Content interface
  +
  +    - onContent
  +    - xhtml:body
  +    - content:encoded
  +    - 
  +    - content type exposed...
  +
  +    - http://intertwingly.net/wiki/pie/content
  \ No newline at end of file
  
  
  
  1.2       +7 -1      
jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/AtomFeedParser.java
  
  Index: AtomFeedParser.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/AtomFeedParser.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AtomFeedParser.java       18 Feb 2004 20:05:20 -0000      1.1
  +++ AtomFeedParser.java       26 Feb 2004 23:16:28 -0000      1.2
  @@ -90,6 +90,12 @@
   
               FeedParserState state = new FeedParserState();
   
  +            FeedVersion v = new FeedVersion();
  +            v.isAtom = true;
  +            listener.onFeedVersion( v );
  +
  +            listener.init();
  +
               doChannel( state, listener, doc );
               doEntry( state, listener, doc );
   
  
  
  
  1.3       +3 -1      
jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/DefaultFeedParserListener.java
  
  Index: DefaultFeedParserListener.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/DefaultFeedParserListener.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultFeedParserListener.java    20 Feb 2004 19:07:44 -0000      1.2
  +++ DefaultFeedParserListener.java    26 Feb 2004 23:16:28 -0000      1.3
  @@ -149,4 +149,6 @@
   
       public void onXHTMLBodyEnd() throws FeedParserException {}
   
  +    public void onFeedVersion( FeedVersion version ) throws FeedParserException {}
  +    
   }
  
  
  
  1.2       +12 -1     
jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/FeedParserListener.java
  
  Index: FeedParserListener.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/FeedParserListener.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FeedParserListener.java   18 Feb 2004 20:05:20 -0000      1.1
  +++ FeedParserListener.java   26 Feb 2004 23:16:28 -0000      1.2
  @@ -102,5 +102,16 @@
   
       public void onItemEnd() throws FeedParserException;
   
  +    /**
  +     * Called when we are first able to determine the feed version for this
  +     * feed.  Ideally implementations should call this BEFORE onChannel but
  +     * depending on the parser infrastructure this might not be possible.
  +     *
  +     * Should be called before init()
  +     *
  +     * @author <a href="mailto:[EMAIL PROTECTED]">Kevin Burton</a>
  +     */
  +    public void onFeedVersion( FeedVersion version ) throws FeedParserException;
  +
   }
   
  
  
  
  1.2       +2 -1      
jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/ModContentFeedParserListener.java
  
  Index: ModContentFeedParserListener.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/ModContentFeedParserListener.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ModContentFeedParserListener.java 18 Feb 2004 20:05:20 -0000      1.1
  +++ ModContentFeedParserListener.java 26 Feb 2004 23:16:29 -0000      1.2
  @@ -60,6 +60,7 @@
   
   /**
    *
  + * @deprecated Migration to ContentFeedParserListener
    * @author <a href="mailto:[EMAIL PROTECTED]">Kevin A. Burton (burtonator)</a>
    * @version $Id$
    */
  
  
  
  1.2       +5 -1      
jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/RSSFeedParser.java
  
  Index: RSSFeedParser.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/RSSFeedParser.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RSSFeedParser.java        18 Feb 2004 20:05:20 -0000      1.1
  +++ RSSFeedParser.java        26 Feb 2004 23:16:29 -0000      1.2
  @@ -88,6 +88,10 @@
   
           FeedParserState state = new FeedParserState();
   
  +        FeedVersion v = new FeedVersion();
  +        v.isRSS = true;
  +        listener.onFeedVersion( v );
  +
           listener.init();
   
           //*** now process the channel. ***
  
  
  
  1.2       +2 -1      
jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/XHTMLFeedParserListener.java
  
  Index: XHTMLFeedParserListener.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/XHTMLFeedParserListener.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XHTMLFeedParserListener.java      18 Feb 2004 20:05:20 -0000      1.1
  +++ XHTMLFeedParserListener.java      26 Feb 2004 23:16:29 -0000      1.2
  @@ -60,6 +60,7 @@
   
   /**
    *
  + * @deprecated Migration to ContentFeedParserListener
    * @author <a href="mailto:[EMAIL PROTECTED]">Kevin A. Burton (burtonator)</a>
    * @version $Id$
    */
  
  
  
  1.1                  
jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/ContentFeedParserListener.java
  
  Index: ContentFeedParserListener.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "FeedParser", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  
  package org.apache.commons.feedparser;
  
  import org.jdom.*;
  
  /**
   * Generic content module designed to be compatible with xhtml:body, Atom
   * content, as well as RSS 1.0 mod_content module.
   * 
   * @author <a href="mailto:[EMAIL PROTECTED]">Kevin A. Burton (burtonator)</a>
   * @version $Id: ContentFeedParserListener.java,v 1.1 2004/02/26 23:16:28 burton Exp 
$
   */
  public interface ContentFeedParserListener {
  
      /**
       *
       * Called when new content is found.
       * 
       * @param type (Atom) Content constructs MAY have a "type" attribute, whose
       * value indicates the media type of the content. When present, this attribute's
       * value MUST be a registered media type [RFC2045]. If not present, its value
       * MUST be considered to be "text/plain".  3.1.2 "mode" Attribute
       * 
       * @param mode (Atom) Content constructs MAY have a "mode" attribute, whose
       * value indicates the method used to encode the content. When present, this
       * attribute's value MUST be listed below. If not present, its value MUST be
       * considered to be "xml".
       * 
       * "xml":
       * 
       * A mode attribute with the value "xml" indicates that the element's content is
       * inline xml (for example, namespace-qualified XHTML).
       * 
       * "escaped":
       * 
       * A mode attribute with the value "escaped" indicates that the element's
       * content is an escaped string. Processors MUST unescape the element's content
       * before considering it as content of the indicated media type.
       * 
       * "base64":
       * 
       * A mode attribute with the value "base64" indicates that the element's content 
is
       * base64-encoded [RFC2045]. Processors MUST decode the element's content before
       * considering it as content of the the indicated media type.
       * 
       * @param format (RSS 1.0 mod_content) Required. An empty element with an
       * rdf:resource attribute that points to a URI representing the format of the
       * content:item. Suggested best practice is to use the list of RDDL natures.
       *
       * @param encoding (RSS 1.0 mod_content) Optional. An empty element with an
       * rdf:resource attribute that points to a URI representing the encoding of the
       * content:item. An encoding is a reversable method of including content within
       * the RSS file.
       *
       * @param value String value of the found content.
       * 
       * @author <a href="mailto:[EMAIL PROTECTED]">Kevin Burton</a>
       */
      public void onContent( FeedParserState state,
                             String type,
                             String format,
                             String encoding,
                             String mode,
                             String value ) throws FeedParserException;
  
      public void onContent() throws FeedParserException;
  
  }
  
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to