Class XmlEncodingUtils

java.lang.Object
org.frankframework.util.XmlEncodingUtils

public class XmlEncodingUtils extends Object
  • Field Details

  • Constructor Details

    • XmlEncodingUtils

      public XmlEncodingUtils()
  • Method Details

    • encodeChars

      public static String encodeChars(String string)
    • encodeChars

      public static String encodeChars(String string, boolean escapeNewLines)
      Translates special characters to XML equivalents like > and &. Please note that non-valid XML chars are not changed, hence you might want to use replaceNonValidXmlCharacters(String) or stripNonValidXmlCharacters(String, boolean) too.
    • encodeCharsAndReplaceNonValidXmlCharacters

      public static String encodeCharsAndReplaceNonValidXmlCharacters(String string)
    • encodeChars

      public static String encodeChars(char[] chars, int offset, int length, boolean escapeNewLines)
      Translates special characters to xml equivalents like > and &. Please note that non-valid xml chars are not changed, hence you might want to use replaceNonValidXmlCharacters(String) or stripNonValidXmlCharacters(String, boolean) too.
    • decodeChars

      public static String decodeChars(String string)
      Translates the five reserved XML characters (< > & " ') to their normal selves
    • replaceNonPrintableCharacters

      public static int replaceNonPrintableCharacters(char[] buf, int offset, int len)
      Replaces non-unicode-characters by '0x00BF' (inverted question mark).
    • replaceNonValidXmlCharacters

      public static String replaceNonValidXmlCharacters(String string)
      Replaces non-unicode-characters by '0x00BF' (inverted question mark) appended with #, the character number and ;.
    • replaceNonValidXmlCharacters

      public static String replaceNonValidXmlCharacters(String string, char to, boolean appendCharNum, boolean allowUnicodeSupplementaryCharacters)
    • stripNonValidXmlCharacters

      public static String stripNonValidXmlCharacters(String string, boolean allowUnicodeSupplementaryCharacters)
    • isPrintableUnicodeChar

      public static boolean isPrintableUnicodeChar(int c)
    • isPrintableUnicodeChar

      public static boolean isPrintableUnicodeChar(int c, boolean allowUnicodeSupplementaryCharacters)
    • readXml

      public static String readXml(InputStream inputStream, String defaultCharset) throws IOException
      Reads binary XML data and uses the XML declaration encoding to turn it into character data.
      Throws:
      IOException
    • readXml

      public static String readXml(byte[] source, String defaultEncoding) throws UnsupportedEncodingException
      Throws:
      UnsupportedEncodingException