class InvalidXmlCharacterModifier implements Modifier {

    @Override
    public AfterModification modify(StringBuilder characterBuffer, int firstModifiableCharacterInBuffer,
            boolean endOfStreamHit) {

        matcher.reset(characterBuffer);
        matcher.region(firstModifiableCharacterInBuffer, characterBuffer.length());

        // String newCharacterBuffer = matcher.replaceAll(replacement);
        // characterBuffer.setLength(0);
        // characterBuffer.append(newCharacterBuffer);

        int start = firstModifiableCharacterInBuffer;
        while (matcher.find(start)) {
            start = onMatch(characterBuffer);
        }

        return factory.skipEntireBuffer(characterBuffer, firstModifiableCharacterInBuffer, endOfStreamHit);
    }

    public  InvalidXmlCharacterModifier(String replacement, String xmlVersion);
    public  InvalidXmlCharacterModifier(int newNumberOfChars, String replacement, String xmlVersion, boolean dollarZero);

}