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    import java.io.InputStream;
020    
021    /**
022     * This FeedParser implementation is based on JDOM and Jaxen and is based around
023     * XPath and JDOM iteration.  While the implementation is straight forward it
024     * has not been optimized for performance.  A SAX based parser would certainly
025     * be less memory intensive but with the downside of being harder to develop.  
026     *
027     * @author <a href="mailto:burton@apache.org">Kevin A. Burton (burtonator)</a>
028     * @version $Id: FeedParser.java 155416 2005-02-26 13:00:10Z dirkv $
029     */
030    public interface FeedParser {
031    
032        /**
033         * Parse this feed.
034         * 
035         * @param resource The URL of the feed being parsed.  This is optional and
036         * may be null but is used when an exception is thrown to aid debugging.
037         *
038         */
039        public void parse( FeedParserListener listener,
040                           InputStream is ,
041                           String resource ) throws FeedParserException;
042    
043        /**
044         * @deprecated Use #parse( FeedParserException, InputStream, String )
045         */
046        public void parse( FeedParserListener listener,
047                           InputStream is ) throws FeedParserException;
048    
049        /**
050         * Parse this feed.
051         *
052         */
053        public void parse( FeedParserListener listener,
054                           org.jdom.Document doc ) throws FeedParserException;
055    
056    }
057