protected 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 (!XMLChar.isValid(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"); } }
protected 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 (!XMLChar.isValid(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"); } }
protected void printEscaped( int ch ) throws IOException { String charRef; // If there is a suitable entity reference for this // character, print it. The list of available entity // references is almost but not identical between // XML and HTML. charRef = getEntityRef( ch ); if ( charRef != null ) { _printer.printText( '&' ); _printer.printText( charRef ); _printer.printText( ';' ); } else if ( ( ch >= ' ' && _encodingInfo.isPrintable((char)ch) && ch != 0xF7 ) || ch == '\n' || ch == '\r' || ch == '\t' ) { // Non printables are below ASCII space but not tab or line // terminator, ASCII delete, or above a certain Unicode threshold. if (ch < 0x10000) { _printer.printText((char)ch ); } else { _printer.printText((char)(((ch-0x10000)>>10)+0xd800)); _printer.printText((char)(((ch-0x10000)&0x3ff)+0xdc00)); } } else { printHex(ch); } }
protected void printEscaped( int ch ) throws IOException { String charRef; // If there is a suitable entity reference for this // character, print it. The list of available entity // references is almost but not identical between // XML and HTML. charRef = getEntityRef( ch ); if ( charRef != null ) { _printer.printText( '&' ); _printer.printText( charRef ); _printer.printText( ';' ); } else if ( ( ch >= ' ' && _encodingInfo.isPrintable((char)ch) && ch != 0xF7 ) || ch == '\n' || ch == '\r' || ch == '\t' ) { // Non printables are below ASCII space but not tab or line // terminator, ASCII delete, or above a certain Unicode threshold. if (ch < 0x10000) { _printer.printText((char)ch ); } else { _printer.printText((char)(((ch-0x10000)>>10)+0xd800)); _printer.printText((char)(((ch-0x10000)&0x3ff)+0xdc00)); } } else { printHex(ch); } }