コード例 #1
0
    @Override
    protected Void doInBackground(XmlResourceParser... arg0) {

      final XmlParser parser =
          new XmlParser(arg0[0]) {
            @Override
            protected void onExecuteEndTagEvent(XmlPullParser parser, String name) {
              super.onExecuteEndTagEvent(parser, name);
              ConditionQuery.this.parser(this, parser, name, false);
            }

            protected void onExecuteStartTagEvent(XmlPullParser parser, String tag) {
              super.onExecuteEndTagEvent(parser, tag);
              ConditionQuery.this.parser(this, parser, tag, true);
            }
          };
      parser.parser();

      return null;
    }
コード例 #2
0
  private void parser(XmlParser xmlParser, XmlPullParser xrp, String name, boolean start) {
    if (name == null) {
      return;
    }

    if (name.equals("PropertySearch")) {
      if (start) {
        bean = new GeologyBean();
      }
    }
    if (name.equals("GeoObject")) {
      if (start) {
        int count = xrp.getAttributeCount();
        if (count < 2) {
          mylog.e(TAG, "attribute count error below 2 " + count);
        }
        try {
          String id = xrp.getAttributeValue(0);
          if (id.equals("11")) {
            System.out.println("11");
          }
          String attName = xrp.getAttributeValue(1);
          if (bean != null) {
            geoobj = bean.createOneGeoObj(id, attName);
          } else {
            mylog.e(TAG, "W : bean is null ");
          }
        } catch (Exception e) {
          mylog.e(TAG, "E : " + e);
          e.printStackTrace();
        }
      }
    }
    if (name.equals("GeoCondition")) {
      if (start) {
        int count = xrp.getAttributeCount();
        if (count < 3) {
          mylog.e(TAG, "attribute count error below 3 " + count);
        }

        try {
          String id = xrp.getAttributeValue(0);
          String attName = xrp.getAttributeValue(1);
          String state = xrp.getAttributeValue(2);
          if (geoobj != null) {
            condition = geoobj.createOneConditionObj(id, attName, state);
          } else {
            mylog.e(TAG, "W : geoobj is null ");
          }
        } catch (Exception e) {
          mylog.e(TAG, "E : " + e);
          e.printStackTrace();
        }
      }
    }
    if (isValue(name)) {
      if (start) {
        try {
          int count = xrp.getAttributeCount();
          if (count < 2) {
            mylog.e(
                TAG, "attribute count error below 2 " + count + xmlParser.debugAttributeValue(xrp));
          }
          String id = xrp.getAttributeValue(0);
          String attName = xrp.getAttributeValue(1);
          if (condition != null) {
            mValues = condition.createOneVaueObj(id, attName);
          }
        } catch (Exception e) {
          e.printStackTrace();
        }
      } else {
        mValues = null;
      }
    }

    if (isFvalue(name)) {
      if (start) {
        int count = xrp.getAttributeCount();
        if (count < 2) {
          mylog.e(TAG, "attribute count error below 2 " + count);
        }
        String id = xrp.getAttributeValue(0);
        String attName = xrp.getAttributeValue(1);
        if (mValues != null) {
          mFvalue = mValues.createFValue(id, attName);
        } else if (condition != null) {
          slog.p(TAG, "mValues is null , use condition " + condition.name + " " + attName);
          mFvalue = condition.createFVaueObj(id, attName);
        }
      }
    }

    if (isSvalue(name)) {
      if (start) {
        int count = xrp.getAttributeCount();
        if (count < 2) {
          mylog.e(TAG, "attribute count error below 2 " + count);
        }
        String id = xrp.getAttributeValue(0);
        String attName = xrp.getAttributeValue(1);

        if (mFvalue != null) {
          svalue = mFvalue.createSValue(id, attName);
        }
      } else {
        svalue = null;
      }
    }
    if (isTvalue(name)) {
      if (start) {
        int count = xrp.getAttributeCount();
        if (count < 2) {
          mylog.e(TAG, "attribute count error below 2 " + count);
        }
        String id = xrp.getAttributeValue(0);
        String attName = xrp.getAttributeValue(1);

        if (svalue != null) {
          svalue.createSValue(id, attName);
        } else {
          mylog.e(TAG, "error svalue is null " + name);
        }
      }
    }
  }