< prev index next >

src/com/sun/org/apache/xml/internal/serializer/ToTextStream.java

Print this page

        

*** 1,8 **** /* ! * reserved comment block ! * DO NOT REMOVE OR ALTER! */ /* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,7 ---- /* ! * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. */ /* * Copyright 2001-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License");
*** 33,42 **** --- 32,42 ---- * This class is not a public API. * It is only public because it is used in other packages. * This class converts SAX or SAX-like calls to a * serialized document for xsl:output method of "text". * @xsl.usage internal + * @LastModified: Sept 2018 */ public final class ToTextStream extends ToStream {
*** 294,306 **** writer.write(m_lineSep, 0, m_lineSepLen); // one input char processed } else if (m_encodingInfo.isInEncoding(c)) { writer.write(c); // one input char processed ! } else if (Encodings.isHighUTF16Surrogate(c)) { final int codePoint = writeUTF16Surrogate(c, ch, i, end); ! if (codePoint != 0) { // I think we can just emit the message, // not crash and burn. final String integralValue = Integer.toString(codePoint); final String msg = Utils.messages.createMessage( MsgKey.ER_ILLEGAL_CHARACTER, --- 294,316 ---- writer.write(m_lineSep, 0, m_lineSepLen); // one input char processed } else if (m_encodingInfo.isInEncoding(c)) { writer.write(c); // one input char processed ! } else if (Encodings.isHighUTF16Surrogate(c) || ! Encodings.isLowUTF16Surrogate(c)) { final int codePoint = writeUTF16Surrogate(c, ch, i, end); ! if (codePoint >= 0) { ! // move the index if the low surrogate is consumed ! // as writeUTF16Surrogate has written the pair ! if (Encodings.isHighUTF16Surrogate(c)) { ! i++; ! } ! ! // printing to the console is not appropriate, but will leave ! // it as is for compatibility. ! if (codePoint >0) { // I think we can just emit the message, // not crash and burn. final String integralValue = Integer.toString(codePoint); final String msg = Utils.messages.createMessage( MsgKey.ER_ILLEGAL_CHARACTER,
*** 308,320 **** //Older behavior was to throw the message, //but newer gentler behavior is to write a message to System.err //throw new SAXException(msg); System.err.println(msg); - } ! i++; // two input chars processed } else { // Don't know what to do with this char, it is // not in the encoding and not a high char in // a surrogate pair, so write out as an entity ref if (encoding != null) { --- 318,329 ---- //Older behavior was to throw the message, //but newer gentler behavior is to write a message to System.err //throw new SAXException(msg); System.err.println(msg); } ! } } else { // Don't know what to do with this char, it is // not in the encoding and not a high char in // a surrogate pair, so write out as an entity ref if (encoding != null) {
< prev index next >