/**
   * Parser WFST Status subtree
   *
   * @param parser Teh xML parser
   * @param transaction The current transaction
   * @throws IOException
   * @throws XmlPullParserException
   */
  private void parseStatus(XMLSchemaParser parser, WFSTTransaction transaction)
      throws XmlPullParserException, IOException {
    int currentTag;
    boolean end = false;

    currentTag = parser.next();

    while (!end) {
      switch (currentTag) {
        case KXmlParser.START_TAG:
          if (parser.getName().compareTo(WFSTTags.WFST_SUCCESS) == 0) {
            transaction.setStatus(WFSTTransaction.STATUS_SUCCESS);
          } else if (parser.getName().compareTo(WFSTTags.WFST_FAILED) == 0) {
            transaction.setStatus(WFSTTransaction.STATUS_FAILED);
          }
          break;
        case KXmlParser.END_TAG:
          if (parser.getName().compareTo(WFSTTags.WFST_STATUS) == 0) end = true;
          break;
        case KXmlParser.TEXT:
          break;
      }
      if (!end) {
        currentTag = parser.next();
      }
    }
  }
  /**
   * Parse the transaction result XML sub tree
   *
   * @param parser
   * @param transaction
   * @throws IOException
   * @throws XmlPullParserException
   */
  private void parseTransactionResult(XMLSchemaParser parser, WFSTTransaction transaction)
      throws XmlPullParserException, IOException {
    int currentTag;
    boolean end = false;

    currentTag = parser.next();

    while (!end) {
      switch (currentTag) {
        case KXmlParser.START_TAG:
          if (parser.getName().compareTo(WFSTTags.WFST_STATUS) == 0) {
            parseStatus(parser, transaction);
          } else if (parser.getName().compareTo(WFSTTags.WFST_TRANSACTIONMESSAGE) == 0) {
            parser.next();
            transaction.setMessage(parser.getText());
          }
          break;
        case KXmlParser.END_TAG:
          if (parser.getName().compareTo(WFSTTags.WFST_TRANSACTIONRESULT) == 0) end = true;
          break;
        case KXmlParser.TEXT:
          break;
      }
      if (!end) {
        currentTag = parser.next();
      }
    }
  }