
Making content from your google group available on your own website is easy to implement using asp.net. Unlike Yahoo groups or regular Usenet groups google exposes XML for all of thier groups as an Atom feed. Sp rather than having to use a newsgroup reader to pull this data you can simply parse the data from the Atom feed and display the output in real time.
About an hour after setting up a google group an atom feed will appear in at the location feed/topics.xml. So in my case my google group is located at
http://groups-beta.google.com/group/A-Programmers-Journal/ and the feed is located at
http://groups-beta.google.com/group/A-Programmers-Journal/feed/topics.xml.
You can parse the Atom XML just like an rss feed; Using an XSL transformation and asp.net.
To take advantage of ASP.nets XML and XSL parsing you need to add the following name spaces at the top of your page.
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Xml.Xsl" %>
Then add the following code to the Page_Load procedure on your page (in vb) Dim groupsXmlSrc As String = "http://groups-beta.google.com/group/A-Programmers-Journal/feed/topics.xml" Dim groupsXslFile As String = Server.MapPath("groups.xsl")
Dim groupsXmlDoc As XmlDocument = New XmlDocument()
groupsXmlDoc.Load(groupsXmlSrc)
Dim groupsXslDoc As XslTransform = New XslTransform()
groupsXslDoc.Load(groupsXslFile) Dim groupsStringBuilder As StringBuilder = New StringBuilder()
Dim groupsStringWriter As StringWriter = New StringWriter(groupsStringBuilder)
groupsXslDoc.Transform(groupsXmlDoc, Nothing, groupsStringWriter)
groups.Text = Replace(Replace(groupsStringBuilder.ToString, "<", "<"), ">",">") As you can see I am using the replace function to HTML decode the content. Other than that everything is pretty straight forward. If you are used to working with standard XML or RSS feeds you may find the Atom feed a little bit confusing and cumbersome to work with. This is the XSL transformation I am using for the google group page on this site. (
http://www.aprogrammersjournal.com/group.aspx )
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:atom="http://purl.org/atom/ns#" > <xsl:template match="atom:entry">
<br/><hr />
<strong><xsl:apply-templates select="atom:title" mode="make-link"/></strong>
<br/>
<xsl:apply-templates select="atom:summary" mode="dispatch" />
<xsl:apply-templates select="atom:content" mode="dispatch" /> ...
<br/>
<br/><strong>Author: </strong> <xsl:apply-templates select="atom:author"/><br/><br/>
<em>posted: <xsl:apply-templates select="atom:issued"/>, last modified: <xsl:apply-templates select="atom:issued"/></em>
<div align ="right">
<br/>[ <a href ="{atom:id}" class ="main">read full</a> ] [ <a href ="{atom:id}" class ="main">comment</a> ]
</div>
</xsl:template>
</xsl:stylesheet>