@@ -2874,41 +2874,43 @@ protected String scanStartElement(final boolean[] empty) throws IOException {
2874
2874
fBeginColumnNumber = beginColumnNumber ;
2875
2875
fBeginCharacterOffset = beginCharacterOffset ;
2876
2876
if (fElementDepth == -1 ) {
2877
- if (fByteStream != null && !fIgnoreSpecifiedCharset_ && "META" .equalsIgnoreCase (ename )) {
2878
- if (DEBUG_CHARSET ) {
2879
- System .out .println ("+++ <META>" );
2880
- }
2881
- final String httpEquiv = getValue (attributes_ , "http-equiv" );
2882
- if ("content-type" .equalsIgnoreCase (httpEquiv )) {
2877
+ if (fByteStream != null ) {
2878
+ final String enameLC = ename .toLowerCase (Locale .ROOT );
2879
+
2880
+ if ( !fIgnoreSpecifiedCharset_ && "meta" .equals (enameLC )) {
2883
2881
if (DEBUG_CHARSET ) {
2884
- System .out .println ("+++ @content-type: \" " + httpEquiv + '"' );
2882
+ System .out .println ("+++ <META>" );
2885
2883
}
2886
- String content = getValue (attributes_ , "content" );
2887
- if (content != null ) {
2888
- content = removeSpaces (content );
2889
- final int index1 = content .toLowerCase (Locale .ROOT ).indexOf ("charset=" );
2890
- if (index1 != -1 ) {
2891
- final int index2 = content .indexOf (';' , index1 );
2892
- final String charset = index2 != -1 ? content .substring (index1 + 8 , index2 )
2893
- : content .substring (index1 + 8 );
2894
- changeEncoding (charset );
2884
+ final String httpEquiv = getValue (attributes_ , "http-equiv" );
2885
+ if ("content-type" .equalsIgnoreCase (httpEquiv )) {
2886
+ if (DEBUG_CHARSET ) {
2887
+ System .out .println ("+++ @content-type: \" " + httpEquiv + '"' );
2888
+ }
2889
+ String content = getValue (attributes_ , "content" );
2890
+ if (content != null ) {
2891
+ content = removeSpaces (content );
2892
+ final int index1 = content .toLowerCase (Locale .ROOT ).indexOf ("charset=" );
2893
+ if (index1 != -1 ) {
2894
+ final int index2 = content .indexOf (';' , index1 );
2895
+ final String charset = index2 != -1 ? content .substring (index1 + 8 , index2 )
2896
+ : content .substring (index1 + 8 );
2897
+ changeEncoding (charset );
2898
+ }
2895
2899
}
2896
2900
}
2897
- }
2898
- else {
2899
- final String metaCharset = getValue ( attributes_ , "charset" );
2900
- if ( metaCharset != null ) {
2901
- changeEncoding ( metaCharset );
2901
+ else {
2902
+ final String metaCharset = getValue ( attributes_ , "charset" );
2903
+ if ( metaCharset != null ) {
2904
+ changeEncoding ( metaCharset );
2905
+ }
2902
2906
}
2903
2907
}
2904
- }
2905
- else if (fByteStream != null ) {
2906
- if ("BODY" .equalsIgnoreCase (ename )) {
2908
+ else if ("body" .equals (enameLC )) {
2907
2909
fByteStream .clear ();
2908
2910
fByteStream = null ;
2909
2911
}
2910
2912
else {
2911
- final HTMLElements .Element element = htmlConfiguration_ .getHtmlElements ().getElement ( ename );
2913
+ final HTMLElements .Element element = htmlConfiguration_ .getHtmlElements ().getElementLC ( enameLC );
2912
2914
if (element .parent != null
2913
2915
&& element .parent .length > 0
2914
2916
&& element .parent [0 ].code == HTMLElements .BODY ) {
0 commit comments