You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2004/04/15 18:57:20 UTC

cvs commit: jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/locate AnchorParser.java AnchorParserListener.java DiscoveryLocator.java FeedReference.java ResourceExpander.java

burton      2004/04/15 09:57:20

  Modified:    feedparser TODO
               feedparser/src/java/org/apache/commons/feedparser/locate
                        AnchorParser.java AnchorParserListener.java
                        DiscoveryLocator.java FeedReference.java
                        ResourceExpander.java
  Log:
  more feedlocator support
  
  Revision  Changes    Path
  1.8       +2 -0      jakarta-commons-sandbox/feedparser/TODO
  
  Index: TODO
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/feedparser/TODO,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TODO	15 Apr 2004 00:58:43 -0000	1.7
  +++ TODO	15 Apr 2004 16:57:20 -0000	1.8
  @@ -47,3 +47,5 @@
   - Support textinput
   
   - All FeedParser exceptions should include the URL of the feed if possible.
  +
  +- Tests for autodiscovery
  \ No newline at end of file
  
  
  
  1.2       +2 -1      jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/locate/AnchorParser.java
  
  Index: AnchorParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/locate/AnchorParser.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AnchorParser.java	15 Apr 2004 00:58:44 -0000	1.1
  +++ AnchorParser.java	15 Apr 2004 16:57:20 -0000	1.2
  @@ -57,7 +57,8 @@
               String resource = EntityDecoder.decode( m.group( 1 ) );
               String title = EntityDecoder.decode( m.group( 2 ).trim() );
   
  -            listener.onAnchor( resource, null, title );
  +            if ( ! listener.onAnchor( resource, null, title ) )
  +                return;
   
           } 
   
  
  
  
  1.2       +13 -4     jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/locate/AnchorParserListener.java
  
  Index: AnchorParserListener.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/locate/AnchorParserListener.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AnchorParserListener.java	15 Apr 2004 00:58:44 -0000	1.1
  +++ AnchorParserListener.java	15 Apr 2004 16:57:20 -0000	1.2
  @@ -23,16 +23,25 @@
   
   /**
    *
  - * Given HTML pull out an array of anchors
  - *
    * @author <a href="mailto:burton@openprivacy.org">Kevin A. Burton</a>
    */
   public interface AnchorParserListener {
   
       public void setContext( Object context );
   
  -    public void onAnchor( String href, String rel, String title );
  +    /**
  +     * Return a result if necessary;
  +     *
  +     * @author <a href="mailto:burton@peerfear.org">Kevin Burton</a>
  +     */
  +    public Object getResult();
   
  -    public void onImage( String src, String width, String height );
  +    /**
  +     * Called when the AnchorParser finds an Anchor.  Return false if you wish
  +     * to stop parsing.
  +     *
  +     * @author <a href="mailto:burton@peerfear.org">Kevin Burton</a>
  +     */
  +    public boolean onAnchor( String href, String rel, String title );
   
   }
  
  
  
  1.5       +3 -1      jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/locate/DiscoveryLocator.java
  
  Index: DiscoveryLocator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/locate/DiscoveryLocator.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DiscoveryLocator.java	15 Apr 2004 04:57:17 -0000	1.4
  +++ DiscoveryLocator.java	15 Apr 2004 16:57:20 -0000	1.5
  @@ -67,8 +67,10 @@
   
               if ( mediatypes.contains( type )  ) {
   
  -                //FIXME: expand the href
  +                //expand the href
                   String href = m.group( 2 );
  +                href = ResourceExpander.expand( resource, href );
  +
                   list.add( new FeedReference( href, type ) );
                   return list;
               }
  
  
  
  1.4       +4 -0      jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/locate/FeedReference.java
  
  Index: FeedReference.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/locate/FeedReference.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- FeedReference.java	15 Apr 2004 00:58:44 -0000	1.3
  +++ FeedReference.java	15 Apr 2004 16:57:20 -0000	1.4
  @@ -25,9 +25,13 @@
    */
   public class FeedReference {
   
  +    public static int METHOD_AUTODISCOVERY;
  +    
       public String resource = null;
       public String type = null;
   
  +    public int method = 0;
  +    
       public FeedReference( String resource, String type ) {
           this.resource = resource;
           this.type = type;
  
  
  
  1.2       +2 -2      jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/locate/ResourceExpander.java
  
  Index: ResourceExpander.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/locate/ResourceExpander.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ResourceExpander.java	15 Apr 2004 04:57:18 -0000	1.1
  +++ ResourceExpander.java	15 Apr 2004 16:57:20 -0000	1.2
  @@ -45,7 +45,7 @@
        *
        * @author <a href="mailto:burton@openprivacy.org">Kevin A. Burton</a>
        */
  -    public static String expand( String resource, String link ) throws Exception {
  +    public static String expand( String resource, String link ) {
   
           //make sure we can use this.
           if ( isInvalidScheme( link ) )
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org