code: private void readTask(ChildTaskContainer mpxjParent, net.sf.mpxj.ganttproject.schema.Task gpTask)
     {
        Task mpxjTask = mpxjParent.addTask();
        mpxjTask.setUniqueID(Integer.valueOf(NumberHelper.getInt(gpTask.getId()) + 1));
        mpxjTask.setName(gpTask.getName());
        mpxjTask.setPercentageComplete(gpTask.getComplete());
        mpxjTask.setPriority(getPriority(gpTask.getPriority()));
        mpxjTask.setHyperlink(gpTask.getWebLink());
  
        Duration duration = Duration.getInstance(NumberHelper.getDouble(gpTask.getDuration()), TimeUnit.DAYS);
        mpxjTask.setDuration(duration);
  
        if (duration.getDuration() == 0)
        {
           mpxjTask.setMilestone(true);
        }
        else
        {
           mpxjTask.setStart(gpTask.getStart());
           mpxjTask.setFinish(m_mpxjCalendar.getDate(gpTask.getStart(), mpxjTask.getDuration(), false));
        }
  
        mpxjTask.setConstraintDate(gpTask.getThirdDate());
        if (mpxjTask.getConstraintDate() != null)
        {
           // TODO: you don't appear to be able to change this setting in GanttProject
           // task.getThirdDateConstraint()
           mpxjTask.setConstraintType(ConstraintType.START_NO_EARLIER_THAN);
        }
  
        readTaskCustomFields(gpTask, mpxjTask);
  
        m_eventManager.fireTaskReadEvent(mpxjTask);
  
        // TODO: read custom values
  
        //
        // Process child tasks
        //
        for (net.sf.mpxj.ganttproject.schema.Task childTask : gpTask.getTask())
        {
           readTask(mpxjTask, childTask);
        }
     }
docs: Recursively read a task, and any sub tasks.
  
  @param mpxjParent Parent for the MPXJ tasks
  @param gpTask GanttProject task