portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sg...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets NewRSSPortlet.java
Date Tue, 01 May 2001 19:30:27 GMT
sgala       01/05/01 12:30:27

  Modified:    src/java/org/apache/jetspeed/portal/portlets
                        NewRSSPortlet.java
  Log:
  Change to update dependency from xerces to jaxp,
  and make the parser non validating, so that I think
  it works (no entities, though) without the infamous
  my.netscape DTD :)
  
  Revision  Changes    Path
  1.7       +11 -15    jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/NewRSSPortlet.java
  
  Index: NewRSSPortlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/NewRSSPortlet.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- NewRSSPortlet.java	2001/03/07 06:47:09	1.6
  +++ NewRSSPortlet.java	2001/05/01 19:30:25	1.7
  @@ -73,8 +73,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.*;
  @@ -98,7 +99,7 @@
   is only used for this mime-type</dd>
   </dl>
   @author <A HREF="mailto:raphael@apache.org">RaphaŽl Luta</A>
  -@version $Id: NewRSSPortlet.java,v 1.6 2001/03/07 06:47:09 taylor Exp $ 
  +@version $Id: NewRSSPortlet.java,v 1.7 2001/05/01 19:30:25 sgala Exp $ 
   */
   public class NewRSSPortlet extends FileWatchPortlet {
       
  @@ -114,7 +115,7 @@
       */
       public void init( ) throws PortletException {
           
  -        DOMParser parser = null;
  +        DocumentBuilder parser = null;
           String url = null;
   
           // load stylesheets available
  @@ -137,7 +138,10 @@
   
           // read content, clean it, parse it and cache the DOM
           try {
  -            parser = new DOMParser();
  +            final DocumentBuilderFactory docfactory = DocumentBuilderFactory.newInstance();
  +            //Have it non-validating
  +            docfactory.setValidating(false);
  +            parser= docfactory.newDocumentBuilder();
               url = getPortletConfig().getURL();
               String content = JetspeedDiskCache.getInstance().getEntry( url ).getData();
               //REMOVE THIS
  @@ -146,20 +150,12 @@
               parser.setEntityResolver(new JetspeedXMLEntityResolver() );
               InputSource isrc = new InputSource( this.cleanse( content ) );
               isrc.setEncoding("UTF-8");
  -            parser.parse( isrc );
  -            this.document = parser.getDocument();
  +            this.document = parser.parse( isrc );
               
           } catch ( Throwable t ) {
   
  -            Locator locator = parser.getLocator();
  -            
  -            String lineInfo = "";
  -
               String message = "RSSPortlet:  Couldn't parse out XML document -> " + 
  -                              url + 
  -                              " " + 
  -                              lineInfo;
  -
  +                              url;
   
               Log.error( message, t );
               throw new PortletException( t.getMessage() );
  
  
  

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


Mime
View raw message