/** * Escapes a string so it may be printed as text content or attribute * value. Non printable characters are escaped using character references. * Where the format specifies a deault entity reference, that reference * is used (e.g. <tt>&lt;</tt>). * * @param source The string to escape */ protected void printEscaped( String source ) throws IOException { for ( int i = 0 ; i < source.length() ; ++i ) { int ch = source.charAt(i); if ((ch & 0xfc00) == 0xd800 && i+1 < source.length()) { int lowch = source.charAt(i+1); if ((lowch & 0xfc00) == 0xdc00) { ch = 0x10000 + ((ch-0xd800)<<10) + lowch-0xdc00; i++; } } printEscaped(ch); } }
/** * Escapes a string so it may be printed as text content or attribute * value. Non printable characters are escaped using character references. * Where the format specifies a deault entity reference, that reference * is used (e.g. <tt>&lt;</tt>). * * @param source The string to escape */ protected void printEscaped( String source ) throws IOException { for ( int i = 0 ; i < source.length() ; ++i ) { int ch = source.charAt(i); if ((ch & 0xfc00) == 0xd800 && i+1 < source.length()) { int lowch = source.charAt(i+1); if ((lowch & 0xfc00) == 0xdc00) { ch = 0x10000 + ((ch-0xd800)<<10) + lowch-0xdc00; i++; } } printEscaped(ch); } }
_printer.printText( ch ); else printEscaped( ch ); _printer.printText( ch ); else printEscaped( ch );
_printer.printText( ch ); else printEscaped( ch ); _printer.printText( ch ); else printEscaped( ch );
_printer.printText( ch ); else printEscaped( ch ); _printer.printText( ch ); else printEscaped( ch );
_printer.printText( ch ); else printEscaped( ch ); _printer.printText( ch ); else printEscaped( ch );
public void internalEntityDecl( String name, String value ) throws SAXException { try { _printer.enterDTD(); _printer.printText( "<!ENTITY " ); _printer.printText( name ); _printer.printText( " \"" ); printEscaped( value ); _printer.printText( "\">" ); if ( _indenting ) _printer.breakLine(); } catch ( IOException except ) { throw new SAXException( except ); } }
public void internalEntityDecl( String name, String value ) throws SAXException { try { _printer.enterDTD(); _printer.printText( "<!ENTITY " ); _printer.printText( name ); _printer.printText( " \"" ); printEscaped( value ); _printer.printText( "\">" ); if ( _indenting ) _printer.breakLine(); } catch ( IOException except ) { throw new SAXException( except ); } }
public void attributeDecl( String eName, String aName, String type, String valueDefault, String value ) throws SAXException { try { _printer.enterDTD(); _printer.printText( "<!ATTLIST " ); _printer.printText( eName ); _printer.printText( ' ' ); _printer.printText( aName ); _printer.printText( ' ' ); _printer.printText( type ); if ( valueDefault != null ) { _printer.printText( ' ' ); _printer.printText( valueDefault ); } if ( value != null ) { _printer.printText( " \"" ); printEscaped( value ); _printer.printText( '"' ); } _printer.printText( '>' ); if ( _indenting ) _printer.breakLine(); } catch ( IOException except ) { throw new SAXException( except ); } }
public void attributeDecl( String eName, String aName, String type, String valueDefault, String value ) throws SAXException { try { _printer.enterDTD(); _printer.printText( "<!ATTLIST " ); _printer.printText( eName ); _printer.printText( ' ' ); _printer.printText( aName ); _printer.printText( ' ' ); _printer.printText( type ); if ( valueDefault != null ) { _printer.printText( ' ' ); _printer.printText( valueDefault ); } if ( value != null ) { _printer.printText( " \"" ); printEscaped( value ); _printer.printText( '"' ); } _printer.printText( '>' ); if ( _indenting ) _printer.breakLine(); } catch ( IOException except ) { throw new SAXException( except ); } }