|
XML for Java Compatibility API 2.0.13 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.xml.parser.Util
Util is a collection of XML4J utility routines which check the conformance of various XML-defined values (XML name, language ID, encoding ID), and which provide services for converting strings to XML format.
Constructor Summary | |
Util()
|
Method Summary | |
static java.lang.String |
backReference(java.lang.String string,
java.lang.String encoding)
Returns the specified string after substituting &, <, >,
, and UTF-16 surrogates for the set of general entities
(&, <, > ) and numeric character
references (&#... ) respectively. |
static java.lang.String |
backReference(java.lang.String string,
java.lang.String specials,
java.lang.String encoding)
Returns the specified string after substituting specials, and UTF-16 surrogates for chracter references &#xnn . |
static java.lang.String |
backReferenceForEntity(java.lang.String string,
java.lang.String encoding)
Returns the specified string after substituting ", ', %, CR,
LF, TAB ,and UTF-16 surrogates for &, ", ',
%, 
, 
, 	, and &#x...; respectively. |
static boolean |
checkAllSpace(java.lang.String string)
Returns whether the specified string consists of only XML whitespace. |
static boolean |
checkEncoding(java.lang.String xmlEncoding)
Returns whether the specified xmlEncoding conforms to an encoding name in XML 1.0. |
static boolean |
checkLanguageID(java.lang.String languageID)
Returns whether the specified languageID conforms to a language ID in XML 1.0. |
static boolean |
checkName(java.lang.String name)
Returns whether the specified name conforms to Name in XML 1.0. |
static boolean |
checkNCName(java.lang.String name)
Returns whether the specified name conforms to NCName in `Namespaces in XML'. |
static boolean |
checkNmtoken(java.lang.String nmtoken)
Returns whether the specified nmtoken conforms to Nmtoken in XML 1.0. |
static boolean |
checkVersionNum(java.lang.String versionNum)
Returns whether the specified versionNum conforms to a version numner in XML 1.0. |
static int |
getInvalidURIChar(java.lang.String uri)
Returns the index of the first invalid character in the specified uri. |
static void |
heapSort(java.lang.String[] pd)
Sort String array. |
static void |
heapSort(java.lang.String[] pd,
int length)
Sort String array. |
static void |
indent(java.io.Writer pw,
int n)
Prints a newline character and n spaces. |
static boolean |
isURN(java.lang.String uri)
Returns whether the specified URI string is a URN. |
static java.lang.String |
normalizeURN(java.lang.String urn)
Returns normalized URN, "urn:" and <NID> are lower-cased. |
static void |
printSpace(java.io.Writer pw,
int n)
Prints n spaces. |
static java.util.Vector |
sortStringVector(java.util.Vector vector)
Returns a sorted vector of strings; strings are orderred using String#compareTo() . |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public Util()
Method Detail |
public static boolean checkName(java.lang.String name)
Name
in XML 1.0.
Refer to
the definition of Name
for details.name
- Name to be checked as a valid XML Name.public static boolean checkNCName(java.lang.String name)
NCName
in `Namespaces in XML'.
Refer to
the definition of NCName
for details.name
- Name to be checked as a valid XML NCName.public static boolean checkNmtoken(java.lang.String nmtoken)
Nmtoken
in XML 1.0.
Refer to
the definition of Nmtoken
for details.nmtoken
- NMToken to be checked as a valid XML NMToken.public static boolean checkAllSpace(java.lang.String string)
S
for details.string
- String to be checked if it constains all XML whitespace.public static boolean checkEncoding(java.lang.String xmlEncoding)
EncName
for details.
Note that just because enc may be a valid encoding name does not imply the encoding is supported by XML4J.
xmlEncoding
- Name to be checked as a valid encoding name.TXDocument.setEncoding(java.lang.String)
public static boolean checkLanguageID(java.lang.String languageID)
languageID
- ID to be checked as a valid language ID.TXElement.getLanguage()
,
TXText.getLanguage()
,
GeneralReference.getLanguage()
public static boolean checkVersionNum(java.lang.String versionNum)
VersionNum
for details.versionNum
- Number to be checked as a valid version number.public static int getInvalidURIChar(java.lang.String uri)
uri
- URI to check for validity against RFC2396.-1
if URI is valid.public static boolean isURN(java.lang.String uri)
public static java.lang.String normalizeURN(java.lang.String urn)
public static java.lang.String backReference(java.lang.String string, java.lang.String encoding)
&, <, >,
, and UTF-16 surrogates for the set of general entities
(&, <, >
) and numeric character
references (&#...
) respectively.
This routine can be used by all DOM and XML4J objects EXCEPT Entity in order to represent their contents in XML format.
string
- String to convert to XML format.encoding
- CURRENTLY NOT IMPLEMENTED.backReferenceForEntity(java.lang.String, java.lang.String)
public static java.lang.String backReferenceForEntity(java.lang.String string, java.lang.String encoding)
", ', %, CR,
LF, TAB
,and UTF-16 surrogates for &, ", ',
%, 
, 
, 	, and &#x...;
respectively.
This routine can be used by Entity objects in order to represent their contents in XML format.
string
- String to convert to XML format.encoding
- CURRENTLY NOT IMPLEMENTED.backReference(java.lang.String, java.lang.String)
public static java.lang.String backReference(java.lang.String string, java.lang.String specials, java.lang.String encoding)
&#xnn
.string
- String to convert to XML format.specials
- Chracters, should be represeted in chracter referenfces.encoding
- CURRENTLY NOT IMPLEMENTED.backReference(java.lang.String, java.lang.String)
public static void printSpace(java.io.Writer pw, int n) throws java.io.IOException
pw
- The character output stream to use.n
- Number of spaces to print.public static void indent(java.io.Writer pw, int n) throws java.io.IOException
pw
- The character output stream to use.n
- Number of spaces to print.public static java.util.Vector sortStringVector(java.util.Vector vector)
String#compareTo()
.vector
- The vector to be sorted.String.compareTo(java.lang.Object)
public static void heapSort(java.lang.String[] pd)
public static void heapSort(java.lang.String[] pd, int length)
|
XML for Java Compatibility API 2.0.13 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |