public class ParserUtils
extends java.lang.Object
| Constructor | Description |
|---|---|
ParserUtils() |
| Modifier and Type | Method | Description |
|---|---|---|
static Parser |
createParserParsingAnInputString(java.lang.String input) |
Create a Parser Object having a String Object as input (instead of a url or a string representing the url location).
|
static Node[] |
findTypeInNode(Node node,
java.lang.Class type) |
Search given node and pick up any objects of given type.
|
static java.lang.String |
removeChars(java.lang.String s,
char occur) |
|
static java.lang.String |
removeEscapeCharacters(java.lang.String inputString) |
|
static java.lang.String |
removeTrailingBlanks(java.lang.String text) |
|
static java.lang.String[] |
splitButChars(java.lang.String input,
java.lang.String charsDoNotBeRemoved) |
Split the input string considering as string separator
all the characters
with the only exception of the characters specified in charsDoNotBeRemoved param.
|
static java.lang.String[] |
splitButDigits(java.lang.String input,
java.lang.String charsDoNotBeRemoved) |
Split the input string considering as string separator
all the not numerical characters
with the only exception of the characters specified in charsDoNotBeRemoved param.
|
static java.lang.String[] |
splitChars(java.lang.String input,
java.lang.String charsToBeRemoved) |
Split the input string considering as string separator
the chars specified in the input variable charsToBeRemoved.
|
static java.lang.String[] |
splitSpaces(java.lang.String input,
java.lang.String charsToBeRemoved) |
Split the input string considering as string separator
all the spaces and tabs like chars and
the chars specified in the input variable charsToBeRemoved.
|
static java.lang.String[] |
splitTags(java.lang.String input,
java.lang.Class nodeType) |
Split the input string in a string array,
considering the tags as delimiter for splitting.
|
static java.lang.String[] |
splitTags(java.lang.String input,
java.lang.Class nodeType,
boolean recursive,
boolean insideTag) |
Split the input string in a string array,
considering the tags as delimiter for splitting.
|
static java.lang.String[] |
splitTags(java.lang.String input,
java.lang.String[] tags) |
Split the input string in a string array,
considering the tags as delimiter for splitting.
|
static java.lang.String[] |
splitTags(java.lang.String input,
java.lang.String[] tags,
boolean recursive,
boolean insideTag) |
Split the input string in a string array,
considering the tags as delimiter for splitting.
|
static java.lang.String[] |
splitTags(java.lang.String input,
NodeFilter filter) |
Split the input string in a string array,
considering the tags as delimiter for splitting.
|
static java.lang.String[] |
splitTags(java.lang.String input,
NodeFilter filter,
boolean recursive,
boolean insideTag) |
Split the input string in a string array,
considering the tags as delimiter for splitting.
|
static java.lang.String |
trimAllTags(java.lang.String input,
boolean inside) |
Trim the input string, removing all the tags in the input string.
|
static java.lang.String |
trimButChars(java.lang.String input,
java.lang.String charsDoNotBeRemoved) |
Remove from the input string all the characters
with the only exception of the characters specified in charsDoNotBeRemoved param.
|
static java.lang.String |
trimButCharsBeginEnd(java.lang.String input,
java.lang.String charsDoNotBeRemoved) |
Remove from the beginning and the end of the input string all the characters
with the only exception of the characters specified in charsDoNotBeRemoved param.
|
static java.lang.String |
trimButDigits(java.lang.String input,
java.lang.String charsDoNotBeRemoved) |
Remove from the input string all the not numerical characters
with the only exception of the characters specified in charsDoNotBeRemoved param.
|
static java.lang.String |
trimButDigitsBeginEnd(java.lang.String input,
java.lang.String charsDoNotBeRemoved) |
Remove from the beginning and the end of the input string all the not numerical characters
with the only exception of the characters specified in charsDoNotBeRemoved param.
|
static java.lang.String |
trimChars(java.lang.String input,
java.lang.String charsToBeRemoved) |
Remove from the input string all the chars specified in the input variable charsToBeRemoved.
|
static java.lang.String |
trimCharsBeginEnd(java.lang.String input,
java.lang.String charsToBeRemoved) |
Remove from the beginning and the end of the input string all the chars specified in the input variable charsToBeRemoved.
|
static java.lang.String |
trimSpaces(java.lang.String input,
java.lang.String charsToBeRemoved) |
Remove from the input string all the spaces and tabs like chars.
|
static java.lang.String |
trimSpacesBeginEnd(java.lang.String input,
java.lang.String charsToBeRemoved) |
Remove from the beginning and the end of the input string all the spaces and tabs like chars.
|
static java.lang.String |
trimTags(java.lang.String input,
java.lang.Class nodeType) |
Trim all tags in the input string and
return a string like the input one
without the tags and their content.
|
static java.lang.String |
trimTags(java.lang.String input,
java.lang.Class nodeType,
boolean recursive,
boolean insideTag) |
Trim all tags in the input string and
return a string like the input one
without the tags and their content (optional).
|
static java.lang.String |
trimTags(java.lang.String input,
java.lang.String[] tags) |
Trim all tags in the input string and
return a string like the input one
without the tags and their content.
|
static java.lang.String |
trimTags(java.lang.String input,
java.lang.String[] tags,
boolean recursive,
boolean insideTag) |
Trim all tags in the input string and
return a string like the input one
without the tags and their content (optional).
|
static java.lang.String |
trimTags(java.lang.String input,
NodeFilter filter) |
Trim all tags in the input string and
return a string like the input one
without the tags and their content.
|
static java.lang.String |
trimTags(java.lang.String input,
NodeFilter filter,
boolean recursive,
boolean insideTag) |
Trim all tags in the input string and
return a string like the input one
without the tags and their content (optional).
|
public static java.lang.String removeChars(java.lang.String s,
char occur)
public static java.lang.String removeEscapeCharacters(java.lang.String inputString)
public static java.lang.String removeTrailingBlanks(java.lang.String text)
public static Node[] findTypeInNode(Node node, java.lang.Class type)
node - The node to search.type - The class to search for.public static java.lang.String[] splitButDigits(java.lang.String input,
java.lang.String charsDoNotBeRemoved)
input - The string in input.charsDoNotBeRemoved - The chars that do not be removed.public static java.lang.String trimButDigits(java.lang.String input,
java.lang.String charsDoNotBeRemoved)
input - The string in input.charsDoNotBeRemoved - The chars that do not be removed.public static java.lang.String trimButDigitsBeginEnd(java.lang.String input,
java.lang.String charsDoNotBeRemoved)
input - - The string in input.charsDoNotBeRemoved - - The chars that do not be removed.public static java.lang.String[] splitSpaces(java.lang.String input,
java.lang.String charsToBeRemoved)
input - The string in input.charsToBeRemoved - The chars to be removed.public static java.lang.String trimSpaces(java.lang.String input,
java.lang.String charsToBeRemoved)
input - The string in input.charsToBeRemoved - The chars to be removed.public static java.lang.String trimSpacesBeginEnd(java.lang.String input,
java.lang.String charsToBeRemoved)
input - The string in input.charsToBeRemoved - The chars to be removed.public static java.lang.String[] splitButChars(java.lang.String input,
java.lang.String charsDoNotBeRemoved)
input - The string in input.charsDoNotBeRemoved - The chars that do not be removed.public static java.lang.String trimButChars(java.lang.String input,
java.lang.String charsDoNotBeRemoved)
input - The string in input.charsDoNotBeRemoved - The chars that do not be removed.public static java.lang.String trimButCharsBeginEnd(java.lang.String input,
java.lang.String charsDoNotBeRemoved)
input - The string in input.charsDoNotBeRemoved - The chars that do not be removed.public static java.lang.String[] splitChars(java.lang.String input,
java.lang.String charsToBeRemoved)
input - The string in input.charsToBeRemoved - The chars to be removed.public static java.lang.String trimChars(java.lang.String input,
java.lang.String charsToBeRemoved)
input - The string in input.charsToBeRemoved - The chars to be removed.public static java.lang.String trimCharsBeginEnd(java.lang.String input,
java.lang.String charsToBeRemoved)
input - The string in input.charsToBeRemoved - The chars to be removed.public static java.lang.String[] splitTags(java.lang.String input,
java.lang.String[] tags)
throws ParserException,
java.io.UnsupportedEncodingException
ParserExceptionjava.io.UnsupportedEncodingException(String input, String[] tags, boolean recursive, boolean insideTag).public static java.lang.String[] splitTags(java.lang.String input,
java.lang.String[] tags,
boolean recursive,
boolean insideTag)
throws ParserException,
java.io.UnsupportedEncodingException
input - The string in input.tags - The tags to be used as splitting delimiter.recursive - Optional parameter (true if not present), if true delete all the tags recursively.insideTag - Optional parameter (true if not present), if true delete also the content of the tags.ParserExceptionjava.io.UnsupportedEncodingExceptionpublic static java.lang.String[] splitTags(java.lang.String input,
java.lang.Class nodeType)
throws ParserException,
java.io.UnsupportedEncodingException
ParserExceptionjava.io.UnsupportedEncodingException(String input, String[] tags, boolean recursive, boolean insideTag).public static java.lang.String[] splitTags(java.lang.String input,
java.lang.Class nodeType,
boolean recursive,
boolean insideTag)
throws ParserException,
java.io.UnsupportedEncodingException
ParserExceptionjava.io.UnsupportedEncodingException(String input, String[] tags, boolean recursive, boolean insideTag).public static java.lang.String[] splitTags(java.lang.String input,
NodeFilter filter)
throws ParserException,
java.io.UnsupportedEncodingException
ParserExceptionjava.io.UnsupportedEncodingException(String input, String[] tags, boolean recursive, boolean insideTag).public static java.lang.String[] splitTags(java.lang.String input,
NodeFilter filter,
boolean recursive,
boolean insideTag)
throws ParserException,
java.io.UnsupportedEncodingException
ParserExceptionjava.io.UnsupportedEncodingException(String input, String[] tags, boolean recursive, boolean insideTag).public static java.lang.String trimAllTags(java.lang.String input,
boolean inside)
input - The string in input.inside - If true, it forces the method to delete also what is inside the tags.public static java.lang.String trimTags(java.lang.String input,
java.lang.String[] tags)
throws ParserException,
java.io.UnsupportedEncodingException
ParserExceptionjava.io.UnsupportedEncodingException(String input, String[] tags, boolean recursive, boolean insideTag).public static java.lang.String trimTags(java.lang.String input,
java.lang.String[] tags,
boolean recursive,
boolean insideTag)
throws ParserException,
java.io.UnsupportedEncodingException
input - The string in input.tags - The tags to be removed.recursive - Optional parameter (true if not present), if true delete all the tags recursively.insideTag - Optional parameter (true if not present), if true delete also the content of the tags.ParserExceptionjava.io.UnsupportedEncodingExceptionpublic static java.lang.String trimTags(java.lang.String input,
java.lang.Class nodeType)
throws ParserException,
java.io.UnsupportedEncodingException
ParserExceptionjava.io.UnsupportedEncodingException(String input, String[] tags, boolean recursive, boolean insideTag).public static java.lang.String trimTags(java.lang.String input,
java.lang.Class nodeType,
boolean recursive,
boolean insideTag)
throws ParserException,
java.io.UnsupportedEncodingException
ParserExceptionjava.io.UnsupportedEncodingException(String input, String[] tags, boolean recursive, boolean insideTag).public static java.lang.String trimTags(java.lang.String input,
NodeFilter filter)
throws ParserException,
java.io.UnsupportedEncodingException
ParserExceptionjava.io.UnsupportedEncodingException(String input, String[] tags, boolean recursive, boolean insideTag).public static java.lang.String trimTags(java.lang.String input,
NodeFilter filter,
boolean recursive,
boolean insideTag)
throws ParserException,
java.io.UnsupportedEncodingException
ParserExceptionjava.io.UnsupportedEncodingException(String input, String[] tags, boolean recursive, boolean insideTag).public static Parser createParserParsingAnInputString(java.lang.String input) throws ParserException, java.io.UnsupportedEncodingException
input - The string in input.ParserExceptionjava.io.UnsupportedEncodingExceptionHTML Parser is an open source library released under LGPL.