SlideShare a Scribd company logo
1 of 18
Download to read offline
1
Enabling Live
Newsfeeds using RSS,
Servlets and
Transformations
Russell Castagnaro
Russell@4charity.com
Introduction
Presenter
? Russell Castagnaro
? Chief Mentor
? 4Charity.com
? SyncTank Solutions, Inc
? russell@4charity.com
? Experience
2
Introduction
4Charity.com
? Application Service Provider for the Non-
Profit industry
? Pure Java development
? Http://www.4charity.com
? Locations:
? San Francisco,CA (HQ)
? Honolulu, HI (Tech Team)
Goals?
Leverage the Servlet 2.2 API
Employ XML for data and configuration
Use Resource Definition Format for
content data
Format XML using XSL Transformation
Eliminate hard-coding values
3
What’s the deal?
Newsfeeds are becoming a requirement
for portal sites.
Easy integration with existing web
services is a key requirement?
How can we avoid writing custom code
for information providers?
Can we avoid applets!!?
Background
In 1999 I wrote an information portal
application.
Live newsfeeds seemed like a good idea
I wrote custom parsers and employed an
open-source tool called Cocoon
Every time the html changed, I had to
recode!
4
Code Example
Needed different ‘ParsSpec’for each
content provider
URLToXMLConsumer.java
SpaceProducer.java
These worked great for 2 months...
‘ParseSpec’
#HeadlineEntry
cacheTime=6000
HeadlineEntry=start=n,end=<p>,attributes=Link,URL,Headline,Source,Date
HeadlineEntry.Link=start=<a href=",end=">
HeadlineEntry.Headline=start=">,end=</a>
HeadlineEntry.Source=start=<font size="-1">,end=</font>
#HeadlineEntry.Description=start=<br>,end=<br>
HeadlineEntry.Date=start=- <i>,end=</i>
HeadlineEntry.DTD="http://space.synctank.com/dtds/newsfeed.dtd "
HeadlineEntry.Doctype=Newsfeed
HeadlineEntry.URL=http://search.news.yahoo.com/search/news?p=space+aerospace&n=
HeadlineEntry.QTY=10
HeadlineEntry.XML=version="1.0"
HeadlineEntry.Header=
<?xml-stylesheet href="http://space.synctank.com/xsl/spacenews.xsl" type="text/xsl"?>n
<?cocoon-process type="xslt"?>n
<!-- ============================================================ -->n
<!-- spacenews.xml -->n
<!-- Simple XML file that uses the Newsfeed DTD. -->n
<!-- Author: XML Loader Russell Castagnaro Thu Nov 18 22:59:07 HST 1999 ->n
<!-- ============================================================ -->n
5
Java Code
URLToXMLProducer.xml and subclasses
Nice Features
All search providers content was
converted to one XML document type
Once the XML was created all search
engines results were handled easily
with XSLT
6
Document Type Definition
<?xml version="1.0" encoding="US-ASCII" ?>
<!-- Newsfeed.dtd -->
<!-- Simple DTD that defines a grammar for news Feeds. -->
<!-- Author: Russell Castagnaro Nov 15 1999 -->
<!ELEMENT Newsfeed (HeadlineEntry)+>
<!ELEMENT HeadlineEntry (Link, Headline, Source, Description, Date)>
<!ELEMENT Link (#PCDATA)>
<!ELEMENT Headline (#PCDATA)>
<!ELEMENT Source (#PCDATA)>
<!ELEMENT Description (#PCDATA)>
<!ELEMENT Date (#PCDATA)>
NewsFeed Content (XML)
<?xml version="1.0"?>
<?xml-stylesheet href="spacenews.xsl" type="text/xsl"?>
<?cocoon-process type="xslt"?>
<Newsfeed>
<HeadlineEntry>
<Link>http://dailynews.yahoo.com/h/ap/19991222/sc/space_shuttle_77.html</Link>
<Headline>Shuttle Astronauts Begin <b>Space</b>walk</Headline>
<Source>(Associated Press)</Source>
<Date>Dec 22 6:08 PM EST</Date>
</HeadlineEntry>
<HeadlineEntry>
<Link>http://biz.yahoo.com/rf/991222/xr.html</Link>
<Headline>RESEARCH ALERT - Boeing raised to buy</Headline>
<Source>(Reuters)</Source>
<Date>Dec 22 12:03 PM EST</Date>
</HeadlineEntry>
</Newsfeed>
7
Transforming the
Newsfeed
Make the news feed human readable:
? Create a Stylesheet using the XML
DOCTYPE rules
? Transform the XML Document Using the XSL
Document
* Specifics on transformations coming soon!
The StyleSheet
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="no"/>
<xsl:template match="/">
<TABLE width="100%" cellpadding="0" cellspacing="0" border="0">
<TR><TD bgcolor="#3366CC" align="left" valign="middle">
<font face="helvetica, arial" size="2" color="#FFFFFF">
<nobr><b>News</b></nobr></font>
</TD><TD align="right" bgcolor="#3366CC" valign="top" >
<a href="/space/news/spacenews.xml">
<font face="helvetica, arial" size="1" color="#FFFFFF">View</font></a>
<IMG SRC="/space/images/spacer2.gif" BORDER="0" WIDTH="5" HEIGHT="2"/>
</TD></TR>
<TR><TD>
<font size="2" face="Arial, Helvetica, sans-serif">
<b>Space and Aerospace News</b></font><BR/>
<xsl:apply-templates/>
</TD></TR></TABLE>
</xsl:template>
<xsl:template match="HeadlineEntry">
<B><FONT face="helvetica, arial" size="1">
<A HREF="{Link}"><xsl:value-of select="Headline"/></A>
</FONT></B> - <I>
<FONT size="-2" face="Arial, Helvetica, sans-serif">
<xsl:value-of select="Source"/></FONT></I><BR/>
</xsl:template>
</xsl:stylesheet>
8
HTML Content
Then the Display Format
Changed
Simple changes in the format from any
site required significant changes
Changing the parsing rules was not
trivial
Eventually this became boring and
tiresome
9
Interesting Points
I was not interested in manipulating XML
documents within Java*
I did not want to deal with DOM or SAX
I was interested in displaying data in a
clean, efficient manner
The producer code I created was a bit
embarrassing
*I was not lazy. I had a very full schedule at the time… . Sheesh!
Time Warp (Oct 2000)
None of my parsing instructions still
worked ?
I had no interest in using the old code
There had to be a better way
I heard about O’reilly’s merkat project…
10
Enter RDF Site Summary
Preliminary format was v .91 from
Netscape (remember them?)
Resource Definition Format Summary
(RSS .91) http://my.netscape.com/publish/formats/rss-0.91.dtd
Eliminates the need to parse through
HTML for content.
Standard - now WC3 has recommended
version 1.0
RSS Example<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN"
"http://my.netscape.com/publish/formats/rss-0.91.dtd">
<rss version="0.91">
<channel>
<title> Space science news</title> <link>http://www.moreover.com</link>
<description>Space science news - news headlines from around the web, refreshed every 15
minutes</description> <language>en-us</language>
<image>
<title>moreover...</title> <url>http://i.moreover.com/pics/rss.gif</url>
<link>http://www.moreover.com</link> <width>144</width> <height>16</height>
<description>News headlines from more than 1,800 sources, harvested every 15
minutes...</description>
</image>
<item>
<title>NASA releases space station crew logs</title>
<link>http://c.moreover.com/click/here.pl?r16768175</link>
<description>floridatoday.com Mar 22 2001 12:20AM ET</description>
</item> <item>
<title>Tough love but support for space by George W. Bushs team</title>
<link>http://c.moreover.com/click/here.pl?r16768185</link>
<description>floridatoday.com Mar 22 2001 12:20AM ET</description>
</item>
</channel>
</rss>
C:developmentCastagnarospacespace-moreover.xml
11
RSS Stylesheet Example
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="rss">
<Foo bar="{version}"> <xsl:apply-templates/> </Foo>
</xsl:template>
<xsl:template match="channel">
<TABLE width="100%" cellpadding="0" cellspacing="0" border="0"> <TR>
<TH align="left" bgcolor="#3366CC" valign="top" >
<a alt="{description}" href="{link}"><font face="helvetica, arial" size="2"
color="#FFFFFF"><nobr><xsl:value-of select="title"/></nobr></font></a></TH> </TR>
<xsl:apply-templates select="image"/>
<xsl:apply-templates select="item"/>
</TABLE>
</xsl:template>
<xsl:template match="image">
<TR><TD align="right"><a href="{link}">
<IMG SRC="{url}" BORDER="0" WIDTH="{width}" HEIGHT="{height}"/></a></TD></TR>
</xsl:template>
<xsl:template match="item">
<TR><TD colspan="2"><B><FONT face="helvetica, arial" size="1">
<A HREF="{link}"><xsl:value-of select="title"/></A></FONT></B> - <I>
<FONT size="-2" face="Arial, Helvetica, sans-serif"><xsl:value-of
select="description"/></FONT></I></TD></TR>
</xsl:template>
</xsl:stylesheet>
Newsfeed HTML
12
Access to RSS Feeds
Where do you find providers???
Directory of open RSS providers:
? http://www.superopendirectory.com/directory/4/standards/rss/sources
RSS Providers
? 10.am
? http://10.am/search/-rss?search=<your term here>
? List of topics: http://10.am/extra/ocsdirectory.xml
? echofactor
? http://www.echofactor.com/feed_categories.html?format=RSS
? MoreOver
? http://w.moreover.com/categories/category_list.html
Now we need to make this content readable!
Transforming
XML to HTML
We have many options on performing XSL
Transformations:
? Depend on the client’s browser to transform the XML
? Write a Servlet to handle the transformation
? Use software that is widely available and standards based
Issues:
? IE 5.x is one of the few browsers that support XSL
transformations
? Publicly available software has many merits too
? Servlets are easy enough. Transformations can be done in
< 10 lines
13
Transformation in a
Servletpublic void service(HttpServletRequest req, HttpServletResponse res)
throws IOException, ServletException {
PrintWriter out = res.getWriter();
res.setContentType("text/html");
File xmlFile = new File(sourcePath, req.getParameter("XML"));
File xslFile = new File(sourcePath, req.getParameter("XSL"));
try {
XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
processor.process(new XSLTInputSource(new FileReader(xmlFile)),
new XSLTInputSource(new FileReader(xslFile)),
new XSLTResultTarget(out));
} catch (Exception e) {
out.println("Error: " + e.getMessage());
}
out.flush();
}
One Problem
We have to get the XML (RSS) file from
the content provider!
Use the networking classes to access the
URL
Be considerate of your provider!
14
New Codepublic void doGet(HttpServletRequest req, HttpServletResponse res) {
try {
PrintWriter out = res.getWriter(); res.setContentType("text/html");
URLConnection con; DataInputStream in;
URL url = new URL(sourceURL); con = url.openConnection();
con.connect(); String type = null;
in = new DataInputStream(con.getInputStream());
FileReader fr = new FileReader(xslsrc);
try {
XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
processor.process(new XSLTInputSource(in), new XSLTInputSource(fr),
new XSLTResultTarget(out));
} catch (Exception e) { log("Error: " + e.getMessage());
} finally { in.close(); fr.close(); }
out.flush();
} catch (Exception e) { …
}
XSLT Model
Request
Response
Servlet
URL Loaded
XML
XSLT
Processor
XSL
Document
HTML
NewsFeed
15
Setting up your servlet
Most Appservers or Webservers
support WAR’s and Deployment
Descriptors
You create a WebApp which has
servlets, parameters and servlet
mappings
Deployment Descriptor
<web-app>
<servlet>
<servlet-name>newsServlet</servlet-name>
<servlet-class>com.synctank.http.servlets.RSSServlet</servlet-class>
<init-param>
<param-name>ERROR_URL</param-name>
<param-value>/error.jsp</param-value>
<description>The error page for this app.</description>
</init-param>
<init-param>
<param-name>SOURCE_SERVLET_URI</param-name>
<param-value>http://www.moreover.com/cgi-
local/page?o=rss&c=Space%20science%20news</param-value>
<description>An absolute url that points to your XML</description>
</init-param>
16
Deployment Descriptor
<init-param>
<param-name>STYLESHEET</param-name>
<param-value>/xsl/rss.xsl</param-value>
<description>The Stylesheet for presentation of the headlines. Should be a
subdirectory of the war. The default is /xsl/rss.xsl </description>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>newsServlet</servlet-name>
<url-pattern>/newsy</url-pattern>
</servlet-mapping> <welcome-file-list>
<welcome-file>/foo/news.html</welcome-file>
</welcome-file-list>
<error-page>
<error-code>404</error-code>
<location>/error.jsp</location>
</error-page>
</web-app>
War directory structure
Root
? WEB-INF
? Web.xml
? classes
? comsynctankhttpservletsRSSServlet.class
? xsl
? rss.xsl
? docs
? Index.html
? error.jsp
17
Moving Forward
RSS version 1.0 has been
recommended by the w3c
1.0 Uses has more flexibility
Once more providers support
Review
Don’t do the time!
Leverage RSS and open content providers
Use XSL to transform XML content to your
format of choice
Cache requests to content providers (keep
them free!)
18
Finally
Thanks for attending
Source Code Available
? http://www.synctank.com/xmldevcon
? russell@4charity.com
Aloha

More Related Content

Similar to 2001: Bridging the Gap between RSS and Java Old School Style

IWMW 2001: XML and XSLT
IWMW 2001: XML and XSLT IWMW 2001: XML and XSLT
IWMW 2001: XML and XSLT IWMW
 
Transforming xml with XSLT
Transforming  xml with XSLTTransforming  xml with XSLT
Transforming xml with XSLTMalintha Adikari
 
Introduction of xml and xslt
Introduction of xml and xsltIntroduction of xml and xslt
Introduction of xml and xsltTUSHAR VARSHNEY
 
eXtensible Markup Language (XML)
eXtensible Markup Language (XML)eXtensible Markup Language (XML)
eXtensible Markup Language (XML)Serhii Kartashov
 
Implementing the Genetic Algorithm in XSLT: PoC
Implementing the Genetic Algorithm in XSLT: PoCImplementing the Genetic Algorithm in XSLT: PoC
Implementing the Genetic Algorithm in XSLT: PoCjimfuller2009
 
Five Pound App talk: hereit.is, Web app architecture, REST, CSS3
Five Pound App talk: hereit.is, Web app architecture, REST, CSS3Five Pound App talk: hereit.is, Web app architecture, REST, CSS3
Five Pound App talk: hereit.is, Web app architecture, REST, CSS3Jamie Matthews
 
Documentation 2.0: DIY Content Delivery and Feedback in Real-time
Documentation 2.0: DIY Content Delivery and Feedback in Real-timeDocumentation 2.0: DIY Content Delivery and Feedback in Real-time
Documentation 2.0: DIY Content Delivery and Feedback in Real-timelykhinin
 
Service Oriented Architecture - Unit II
Service Oriented Architecture - Unit IIService Oriented Architecture - Unit II
Service Oriented Architecture - Unit IIRoselin Mary S
 
Moving from Web 1.0 to Web 2.0
Moving from Web 1.0 to Web 2.0Moving from Web 1.0 to Web 2.0
Moving from Web 1.0 to Web 2.0Estelle Weyl
 
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)Pat Patterson
 
Slow kinda sucks
Slow kinda sucksSlow kinda sucks
Slow kinda sucksTim Wright
 
Surviving the Zombie Apocalpyse of Connected Devices
Surviving the Zombie Apocalpyse of Connected DevicesSurviving the Zombie Apocalpyse of Connected Devices
Surviving the Zombie Apocalpyse of Connected DevicesGustaf Nilsson Kotte
 
Notes from the Library Juice Academy courses on XPath, XSLT, and XQuery: Univ...
Notes from the Library Juice Academy courses on XPath, XSLT, and XQuery: Univ...Notes from the Library Juice Academy courses on XPath, XSLT, and XQuery: Univ...
Notes from the Library Juice Academy courses on XPath, XSLT, and XQuery: Univ...Allison Jai O'Dell
 
Base HTML & CSS
Base HTML & CSSBase HTML & CSS
Base HTML & CSSNick Chan
 
Create Responsive Website Design with Bootstrap 3
Create Responsive Website Design with Bootstrap 3Create Responsive Website Design with Bootstrap 3
Create Responsive Website Design with Bootstrap 3Wahyu Putra
 

Similar to 2001: Bridging the Gap between RSS and Java Old School Style (20)

xhtml_basics
xhtml_basicsxhtml_basics
xhtml_basics
 
Xhtml Basics
Xhtml BasicsXhtml Basics
Xhtml Basics
 
Xhtml Basics
Xhtml BasicsXhtml Basics
Xhtml Basics
 
IWMW 2001: XML and XSLT
IWMW 2001: XML and XSLT IWMW 2001: XML and XSLT
IWMW 2001: XML and XSLT
 
Transforming xml with XSLT
Transforming  xml with XSLTTransforming  xml with XSLT
Transforming xml with XSLT
 
Introduction of xml and xslt
Introduction of xml and xsltIntroduction of xml and xslt
Introduction of xml and xslt
 
eXtensible Markup Language (XML)
eXtensible Markup Language (XML)eXtensible Markup Language (XML)
eXtensible Markup Language (XML)
 
Implementing the Genetic Algorithm in XSLT: PoC
Implementing the Genetic Algorithm in XSLT: PoCImplementing the Genetic Algorithm in XSLT: PoC
Implementing the Genetic Algorithm in XSLT: PoC
 
Five Pound App talk: hereit.is, Web app architecture, REST, CSS3
Five Pound App talk: hereit.is, Web app architecture, REST, CSS3Five Pound App talk: hereit.is, Web app architecture, REST, CSS3
Five Pound App talk: hereit.is, Web app architecture, REST, CSS3
 
Html5 intro
Html5 introHtml5 intro
Html5 intro
 
Documentation 2.0: DIY Content Delivery and Feedback in Real-time
Documentation 2.0: DIY Content Delivery and Feedback in Real-timeDocumentation 2.0: DIY Content Delivery and Feedback in Real-time
Documentation 2.0: DIY Content Delivery and Feedback in Real-time
 
Service Oriented Architecture - Unit II
Service Oriented Architecture - Unit IIService Oriented Architecture - Unit II
Service Oriented Architecture - Unit II
 
Seo cheat-sheet
Seo cheat-sheetSeo cheat-sheet
Seo cheat-sheet
 
Moving from Web 1.0 to Web 2.0
Moving from Web 1.0 to Web 2.0Moving from Web 1.0 to Web 2.0
Moving from Web 1.0 to Web 2.0
 
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
 
Slow kinda sucks
Slow kinda sucksSlow kinda sucks
Slow kinda sucks
 
Surviving the Zombie Apocalpyse of Connected Devices
Surviving the Zombie Apocalpyse of Connected DevicesSurviving the Zombie Apocalpyse of Connected Devices
Surviving the Zombie Apocalpyse of Connected Devices
 
Notes from the Library Juice Academy courses on XPath, XSLT, and XQuery: Univ...
Notes from the Library Juice Academy courses on XPath, XSLT, and XQuery: Univ...Notes from the Library Juice Academy courses on XPath, XSLT, and XQuery: Univ...
Notes from the Library Juice Academy courses on XPath, XSLT, and XQuery: Univ...
 
Base HTML & CSS
Base HTML & CSSBase HTML & CSS
Base HTML & CSS
 
Create Responsive Website Design with Bootstrap 3
Create Responsive Website Design with Bootstrap 3Create Responsive Website Design with Bootstrap 3
Create Responsive Website Design with Bootstrap 3
 

More from Russell Castagnaro

The Commerce We Deserve: Cryptocomerce
The Commerce We Deserve: CryptocomerceThe Commerce We Deserve: Cryptocomerce
The Commerce We Deserve: CryptocomerceRussell Castagnaro
 
HICSS-50: Are smart cities to fragile
HICSS-50: Are smart cities to fragileHICSS-50: Are smart cities to fragile
HICSS-50: Are smart cities to fragileRussell Castagnaro
 
2014 Introduction to eHawaii.gov
2014 Introduction to eHawaii.gov2014 Introduction to eHawaii.gov
2014 Introduction to eHawaii.govRussell Castagnaro
 
2014 Hawaii Digital Government Summit : Department of Health and eHawaii.gov
2014 Hawaii Digital Government Summit : Department of Health and eHawaii.gov2014 Hawaii Digital Government Summit : Department of Health and eHawaii.gov
2014 Hawaii Digital Government Summit : Department of Health and eHawaii.govRussell Castagnaro
 
Love, Death and Elevators: An undercover look at eGovernment Services in Hawaii
Love, Death and Elevators: An undercover look at eGovernment Services in HawaiiLove, Death and Elevators: An undercover look at eGovernment Services in Hawaii
Love, Death and Elevators: An undercover look at eGovernment Services in HawaiiRussell Castagnaro
 
Russell Castagnaro Hawaii Digital Government Summit 2013
Russell Castagnaro Hawaii Digital Government Summit 2013Russell Castagnaro Hawaii Digital Government Summit 2013
Russell Castagnaro Hawaii Digital Government Summit 2013Russell Castagnaro
 
HICSS 2012 eHawaii.gov : eGovernment in Practice
HICSS 2012 eHawaii.gov : eGovernment in PracticeHICSS 2012 eHawaii.gov : eGovernment in Practice
HICSS 2012 eHawaii.gov : eGovernment in PracticeRussell Castagnaro
 
eTax services in Hawaii: Lessons Learned
eTax services in Hawaii: Lessons LearnedeTax services in Hawaii: Lessons Learned
eTax services in Hawaii: Lessons LearnedRussell Castagnaro
 
2009 eBench Warrants presentation
2009 eBench Warrants presentation2009 eBench Warrants presentation
2009 eBench Warrants presentationRussell Castagnaro
 
Hawaii International Conference on Systems Science 2013
Hawaii International Conference on Systems Science 2013Hawaii International Conference on Systems Science 2013
Hawaii International Conference on Systems Science 2013Russell Castagnaro
 
2001: JNDI Its all in the Context
2001:  JNDI Its all in the Context2001:  JNDI Its all in the Context
2001: JNDI Its all in the ContextRussell Castagnaro
 
2000: Making IT Happen with J2EE
2000: Making IT Happen with J2EE2000: Making IT Happen with J2EE
2000: Making IT Happen with J2EERussell Castagnaro
 

More from Russell Castagnaro (15)

The Commerce We Deserve: Cryptocomerce
The Commerce We Deserve: CryptocomerceThe Commerce We Deserve: Cryptocomerce
The Commerce We Deserve: Cryptocomerce
 
Blockchain Introduction
Blockchain IntroductionBlockchain Introduction
Blockchain Introduction
 
Wampum Introduction Deck
Wampum Introduction DeckWampum Introduction Deck
Wampum Introduction Deck
 
HICSS-50: Are smart cities to fragile
HICSS-50: Are smart cities to fragileHICSS-50: Are smart cities to fragile
HICSS-50: Are smart cities to fragile
 
2014 Introduction to eHawaii.gov
2014 Introduction to eHawaii.gov2014 Introduction to eHawaii.gov
2014 Introduction to eHawaii.gov
 
2014 Access Hawaii Report
2014 Access Hawaii Report2014 Access Hawaii Report
2014 Access Hawaii Report
 
2014 Hawaii Digital Government Summit : Department of Health and eHawaii.gov
2014 Hawaii Digital Government Summit : Department of Health and eHawaii.gov2014 Hawaii Digital Government Summit : Department of Health and eHawaii.gov
2014 Hawaii Digital Government Summit : Department of Health and eHawaii.gov
 
Love, Death and Elevators: An undercover look at eGovernment Services in Hawaii
Love, Death and Elevators: An undercover look at eGovernment Services in HawaiiLove, Death and Elevators: An undercover look at eGovernment Services in Hawaii
Love, Death and Elevators: An undercover look at eGovernment Services in Hawaii
 
Russell Castagnaro Hawaii Digital Government Summit 2013
Russell Castagnaro Hawaii Digital Government Summit 2013Russell Castagnaro Hawaii Digital Government Summit 2013
Russell Castagnaro Hawaii Digital Government Summit 2013
 
HICSS 2012 eHawaii.gov : eGovernment in Practice
HICSS 2012 eHawaii.gov : eGovernment in PracticeHICSS 2012 eHawaii.gov : eGovernment in Practice
HICSS 2012 eHawaii.gov : eGovernment in Practice
 
eTax services in Hawaii: Lessons Learned
eTax services in Hawaii: Lessons LearnedeTax services in Hawaii: Lessons Learned
eTax services in Hawaii: Lessons Learned
 
2009 eBench Warrants presentation
2009 eBench Warrants presentation2009 eBench Warrants presentation
2009 eBench Warrants presentation
 
Hawaii International Conference on Systems Science 2013
Hawaii International Conference on Systems Science 2013Hawaii International Conference on Systems Science 2013
Hawaii International Conference on Systems Science 2013
 
2001: JNDI Its all in the Context
2001:  JNDI Its all in the Context2001:  JNDI Its all in the Context
2001: JNDI Its all in the Context
 
2000: Making IT Happen with J2EE
2000: Making IT Happen with J2EE2000: Making IT Happen with J2EE
2000: Making IT Happen with J2EE
 

Recently uploaded

What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 

Recently uploaded (20)

What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 

2001: Bridging the Gap between RSS and Java Old School Style

  • 1. 1 Enabling Live Newsfeeds using RSS, Servlets and Transformations Russell Castagnaro Russell@4charity.com Introduction Presenter ? Russell Castagnaro ? Chief Mentor ? 4Charity.com ? SyncTank Solutions, Inc ? russell@4charity.com ? Experience
  • 2. 2 Introduction 4Charity.com ? Application Service Provider for the Non- Profit industry ? Pure Java development ? Http://www.4charity.com ? Locations: ? San Francisco,CA (HQ) ? Honolulu, HI (Tech Team) Goals? Leverage the Servlet 2.2 API Employ XML for data and configuration Use Resource Definition Format for content data Format XML using XSL Transformation Eliminate hard-coding values
  • 3. 3 What’s the deal? Newsfeeds are becoming a requirement for portal sites. Easy integration with existing web services is a key requirement? How can we avoid writing custom code for information providers? Can we avoid applets!!? Background In 1999 I wrote an information portal application. Live newsfeeds seemed like a good idea I wrote custom parsers and employed an open-source tool called Cocoon Every time the html changed, I had to recode!
  • 4. 4 Code Example Needed different ‘ParsSpec’for each content provider URLToXMLConsumer.java SpaceProducer.java These worked great for 2 months... ‘ParseSpec’ #HeadlineEntry cacheTime=6000 HeadlineEntry=start=n,end=<p>,attributes=Link,URL,Headline,Source,Date HeadlineEntry.Link=start=<a href=",end="> HeadlineEntry.Headline=start=">,end=</a> HeadlineEntry.Source=start=<font size="-1">,end=</font> #HeadlineEntry.Description=start=<br>,end=<br> HeadlineEntry.Date=start=- <i>,end=</i> HeadlineEntry.DTD="http://space.synctank.com/dtds/newsfeed.dtd " HeadlineEntry.Doctype=Newsfeed HeadlineEntry.URL=http://search.news.yahoo.com/search/news?p=space+aerospace&n= HeadlineEntry.QTY=10 HeadlineEntry.XML=version="1.0" HeadlineEntry.Header= <?xml-stylesheet href="http://space.synctank.com/xsl/spacenews.xsl" type="text/xsl"?>n <?cocoon-process type="xslt"?>n <!-- ============================================================ -->n <!-- spacenews.xml -->n <!-- Simple XML file that uses the Newsfeed DTD. -->n <!-- Author: XML Loader Russell Castagnaro Thu Nov 18 22:59:07 HST 1999 ->n <!-- ============================================================ -->n
  • 5. 5 Java Code URLToXMLProducer.xml and subclasses Nice Features All search providers content was converted to one XML document type Once the XML was created all search engines results were handled easily with XSLT
  • 6. 6 Document Type Definition <?xml version="1.0" encoding="US-ASCII" ?> <!-- Newsfeed.dtd --> <!-- Simple DTD that defines a grammar for news Feeds. --> <!-- Author: Russell Castagnaro Nov 15 1999 --> <!ELEMENT Newsfeed (HeadlineEntry)+> <!ELEMENT HeadlineEntry (Link, Headline, Source, Description, Date)> <!ELEMENT Link (#PCDATA)> <!ELEMENT Headline (#PCDATA)> <!ELEMENT Source (#PCDATA)> <!ELEMENT Description (#PCDATA)> <!ELEMENT Date (#PCDATA)> NewsFeed Content (XML) <?xml version="1.0"?> <?xml-stylesheet href="spacenews.xsl" type="text/xsl"?> <?cocoon-process type="xslt"?> <Newsfeed> <HeadlineEntry> <Link>http://dailynews.yahoo.com/h/ap/19991222/sc/space_shuttle_77.html</Link> <Headline>Shuttle Astronauts Begin <b>Space</b>walk</Headline> <Source>(Associated Press)</Source> <Date>Dec 22 6:08 PM EST</Date> </HeadlineEntry> <HeadlineEntry> <Link>http://biz.yahoo.com/rf/991222/xr.html</Link> <Headline>RESEARCH ALERT - Boeing raised to buy</Headline> <Source>(Reuters)</Source> <Date>Dec 22 12:03 PM EST</Date> </HeadlineEntry> </Newsfeed>
  • 7. 7 Transforming the Newsfeed Make the news feed human readable: ? Create a Stylesheet using the XML DOCTYPE rules ? Transform the XML Document Using the XSL Document * Specifics on transformations coming soon! The StyleSheet <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" indent="no"/> <xsl:template match="/"> <TABLE width="100%" cellpadding="0" cellspacing="0" border="0"> <TR><TD bgcolor="#3366CC" align="left" valign="middle"> <font face="helvetica, arial" size="2" color="#FFFFFF"> <nobr><b>News</b></nobr></font> </TD><TD align="right" bgcolor="#3366CC" valign="top" > <a href="/space/news/spacenews.xml"> <font face="helvetica, arial" size="1" color="#FFFFFF">View</font></a> <IMG SRC="/space/images/spacer2.gif" BORDER="0" WIDTH="5" HEIGHT="2"/> </TD></TR> <TR><TD> <font size="2" face="Arial, Helvetica, sans-serif"> <b>Space and Aerospace News</b></font><BR/> <xsl:apply-templates/> </TD></TR></TABLE> </xsl:template> <xsl:template match="HeadlineEntry"> <B><FONT face="helvetica, arial" size="1"> <A HREF="{Link}"><xsl:value-of select="Headline"/></A> </FONT></B> - <I> <FONT size="-2" face="Arial, Helvetica, sans-serif"> <xsl:value-of select="Source"/></FONT></I><BR/> </xsl:template> </xsl:stylesheet>
  • 8. 8 HTML Content Then the Display Format Changed Simple changes in the format from any site required significant changes Changing the parsing rules was not trivial Eventually this became boring and tiresome
  • 9. 9 Interesting Points I was not interested in manipulating XML documents within Java* I did not want to deal with DOM or SAX I was interested in displaying data in a clean, efficient manner The producer code I created was a bit embarrassing *I was not lazy. I had a very full schedule at the time… . Sheesh! Time Warp (Oct 2000) None of my parsing instructions still worked ? I had no interest in using the old code There had to be a better way I heard about O’reilly’s merkat project…
  • 10. 10 Enter RDF Site Summary Preliminary format was v .91 from Netscape (remember them?) Resource Definition Format Summary (RSS .91) http://my.netscape.com/publish/formats/rss-0.91.dtd Eliminates the need to parse through HTML for content. Standard - now WC3 has recommended version 1.0 RSS Example<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd"> <rss version="0.91"> <channel> <title> Space science news</title> <link>http://www.moreover.com</link> <description>Space science news - news headlines from around the web, refreshed every 15 minutes</description> <language>en-us</language> <image> <title>moreover...</title> <url>http://i.moreover.com/pics/rss.gif</url> <link>http://www.moreover.com</link> <width>144</width> <height>16</height> <description>News headlines from more than 1,800 sources, harvested every 15 minutes...</description> </image> <item> <title>NASA releases space station crew logs</title> <link>http://c.moreover.com/click/here.pl?r16768175</link> <description>floridatoday.com Mar 22 2001 12:20AM ET</description> </item> <item> <title>Tough love but support for space by George W. Bushs team</title> <link>http://c.moreover.com/click/here.pl?r16768185</link> <description>floridatoday.com Mar 22 2001 12:20AM ET</description> </item> </channel> </rss> C:developmentCastagnarospacespace-moreover.xml
  • 11. 11 RSS Stylesheet Example <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="rss"> <Foo bar="{version}"> <xsl:apply-templates/> </Foo> </xsl:template> <xsl:template match="channel"> <TABLE width="100%" cellpadding="0" cellspacing="0" border="0"> <TR> <TH align="left" bgcolor="#3366CC" valign="top" > <a alt="{description}" href="{link}"><font face="helvetica, arial" size="2" color="#FFFFFF"><nobr><xsl:value-of select="title"/></nobr></font></a></TH> </TR> <xsl:apply-templates select="image"/> <xsl:apply-templates select="item"/> </TABLE> </xsl:template> <xsl:template match="image"> <TR><TD align="right"><a href="{link}"> <IMG SRC="{url}" BORDER="0" WIDTH="{width}" HEIGHT="{height}"/></a></TD></TR> </xsl:template> <xsl:template match="item"> <TR><TD colspan="2"><B><FONT face="helvetica, arial" size="1"> <A HREF="{link}"><xsl:value-of select="title"/></A></FONT></B> - <I> <FONT size="-2" face="Arial, Helvetica, sans-serif"><xsl:value-of select="description"/></FONT></I></TD></TR> </xsl:template> </xsl:stylesheet> Newsfeed HTML
  • 12. 12 Access to RSS Feeds Where do you find providers??? Directory of open RSS providers: ? http://www.superopendirectory.com/directory/4/standards/rss/sources RSS Providers ? 10.am ? http://10.am/search/-rss?search=<your term here> ? List of topics: http://10.am/extra/ocsdirectory.xml ? echofactor ? http://www.echofactor.com/feed_categories.html?format=RSS ? MoreOver ? http://w.moreover.com/categories/category_list.html Now we need to make this content readable! Transforming XML to HTML We have many options on performing XSL Transformations: ? Depend on the client’s browser to transform the XML ? Write a Servlet to handle the transformation ? Use software that is widely available and standards based Issues: ? IE 5.x is one of the few browsers that support XSL transformations ? Publicly available software has many merits too ? Servlets are easy enough. Transformations can be done in < 10 lines
  • 13. 13 Transformation in a Servletpublic void service(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { PrintWriter out = res.getWriter(); res.setContentType("text/html"); File xmlFile = new File(sourcePath, req.getParameter("XML")); File xslFile = new File(sourcePath, req.getParameter("XSL")); try { XSLTProcessor processor = XSLTProcessorFactory.getProcessor(); processor.process(new XSLTInputSource(new FileReader(xmlFile)), new XSLTInputSource(new FileReader(xslFile)), new XSLTResultTarget(out)); } catch (Exception e) { out.println("Error: " + e.getMessage()); } out.flush(); } One Problem We have to get the XML (RSS) file from the content provider! Use the networking classes to access the URL Be considerate of your provider!
  • 14. 14 New Codepublic void doGet(HttpServletRequest req, HttpServletResponse res) { try { PrintWriter out = res.getWriter(); res.setContentType("text/html"); URLConnection con; DataInputStream in; URL url = new URL(sourceURL); con = url.openConnection(); con.connect(); String type = null; in = new DataInputStream(con.getInputStream()); FileReader fr = new FileReader(xslsrc); try { XSLTProcessor processor = XSLTProcessorFactory.getProcessor(); processor.process(new XSLTInputSource(in), new XSLTInputSource(fr), new XSLTResultTarget(out)); } catch (Exception e) { log("Error: " + e.getMessage()); } finally { in.close(); fr.close(); } out.flush(); } catch (Exception e) { … } XSLT Model Request Response Servlet URL Loaded XML XSLT Processor XSL Document HTML NewsFeed
  • 15. 15 Setting up your servlet Most Appservers or Webservers support WAR’s and Deployment Descriptors You create a WebApp which has servlets, parameters and servlet mappings Deployment Descriptor <web-app> <servlet> <servlet-name>newsServlet</servlet-name> <servlet-class>com.synctank.http.servlets.RSSServlet</servlet-class> <init-param> <param-name>ERROR_URL</param-name> <param-value>/error.jsp</param-value> <description>The error page for this app.</description> </init-param> <init-param> <param-name>SOURCE_SERVLET_URI</param-name> <param-value>http://www.moreover.com/cgi- local/page?o=rss&c=Space%20science%20news</param-value> <description>An absolute url that points to your XML</description> </init-param>
  • 16. 16 Deployment Descriptor <init-param> <param-name>STYLESHEET</param-name> <param-value>/xsl/rss.xsl</param-value> <description>The Stylesheet for presentation of the headlines. Should be a subdirectory of the war. The default is /xsl/rss.xsl </description> </init-param> <load-on-startup>0</load-on-startup> </servlet> <servlet-mapping> <servlet-name>newsServlet</servlet-name> <url-pattern>/newsy</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>/foo/news.html</welcome-file> </welcome-file-list> <error-page> <error-code>404</error-code> <location>/error.jsp</location> </error-page> </web-app> War directory structure Root ? WEB-INF ? Web.xml ? classes ? comsynctankhttpservletsRSSServlet.class ? xsl ? rss.xsl ? docs ? Index.html ? error.jsp
  • 17. 17 Moving Forward RSS version 1.0 has been recommended by the w3c 1.0 Uses has more flexibility Once more providers support Review Don’t do the time! Leverage RSS and open content providers Use XSL to transform XML content to your format of choice Cache requests to content providers (keep them free!)
  • 18. 18 Finally Thanks for attending Source Code Available ? http://www.synctank.com/xmldevcon ? russell@4charity.com Aloha