net.sf.statcvs.pages.xml

Class XML


public final class XML
extends Object

TODO: Can we turn this into an abstract base class of MarkupHTML and MarkupXDoc?
Version:
$Id: XML.java,v 1.3 2008/04/02 11:52:02 benoitx Exp $
Authors:
Anja Jentzsch
Richard Cyganiak (richard@cyganiak.de)

Method Summary

static String
escape(String text)
Escapes HTML meta characters "&", "<", ">" and turns "\n" line breaks into HTML line breaks ("
");
static String
escapeAuthorName(String authorName)
Escapes evil characters in author's names.
static String
escapeDirectoryName(String directoryName)
static String
getAuthorIdLink(Author author)
Returns HTML code for a link to an author Id page
static String
getAuthorLink(Author author)
Returns HTML code for a link to an author page
static String
getDate(Date date)
Returns HTML code for a date
static String
getDateAndTime(Date date)
Returns HTML code for a date, including time
static String
getDirectoryLink(Directory directory)
Returns HTML code for a directory page link
static String
getIcon(String iconFilename)
Generates HTML for an icon
static String
getLink(String link, String linkName)
Creates a HTML representation of a hyperlink
static String
getLink(String link, String linkName, String prefix, String suffix)
Creates a HTML representation of a hyperlink

Method Details

escape

public static String escape(String text)
Escapes HTML meta characters "&", "<", ">" and turns "\n" line breaks into HTML line breaks ("
");
Parameters:
text - some string, for example "x > 0 && y <32100"
Returns:
HTML-escaped string, for example "x > 0 && y < 100"

escapeAuthorName

public static String escapeAuthorName(String authorName)
Escapes evil characters in author's names. E.g. "#" must be escaped because for an author "my#name" a page "author_my#name.html" will be created, and you can't link to that in HTML TODO: Replace everything *but* known good characters, instead of just evil ones
Parameters:
authorName - an author's name
Returns:
a version safe for creation of files and URLs

escapeDirectoryName

public static String escapeDirectoryName(String directoryName)

getAuthorIdLink

public static String getAuthorIdLink(Author author)
Returns HTML code for a link to an author Id page
Parameters:
author - the author
Returns:
HTML code for the link

getAuthorLink

public static String getAuthorLink(Author author)
Returns HTML code for a link to an author page
Parameters:
author - the author
Returns:
HTML code for the link

getDate

public static String getDate(Date date)
Returns HTML code for a date
Parameters:
date - the date
Returns:
HTML code for the date

getDateAndTime

public static String getDateAndTime(Date date)
Returns HTML code for a date, including time
Parameters:
date - the date
Returns:
HTML code for the date

getDirectoryLink

public static String getDirectoryLink(Directory directory)
Returns HTML code for a directory page link
Parameters:
directory - a directory
Returns:
HTML code for the link

getIcon

public static String getIcon(String iconFilename)
Generates HTML for an icon
Parameters:
iconFilename - an icon filename (HTMLOutput.XXXX_ICON constants)
Returns:
HTML string

getLink

public static String getLink(String link,
                             String linkName)
Creates a HTML representation of a hyperlink
Parameters:
link - URL
linkName - Name of the Link
Returns:
String HTML code of the hyperlink

getLink

public static String getLink(String link,
                             String linkName,
                             String prefix,
                             String suffix)
Creates a HTML representation of a hyperlink
Parameters:
link - URL
linkName - Name of the Link
prefix - A prefix to be inserted before the link label; no HTML escaping is performed
Returns:
String HTML code of the hyperlink