|
Qizx/open API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.axyana.qizxopen.util.XMLUtil
A collection of utility functions (static methods) related to XML.
Constructor Summary | |
XMLUtil()
|
Method Summary | |
static java.lang.String |
collapseWhiteSpace(java.lang.String value)
Replaces successive XML space characters by a single space character (' ') then removes leading and trailing space characters if any. |
static java.lang.String |
compressWhiteSpace(java.lang.String value)
Replaces successive XML space characters ('\t', '\r', '\n', ' ') by a single space character (' '). |
static void |
escapeXML(char[] chars,
int offset,
int length,
java.lang.StringBuffer escaped)
Escapes specified character array (that is, '<' is replaced by "<", '&' is replaced by "&", etc). |
static void |
escapeXML(char[] chars,
int offset,
int length,
java.lang.StringBuffer escaped,
boolean ascii)
Escapes specified character array (that is, '<' is replaced by "<", '&' is replaced by "&", etc). |
static java.lang.String |
escapeXML(java.lang.String string)
Escapes specified string (that is, '<' is replaced by "<", '&' is replaced by "&", etc). |
static void |
escapeXML(java.lang.String string,
java.lang.StringBuffer escaped)
Escapes specified string (that is, '<' is replaced by "<", '&' is replaced by "&", etc). |
static java.lang.String |
getUniqueId()
Returns a unique ID which can be used for example as the value of an attribute of type ID. |
static boolean |
isName(java.lang.String s)
Tests if specified string is a lexically correct Name. |
static boolean |
isNCName(java.lang.String s)
Tests if specified string is a lexically correct NCName. |
static boolean |
isNmtoken(java.lang.String s)
Tests if specified string is a lexically correct NMTOKEN. |
static boolean |
isPITarget(java.lang.String s)
Tests if specified string is a lexically correct target for a process instruction. |
static boolean |
isXMLChar(char c)
Tests if specified character is a character which can be contained in a XML document. |
static boolean |
isXMLSpace(char c)
Tests if specified character is a XML space ('\t', '\r', '\n', ' '). |
static boolean |
isXMLSpace(java.lang.String s)
Tests if all characters are XML space ('\t', '\r', '\n', ' '). |
static java.lang.String |
quoteXML(java.lang.String string)
Escapes specified string (that is, '<' is replaced by "<", '&' is replaced by "&", etc) then quotes the escaped string. |
static java.lang.String |
replaceWhiteSpace(java.lang.String value)
Replaces sequence "\r\n" and characters '\t', '\r', '\n' by a single space character ' '. |
static java.lang.String[] |
splitList(java.lang.String s)
Splits specified string at XML space character boundaries ('\t', '\r', '\n', ' '). |
static java.lang.String |
unescapeXML(java.lang.String text)
Unescapes specified string. |
static void |
unescapeXML(java.lang.String text,
int offset,
int length,
java.lang.StringBuffer unescaped)
Unescapes specified string. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public XMLUtil()
Method Detail |
public static final boolean isPITarget(java.lang.String s)
Note that Names starting with "xml" (case-insensitive) are rejected.
s
- string to be tested
true
if test is successful; false
otherwisepublic static final boolean isNmtoken(java.lang.String s)
s
- string to be tested
true
if test is successful; false
otherwisepublic static final boolean isNCName(java.lang.String s)
s
- string to be tested
true
if test is successful; false
otherwisepublic static final boolean isName(java.lang.String s)
s
- string to be tested
true
if test is successful; false
otherwisepublic static final boolean isXMLSpace(char c)
c
- character to be tested
true
if test is successful; false
otherwisepublic static final boolean isXMLSpace(java.lang.String s)
s
- characters to be tested
true
if test is successful; false
otherwisepublic static final boolean isXMLChar(char c)
c
- character to be tested
true
if test is successful; false
otherwisepublic static final java.lang.String collapseWhiteSpace(java.lang.String value)
value
- string to be processed
public static final java.lang.String compressWhiteSpace(java.lang.String value)
value
- string to be processed
public static final java.lang.String replaceWhiteSpace(java.lang.String value)
value
- string to be processed
public static final java.lang.String[] splitList(java.lang.String s)
s
- string to be split
public static final java.lang.String escapeXML(java.lang.String string)
string
- string to be escaped
public static final java.lang.String quoteXML(java.lang.String string)
string
- string to be escaped and quoted
public static final void escapeXML(java.lang.String string, java.lang.StringBuffer escaped)
string
- string to be escapedescaped
- buffer used to store escaped string (characters are
appended to this buffer)public static final void escapeXML(char[] chars, int offset, int length, java.lang.StringBuffer escaped)
chars
- character array to be escapedoffset
- specifies first character in array to be escapedlength
- number of characters in array to be escapedescaped
- buffer used to store escaped string (characters are
appended to this buffer)public static final void escapeXML(char[] chars, int offset, int length, java.lang.StringBuffer escaped, boolean ascii)
chars
- character array to be escapedoffset
- specifies first character in array to be escapedlength
- number of characters in array to be escapedescaped
- buffer used to store escaped string (characters are
appended to this buffer)ascii
- if true, characters with code > 127 are escaped as
&#code;public static final java.lang.String unescapeXML(java.lang.String text)
text
- string to be unescaped
public static final void unescapeXML(java.lang.String text, int offset, int length, java.lang.StringBuffer unescaped)
text
- string to be unescapedoffset
- specifies first character in string to be unescapedlength
- number of characters in string to be unescapedunescaped
- buffer used to store unescaped string (characters are
appended to this buffer)public static final java.lang.String getUniqueId()
|
© 2005 Axyana Software | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |