DatatypeFactory datatypeFactory = DatatypeFactory.newInstance();
GregorianCalendar gregorianCalendarCreated = new GregorianCalendar();
gregorianCalendarCreated.add(Calendar.HOUR, 2);
XMLGregorianCalendar xmlGregorianCalendarCreated = datatypeFactory.newXMLGregorianCalendar(gregorianCalendarCreated);
created.setTextContent(xmlGregorianCalendarCreated.toXMLFormat());
GregorianCalendar gregorianCalendarExpires = new GregorianCalendar();
gregorianCalendarExpires.add(Calendar.HOUR, 2);
gregorianCalendarExpires.add(Calendar.SECOND, 300);
XMLGregorianCalendar xmlGregorianCalendarExpires = datatypeFactory.newXMLGregorianCalendar(gregorianCalendarExpires);