1 16 package org.apache.jetspeed.portal.portlets.viewprocessor; 17 18 import org.apache.jetspeed.portal.Portlet; 20 import org.apache.jetspeed.portal.PortletException; 21 22 import org.w3c.dom.Node ; 24 import org.w3c.dom.NodeList ; 25 26 48 public class RSSViewProcessor extends XSLViewProcessor 49 { 50 51 58 public void init(Portlet portlet) 59 throws PortletException 60 { 61 62 super.init(portlet); 63 64 String title = null; 66 String description = null; 67 68 Node channel = null; 70 NodeList list = this.document.getElementsByTagName("channel"); 71 72 if (list.getLength() != 1) 73 { 74 throw new PortletException(ERROR_NOT_VALID); 75 } 76 77 channel = list.item(0); 78 79 Node tn = getNode( channel, "title" ); 80 81 if ( tn == null ) { 82 throw new PortletException( ERROR_NOT_VALID ); 83 } 84 else 85 { 86 Node fc = tn.getFirstChild(); 87 if (fc != null) 88 { 89 title = fc.getNodeValue(); 90 } 91 } 92 93 Node dn = getNode( channel, "description" ); 94 95 if ( dn != null ) 96 { 97 Node fc = dn.getFirstChild(); 98 if (fc != null) 99 { 100 description = fc.getNodeValue(); 101 } 102 } 103 104 portlet.setTitle(title); 105 portlet.setDescription(description); 106 } 107 108 } 109 | Popular Tags |