// update editing-duration info.
long editingDuration = calendar.getTimeInMillis() - documentOpeningTime;
editingDuration = (editingDuration < 1) ? 1 : editingDuration;
try {
DatatypeFactory aFactory = DatatypeFactory.newInstance();
metaData.setEditingDuration(new Duration(aFactory.newDurationDayTime(editingDuration)));
} catch (DatatypeConfigurationException e) {
Logger.getLogger(Document.class.getName()).log(Level.SEVERE,
"editing duration update fail as DatatypeFactory can not be instanced", e);
}
}