Package org.jibx.runtime.impl
Class UTF8Escaper
java.lang.Object
org.jibx.runtime.impl.UTF8Escaper
- All Implemented Interfaces:
ICharacterEscaper
Handler for writing UTF output stream (for any form of UTF, despite the
name). This code is specifically for XML 1.0 and would require changes for
XML 1.1 (to handle the added legal characters, rather than throwing an
exception).
- Version:
- 1.0
- Author:
- Dennis M. Sosnoski
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Private constructor to prevent external creation. -
Method Summary
Modifier and TypeMethodDescriptionstatic ICharacterEscaper
Get instance of escaper.void
writeAttribute
(String text, Writer writer) Write attribute value with character entity substitutions.void
writeCData
(String text, Writer writer) Write CDATA to document.void
writeContent
(String text, Writer writer) Write content value with character entity substitutions.
-
Field Details
-
s_instance
Singleton instance of class.
-
-
Constructor Details
-
UTF8Escaper
private UTF8Escaper()Private constructor to prevent external creation.
-
-
Method Details
-
writeAttribute
Write attribute value with character entity substitutions. This assumes that attributes use the regular quote ('"') delimitor.- Specified by:
writeAttribute
in interfaceICharacterEscaper
- Parameters:
text
- attribute value textwriter
- sink for output text- Throws:
IOException
- on error writing to document
-
writeContent
Write content value with character entity substitutions.- Specified by:
writeContent
in interfaceICharacterEscaper
- Parameters:
text
- content value textwriter
- sink for output text- Throws:
IOException
- on error writing to document
-
writeCData
Write CDATA to document. This writes the beginning and ending sequences for a CDATA section as well as the actual text, verifying that only characters allowed by the encoding are included in the text.- Specified by:
writeCData
in interfaceICharacterEscaper
- Parameters:
text
- content value textwriter
- sink for output text- Throws:
IOException
- on error writing to document
-
getInstance
Get instance of escaper.- Returns:
- escaper instance
-