org.apache.xmlbeans
Class XmlOptionCharEscapeMap

This class is used to set up a map containing characters to be escaped.
Characters can be escaped as hex, decimal or as a predefined entity (this
latter option applies only to the 5 characters defined as predefined entities
in the XML Spec).

For example:

XmlOptionCharEscapeMap escapes = new XmlOptionCharEscapeMap();
escapes.addMapping('A', XmlOptionCharEscapeMap.HEXADECIMAL);
escapes.addMapping('B', XmlOptionCharEscapeMap.DECIMAL);
escapes.addMapping('>', XmlOptionCharEscapeMap.PREDEF_ENTITY);
XmlOptions opts = new XmlOptions();
opts.setSaveSubstituteCharacters(escapes);
System.out.println(myXml.xmlText(opts));
will result in:
A being printed as A
B being printed as B
> being printed as >