com.mirth.connect.userutil
Class XmlUtil

java.lang.Object
  extended by com.mirth.connect.userutil.XmlUtil

public class XmlUtil
extends java.lang.Object

Provides XML utility methods.


Method Summary
static java.lang.String decode(java.lang.String entity)
          Converts an XML/HTML entity reference into a string with the literal character.
static java.lang.String encode(char s)
          Encodes a character into the corresponding XML/HTML entity.
static java.lang.String encode(char[] text, int start, int length)
          Converts a character array, encoding characters into the corresponding XML/HTML entities as needed.
static java.lang.String encode(java.lang.String s)
          Converts a string, encoding characters into the corresponding XML/HTML entities as needed.
static java.lang.String prettyPrint(java.lang.String input)
          Formats an XML string with indented markup.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

prettyPrint

public static java.lang.String prettyPrint(java.lang.String input)
Formats an XML string with indented markup.

Parameters:
input - The XML string to format.
Returns:
The formatted XML string.

decode

public static java.lang.String decode(java.lang.String entity)
Converts an XML/HTML entity reference into a string with the literal character.

Parameters:
entity - The XML/HTML entity to decode.
Returns:
A string containing the decoded character.

encode

public static java.lang.String encode(char s)
Encodes a character into the corresponding XML/HTML entity.

Parameters:
s - The character to encode.
Returns:
The encoded XML/HTML entity.

encode

public static java.lang.String encode(java.lang.String s)
Converts a string, encoding characters into the corresponding XML/HTML entities as needed.

Parameters:
s - The string to encode.
Returns:
The encoded string with replaced XML/HTML entities.

encode

public static java.lang.String encode(char[] text,
                                      int start,
                                      int length)
Converts a character array, encoding characters into the corresponding XML/HTML entities as needed.

Parameters:
text - The character array to encode.
start - The index to start at in the character array.
length - The maximum amount of characters to read from the array.
Returns:
The encoded string with replaced XML/HTML entities.