save online XML and show certain hours

VerjeorgeSell

New Member
I have an online xml parsing. it's works fine but the problem that this xml at 16:00 you can't have access to it. Let me know how I can set a time to be saved and then displayed as the last appeared in the xml.this is my Main code:\[code\] SitesList sitesList = null;@Overridepublic void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tabla1); TableLayout layout =(TableLayout)findViewById(R.id.tabla); TableRow tr[] = new TableRow[99]; TextView variacion[]; TextView nemotecnico[]; TextView hora[]; TextView precio[]; TextView unidad[]; try { /** Handling XML */ SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); XMLReader xr = sp.getXMLReader(); /** Send URL to parse XML Tags */ URL sourceUrl = new URL("http://www.bovalpo.com/cgi-local/xml_bcv.pl?URL=75"); /** Create handler to handle XML Tags ( extends DefaultHandler ) */ MyXMLHandler myXMLHandler = new MyXMLHandler(); xr.setContentHandler(myXMLHandler); xr.parse(new InputSource(sourceUrl.openStream())); } catch (Exception e) { System.out.println("XML Pasing Excpetion = " + e); } /** Get result from MyXMLHandler SitlesList Object */ sitesList = MyXMLHandler.sitesList; /** Assign textview array lenght by arraylist size */ nemotecnico = new TextView[sitesList.getNemotecnico().size()]; variacion = new TextView[sitesList.getVariacion().size()]; hora = new TextView[sitesList.getHora().size()]; precio = new TextView[sitesList.getPrecio().size()]; unidad = new TextView[sitesList.getUnidad().size()]; /** Set the result text in textview and add it to layout */ for (int i = 0; i < sitesList.getRegistro().size(); i++) { variacion = new TextView(this); variacion.setText(" "+ sitesList.getVariacion().get(i)); nemotecnico = new TextView(this); nemotecnico.setText(" " +sitesList.getNemotecnico().get(i)); hora= new TextView(this); hora.setText("" +sitesList.getHora().get(i)); precio = new TextView(this); precio.setText(" " + sitesList.getPrecio().get(i)); unidad = new TextView(this); unidad.setText(" " + sitesList.getUnidad().get(i)); Pattern pattern = Pattern.compile("^([a-z: ]*)?+(\\+?[0-9]+([,\\.][0-9]*)?)$"); Matcher matcher = pattern.matcher(sitesList.getVariacion().get(i)); if (!matcher.matches()) variacion.setTextColor(Color.parseColor("#ff0000")); else variacion.setTextColor(Color.parseColor("#008000")); } int cont = sitesList.getNemotecnico().size(); for (int i = 0; i <cont; i++) { tr = new TableRow(this); tr.addView(nemotecnico, new TableRow.LayoutParams(1)); tr.addView(hora, new TableRow.LayoutParams(2)); tr.addView(precio, new TableRow.LayoutParams(3)); tr.addView(variacion, new TableRow.LayoutParams(4)); tr.addView(unidad, new TableRow.LayoutParams(5)); layout.addView(tr, new TableLayout.LayoutParams()); }} \[/code\]}
 
Back
Top