DLESE Tools
v1.6.0

org.dlese.dpc.webapps.tools
Class OutputTools

java.lang.Object
  extended by org.dlese.dpc.webapps.tools.OutputTools

public final class OutputTools
extends Object

This class contains tools for formatting ouput, such as converting XML text to HTML, that are useful in many servlet/JSP based applications.

Author:
John Weatherley

Constructor Summary
OutputTools()
           
 
Method Summary
static String getContentFromXML(String stg)
          Gets the content from XML by stripping all XML tags.
static String htmlEncode(String text)
          Convert a plain text string into HTML.
static String xmlToHtml(String stg)
          Provides HTML encoding for XML resulting in text that looks good in a Web browser.
static String xmlToHtmlIndent(String stg)
          Provides HTML encoding for XML resulting in text that looks good in a Web browser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OutputTools

public OutputTools()
Method Detail

xmlToHtml

public static final String xmlToHtml(String stg)
Provides HTML encoding for XML resulting in text that looks good in a Web browser. Uses the indentation that existed in the original text. Use this method to encode text that will be displayed in a web browser (e.g. JSP or HTML page).

Parameters:
stg - The string to convert.
Returns:
A string suitable for display as HTML

getContentFromXML

public static final String getContentFromXML(String stg)
Gets the content from XML by stripping all XML tags. The input XML should be valid prior to calling this method. This method produces exactly the same output as XMLConversionService.getContentFromXML(String).

Parameters:
stg - An XML String.
Returns:
The contentFromXML.

xmlToHtmlIndent

public static final String xmlToHtmlIndent(String stg)
Provides HTML encoding for XML resulting in text that looks good in a Web browser. Attempts to indent based on the XML structure rather than using the indentation in the text itself. Use this method to encode text that will be displayed in a web browser (e.g. JSP or HTML page).

Note: This method still needs some work.

Parameters:
stg - The string to convert.
Returns:
A string suitable for display as HTML

htmlEncode

public static final String htmlEncode(String text)
Convert a plain text string into HTML. The resulting String is sutable for display in a web browser.

Parameters:
text - The original text.
Returns:
The text encoded into HTML

DLESE Tools
v1.6.0