本文整理汇总了Java中com.sun.org.apache.xerces.internal.util.XML11Char.isXML11Valid方法的典型用法代码示例。如果您正苦于以下问题:Java XML11Char.isXML11Valid方法的具体用法?Java XML11Char.isXML11Valid怎么用?Java XML11Char.isXML11Valid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.org.apache.xerces.internal.util.XML11Char
的用法示例。
在下文中一共展示了XML11Char.isXML11Valid方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: printEscaped
import com.sun.org.apache.xerces.internal.util.XML11Char; //导入方法依赖的package包/类
protected void printEscaped( String source ) throws IOException {
int length = source.length();
for ( int i = 0 ; i < length ; ++i ) {
int ch = source.charAt(i);
if (!XML11Char.isXML11Valid(ch)) {
if (++i <length) {
surrogates(ch, source.charAt(i));
} else {
fatalError("The character '"+(char)ch+"' is an invalid XML character");
}
continue;
}
if (ch == '\n' || ch == '\r' || ch == '\t' || ch == 0x0085 || ch == 0x2028){
printHex(ch);
} else if (ch == '<') {
_printer.printText("<");
} else if (ch == '&') {
_printer.printText("&");
} else if (ch == '"') {
_printer.printText(""");
} else if ((ch >= ' ' && _encodingInfo.isPrintable((char) ch))) {
_printer.printText((char) ch);
} else {
printHex(ch);
}
}
}
示例2: surrogates
import com.sun.org.apache.xerces.internal.util.XML11Char; //导入方法依赖的package包/类
protected final void surrogates(int high, int low) throws IOException{
if (XMLChar.isHighSurrogate(high)) {
if (!XMLChar.isLowSurrogate(low)) {
//Invalid XML
fatalError("The character '"+(char)low+"' is an invalid XML character");
}
else {
int supplemental = XMLChar.supplemental((char)high, (char)low);
if (!XML11Char.isXML11Valid(supplemental)) {
//Invalid XML
fatalError("The character '"+(char)supplemental+"' is an invalid XML character");
}
else {
if (content().inCData ) {
_printer.printText("]]>&#x");
_printer.printText(Integer.toHexString(supplemental));
_printer.printText(";<![CDATA[");
}
else {
printHex(supplemental);
}
}
}
} else {
fatalError("The character '"+(char)high+"' is an invalid XML character");
}
}
示例3: printEscaped
import com.sun.org.apache.xerces.internal.util.XML11Char; //导入方法依赖的package包/类
protected void printEscaped( String source ) throws IOException {
int length = source.length();
for ( int i = 0 ; i < length ; ++i ) {
int ch = source.charAt(i);
if (!XML11Char.isXML11Valid(ch)) {
if (++i <length) {
surrogates(ch, source.charAt(i), false);
}
else {
fatalError("The character '"+(char)ch+"' is an invalid XML character");
}
continue;
}
if (ch == '\n' || ch == '\r' || ch == '\t' || ch == 0x0085 || ch == 0x2028) {
printHex(ch);
}
else if (ch == '<') {
_printer.printText("<");
}
else if (ch == '&') {
_printer.printText("&");
}
else if (ch == '"') {
_printer.printText(""");
}
else if ((ch >= ' ' && _encodingInfo.isPrintable((char) ch))) {
_printer.printText((char) ch);
}
else {
printHex(ch);
}
}
}
示例4: surrogates
import com.sun.org.apache.xerces.internal.util.XML11Char; //导入方法依赖的package包/类
protected final void surrogates(int high, int low, boolean inContent) throws IOException{
if (XMLChar.isHighSurrogate(high)) {
if (!XMLChar.isLowSurrogate(low)) {
//Invalid XML
fatalError("The character '"+(char)low+"' is an invalid XML character");
}
else {
int supplemental = XMLChar.supplemental((char)high, (char)low);
if (!XML11Char.isXML11Valid(supplemental)) {
//Invalid XML
fatalError("The character '"+(char)supplemental+"' is an invalid XML character");
}
else {
if (inContent && content().inCData) {
_printer.printText("]]>&#x");
_printer.printText(Integer.toHexString(supplemental));
_printer.printText(";<![CDATA[");
}
else {
printHex(supplemental);
}
}
}
}
else {
fatalError("The character '"+(char)high+"' is an invalid XML character");
}
}
示例5: isInvalid
import com.sun.org.apache.xerces.internal.util.XML11Char; //导入方法依赖的package包/类
protected boolean isInvalid(int value) {
return (!XML11Char.isXML11Valid(value));
}
示例6: printText
import com.sun.org.apache.xerces.internal.util.XML11Char; //导入方法依赖的package包/类
protected void printText( String text, boolean preserveSpace, boolean unescaped )
throws IOException {
int index;
char ch;
int length = text.length();
if ( preserveSpace ) {
// Preserving spaces: the text must print exactly as it is,
// without breaking when spaces appear in the text and without
// consolidating spaces. If a line terminator is used, a line
// break will occur.
for ( index = 0 ; index < length ; ++index ) {
ch = text.charAt( index );
if (!XML11Char.isXML11Valid(ch)) {
// check if it is surrogate
if (++index <length) {
surrogates(ch, text.charAt(index));
} else {
fatalError("The character '"+(char)ch+"' is an invalid XML character");
}
continue;
}
if ( unescaped && XML11Char.isXML11ValidLiteral(ch)) {
_printer.printText( ch );
} else
printXMLChar( ch );
}
} else {
// Not preserving spaces: print one part at a time, and
// use spaces between parts to break them into different
// lines. Spaces at beginning of line will be stripped
// by printing mechanism. Line terminator is treated
// no different than other text part.
for ( index = 0 ; index < length ; ++index ) {
ch = text.charAt( index );
if (!XML11Char.isXML11Valid(ch)) {
// check if it is surrogate
if (++index <length) {
surrogates(ch, text.charAt(index));
} else {
fatalError("The character '"+(char)ch+"' is an invalid XML character");
}
continue;
}
if ( unescaped && XML11Char.isXML11ValidLiteral(ch) )
_printer.printText( ch );
else
printXMLChar( ch);
}
}
}
示例7: printText
import com.sun.org.apache.xerces.internal.util.XML11Char; //导入方法依赖的package包/类
protected void printText( String text, boolean preserveSpace, boolean unescaped )
throws IOException {
int index;
char ch;
int length = text.length();
if ( preserveSpace ) {
// Preserving spaces: the text must print exactly as it is,
// without breaking when spaces appear in the text and without
// consolidating spaces. If a line terminator is used, a line
// break will occur.
for ( index = 0 ; index < length ; ++index ) {
ch = text.charAt( index );
if (!XML11Char.isXML11Valid(ch)) {
// check if it is surrogate
if (++index <length) {
surrogates(ch, text.charAt(index), true);
} else {
fatalError("The character '"+ch+"' is an invalid XML character");
}
continue;
}
if ( unescaped && XML11Char.isXML11ValidLiteral(ch)) {
_printer.printText( ch );
}
else {
printXMLChar( ch );
}
}
}
else {
// Not preserving spaces: print one part at a time, and
// use spaces between parts to break them into different
// lines. Spaces at beginning of line will be stripped
// by printing mechanism. Line terminator is treated
// no different than other text part.
for ( index = 0 ; index < length ; ++index ) {
ch = text.charAt( index );
if (!XML11Char.isXML11Valid(ch)) {
// check if it is surrogate
if (++index <length) {
surrogates(ch, text.charAt(index), true);
} else {
fatalError("The character '"+ch+"' is an invalid XML character");
}
continue;
}
if ( unescaped && XML11Char.isXML11ValidLiteral(ch) ) {
_printer.printText( ch );
}
else {
printXMLChar( ch );
}
}
}
}
示例8: isValid
import com.sun.org.apache.xerces.internal.util.XML11Char; //导入方法依赖的package包/类
/**
* Returns true if the specified character is a valid XML character
* as per the rules of XML 1.1.
*
* @param ch The character to check.
*/
protected boolean isValid(int ch) {
return XML11Char.isXML11Valid(ch);
}