newfield.setFieldId(null);
newfield.setFieldId(findUniqueIdName(FieldObj, newfield.getFieldId()));   FieldObj.put(newfield.getFieldId(), newfield);
       public Object action (SaxDocumentHandler handler, AttributeList attrs) {          // create new object appropriately           Field newfield = new Field();          newfield.setXMLAttributes(attrs); // set XML attributes from passed list          // grab the field axis and add the field           FieldAxis fieldAxis = CurrentArray.getFieldAxis();          fieldAxis.addField(newfield);          String fieldId = newfield.getFieldId();          String fieldIdRef = newfield.getFieldIdRef();          // add this object to the lookup table, if it has an ID          if (fieldId != null) {             // a warning check, just in case             if (FieldObj.containsKey(fieldId))                    Log.warnln("More than one field node with fieldId=\""+fieldId+"\", using latest node." );             // add this into the list of field objects             FieldObj.put(fieldId, newfield);          }          //  If there is a reference object, clone it to get          //  the new field          if (fieldIdRef != null) {             if (FieldObj.containsKey(fieldIdRef)) {                BaseObject refFieldObj = (BaseObject) FieldObj.get(fieldIdRef);                try                 {                    newfield = (Field) refFieldObj.clone();                } catch (java.lang.CloneNotSupportedException e) {                    Log.errorln("Weird error, cannot clone field object. Aborting read.");                    System.exit(-1);                }                // override attrs with those in passed list                newfield.setXMLAttributes(attrs);                newfield.setFieldId(null); // shouldnt have fieldId from the refObj              } else {                Log.warnln("Error: Reader got an field with FieldIdRef=\""+fieldIdRef+"\" but no previous field has that id! Ignoring add field request.");                    return (Object) null;             }          }          // add this object to all open field groups          Iterator iter = CurrentFieldGroupList.iterator();          while (iter.hasNext()) {             FieldGroup nextFieldGroupObj = (FieldGroup) iter.next();             newfield.addToGroup(nextFieldGroupObj);          }          CurrentDatatypeObject = newfield;          LastFieldObject = newfield;          return newfield;       }