Revision 11128

View differences:

trunk/libraries/libGPE/src/org/gvsig/gpe/GPEParser.java
46 46
 *
47 47
 * $Id$
48 48
 * $Log$
49
 * Revision 1.2  2007-04-11 08:46:21  csanchez
49
 * Revision 1.3  2007-04-11 11:18:15  csanchez
50 50
 * Actualizacion protoripo libGPE
51 51
 *
52
 * Revision 1.2  2007/04/11 08:46:21  csanchez
53
 * Actualizacion protoripo libGPE
54
 *
52 55
 * Revision 1.1  2007/04/11 08:19:32  csanchez
53 56
 * actualizacion
54 57
 *
......
63 66
	private GPEErrorHandler errorHandler;
64 67
	private GPEContentHandler contentHandler;
65 68
	private File parserFile = null;	
69
	private Object prueba;
66 70
	
67
	
68 71
	/** 
69 72
	 * 
70 73
	 * AQUI SE IMPLEMENTA LA BASE PARA PODER PARSEAR CUALQUIER FICHERO:
......
76 79
	 * -SI EXISTE, LLAMADA AL PARSER DEL FORMATO CONCRETO
77 80
	 *
78 81
	 **/
79
	public GPEParser(File file){
80
		//file to parse...
81
		this.parserFile = file;
82
		errorHandler = new GPEErrorHandler();
83
		contentHandler = new GPEContentHandler();
82
	public GPEParser(GPEContentHandler contents, GPEErrorHandler errors){
83
		this.contentHandler = contents;
84
		this.errorHandler=errors;
84 85
	}
85
	public void parse(File fichero){		
86
	
87

  
88
	public void parse(File file){
86 89
		
90
//		/***** para lectura en modo texto ****/
91
//		GPEXMLReader.open();
92
//		FileReader reader = null;       
93
//		try {
94
//			reader = new FileReader(this.parserFile);
95
//		} catch (FileNotFoundException e) {
96
//			// TODO llamada a ??GPEErrorHandler?? para tratar la excepci?n o lanzamos desde aqu?
97
//			// Fichero no existe.
98
//		}
99
//		BufferedReader br = new BufferedReader(reader);
100
//		char[] buffer = new char[100];
101
//		try {
102
//			br.read(buffer);
103
//		} catch (IOException e) {
104
//			// TODO llamada a ??GPEErrorHandler?? para tratar la excepci?n o lanzamos desde aqu?
105
//			// Error de lectura del buffer
106
//		}
107
//		StringBuffer st = new StringBuffer(new String(buffer));
108
//		
109
//		// We find the encoding at the begining of the file
110
//		
111
//		String searchText = "encoding=\"";
112
//		int index = st.indexOf(searchText);
113
//
114
//		// If it find the encoding, it takes the new encoding, else it takes the default encoding "UTF-8"
115
//		if (index>-1) { 
116
//			st.delete(0, index+searchText.length());
117
//			encoding = st.substring(0, st.indexOf("\""));
118
//		}
119
//		
120
//		// make GML parser with the good enconding
121
//		XMLSchemaParser parser = new XMLSchemaParser();
122
//		
123
//		// setImput(file,encoding): it sets the encoding to read with the KXML parser		
124
//		try {
125
//			parser.setInput(new FileInputStream(m_File), encoding);
126
//		} catch (FileNotFoundException e) {
127
//			// TODO Auto-generated catch block
128
//			throw new GMLException(m_File.getName(),e);
129
//		} catch (XmlPullParserException e) {
130
//			// TODO Auto-generated catch block
131
//			throw new GMLException(m_File.getName(),e);
132
//		}
133
//		return parser;
134

  
87 135
	}
88 136
	abstract public boolean accept(File file);
89 137
	

Also available in: Unified diff