@Override
  public void startElement(
      final String uri, final String localName, final String name, final Attributes attributes)
      throws SAXException {
    if (localName.equals("Error") || name.equals("Error")) {
      final String errorCode = attributes.getValue("", "errorCode");
      final String severity = attributes.getValue("", "severity");
      final String locationPath = attributes.getValue("", "locationPath");
      final String message = attributes.getValue("", "message");
      this.mErrors.add(new Error(errorCode, severity, locationPath, message));
    }

    this.sb.setLength(0);

    if (localName.equals("XLS")) {
      this.inXLS = true;
    } else if (localName.equals("ResponseHeader")) {
      this.inRepsonseHeader = true;
    } else if (localName.equals("Response")) {
      this.inRepsonse = true;
    } else if (localName.equals("DirectoryResponse")) {
      this.inDirectoryResponse = true;
    } else if (localName.equals("POIContext")) {
      this.inPOIContext = true;
    } else if (localName.equals("POI")) {
      this.inPOI = true;
      this.mCurPOI = new ORSPOI();
      final String poiname = attributes.getValue("", "POIName");
      final String poitype = attributes.getValue("", "description");
      this.mCurPOI.setName(poiname);
      this.mCurPOI.setPOIType(POIType.fromRawName(poitype));
      this.mPOIs.add(this.mCurPOI);
    } else if (localName.equals("Point")) {
      this.inPoint = true;
    } else if (localName.equals("pos")) {
      this.inPos = true;
    } else if (localName.equals("Distance")) {
      this.inDistance = true;
      final String uom = attributes.getValue("", "uom");

      float factor = 0;
      if (uom != null) {
        if (uom.equals("M")) {
          factor = 1;
        } else if (uom.equals("KM")) {
          factor = 1000;
        }
      }

      this.mCurPOI.setDistance((int) (factor * Float.parseFloat(attributes.getValue("", "value"))));
    } else {
      Log.w(DEBUGTAG, "Unexpected tag: '" + name + "'");
    }
    super.startElement(uri, localName, name, attributes);
  }
Esempio n. 2
0
  @Override
  protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
    switch (requestCode) {
      case REQUESTCODE_POICATEGORYSELECTOR:
        this.mAddOSMPOIType = POIType.values()[resultCode];
        showDialog(DIALOG_INPUT_OSM_POI);
        break;
    }

    super.onActivityResult(requestCode, resultCode, data);
  }