public void comment( char[] chars, int start, int length ) throws SAXException { try { comment( new String( chars, start, length ) ); } catch ( IOException except ) { throw new SAXException( except ); } }
public void endPreserving() { ElementState state; state = getElementState(); state.preserveSpace = false; }
characters(text); else if ( !_indenting || getElementState().preserveSpace || (text.replace('\n',' ').trim().length() != 0)) characters( text ); startCDATA(); characters(text); endCDATA(); characters(text); comment( text ); endCDATA(); content(); child = node.getFirstChild(); while ( child != null ) { serializeNode( child ); child = child.getNextSibling(); checkUnboundNamespacePrefixedNode(node); child = node.getFirstChild(); while ( child != null ) { serializeNode( child ); child = child.getNextSibling();
ElementState state; state = content(); if ( isDocumentState() ) { if ( _preRoot == null ) _preRoot = new Vector(); } else { _printer.indent(); printText( fStrBuffer.toString(), true, true ); _printer.unindent(); if ( _indenting )
state = content(); surrogates(ch, chars[index]); fatalError("The character '"+(char)ch+"' is an invalid XML character"); printText( chars, start, length, true, state.unescaped ); _printer.setNextIndent( saveIndent ); } else { printText( chars, start, length, false, state.unescaped );
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"); } }
state = content(); printCDATAText( text); _printer.setNextIndent( saveIndent ); printText( text, true, state.unescaped ); _printer.setNextIndent( saveIndent ); } else { printText( text, false, state.unescaped );
if ((features & DOMSerializerImpl.WELLFORMED) != 0) { modifyDOMError(msg, DOMError.SEVERITY_FATAL_ERROR, "wf-invalid-character", fCurrentNode); fDOMErrorHandler.handleError(fDOMError); throw new LSException(LSException.SERIALIZE_ERR, msg); modifyDOMError(msg, DOMError.SEVERITY_ERROR, "cdata-section-not-splitted", fCurrentNode); if (!fDOMErrorHandler.handleError(fDOMError)) { throw new LSException(LSException.SERIALIZE_ERR, msg); "SplittingCDATA", null); modifyDOMError( msg, DOMError.SEVERITY_WARNING, surrogates(ch, text.charAt(index)); fatalError("The character '"+(char)ch+"' is an invalid XML character");
public void setOutputFormat( OutputFormat format ) { super.setOutputFormat( format != null ? format : new OutputFormat( Method.HTML, "ISO-8859-1", false ) ); }
protected void characters( String text ) throws IOException { ElementState state; // HTML: no CDATA section state = content(); super.characters( text ); }
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); } }
state = getElementState(); if ( ! isDocumentState() ) {
public void ignorableWhitespace( char[] chars, int start, int length ) throws SAXException { int i; try { content(); // Print ignorable whitespaces only when indenting, after // all they are indentation. Cancel the indentation to // not indent twice. if ( _indenting ) { _printer.setThisIndent( 0 ); for ( i = start ; length-- > 0 ; ++i ) _printer.printText( chars[ i ] ); } } catch ( IOException except ) { throw new SAXException( except ); } }
characters(text); else if ( !_indenting || getElementState().preserveSpace || (text.replace('\n',' ').trim().length() != 0)) characters( text ); startCDATA(); characters(text); endCDATA(); characters(text); comment( text ); endCDATA(); content(); child = node.getFirstChild(); while ( child != null ) { serializeNode( child ); child = child.getNextSibling(); checkUnboundNamespacePrefixedNode(node); child = node.getFirstChild(); while ( child != null ) { serializeNode( child ); child = child.getNextSibling();
ElementState state; state = content(); if ( isDocumentState() ) { if ( _preRoot == null ) _preRoot = new Vector(); } else { _printer.indent(); printText( fStrBuffer.toString(), true, true ); _printer.unindent(); if ( _indenting )
state = content(); surrogates(ch, chars[index]); fatalError("The character '"+(char)ch+"' is an invalid XML character"); printText( chars, start, length, true, state.unescaped ); _printer.setNextIndent( saveIndent ); } else { printText( chars, start, length, false, state.unescaped );
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"); } }
state = content(); printCDATAText( text); _printer.setNextIndent( saveIndent ); printText( text, true, state.unescaped ); _printer.setNextIndent( saveIndent ); } else { printText( text, false, state.unescaped );
if ((features & DOMSerializerImpl.WELLFORMED) != 0) { modifyDOMError(msg, DOMError.SEVERITY_FATAL_ERROR, "wf-invalid-character", fCurrentNode); fDOMErrorHandler.handleError(fDOMError); throw new LSException(LSException.SERIALIZE_ERR, msg); modifyDOMError(msg, DOMError.SEVERITY_ERROR, "cdata-section-not-splitted", fCurrentNode); if (!fDOMErrorHandler.handleError(fDOMError)) { throw new LSException(LSException.SERIALIZE_ERR, msg); "SplittingCDATA", null); modifyDOMError( msg, DOMError.SEVERITY_WARNING, surrogates(ch, text.charAt(index)); fatalError("The character '"+(char)ch+"' is an invalid XML character");