Code example for DatatypeFactory

Methods: newXMLGregorianCalendar

0
	public JAXBElement<URI> standardClassURI() {
		return new JAXBElement<URI>(NAME, URI.class, URI.create("http://springframework.org"));
	} 
 
	public JAXBElement<XMLGregorianCalendar> standardClassXMLGregorianCalendar() throws DatatypeConfigurationException {
		XMLGregorianCalendar calendar =
				factory.newXMLGregorianCalendar((GregorianCalendar) Calendar.getInstance());
		return new JAXBElement<XMLGregorianCalendar>(NAME, XMLGregorianCalendar.class, calendar);
	} 
 
	public JAXBElement<Duration> standardClassDuration() {
		Duration duration = factory.newDuration(42000);
		return new JAXBElement<Duration>(NAME, Duration.class, duration);
	} 
 
	public JAXBElement<Image> standardClassImage() throws IOException {
		Image image = ImageIO.read(getClass().getResourceAsStream("spring-ws.png"));
		return new JAXBElement<Image>(NAME, Image.class, image);
	} 
 
Connect your IDE to all the code out there  Get Codota for Java