public class XmlEncodingUtils extends Object
Modifier and Type | Field and Description |
---|---|
static char |
REPLACE_NON_XML_CHAR |
Constructor and Description |
---|
XmlEncodingUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
decodeChars(String string)
Translates the five reserved XML characters (< > & " ') to their normal selves
|
static String |
encodeChars(char[] chars,
int offset,
int length) |
static String |
encodeChars(char[] chars,
int offset,
int length,
boolean escapeNewLines)
Translates special characters to xml equivalents
like > and &.
|
static String |
encodeChars(String string) |
static String |
encodeChars(String string,
boolean escapeNewLines)
Translates special characters to xml equivalents
like > and &.
|
static String |
encodeCharsAndReplaceNonValidXmlCharacters(String string) |
static boolean |
isPrintableUnicodeChar(int c) |
static boolean |
isPrintableUnicodeChar(int c,
boolean allowUnicodeSupplementaryCharacters) |
static String |
readXml(byte[] source,
String defaultEncoding) |
static String |
readXml(InputStream inputStream,
String defaultCharset)
Reads binary XML data and uses the XML declaration encoding to turn it into character data.
|
static int |
replaceNonPrintableCharacters(char[] buf,
int offset,
int len)
Replaces non-unicode-characters by '0x00BF' (inverted question mark).
|
static String |
replaceNonValidXmlCharacters(String string)
Replaces non-unicode-characters by '0x00BF' (inverted question mark)
appended with #, the character number and ;.
|
static String |
replaceNonValidXmlCharacters(String string,
char to,
boolean appendCharNum,
boolean allowUnicodeSupplementaryCharacters) |
static String |
stripNonValidXmlCharacters(String string,
boolean allowUnicodeSupplementaryCharacters) |
public static final char REPLACE_NON_XML_CHAR
public static String encodeChars(String string, boolean escapeNewLines)
public static String encodeCharsAndReplaceNonValidXmlCharacters(String string)
public static String encodeChars(char[] chars, int offset, int length)
public static String encodeChars(char[] chars, int offset, int length, boolean escapeNewLines)
public static String decodeChars(String string)
public static int replaceNonPrintableCharacters(char[] buf, int offset, int len)
public static String replaceNonValidXmlCharacters(String string)
public static String replaceNonValidXmlCharacters(String string, char to, boolean appendCharNum, boolean allowUnicodeSupplementaryCharacters)
public static String stripNonValidXmlCharacters(String string, boolean allowUnicodeSupplementaryCharacters)
public static boolean isPrintableUnicodeChar(int c)
public static boolean isPrintableUnicodeChar(int c, boolean allowUnicodeSupplementaryCharacters)
public static String readXml(InputStream inputStream, String defaultCharset) throws IOException
IOException
public static String readXml(byte[] source, String defaultEncoding) throws UnsupportedEncodingException
UnsupportedEncodingException
Copyright © 2023 Frank!Framework. All rights reserved.