org.exolab.adaptx.xpath.engine

Class 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: 1.2 $
Author:
Keith Visco

Field Summary

static char
CR
Carriage Return character
static String
EMPTY
Empty String
static char
LF
Linefeed character
static char
NULL
Null character
static char
SPACE
Single space character
static char
TAB
Tab character

Method Summary

static String[]
fromQualified(String qname)
static String
stripSpace(String data)
Strips whitespace from the given String.
static String
stripSpace(String data, boolean stripAllLeadSpace, boolean stripAllTrailSpace)
Strips whitespace from the given String.
static int
stripSpace(char[] data, boolean stripAllLeadSpace, boolean stripAllTrailSpace)
Strips whitespace from the given String.
static String
toQualified(String uri, String local)

Field Details

CR

public static final char CR
Carriage Return character
Field Value:
'\r'

EMPTY

public static final String EMPTY
Empty String

LF

public static final char LF
Linefeed character
Field Value:
'\n'

NULL

public static final char NULL
Null character
Field Value:
'\u0000'

SPACE

public static final char SPACE
Single space character
Field Value:
' '

TAB

public static final char TAB
Tab character
Field Value:
'\t'

Method Details

fromQualified

public static String[] fromQualified(String qname)

stripSpace

public static String stripSpace(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 String stripSpace(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 from

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 from
Returns:
the new length of the array

toQualified

public static String toQualified(String uri,
                                 String local)