| 
 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.apache.xmlbeans.XmlOptionCharEscapeMap
public class XmlOptionCharEscapeMap
Corresponds to the Saver and XmlOptions.
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).
      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 >
 
| Field Summary | |
|---|---|
| static int | DECIMAL | 
| static int | HEXADECIMAL | 
| static int | PREDEF_ENTITY | 
| Constructor Summary | |
|---|---|
| XmlOptionCharEscapeMap()Construct a new XmlOptionCharEncoder. | |
| Method Summary | |
|---|---|
|  void | addMapping(char ch,
           int mode)set up this character to be escaped in output documents according to the given mode | 
|  void | addMappings(char ch1,
            char ch2,
            int mode)set up this contiguous set of characters to be escaped in output documents according to the given mode | 
|  boolean | containsChar(char ch) | 
|  java.lang.String | getEscapedString(char ch)returns the escaped String for the character | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public static final int PREDEF_ENTITY
public static final int DECIMAL
public static final int HEXADECIMAL
| Constructor Detail | 
|---|
public XmlOptionCharEscapeMap()
| Method Detail | 
|---|
public boolean containsChar(char ch)
public void addMapping(char ch,
                       int mode)
                throws XmlException
XmlException
public void addMappings(char ch1,
                        char ch2,
                        int mode)
                 throws XmlException
XmlExceptionpublic java.lang.String getEscapedString(char ch)
| 
 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||