コード例 #1
0
  public boolean parseOperatorXml(String content, ArrayList<String> ids, ArrayList<String> values) {
    Map<String, String> data = new HashMap<String, String>();
    Jxml xml = new Jxml();
    if (xml.SetDoc(content) && xml.FindElem("InvokeReturn")) {
      xml.IntoElem();
      while (xml.FindElem()) {
        String key, value;
        key = xml.GetTagName();
        if ("Object".compareToIgnoreCase(key) == 0) {
          ids.clear();
          values.clear();

          xml.IntoElem();
          while (xml.FindElem("EmployeeModel")) {
            xml.IntoElem();
            while (xml.FindElem()) {
              key = xml.GetTagName();
              if (key.compareToIgnoreCase("EmployeeId") == 0) {
                value = xml.GetData();
                ids.add(value);
              } else if (key.compareToIgnoreCase("EmployeeName") == 0) {
                value = xml.GetData();
                values.add(value);
              }
            }
            xml.OutOfElem();
          }
          xml.OutOfElem();
        } else {
          value = xml.GetData();
          data.put(key, value);
        }
      }
      xml.OutOfElem();

      return true;
    }

    return false;
  }
コード例 #2
0
  public boolean parseCodeXml(
      String content, ArrayList<String> codeKeys, ArrayList<String> codeValues) {
    Jxml xml = new Jxml();
    if (xml.SetDoc(content) && xml.FindElem("InvokeReturn")) {
      xml.IntoElem();
      while (xml.FindElem()) {
        String key, value;
        key = xml.GetTagName();
        if ("Object".compareToIgnoreCase(key) == 0) {
          codeKeys.clear();
          codeValues.clear();

          xml.IntoElem();
          while (xml.FindElem("CodeModel")) {
            xml.IntoElem();
            while (xml.FindElem()) {
              key = xml.GetTagName();
              value = xml.GetData();
              if (key.compareToIgnoreCase("Key") == 0) {
                codeKeys.add(value);
              } else if (key.compareToIgnoreCase("Value") == 0) {
                codeValues.add(value);
              }
            }
            xml.OutOfElem();
          }
          xml.OutOfElem();
        } else {
          value = xml.GetData();
        }
      }
      xml.OutOfElem();

      return true;
    }

    return false;
  }