code: private void writeTaskExtendedAttributes(Project.Tasks.Task xml, Task mpx)
     {
        Project.Tasks.Task.ExtendedAttribute attrib;
        List<Project.Tasks.Task.ExtendedAttribute> extendedAttributes = xml.getExtendedAttribute();
  
        for (TaskField mpxFieldID : getAllTaskExtendedAttributes())
        {
           Object value = mpx.getCachedValue(mpxFieldID);
  
           if (FieldTypeHelper.valueIsNotDefault(mpxFieldID, value))
           {
              m_extendedAttributesInUse.add(mpxFieldID);
  
              Integer xmlFieldID = Integer.valueOf(MPPTaskField.getID(mpxFieldID) | MPPTaskField.TASK_FIELD_BASE);
  
              attrib = m_factory.createProjectTasksTaskExtendedAttribute();
              extendedAttributes.add(attrib);
              attrib.setFieldID(xmlFieldID.toString());
              attrib.setValue(DatatypeConverter.printExtendedAttribute(this, value, mpxFieldID.getDataType()));
              attrib.setDurationFormat(printExtendedAttributeDurationFormat(value));
           }
        }
     }
docs: This method writes extended attribute data for a task.
  
  @param xml MSPDI task
  @param mpx MPXJ task