All pastes #516013 Raw Edit

Untitled

public java v1 · immutable
#516013 ·published 2007-05-28 13:56 UTC
rendered paste body
  // Blocking.  public void parse(InputStream in) throws IOException {    Reader reader = new InputStreamReader(in);    XmlParser parser = new XmlParser(reader);    ParseEvent pe = null;        parser.skip();    parser.read(Xml.START_TAG, null, "loc");        boolean trucking = true;    boolean first = true;    String ID[] = new String[100];    Float lat[] = new Float[100];    Float lon[] = new Float[100];    String type[] = new String[100];    String CDATA[] = new String[100];     int index = 0;    Attribute atr = null;    while (trucking) {      pe = parser.read();      if (pe.getType() == Xml.START_TAG) {        String name = pe.getName();        if (name.equals("waypont")) {          // bude citat dokym nenajde ukoncovaci tag k </waypont>          while ((pe.getType() != Xml.END_TAG) ||              (pe.getName().equals(name) == false)) {            pe = parser.read();            if (pe.getType() == Xml.START_TAG && // zacina element                pe.getName().equals("name")) { // meno elementu je name              atr = getAttribute(0); // skusime najprv s nulou              if (atr.getName() == "id") {                ID[index] = atr.getValue();              }              pe = parser.read();	      CDATA[index] = pe.getText();            }            else if (pe.getType() == Xml.START_TAG &&                pe.getName().equals("type")) {              // pe.getAtr            }            else if (pe.getType() == Xml.START_TAG &&                pe.getName().equals("link")) {              pe = parser.read();                                         }	    index++;          }          mRSSListener.itemParsed(title, link, description);        }        else {          // TU KUKAJ ;) <- to je ak by tam bol dajaky element, co nie je wayponot	  Sytem.out.println("nespravny .loc XML"+pe.getName());         }      }      // koniec xml      if (pe.getType() == Xml.END_TAG &&            pe.getName().equals("loc"))        trucking = false;    }  }}