svn commit: r1004570 - /lenya/sandbox/modules/feed/branches/add-apache-feedparser/java/src/org/apache/lenya/parser/FeedToDocumentParser.java

[email protected] Tue, 05 Oct 2010 08:27:45 -0000
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: florent
Date: Tue Oct  5 08:27:45 2010
New Revision: 1004570

URL: http://svn.apache.org/viewvc?rev=1004570&view=rev
Log:
- add an inputStream method

Modified:
    lenya/sandbox/modules/feed/branches/add-apache-feedparser/java/src/org/apache/lenya/parser/FeedToDocumentParser.java

Modified: lenya/sandbox/modules/feed/branches/add-apache-feedparser/java/src/org/apache/lenya/parser/FeedToDocumentParser.java
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/feed/branches/add-apache-feedparser/java/src/org/apache/lenya/parser/FeedToDocumentParser.java?rev=1004570&r1=1004569&r2=1004570&view=diff
==============================================================================
--- lenya/sandbox/modules/feed/branches/add-apache-feedparser/java/src/org/apache/lenya/parser/FeedToDocumentParser.java (original)
+++ lenya/sandbox/modules/feed/branches/add-apache-feedparser/java/src/org/apache/lenya/parser/FeedToDocumentParser.java Tue Oct  5 08:27:45 2010
@@ -44,35 +44,45 @@ public class FeedToDocumentParser{
     public FeedToDocumentParser(){
     
     }
-    
-    public void parse(String urlToParse, ContentHandler ch)
-	throws  SAXException, IOException
-    {
 
+    public void parse(InputStream is, ContentHandler ch, String urlToParse) throws  SAXException{
 	try{
+	
 	    //create a new FeedParser...
 	    FeedParser parser = FeedParserFactory.newFeedParser();
 	    
 	    //create a listener for handling our callbacks
 	    FeedParserListener listener = new LenyaFeedParserListener(ch);
 	    
+	    //start parsing our feed and have the above onItem methods called
+	    parser.parse( listener, is, urlToParse );
+	}
+	catch(FeedParserException fde){
+	    throw new SAXException(fde);
+	    //TODO : deal with this error
+	}
+    
+    }
+    
+    public void parse(String urlToParse, ContentHandler ch)
+	throws  SAXException, IOException
+    {
+
+	try{
 	    //use the FeedParser network IO package to fetch our resource URL
 	    ResourceRequest request = ResourceRequestFactory.getResourceRequest( urlToParse );
 	    
 	    //grab our input stream
 	    InputStream is = request.getInputStream();
 	    
-	    //start parsing our feed and have the above onItem methods called
-	    parser.parse( listener, is, urlToParse );	
+	    parse(is, ch, urlToParse);
+
+	    
 	}
 	catch(NetworkException ne){
 	    throw new SAXException(ne);
 	    //TODO : deal with this error
 	}
-	catch(FeedParserException fde){
-	    throw new SAXException(fde);
-	    //TODO : deal with this error
-	}
 	catch(IOException io){
 	    throw io;
 	    //TODO : deal with this error