Top Description Inners Methods
com.ctc.wstx.api

public Interface InvalidCharHandler

Known Direct Implementers
com.ctc.wstx.api.InvalidCharHandler.FailingHandler, com.ctc.wstx.api.InvalidCharHandler.ReplacingHandler
Imports
java.io.IOException

Simple converter interface designed to be used with stream writer property WstxOutputProperties#P_OUTPUT_INVALID_CHAR_HANDLER. The idea is that it should be easy to have a way to convert invalid characters such as Ascii control characters into something that is legal to include in XML content. This only allows for simple char-by-char replacements, instead of something more advanced such as escaping. If escaping is needed, check out org.codehaus.stax2.XMLOutputFactory2#P_TEXT_ESCAPER instead.

Note about exceptions: choice of only allowing throwing of IOExceptions is due to the way Woodstox stream writer backend works; XmlWriter can only throw IOExceptions.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
InvalidCharHandler.FailingHandler

This handler implementation just throws an exception for all invalid characters encountered.

public static class
InvalidCharHandler.ReplacingHandler

Alternative to the default handler, this handler converts all invalid characters to the specified output character.

Method Summary

Modifier and TypeMethod and Description
public char
convertInvalidChar(int invalidChar)

Method Detail

convertInvalidCharback to summary
public char convertInvalidChar(int invalidChar) throws IOException
com.ctc.wstx.api back to summary

public Class InvalidCharHandler.FailingHandler

extends Object
implements InvalidCharHandler
Class Inheritance
All Implemented Interfaces
com.ctc.wstx.api.InvalidCharHandler

This handler implementation just throws an exception for all invalid characters encountered. It is the default handler used if nothing else has been specified.

Field Summary

Modifier and TypeField and Description
private static final InvalidCharHandler.FailingHandler
public static final int
public static final int
public static final int
public static final int

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public char
public static InvalidCharHandler.FailingHandler
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

sInstanceback to summary
private static final InvalidCharHandler.FailingHandler sInstance
SURR1_FIRSTback to summary
public static final int SURR1_FIRST
SURR1_LASTback to summary
public static final int SURR1_LAST
SURR2_FIRSTback to summary
public static final int SURR2_FIRST
SURR2_LASTback to summary
public static final int SURR2_LAST

Constructor Detail

FailingHandlerback to summary
protected FailingHandler()

Method Detail

convertInvalidCharback to summary
public char convertInvalidChar(int c) throws IOException

Implements com.ctc.wstx.api.InvalidCharHandler.convertInvalidChar.

Annotations
@Override
getInstanceback to summary
public static InvalidCharHandler.FailingHandler getInstance()
com.ctc.wstx.api back to summary

public Class InvalidCharHandler.ReplacingHandler

extends Object
implements InvalidCharHandler
Class Inheritance
All Implemented Interfaces
com.ctc.wstx.api.InvalidCharHandler

Alternative to the default handler, this handler converts all invalid characters to the specified output character. That character will not be further verified or modified by the stream writer.

Field Summary

Modifier and TypeField and Description
pack-priv final char

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public char
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

mReplacementCharback to summary
pack-priv final char mReplacementChar

Constructor Detail

ReplacingHandlerback to summary
public ReplacingHandler(char c)

Method Detail

convertInvalidCharback to summary
public char convertInvalidChar(int c) throws IOException

Implements com.ctc.wstx.api.InvalidCharHandler.convertInvalidChar.

Annotations
@Override