src/main/java/eu/europena/research/XmlUtil.java
/**
     * Extracts the encoding used in the xml string.
     * 
     * @param xml
     * @return encoding
     */
Extracts the encoding used in the xml string.

@param xml
@return encoding
Extracts the encoding used in the xml string . @param xml @return encoding
public static String extractXmlEncoding(String xml) {
        String encoding = null;
        String prefix = "<?xml version=\"1.0\" encoding=\"";
        if (xml.substring(0, 200).contains(prefix)) {
            int start = xml.indexOf(prefix) + prefix.length();
            int end = xml.indexOf("\"", start);
            encoding = xml.substring(start, end);
        }
        return encoding;
    }
public static String extractXmlEncoding ( String xml ) { String encoding = null ; String prefix = "<?xml version=\"1.0\" encoding=\"" ; if ( xml . substring ( 0 , 200 ) . contains ( prefix ) ) { int start = xml . indexOf ( prefix ) + prefix . length ( ) ; int end = xml . indexOf ( "\"" , start ) ; encoding = xml . substring ( start , end ) ; } return encoding ; }
Extracts the encoding used in the xml string.
Extracts the encoding used in the xml string .
// "UTF-8";