Class XMLUtil
java.lang.Object
com.itextpdf.text.xml.XMLUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringEscapes a string with the appropriated XML codes.static intfindInArray(char needle, char[] haystack, int start) Looks for a character in a character array, starting from a certain positionstatic StringgetEncodingName(byte[] b4) Returns the IANA encoding name that is auto-detected from the bytes specified, with the endian-ness of that encoding where appropriate.static booleanisValidCharacterValue(int c) Checks if a character value should be escaped/unescaped.static booleanChecks if a character value should be escaped/unescaped.static intUnescapes 'lt', 'gt', 'apos', 'quote' and 'amp' to the corresponding character values.static StringUnescapes a String, replacing invalid input: '&#'nn;, <, >, &, ", and invalid input: '&apos' to the corresponding characters.
-
Constructor Details
-
XMLUtil
public XMLUtil()
-
-
Method Details
-
escapeXML
-
unescapeXML
-
unescape
Unescapes 'lt', 'gt', 'apos', 'quote' and 'amp' to the corresponding character values.- Parameters:
s- a string representing a character- Returns:
- a character value
-
isValidCharacterValue
Checks if a character value should be escaped/unescaped.- Parameters:
s- the String representation of an integer- Returns:
- true if it's OK to escape or unescape this value
-
isValidCharacterValue
public static boolean isValidCharacterValue(int c) Checks if a character value should be escaped/unescaped.- Parameters:
c- a character value- Returns:
- true if it's OK to escape or unescape this value
-
findInArray
public static int findInArray(char needle, char[] haystack, int start) Looks for a character in a character array, starting from a certain position- Parameters:
needle- the character you're looking forhaystack- the character arraystart- the start position- Returns:
- the position where the character was found, or -1 if it wasn't found.
-
getEncodingName
Returns the IANA encoding name that is auto-detected from the bytes specified, with the endian-ness of that encoding where appropriate. (method found in org.apache.xerces.impl.XMLEntityManager, originally published by the Apache Software Foundation under the Apache Software License; now being used in iText under the MPL)- Parameters:
b4- The first four bytes of the input.- Returns:
- an IANA-encoding string
- Since:
- 5.0.6
-