public void startElement(String uri, String localName, String qName, Attributes attrs)
      throws SAXException {
    try {
      // Common XML Attributes
      String attrId = null;
      // Primary Key Attributes for Constant Enum support
      // ISOCountry Attributes
      String attrISOCode = null;
      String attrName = null;
      // ISOCountry References
      // Attribute Extraction
      String attrLocalName;
      int numAttrs;
      int idxAttr;
      final String S_ProcName = "startElement";
      final String S_LocalName = "LocalName";

      assert qName.equals("ISOCountry");

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

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

      // Instantiate an edit buffer for the parsed information
      ICFBamISOCountryEditObj editBuff =
          (ICFBamISOCountryEditObj) schemaObj.getISOCountryTableObj().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("ISOCode")) {
          if (attrISOCode != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrISOCode = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("Name")) {
          if (attrName != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrName = 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 ((attrId == null) || (attrId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "Id");
      }
      if (attrISOCode == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "ISOCode");
      }
      if (attrName == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "Name");
      }

      // Save named attributes to context
      CFLibXmlCoreContext curContext = getParser().getCurContext();
      curContext.putNamedValue("Id", attrId);
      curContext.putNamedValue("ISOCode", attrISOCode);
      curContext.putNamedValue("Name", attrName);

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

      short natId;
      natId = Short.parseShort(attrId);
      editBuff.getPKey().setRequiredId(natId);
      editBuff.getISOCountryBuff().setRequiredId(natId);

      String natISOCode = attrISOCode;
      editBuff.setRequiredISOCode(natISOCode);

      String natName = attrName;
      editBuff.setRequiredName(natName);

      // Get the scope/container object

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

      CFBamSaxLoader.LoaderBehaviourEnum loaderBehaviour = saxLoader.getISOCountryLoaderBehaviour();
      ICFBamISOCountryEditObj editISOCountry = null;
      ICFBamISOCountryObj origISOCountry =
          (ICFBamISOCountryObj)
              schemaObj
                  .getISOCountryTableObj()
                  .readISOCountryByISOCodeIdx(editBuff.getRequiredISOCode());
      editBuff.getPKey().setRequiredId(natId);
      editBuff.getISOCountryBuff().setRequiredId(natId);
      if (origISOCountry == null) {
        editISOCountry = editBuff;
      } else {
        switch (loaderBehaviour) {
          case Insert:
            break;
          case Update:
            editISOCountry = (ICFBamISOCountryEditObj) origISOCountry.beginEdit();
            editISOCountry.setRequiredISOCode(editBuff.getRequiredISOCode());
            editISOCountry.setRequiredName(editBuff.getRequiredName());
            break;
          case Replace:
            editISOCountry = (ICFBamISOCountryEditObj) origISOCountry.beginEdit();
            editISOCountry.delete();
            editISOCountry.endEdit();
            origISOCountry = null;
            editISOCountry = editBuff;
            break;
        }
      }

      if (editISOCountry != null) {
        if (origISOCountry != null) {
          editISOCountry.update();
        } else {
          origISOCountry = (ICFBamISOCountryObj) editISOCountry.create();
        }
        editISOCountry.endEdit();
      }

      curContext.putNamedValue("Object", origISOCountry);
    } 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);
    }
  }