commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bur...@apache.org
Subject cvs commit: jakarta-commons-sandbox/feedparser/src/java/org/apache/commons/feedparser/locate FeedLocator.java
Date Wed, 18 Aug 2004 18:23:02 GMT
burton      2004/08/18 11:23:01

  Modified:    feedparser/src/java/org/apache/commons/feedparser
                        RSSFeedParser.java
               feedparser/src/java/org/apache/commons/feedparser/impl
                        DebugFeedParserListener.java
               feedparser/src/java/org/apache/commons/feedparser/locate
                        FeedLocator.java
  Log:
  Always trim() element values... while its slower its needed becuase Xerces isnt always trimming
them
  
  Revision  Changes    Path
  1.9       +9 -5      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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- RSSFeedParser.java	28 Jun 2004 01:04:37 -0000	1.8
  +++ RSSFeedParser.java	18 Aug 2004 18:23:01 -0000	1.9
  @@ -107,7 +107,7 @@
   
           listener.onChannel( state, 
                               getChildElementTextByName( state, "title" ),
  -                            getChildElementTextByName( state, "link" ),
  +                            getChildElementTextByName( state, "link" ).trim(),
                               getChildElementTextByName( state, "description" ) );
   
           listener.onChannelEnd();
  @@ -237,16 +237,20 @@
        *
        * @author <a href="mailto:burton@peerfear.org">Kevin A. Burton</a>
        */
  -    private static String getChildElementTextByName( FeedParserState state, String name
) throws Exception {
  +    private static String getChildElementTextByName( FeedParserState state,
  +                                                     String name ) throws Exception {
   
           XPath xpath = new XPath( "descendant::*[local-name() = '" + name + "']" );
           Object resultNode = xpath.selectSingleNode( state.current );
   
           String resultText = null;
   
  -        if ( resultNode != null ) {
  +        if ( resultNode != null )
               resultText = ((Element)resultNode).getText();
  -        } 
  +
  +        //The normalize method of XML SHOULD take care of this but for some reason it doesnt.
  +        if ( resultText != null )
  +            resultText = resultText.trim();
   
           return resultText;
           
  
  
  
  1.6       +5 -2      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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DebugFeedParserListener.java	26 Jun 2004 22:42:45 -0000	1.5
  +++ DebugFeedParserListener.java	18 Aug 2004 18:23:01 -0000	1.6
  @@ -53,6 +53,9 @@
                              String description ) {
   
           System.out.println( "debug: onChannel" );
  +        System.out.println( "\ttitle : " + title );
  +        System.out.println( "\tlink : '" + link + "'" );
  +        System.out.println( "\tdescription : " + description );
   
       }
   
  @@ -94,7 +97,7 @@
           System.out.println( "debug: onItem" );
   
           System.out.println( "\ttitle : " + title );
  -        System.out.println( "\tlink : " + link );
  +        System.out.println( "\tlink : '" + link + "'" );
           System.out.println( "\tdescription : " + description );
   
       }
  
  
  
  1.16      +3 -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.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- FeedLocator.java	16 Aug 2004 23:17:44 -0000	1.15
  +++ FeedLocator.java	18 Aug 2004 18:23:01 -0000	1.16
  @@ -91,7 +91,9 @@
   
           //String resource = "http://codinginparadise.org/";
   
  -        String resource = "http://guinness.joeuser.com";
  +        String resource= "http://www.thealarmclock.com/mt/";
  +        
  +        //String resource = "http://guinness.joeuser.com";
           
           //String resource = "http://georgewbush.com/blog";
   
  
  
  

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


Mime
View raw message