public HTMLBox(Channel channel, List list, String filename, 
        boolean generateJavaScript) {

        // Note: This code could probably be cleaned up a lot by using the 
        // Element Construction Set from Apache 
        // (http://jakarta.apache.org/ecs/index.html). But I didn't want the 
        // examples to depend on any outside libraries or code other than JAXP 
        // and the JDK.
        StringBuffer output = new StringBuffer();
        
        if (generateJavaScript) {
            output.append("document.writeln(\"");
        }

        output.append("<table class='block'>");
        output.append("<tr><td class='channelTitle'>");
        output.append(channel.getTitle());
        output.append("</td></tr>");
        if (!channel.getImageURL().toString().equals("")) {
            output.append("<tr><td align='center'><img src=\'");
            output.append(channel.getImageURL().toString());
            output.append("\'></td></tr>");
        }
        output.append("<tr><td>");
        
        // Create an iterator for the list of items retrieved and iterate
        // through them. Print out a string representation of each item to show
        // what was parsed from the RSS file.
        Iterator i = list.iterator();
        
        while (i.hasNext()) {
            Item tempItem = (Item) i.next();
            
            output.append("<a class='itemTitle' href=\'");
            output.append(tempItem.getLink().toString());
            output.append("\'>");
            output.append(tempItem.getTitle());
            output.append("</a><br>");
        }
        
        output.append("</td></tr>");
        output.append("</table>");

        if (generateJavaScript) {
            output.append("\");");
        }
        
        // Open the target file and write the string to it.
        try {
            FileOutputStream ostream = new FileOutputStream(new File(filename));
            ostream.write(output.toString().getBytes());
            ostream.close();
        } catch (java.io.FileNotFoundException fnfe) {
        } catch (java.io.IOException ioe) {
        }
    }