Here you can find the source of getXMLGregorianCalendar()
public static XMLGregorianCalendar getXMLGregorianCalendar()
//package com.java2s; //License from project: Open Source License import java.util.GregorianCalendar; import javax.xml.datatype.DatatypeConfigurationException; import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.XMLGregorianCalendar; public class Main { public static XMLGregorianCalendar getXMLGregorianCalendar() { try {/*from w w w . j a v a 2s. c o m*/ GregorianCalendar gcal = new GregorianCalendar(); return DatatypeFactory.newInstance().newXMLGregorianCalendar(gcal); } catch (DatatypeConfigurationException e1) { // TODO Auto-generated catch block e1.printStackTrace(); return null; } } }