Package org.exolab.adaptx.xpath.engine
Class XMLUtils
- java.lang.Object
-
- org.exolab.adaptx.xpath.engine.XMLUtils
-
public final class XMLUtils extends java.lang.Object
A utility class for handling whitespace and namespaces. The code in this class was adapted from XSL:P.- Version:
- $Revision: 3731 $
- Author:
- Keith Visco
-
-
Constructor Summary
Constructors Constructor Description XMLUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String[]
fromQualified(java.lang.String qname)
static int
stripSpace(char[] data, boolean stripAllLeadSpace, boolean stripAllTrailSpace)
Strips whitespace from the given String.static java.lang.String
stripSpace(java.lang.String data)
Strips whitespace from the given String.static java.lang.String
stripSpace(java.lang.String data, boolean stripAllLeadSpace, boolean stripAllTrailSpace)
Strips whitespace from the given String.static java.lang.String
toQualified(java.lang.String uri, java.lang.String local)
-
-
-
Field Detail
-
NULL
public static final char NULL
Null character- See Also:
- Constant Field Values
-
SPACE
public static final char SPACE
Single space character- See Also:
- Constant Field Values
-
TAB
public static final char TAB
Tab character- See Also:
- Constant Field Values
-
CR
public static final char CR
Carriage Return character- See Also:
- Constant Field Values
-
LF
public static final char LF
Linefeed character- See Also:
- Constant Field Values
-
EMPTY
public static final java.lang.String EMPTY
Empty String- See Also:
- Constant Field Values
-
-
Method Detail
-
toQualified
public static java.lang.String toQualified(java.lang.String uri, java.lang.String local)
-
fromQualified
public static java.lang.String[] fromQualified(java.lang.String qname)
-
stripSpace
public static java.lang.String stripSpace(java.lang.String data)
Strips whitespace from the given String. Newlines (#xD), tabs (#x9), and consecutive spaces (#x20) are converted to a single space (#x20). This method is useful for processing consective Strings since any leading spaces will be converted to a single space.- Parameters:
data
- the String to strip whitespace from
-
stripSpace
public static java.lang.String stripSpace(java.lang.String data, boolean stripAllLeadSpace, boolean stripAllTrailSpace)
Strips whitespace from the given String. Newlines (#xD), tabs (#x9), and consecutive spaces (#x20) are converted to a single space (#x20).- Parameters:
data
- the String to strip whitespace fromstripAllLeadSpace
- , a boolean indicating whether or not to strip all leading space. If true all whitespace from the start of the given String will be stripped. If false, all whitespace from the start of the given String will be converted to a single space.stripAllTrailSpace
- , a boolean indicating whether or not to strip all trailing space. If true all whitespace at the end of the given String will be stripped. If false, all whitespace at the end of the given String will be converted to a single space.
-
stripSpace
public static int stripSpace(char[] data, boolean stripAllLeadSpace, boolean stripAllTrailSpace)
Strips whitespace from the given String. Newlines (#xD), tabs (#x9), and consecutive spaces (#x20) are converted to a single space (#x20).- Parameters:
data
- the chars to strip whitespace fromstripAllLeadSpace
- , a boolean indicating whether or not to strip all leading space. If true all whitespace from the start of the given String will be stripped. If false, all whitespace from the start of the given String will be converted to a single space.stripAllTrailSpace
- , a boolean indicating whether or not to strip all trailing space. If true all whitespace at the end of the given String will be stripped. If false, all whitespace at the end of the given String will be converted to a single space.- Returns:
- the new length of the array
-
-