hudson.plugins.violations.generate
Class XMLUtil

java.lang.Object
  extended by hudson.plugins.violations.generate.XMLUtil

public final class XMLUtil
extends java.lang.Object

Some helper methods for encoding xml and html strings.


Method Summary
static java.lang.String escapeAttribute(java.lang.String str)
          Encode an attribute value.
static java.lang.String escapeContent(java.lang.String str)
          XML encode a string.
static java.lang.String escapeHTMLContent(java.lang.String tabIcon, java.lang.String str)
          Convert a string to html content, Same as the xml version except that spaces and tabs are converted.
static java.lang.String toAttribute(java.lang.String name, int value)
          Return an attribute setting.
static java.lang.String toAttribute(java.lang.String name, java.lang.String value)
          Return an attribute setting.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

escapeHTMLContent

public static java.lang.String escapeHTMLContent(java.lang.String tabIcon,
                                                 java.lang.String str)
Convert a string to html content, Same as the xml version except that spaces and tabs are converted.

Parameters:
tabIcon - the icon to represent a tag.
str - the string to convert.
Returns:
the converted string.

escapeContent

public static java.lang.String escapeContent(java.lang.String str)
XML encode a string.

Parameters:
str - the string to encode.
Returns:
the encoded string.

escapeAttribute

public static java.lang.String escapeAttribute(java.lang.String str)
Encode an attribute value. This assumes use of " as the attribute value delimiter.

Parameters:
str - the string to convert.
Returns:
the converted string.

toAttribute

public static java.lang.String toAttribute(java.lang.String name,
                                           java.lang.String value)
Return an attribute setting.

Parameters:
name - the name of the attribute.
value - the value of the attribute.
Returns:
the encoded attribute = value string.

toAttribute

public static java.lang.String toAttribute(java.lang.String name,
                                           int value)
Return an attribute setting.

Parameters:
name - the name of the attribute.
value - the value of the attribute.
Returns:
the encoded attribute = value string.


Copyright © 2004-2012. All Rights Reserved.