sgala       01/12/05 10:46:55

  Modified:    src/java/org/apache/jetspeed/portal/portlets RSSPortlet.java
  Log:
  Converting to JAXP support. This class was missing. We should remove it or 
NewRSSPortlet.
  
  Revision  Changes    Path
  1.46      +19 -30    
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/RSSPortlet.java
  
  Index: RSSPortlet.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/RSSPortlet.java,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- RSSPortlet.java   2001/09/13 13:53:02     1.45
  +++ RSSPortlet.java   2001/12/05 18:46:55     1.46
  @@ -75,8 +75,9 @@
   //turbine
   import org.apache.turbine.util.*;
   
  -//xerces support
  -import org.apache.xerces.parsers.*;
  +//JAXP support
  +import javax.xml.parsers.DocumentBuilder;
  +import javax.xml.parsers.DocumentBuilderFactory;
   
   //XML stuff
   import org.w3c.dom.*;
  @@ -87,7 +88,7 @@
   
   @author <A HREF="mailto:[EMAIL PROTECTED]";>Kevin A. Burton</A>
   @author <A HREF="mailto:[EMAIL PROTECTED]";>Santiago Gala</A>
  -@version $Id: RSSPortlet.java,v 1.45 2001/09/13 13:53:02 sgala Exp $ 
  +@version $Id: RSSPortlet.java,v 1.46 2001/12/05 18:46:55 sgala Exp $ 
   */
   public class RSSPortlet extends FileWatchPortlet {
       
  @@ -100,15 +101,19 @@
       
       /**
       @author <A HREF="mailto:[EMAIL PROTECTED]";>Kevin A. Burton</A>
  -    @version $Id: RSSPortlet.java,v 1.45 2001/09/13 13:53:02 sgala Exp $ 
  +    @version $Id: RSSPortlet.java,v 1.46 2001/12/05 18:46:55 sgala Exp $ 
       */
       public void init( ) throws PortletException {
   
  -        DOMParser parser = null;
  +        DocumentBuilder parser = null;
  +        Document document = null;
           String url = null;
   
           try {
  -            parser = new DOMParser();
  +            final DocumentBuilderFactory docfactory = 
DocumentBuilderFactory.newInstance();
  +            //Have it non-validating
  +            docfactory.setValidating(false);
  +            parser= docfactory.newDocumentBuilder();
               //SGP Changing Resolver to enable Reading through cache
               parser.setEntityResolver(new JetspeedXMLEntityResolver() );
   
  @@ -121,37 +126,23 @@
               is.setEncoding( "UTF8" );
               is.setSystemId( url );
   
  -            parser.setFeature( 
"http://apache.org/xml/features/allow-java-encodings";, 
  -                               true );
  -            parser.parse( is );
  +            //parser.setFeature( 
"http://apache.org/xml/features/allow-java-encodings";, 
  +            //                   true );
  +            document = parser.parse( is );
   
  -        } catch ( Throwable t ) {
  +        } catch ( Throwable t )
  +        {
   
  -            Locator locator = parser.getLocator();
  -            
  -            String lineInfo = "";
  -
  -            /*NOTE: When trying to get line info Xerces was throwing an NPE
  -            String lineInfo = "LineInfo: line number: " + 
  -                              locator.getLineNumber() +
  -                              " column number:  " + 
  -                              locator.getColumnNumber();
  -                              */
  -
               String message = "RSSPortlet:  Couldn't parse out XML document -> " + 
  -                              url + 
  -                              " " + 
  -                              lineInfo;
  -
  +                              url;
   
               Log.error( message, t );
               throw new PortletException( t.getMessage() );
  +
           }
   
           //SGP giving NullPointer
           try {
  -            Document document = parser.getDocument();
  -
               //now that we have the document set the items for this
   
               this.setItems( this.parseItems( document ) );
  @@ -160,9 +151,7 @@
               String description = null;
   
               //this a hack until DOM2 namespace support becomes better in Xerces.
  -        
               Node root = document.getFirstChild();
  -        
               //now find the channel node.
               Node channel = null;
           
  @@ -296,7 +285,7 @@
   
       /**
       @author <A HREF="mailto:[EMAIL PROTECTED]";>Kevin A. Burton</A>
  -    @version $Id: RSSPortlet.java,v 1.45 2001/09/13 13:53:02 sgala Exp $ 
  +    @version $Id: RSSPortlet.java,v 1.46 2001/12/05 18:46:55 sgala Exp $ 
       */
       public boolean isCacheable() {
           return true;
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to