edu.cmu.pslc.logging.util

## Class LogFormatUtils

- java.lang.Object
- - edu.cmu.pslc.logging.util.LogFormatUtils

-     public final class LogFormatUtils
      extends java.lang.Object

  Utility class for Logging. Handles string escaping.
  Version:
    $Revision: 6719 $
    Last modified by: $Author: alida $
    Last modified on: $Date: 2011-03-17 11:13:06 -0400 (Thu, 17 Mar 2011) $
  Author:
    Benjamin Billings

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.lang.String` | `escapeAttribute(java.lang.String attributeString)` Returns an escaped version of the string suitable for inclusion in an XML attribute.
    `static java.lang.String` | `escapeElement(java.lang.String theString)` Check that the string does not contain any invalid XML characters, if no invalid characters, returns the string, otherwise checks that the characters are escaped properly.
    `static java.lang.Boolean` | `hasUnescapedString(java.lang.String theString)` This function checks a string to make sure that all characters listed in Escapable entities are escaped, and that the ampersands are part of an escape sequence of some kind.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### escapeAttribute

          public static java.lang.String escapeAttribute(java.lang.String attributeString)

      Returns an escaped version of the string suitable for inclusion in an XML attribute. An already escaped string will not be re-escaped.
      Parameters:
        `attributeString` - The string to escape.
      Returns:
        an escaped version of the string.

    - #### escapeElement

          public static java.lang.String escapeElement(java.lang.String theString)

      Check that the string does not contain any invalid XML characters, if no invalid characters, returns the string, otherwise checks that the characters are escaped properly. If not escaped properly wraps the string in CDATA[ ... ]]
      Parameters:
        `theString` - The string to escape.
      Returns:
        the string wrapped with CDATA[ ... ]]

    - #### hasUnescapedString

          public static java.lang.Boolean hasUnescapedString(java.lang.String theString)

      This function checks a string to make sure that all characters listed in Escapable entities are escaped, and that the ampersands are part of an escape sequence of some kind.
      Parameters:
        `theString` - the string to check for unescaped characters
      Returns:
        true if has unescaped characters, false otherwise.

Copyright (c) 2015 - Pittsburgh Science of Learning Center