DOMParserSaveEncodingpublic 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 |
Methods Summary |
---|
public java.lang.String | getJavaEncoding()
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.String | getMimeEncoding()
return(_mimeEncoding);
| private void | setMimeEncoding(java.lang.String encoding)//Default MIME so we check the file.encoding
_mimeEncoding = encoding;
| public void | startGeneralEntity(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);
|
|