[prev in list] [next in list] [prev in thread] [next in thread]
List: jakarta-commons-dev
Subject: cvs commit: jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/locate FeedLoc
From: burton () apache ! org
Date: 2004-04-29 9:36:25
Message-ID: 20040429093625.96071.qmail () minotaur ! apache ! org
[Download RAW message or body]
burton 2004/04/29 02:36:25
Modified: feedparser/src/java/org/apache/commons/feedparser
AtomFeedParser.java ContentFeedParserListener.java
DefaultFeedParserListener.java
feedparser/src/java/org/apache/commons/feedparser/impl
DebugFeedParserListener.java
feedparser/src/java/org/apache/commons/feedparser/locate
FeedLocator.java
Log:
now support rich Atom summary
Revision Changes Path
1.6 +22 -2 \
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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- AtomFeedParser.java 13 Mar 2004 07:05:57 -0000 1.5
+++ AtomFeedParser.java 29 Apr 2004 09:36:25 -0000 1.6
@@ -178,10 +178,30 @@
value = getXMLOfContent( content.getContent() );
}
- clistener.onContent( state, type, format, encoding, mode, value );
+ boolean isSummary = false;
+
+ clistener.onContent( state, type, format, encoding, mode, value, \
isSummary );
}
+ xpath = new XPath( "atom:summary[@type='application/xhtml+xml']" );
+ xpath.setNamespaceContext( NS.context );
+ Element e = (Element)xpath.selectSingleNode( current );
+
+ if ( e != null ) {
+
+ String type = "text/html";
+ String format = "application/xhtml+xml";
+ String encoding = null;
+ String mode = "xml";
+
+ String value = getXMLOfContent( e );
+ boolean isSummary = true;
+
+ clistener.onContent( state, type, format, encoding, mode, value, \
isSummary ); +
+ }
+
}
private static String getXMLOfContent( Element element ) {
1.5 +6 -2 \
jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/ContentFeedParserListener.java
Index: ContentFeedParserListener.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/ContentFeedParserListener.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ContentFeedParserListener.java 2 Mar 2004 08:27:52 -0000 1.4
+++ ContentFeedParserListener.java 29 Apr 2004 09:36:25 -0000 1.5
@@ -72,6 +72,9 @@
* This is done because the content might be binary and returning as a
* string would be invalid.
*
+ * @param isSummary True if this is just a summary of the content and not
+ * the full content. This is only known for Atom feeds.
+ *
* @author <a href="mailto:burton@peerfear.org">Kevin Burton</a>
*/
public void onContent( FeedParserState state,
@@ -79,7 +82,8 @@
String format,
String encoding,
String mode,
- String value ) throws FeedParserException;
+ String value,
+ boolean isSummary ) throws FeedParserException;
public void onContentEnd() throws FeedParserException;
1.7 +3 -2 \
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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DefaultFeedParserListener.java 2 Mar 2004 08:27:52 -0000 1.6
+++ DefaultFeedParserListener.java 29 Apr 2004 09:36:25 -0000 1.7
@@ -122,7 +122,8 @@
String format,
String encoding,
String mode,
- String value ) throws FeedParserException {}
+ String value,
+ boolean isSummary ) throws FeedParserException {}
public void onContentEnd() throws FeedParserException {}
1.4 +15 -1 \
jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/impl/DebugFeedParserListener.java
Index: DebugFeedParserListener.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/impl/DebugFeedParserListener.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DebugFeedParserListener.java 21 Apr 2004 06:59:52 -0000 1.3
+++ DebugFeedParserListener.java 29 Apr 2004 09:36:25 -0000 1.4
@@ -125,5 +125,19 @@
}
+ public void onContent( FeedParserState state,
+ String type,
+ String format,
+ String encoding,
+ String mode,
+ String value,
+ boolean isSummary ) throws FeedParserException {
+
+
+ System.out.println( "onContent: " );
+ System.out.println( value );
+
+ }
+
}
1.6 +13 -1 \
jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/locate/FeedLocator.java
Index: FeedLocator.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/locate/FeedLocator.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- FeedLocator.java 23 Apr 2004 17:45:43 -0000 1.5
+++ FeedLocator.java 29 Apr 2004 09:36:25 -0000 1.6
@@ -64,9 +64,21 @@
DiscoveryLocator.locate( resource, content, list );
+ //this failed... try probe location
+ //FIXME: if we still fail try location link probing /index.rdf, /index.xml
+ if ( list.size() == 0 )
+ ProbeLocator.locate( resource, content, list );
+
+ //this failed... try looking for links
+ if ( list.size() == 0 )
+ LinkLocator.locate( resource, content, list );
+
//FIXME: if we faile to locate with location with link discovery.
- //FIXME: if we still fail try location link probing /index.rdf, /index.xml
+ //now resort to link probing
+ //
+ // /rss.xml (for radio blogs)
+ // /index.rdf (for moveable type blogs
return list;
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic