FileDocCategorySizeDatePackage
DOMParserSaveEncoding.javaAPI DocApache Xerces 3.0.12708Fri Sep 14 20:33:58 BST 2007ui

DOMParserSaveEncoding

public class DOMParserSaveEncoding extends org.apache.xerces.parsers.DOMParser
The DOMParserSaveEncoding class extends DOMParser. It also provides the Java Encoding of the XML document by overriding the startDocument method and providing a way to capture the MIME encoding from the XML document which in turn is converted to the Java Encoding by the internal MIME2Java class.

Fields Summary
String
_mimeEncoding
Constructors Summary
Methods Summary
public java.lang.StringgetJavaEncoding()

        String javaEncoding = null;
        String mimeEncoding = getMimeEncoding();

        if (mimeEncoding != null) {
            if (mimeEncoding.equals( "DEFAULT" ))
                javaEncoding =  "UTF8";
            else if (mimeEncoding.equalsIgnoreCase( "UTF-16" ))
                javaEncoding = "Unicode";
            else
                javaEncoding = EncodingMap.getIANA2JavaMapping( mimeEncoding );    
        } 
        if(javaEncoding == null)   // Should never return null
            javaEncoding = "UTF8";
        return(javaEncoding);
    
private java.lang.StringgetMimeEncoding()

        return(_mimeEncoding);
    
private voidsetMimeEncoding(java.lang.String encoding)

//Default  MIME so we check the file.encoding
          
        _mimeEncoding = encoding;
    
public voidstartGeneralEntity(java.lang.String name, org.apache.xerces.xni.XMLResourceIdentifier identifier, java.lang.String encoding, org.apache.xerces.xni.Augmentations augs)

        if( encoding != null){
            setMimeEncoding( encoding);
        }
        super.startGeneralEntity(name, identifier, encoding, augs);