Package org.dlese.dpc.webapps.tools
Class OutputTools
java.lang.Object
org.dlese.dpc.webapps.tools.OutputTools
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final StringgetContentFromXML(String stg) Gets the content from XML by stripping all XML tags.static final StringhtmlEncode(String text) Convert a plain text string into HTML.static final StringProvides HTML encoding for XML resulting in text that looks good in a Web browser.static final StringxmlToHtmlIndent(String stg) Provides HTML encoding for XML resulting in text that looks good in a Web browser.
-
Constructor Details
-
OutputTools
public OutputTools()
-
-
Method Details
-
xmlToHtml
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
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 asXMLConversionService.getContentFromXML(String).- Parameters:
stg- An XML String.- Returns:
- The contentFromXML.
-
xmlToHtmlIndent
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
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
-