public void startElement(String uri, String localName, String qName, Attributes attrs)
      throws SAXException {
    CFFreeSwitchXMsgSchemaMessageFormatter schemaFormatter = null;
    try {
      // Common XML Attributes
      String attrId = null;
      String attrTenantId = null;
      String attrMenuId = null;
      String attrDigits = null;
      // Attribute Extraction
      String attrLocalName;
      int numAttrs;
      int idxAttr;
      final String S_ProcName = "startElement";
      final String S_LocalName = "LocalName";

      assert qName.equals("RqstPbxIvrMenuEntryReadByUDigitsIdx");

      CFFreeSwitchXMsgRqstHandler xmsgRqstHandler = (CFFreeSwitchXMsgRqstHandler) getParser();
      if (xmsgRqstHandler == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()");
      }

      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();

      ICFFreeSwitchSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj();
      if (schemaObj == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()");
      }

      // Extract Attributes
      numAttrs = attrs.getLength();
      for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) {
        attrLocalName = attrs.getLocalName(idxAttr);
        if (attrLocalName.equals("Id")) {
          if (attrId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("TenantId")) {
          if (attrTenantId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrTenantId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("MenuId")) {
          if (attrMenuId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrMenuId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("Digits")) {
          if (attrDigits != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrDigits = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("schemaLocation")) {
          // ignored
        } else {
          throw CFLib.getDefaultExceptionFactory()
              .newUnrecognizedAttributeException(
                  getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName);
        }
      }

      // Ensure that required attributes have values
      if ((attrTenantId == null) || (attrTenantId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "TenantId");
      }
      if ((attrMenuId == null) || (attrMenuId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "MenuId");
      }
      if (attrDigits == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "Digits");
      }

      // Save named attributes to context
      CFLibXmlCoreContext curContext = getParser().getCurContext();
      // Convert string attributes to native Java types
      // and apply the converted attributes to the editBuff.

      long natTenantId;
      natTenantId = Long.parseLong(attrTenantId);

      long natMenuId;
      natMenuId = Long.parseLong(attrMenuId);

      String natDigits;
      natDigits = attrDigits;

      // Read the object
      ICFFreeSwitchPbxIvrMenuEntryObj read =
          ((ICFFreeSwitchPbxIvrMenuEntryObj)
              schemaObj
                  .getPbxIvrMenuEntryTableObj()
                  .readPbxIvrMenuEntryByUDigitsIdx(natTenantId, natMenuId, natDigits, true));
      if (read != null) {
        String response =
            schemaFormatter.formatRspnXmlPreamble()
                + "\n"
                + "\t"
                + CFFreeSwitchXMsgPbxIvrMenuEntryMessageFormatter
                    .formatPbxIvrMenuEntryRspnSingleOpenTag()
                + CFFreeSwitchXMsgPbxIvrMenuEntryMessageFormatter
                    .formatPbxIvrMenuEntryRspnDerivedRec("\n\t\t", read.getPbxIvrMenuEntryBuff())
                + "\n"
                + "\t"
                + CFFreeSwitchXMsgPbxIvrMenuEntryMessageFormatter
                    .formatPbxIvrMenuEntryRspnSingleCloseTag()
                + schemaFormatter.formatRspnXmlPostamble();
        ((CFFreeSwitchXMsgRqstHandler) getParser()).appendResponse(response);
      } else {
        String response =
            schemaFormatter.formatRspnXmlPreamble()
                + "\n"
                + "\t"
                + CFFreeSwitchXMsgSchemaMessageFormatter.formatRspnNoDataFound()
                + "\n"
                + schemaFormatter.formatRspnXmlPostamble();
        xmsgRqstHandler.appendResponse(response);
      }
    } catch (RuntimeException e) {
      CFFreeSwitchXMsgRqstHandler xmsgRqstHandler = ((CFFreeSwitchXMsgRqstHandler) getParser());
      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFFreeSwitchXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e)
              + "\n"
              + schemaFormatter.formatRspnXmlPostamble();
      xmsgRqstHandler.resetResponse();
      xmsgRqstHandler.appendResponse(response);
      xmsgRqstHandler.setCaughtException(true);
    } catch (Error e) {
      CFFreeSwitchXMsgRqstHandler xmsgRqstHandler = ((CFFreeSwitchXMsgRqstHandler) getParser());
      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFFreeSwitchXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e)
              + "\n"
              + schemaFormatter.formatRspnXmlPostamble();
      xmsgRqstHandler.resetResponse();
      xmsgRqstHandler.appendResponse(response);
      xmsgRqstHandler.setCaughtException(true);
    }
  }
  public void startElement(String uri, String localName, String qName, Attributes attrs)
      throws SAXException {
    CFFreeSwitchXMsgSchemaMessageFormatter schemaFormatter = null;
    try {
      // Common XML Attributes
      String attrId = null;
      // Attribute Extraction
      String attrLocalName;
      int numAttrs;
      int idxAttr;
      final String S_ProcName = "startElement";
      final String S_LocalName = "LocalName";

      assert qName.equals("RqstPbxIvrMenuEntryReadAll");

      CFFreeSwitchXMsgRqstHandler xmsgRqstHandler = (CFFreeSwitchXMsgRqstHandler) getParser();
      if (xmsgRqstHandler == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()");
      }

      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();

      ICFFreeSwitchSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj();
      if (schemaObj == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()");
      }

      // Extract Attributes
      numAttrs = attrs.getLength();
      for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) {
        attrLocalName = attrs.getLocalName(idxAttr);
        if (attrLocalName.equals("Id")) {
          if (attrId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("schemaLocation")) {
          // ignored
        } else {
          throw CFLib.getDefaultExceptionFactory()
              .newUnrecognizedAttributeException(
                  getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName);
        }
      }

      // Save named attributes to context
      CFLibXmlCoreContext curContext = getParser().getCurContext();
      // Read the objects and prepare the response XML
      List<ICFFreeSwitchPbxIvrMenuEntryObj> list =
          schemaObj.getPbxIvrMenuEntryTableObj().readAllPbxIvrMenuEntry(true);
      String responseOpening =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFFreeSwitchXMsgPbxIvrMenuEntryMessageFormatter
                  .formatPbxIvrMenuEntryRspnListOpenTag();
      xmsgRqstHandler.appendResponse(responseOpening);
      Iterator<ICFFreeSwitchPbxIvrMenuEntryObj> iter = list.iterator();
      ICFFreeSwitchPbxIvrMenuEntryObj cur;
      String subxml;
      while (iter.hasNext()) {
        cur = iter.next();
        subxml =
            CFFreeSwitchXMsgPbxIvrMenuEntryMessageFormatter.formatPbxIvrMenuEntryRspnDerivedRec(
                "\n\t\t", cur.getPbxIvrMenuEntryBuff());
        xmsgRqstHandler.appendResponse(subxml);
      }
      String responseClosing =
          "\n"
              + "\t"
              + CFFreeSwitchXMsgPbxIvrMenuEntryMessageFormatter
                  .formatPbxIvrMenuEntryRspnListCloseTag()
              + schemaFormatter.formatRspnXmlPostamble();
      xmsgRqstHandler.appendResponse(responseClosing);
    } catch (RuntimeException e) {
      CFFreeSwitchXMsgRqstHandler xmsgRqstHandler = ((CFFreeSwitchXMsgRqstHandler) getParser());
      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFFreeSwitchXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e)
              + "\n"
              + schemaFormatter.formatRspnXmlPostamble();
      xmsgRqstHandler.resetResponse();
      xmsgRqstHandler.appendResponse(response);
      xmsgRqstHandler.setCaughtException(true);
    } catch (Error e) {
      CFFreeSwitchXMsgRqstHandler xmsgRqstHandler = ((CFFreeSwitchXMsgRqstHandler) getParser());
      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFFreeSwitchXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e)
              + "\n"
              + schemaFormatter.formatRspnXmlPostamble();
      xmsgRqstHandler.resetResponse();
      xmsgRqstHandler.appendResponse(response);
      xmsgRqstHandler.setCaughtException(true);
    }
  }
  public void startElement(String uri, String localName, String qName, Attributes attrs)
      throws SAXException {
    try {
      // Common XML Attributes
      String attrId = null;
      // PbxIvrMenuEntry Attributes
      String attrDigits = null;
      String attrEntryType = null;
      String attrParam = null;
      // PbxIvrMenuEntry References
      ICFFreeSwitchTenantObj refTenant = null;
      ICFFreeSwitchPbxIvrMenuObj refMenu = null;
      // Attribute Extraction
      String attrLocalName;
      int numAttrs;
      int idxAttr;
      final String S_ProcName = "startElement";
      final String S_LocalName = "LocalName";

      assert qName.equals("PbxIvrMenuEntry");

      CFFreeSwitchSaxLoader saxLoader = (CFFreeSwitchSaxLoader) getParser();
      if (saxLoader == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()");
      }

      ICFFreeSwitchSchemaObj schemaObj = saxLoader.getSchemaObj();
      if (schemaObj == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()");
      }

      // Instantiate an edit buffer for the parsed information
      ICFFreeSwitchPbxIvrMenuEntryEditObj editBuff =
          (ICFFreeSwitchPbxIvrMenuEntryEditObj)
              schemaObj.getPbxIvrMenuEntryTableObj().newInstance().beginEdit();

      // Extract Attributes
      numAttrs = attrs.getLength();
      for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) {
        attrLocalName = attrs.getLocalName(idxAttr);
        if (attrLocalName.equals("Id")) {
          if (attrId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("Digits")) {
          if (attrDigits != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrDigits = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("EntryType")) {
          if (attrEntryType != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrEntryType = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("Param")) {
          if (attrParam != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrParam = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("schemaLocation")) {
          // ignored
        } else {
          throw CFLib.getDefaultExceptionFactory()
              .newUnrecognizedAttributeException(
                  getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName);
        }
      }

      // Ensure that required attributes have values
      if (attrDigits == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "Digits");
      }
      if (attrEntryType == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "EntryType");
      }
      if (attrParam == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "Param");
      }

      // Save named attributes to context
      CFLibXmlCoreContext curContext = getParser().getCurContext();
      curContext.putNamedValue("Id", attrId);
      curContext.putNamedValue("Digits", attrDigits);
      curContext.putNamedValue("EntryType", attrEntryType);
      curContext.putNamedValue("Param", attrParam);

      // Convert string attributes to native Java types
      // and apply the converted attributes to the editBuff.

      Integer natId;
      if ((attrId != null) && (attrId.length() > 0)) {
        natId = new Integer(Integer.parseInt(attrId));
      } else {
        natId = null;
      }
      String natDigits = attrDigits;
      editBuff.setRequiredDigits(natDigits);

      String natEntryType = attrEntryType;
      editBuff.setRequiredEntryType(natEntryType);

      String natParam = attrParam;
      editBuff.setRequiredParam(natParam);

      // Get the scope/container object

      CFLibXmlCoreContext parentContext = curContext.getPrevContext();
      Object scopeObj;
      if (parentContext != null) {
        scopeObj = parentContext.getNamedValue("Object");
      } else {
        scopeObj = null;
      }

      // Resolve and apply required Container reference

      if (scopeObj == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "scopeObj");
      } else if (scopeObj instanceof ICFFreeSwitchPbxIvrMenuObj) {
        refMenu = (ICFFreeSwitchPbxIvrMenuObj) scopeObj;
        editBuff.setRequiredContainerMenu(refMenu);
        refTenant = (ICFFreeSwitchTenantObj) editBuff.getRequiredOwnerTenant();
      } else {
        throw CFLib.getDefaultExceptionFactory()
            .newUnsupportedClassException(
                getClass(), S_ProcName, "scopeObj", scopeObj, "ICFFreeSwitchPbxIvrMenuObj");
      }

      // Resolve and apply Owner reference

      if (refTenant == null) {
        if (scopeObj instanceof ICFFreeSwitchTenantObj) {
          refTenant = (ICFFreeSwitchTenantObj) scopeObj;
          editBuff.setRequiredOwnerTenant(refTenant);
        } else {
          throw CFLib.getDefaultExceptionFactory()
              .newNullArgumentException(getClass(), S_ProcName, 0, "Owner<Tenant>");
        }
      }

      ICFFreeSwitchPbxIvrMenuEntryObj origPbxIvrMenuEntry;
      ICFFreeSwitchPbxIvrMenuEntryEditObj editPbxIvrMenuEntry = editBuff;
      origPbxIvrMenuEntry = (ICFFreeSwitchPbxIvrMenuEntryObj) editPbxIvrMenuEntry.create();
      editPbxIvrMenuEntry.endEdit();

      curContext.putNamedValue("Object", origPbxIvrMenuEntry);
    } catch (RuntimeException e) {
      throw new RuntimeException(
          "Near "
              + getParser().getLocationInfo()
              + ": Caught and rethrew "
              + e.getClass().getName()
              + " - "
              + e.getMessage(),
          e);
    } catch (Error e) {
      throw new Error(
          "Near "
              + getParser().getLocationInfo()
              + ": Caught and rethrew "
              + e.getClass().getName()
              + " - "
              + e.getMessage(),
          e);
    }
  }