Interface XMLEscapeWriter
- All Known Implementing Classes:
XMLEscapeWriterASCII,XMLEscapeWriterBase,XMLEscapeWriterUTF8
This interface mimics the XMLEscape interface but is designed to
be more efficient for writers, in other words, it wraps a writer and writes
directly onto it.
This interface is based on the paragraph 2.4 of the XML 1.0 Specifications.
- Version:
- 7 March 2005
-
Method Summary
Modifier and TypeMethodDescriptionReturns the encoding used by the implementing class.voidwriteAttValue(char[] ch, int off, int len) Writes a well-formed attribute value.voidwriteAttValue(String value) Writes a well-formed attribute value.voidwriteText(char c) Writes the character so that the text value for the element remains well-formed.voidwriteText(char[] ch, int off, int len) Writes a well-formed text value for the element.voidWrites the text string so that the text value for the element remains well-formed.
-
Method Details
-
writeAttValue
Writes a well-formed attribute value.This method must replace any character in the specified value by the corresponding numeric character reference or the predefined XML general entities, if the character is not allowed or not in the encoding range.
Attribute values must not contain '&' or '<. Quotes and apostrophes must also be escaped by """ and "'" respectively.
- Parameters:
ch- The value that needs to be attribute-escaped.off- The start (offset) of the characters.len- The length of characters to.- Throws:
IOException- If thrown by the underlying writer.
-
writeAttValue
Writes a well-formed attribute value.Method provided for convenience, using the same specifications as
writeAttValue(char[], int, int).This method should return
nullif the given value isnull.- Parameters:
value- The value that needs to be attribute-escaped.- Throws:
IOException- If thrown by the underlying writer.
-
writeText
Writes a well-formed text value for the element.This method must replace any character in the specified value by the corresponding numeric character reference or the predefined XML general entities, if the character is not allowed or not in the encoding range.
The text of an element must not contain '&' or '<.
- Parameters:
ch- The value that needs to be attribute-escaped.off- The start (offset) of the characters.len- The length of characters to.- Throws:
IOException- If thrown by the underlying writer.
-
writeText
Writes the text string so that the text value for the element remains well-formed.Method provided for convenience, using the same specifications as
writeText(char[], int, int).This method should do nothing if the given value is
null.- Parameters:
text- The text that needs to be text-escaped.- Throws:
IOException- If thrown by the underlying writer.
-
writeText
Writes the character so that the text value for the element remains well-formed.This method should return
nullif the given value isnull.- Parameters:
c- The character that needs to be text-escaped.- Throws:
IOException- If thrown by the underlying writer.
-
getEncoding
String getEncoding()Returns the encoding used by the implementing class.- Returns:
- The encoding used by the implementing class.
-