private Order loadOrder(File orderFile){

    Order result = null;
    
    String errorDescription = null;
    SAXReader reader = new SAXReader();
    Document doc;
    try {
      doc = reader.read(orderFile);
      doc.normalize();
      Element rootNode = doc.getRootElement();
      if (rootNode.getName().equals(OrderTableModel.ORDER_NODE)){
        String orderNumber = rootNode.element(OrderTableModel.ORDER_NUMBER_NODE).getText();
        String itemNumber = rootNode.element(OrderTableModel.ITEM_NUMBER_NODE).getText();
        int numItemsPlanned = Integer.parseInt(rootNode.element(OrderTableModel.NUM_ITEMS_PLANNED_NODE).getText());
        int cycle = Integer.parseInt(rootNode.element(OrderTableModel.CYCLE_NODE).getText());
        int numActiveCavities = Integer.parseInt(rootNode.element(OrderTableModel.NUM_ACTIVE_CAVITIES_NODE).getText());
        int shift = Integer.parseInt(rootNode.element(OrderTableModel.SHIFT_NODE).getText());
        String machineId = rootNode.element(OrderTableModel.MACHINE_ID_NODE).getText();
        Date date = ProductionMonitoring.STORAGE_DATE_FORMAT.parse(rootNode.element(OrderTableModel.DATE_NODE).getText());
        Date sysDate = ProductionMonitoring.STORAGE_DATE_FORMAT.parse(rootNode.element(OrderTableModel.SYS_DATE_NODE).getText());
        result = new Order(orderNumber, itemNumber, machineId ,date);
        result.setNumActiveCavities(numActiveCavities);
        result.setNumItemsPlanned(numItemsPlanned);
        result.setCycle(cycle);
        result.setShift(shift);
        result.setSysDate(sysDate);
        Element monitoringsNode =  rootNode.element(OrderTableModel.MONITORINGS_NODE);
        if (monitoringsNode != null){
          List monitoringElements = monitoringsNode.elements(OrderTableModel.MONITORING_NODE);
          LinkedList<Monitoring> monitorings = new LinkedList<Monitoring>();
          for (Object object : monitoringElements){
            Element monitoring = (Element)object;
            int monitoringOrder = Integer.parseInt(monitoring.element(OrderTableModel.MONITORING_ORDER_NODE).getText());
            int monitoringProduced = Integer.parseInt(monitoring.element(OrderTableModel.MONITORING_PRODUCED_NODE).getText());
            int plannedIdleTime = Integer.parseInt(monitoring.element(OrderTableModel.PLANNED_IDLE_TIME_NODE).getText());
            int formExchange = Integer.parseInt(monitoring.element(OrderTableModel.FORM_EXCHANGE_NODE).getText());
            int nabehove = Integer.parseInt(monitoring.element(OrderTableModel.NABEHOVE_NODE).getText());
            int prestreky = Integer.parseInt(monitoring.element(OrderTableModel.PRESTREKY_NODE).getText());
            int nedostreky = Integer.parseInt(getValueForRenamedColumn(monitoring,OrderTableModel.NEDOSTREKY_NODE,"Otrepy"));
            int zhorene = Integer.parseInt(monitoring.element(OrderTableModel.ZHORENE_NODE).getText());
            int vadaMaterialu = Integer.parseInt(monitoring.element(OrderTableModel.VADA_MATERIALU_NODE).getText());
            int deformacie = Integer.parseInt(getValueForRenamedColumn(monitoring,OrderTableModel.DEFORMACIE_NODE,"N.o.za."));
            int poskodenyZastrekZalis = Integer.parseInt(monitoring.element(OrderTableModel.POSKODENY_ZASTREK_ZALIS_NODE).getText());
            int chybajuciZastrek = Integer.parseInt(getValueForRenamedColumn(monitoring,OrderTableModel.CHYBAJUCI_ZASTREK_NODE,"N.poj."));
            int bodVstreku = Integer.parseInt(monitoring.element(OrderTableModel.BOD_VSTREKU_NODE).getText());
            int pritomnostPruznychElementov = Integer.parseInt(monitoring.element(OrderTableModel.PRITOMNOST_PRUZNYCH_ELEMENTOV_NODE).getText());
            int vyhadzane = Integer.parseInt(monitoring.element(OrderTableModel.VYHADZANE_NODE).getText());
            int prestrekyVOtvoroch = Integer.parseInt(monitoring.element(OrderTableModel.PRESTREKY_V_OTVOROCH_NODE).getText());
            int farba = Integer.parseInt(monitoring.element(OrderTableModel.FARBA_NODE).getText());
            int zastavenieStroja = Integer.parseInt(monitoring.element(OrderTableModel.ZASTAVENIE_STROJA_NODE).getText());
            int ine = Integer.parseInt(monitoring.element(OrderTableModel.INE_NODE).getText());
            int nedolisovaneStroj = Integer.parseInt(monitoring.element(OrderTableModel.NEDOLISOVANE_STROJ_NODE).getText());
            int nedolisovaneForma = Integer.parseInt(monitoring.element(OrderTableModel.NEDOLISOVANE_FORMA_NODE).getText());
            int nedolisovanePeriferie = Integer.parseInt(monitoring.element(OrderTableModel.NEDOLISOVANE_PERIFERIE_NODE).getText());
            Date monitoringDate = ProductionMonitoring.STORAGE_DATE_FORMAT.parse(monitoring.element(OrderTableModel.MONITORING_DATE_NODE).getText());
            Date monitoringSysDate = ProductionMonitoring.STORAGE_DATE_FORMAT.parse(monitoring.element(OrderTableModel.MONITORING_SYS_DATE_NODE).getText());
            Monitoring monitoringEntity = new Monitoring(result, result.getOrderNumber(), monitoringDate);
            monitoringEntity.setNabehove(nabehove);
            monitoringEntity.setPrestreky(prestreky);
            monitoringEntity.setNedostreky(nedostreky);
            monitoringEntity.setZhorene(zhorene);
            monitoringEntity.setVadaMaterialu(vadaMaterialu);
            monitoringEntity.setDeformacie(deformacie);
            monitoringEntity.setPoskodenyZastrekZalis(poskodenyZastrekZalis);
            monitoringEntity.setChybajuciZastrek(chybajuciZastrek);
            monitoringEntity.setBodVstreku(bodVstreku);
            monitoringEntity.setPritomnostPruznychElementov(pritomnostPruznychElementov);
            monitoringEntity.setVyhadzane(vyhadzane);
            monitoringEntity.setPrestrekyVOtvoroch(prestrekyVOtvoroch);
            monitoringEntity.setFarba(farba);
            monitoringEntity.setZastavenieStroja(zastavenieStroja);
            monitoringEntity.setIne(ine);         
            monitoringEntity.setOrder(monitoringOrder);
            monitoringEntity.setProduced(monitoringProduced);
            monitoringEntity.setSysDate(monitoringSysDate);
            monitoringEntity.setNedolisovaneStroj(nedolisovaneStroj);
            monitoringEntity.setNedolisovaneForma(nedolisovaneForma);
            monitoringEntity.setNedolisovanePeriferie(nedolisovanePeriferie);
            monitoringEntity.setPlannedIdleTime(plannedIdleTime);
            monitoringEntity.setFormExchange(formExchange);
            monitorings.addLast(monitoringEntity);
          }
          result.setMonitoring(monitorings);
        }
      }
      else{
        errorDescription = "Hlavny element suboru musi byt " + OrderTableModel.ORDER_NODE;
      }
    } catch (DocumentException e) {
      errorDescription = e.toString();
    } catch (NullPointerException jlnpe){
      errorDescription = jlnpe.toString();
    } catch (ParseException pe){
      errorDescription = pe.toString();
    }

    if (errorDescription != null){
      errorDescription = "Subor " + orderFile.getAbsoluteFile() + " nebol uspesne nacitany.\n" +
        "Detaily chyby:\n" +
        errorDescription;
      MessageBox.displayMessageBox(table.getShell(), SWT.ERROR, "Chyba!",
         errorDescription);
      result = null;
    }
    return result;
  }