Ver Mensaje Individual
  #5 (permalink)  
Antiguo 05/07/2011, 04:35
sirdaiz
 
Fecha de Ingreso: diciembre-2010
Mensajes: 459
Antigüedad: 13 años, 4 meses
Puntos: 21
Respuesta: Como parsear esto.

Yo estoy haciendo algo aprecido, si te sirve este codigo:

Código PHP:
Ver original
  1. public static void main(String[] args) throws IOException {
  2.  
  3.         Main2 listaAntigua=new Main2();
  4.         FileInputStream fstream = new FileInputStream("C:/Users/hwsol/Documents/NetBeansProjects/JavaApplication4/catalogos.txt");
  5.         InputStreamReader fichero = new InputStreamReader(fstream, "UTF-8");
  6.         //DataInputStream in = new DataInputStream(fichero);        
  7.         BufferedReader br = new BufferedReader(fichero);
  8.     String strLine;
  9.         List<String> los_catalogos =  null;
  10.         String clave;
  11.         while ((strLine = br.readLine()) != null )   {
  12.             clave=null;
  13.             los_catalogos= new ArrayList<String>();
  14.             StringTokenizer st = new StringTokenizer(strLine, "\t");
  15.             //System.out.println("numero"+st.countTokens());
  16.             clave=st.nextToken();
  17.             //System.out.println("clave"+clave);
  18.             while (st.hasMoreTokens()){            
  19.                 String siguiente=st.nextToken();
  20.                 los_catalogos.add(siguiente);
  21.             }
  22.             listaAntigua.textosAntiguos(clave,los_catalogos);
  23.             System.out.println("SIGUIENTE");
  24.          }
  25.     }

Aqui yo el archivo lo pase de una hoja excel a un .txt, por lo que automaticamente te lo speara por tabuladores y con esta linea:
StringTokenizer st = new StringTokenizer(strLine, "\t");
te los divine las tabulaciones

Saludos

Última edición por sirdaiz; 05/07/2011 a las 04:42