Revision 14705 trunk/libraries/libRemoteServices/src/org/gvsig/remoteClient/wms/wms_1_3_0/WMSProtocolHandler1_3_0.java
WMSProtocolHandler1_3_0.java | ||
---|---|---|
1 | 1 |
|
2 | 2 |
package org.gvsig.remoteClient.wms.wms_1_3_0; |
3 | 3 |
|
4 |
import java.io.BufferedReader; |
|
5 | 4 |
import java.io.ByteArrayInputStream; |
6 | 5 |
import java.io.File; |
7 |
import java.io.FileInputStream; |
|
8 |
import java.io.FileNotFoundException; |
|
9 |
import java.io.FileReader; |
|
10 | 6 |
import java.io.IOException; |
11 | 7 |
import java.util.ArrayList; |
12 | 8 |
import java.util.TreeMap; |
13 | 9 |
|
14 | 10 |
import org.gvsig.remoteClient.utils.CapabilitiesTags; |
11 |
import org.gvsig.remoteClient.utils.EncodingXMLParser; |
|
15 | 12 |
import org.gvsig.remoteClient.utils.ExceptionTags; |
16 | 13 |
import org.gvsig.remoteClient.utils.Utilities; |
17 | 14 |
import org.gvsig.remoteClient.wms.WMSStatus; |
... | ... | |
44 | 41 |
public void parse(File f) |
45 | 42 |
{ |
46 | 43 |
rootLayer = null; |
47 |
FileReader reader = null; |
|
48 |
try |
|
49 |
{ |
|
50 |
reader = new FileReader(f); |
|
51 |
BufferedReader br = new BufferedReader(reader); |
|
52 |
char[] buffer = new char[100]; |
|
53 |
br.read(buffer); |
|
54 |
StringBuffer st = new StringBuffer(new String(buffer)); |
|
55 |
String searchText = "encoding=\""; |
|
56 |
int index = st.indexOf(searchText); |
|
57 |
if (index>-1) { |
|
58 |
st.delete(0, index+searchText.length()); |
|
59 |
encoding = st.substring(0, st.indexOf("\"")); |
|
60 |
} |
|
61 |
} |
|
62 |
catch(FileNotFoundException ex) { |
|
63 |
ex.printStackTrace(); |
|
64 |
} catch (IOException e) { |
|
65 |
e.printStackTrace(); |
|
66 |
} |
|
67 | 44 |
|
68 | 45 |
int tag; |
69 |
KXmlParser kxmlParser = null;
|
|
70 |
kxmlParser = new KXmlParser();
|
|
46 |
EncodingXMLParser kxmlParser = null;
|
|
47 |
kxmlParser = new EncodingXMLParser();
|
|
71 | 48 |
try |
72 | 49 |
{ |
73 |
kxmlParser.setInput(new FileInputStream(f), encoding);
|
|
50 |
kxmlParser.setInput(f);
|
|
74 | 51 |
kxmlParser.nextTag(); |
75 | 52 |
if ( kxmlParser.getEventType() != KXmlParser.END_DOCUMENT ) |
76 | 53 |
{ |
Also available in: Unified diff