Questions tagged [xmlgregoriancalendar]

Representation for W3C XML Schema 1.0 date/time datatypes.

Representation for W3C XML Schema 1.0 date/time datatypes. Specifically, these date/time datatypes are DatatypeConstants.DATETIME, DatatypeConstants.TIME, DatatypeConstants.DATE, DatatypeConstants.GYEARMONTH, DatatypeConstants.GMONTHDAY, DatatypeConstants.GYEAR, DatatypeConstants.GMONTH, and DatatypeConstants.GDAY defined in the XML Namespace "http://www.w3.org/2001/XMLSchema". These datatypes are normatively defined in W3C XML Schema 1.0 Part 2, Section 3.2.7-14.

72 questions
651
votes
10 answers

java.util.Date to XMLGregorianCalendar

Isn't there a convenient way of getting from a java.util.Date to a XMLGregorianCalendar?
mac
  • 9,885
  • 4
  • 36
  • 51
13
votes
1 answer

XMLGregorianCalendar in java, with NO Timezone

How do I create an XMLGregorianCalendar without a timezone? No time offset (0) == UTC which outputs a 'Z' in the output. The meaning of my field is implicit local time, where locality is specified elsewhere on the xml record (such as address). How…
Inquisitor Shm
  • 1,433
  • 5
  • 17
  • 26
8
votes
2 answers

Jackson polymorphic serialization generates an incorrect class name

When I use Jackson polymorphic serialization, it generates a JSON object with an incorrect fully qualified class name. The code below serializes an XMLGregorianCalendar. The output is: ["java.util.GregorianCalendar",-3600000] I expected the…
6
votes
2 answers

How to generate XMLGregorianCalendar time as UTC

I want to create an XMLGregorianCalendar with the following characteristics: Time only UTC timezone (The "Z" appended at the end) So I would expect the date to be printed as: 18:00:00Z (XML Date). The element is an xsd:time and I want the time to…
Evandro Pomatti
  • 13,341
  • 16
  • 97
  • 165
4
votes
1 answer

convert 'java.sql.Date' to class 'javax.xml.datatype.XMLGregorianCalendar'

I have a scenario where I have to convert java.sql.Date to class javax.xml.datatype.XMLGregorianCalendar and I tried the following GregorianCalendar cal = new…
Siva
  • 289
  • 1
  • 6
  • 16
4
votes
1 answer

How to de-serialize XMLGregorianCalender with Gson?

When processing a Json string with XMLGregorianCalender using Gson I get the exception: java.lang.RuntimeException: Failed to invoke public javax.xml.datatype.XMLGregorianCalendar() with no args The object which is de-serialized by fromJson(..)…
Sharafath Ahmed
  • 125
  • 3
  • 12
3
votes
0 answers

Unmarshalling Error after convert XMLGregorianCalendar to LocalDate (yyyy-MM-dd)

Hello everyone and thanks for your time! Gonna try to get to the point as simple as possible: I have REST and SOAP webservices. REST has a LocalDate birthdate field in the request model, and SOAP has a XMLGregorianCalendar birthdate field in the…
Tiago Machado
  • 355
  • 7
  • 24
2
votes
2 answers

How get only year with type XMLGregorianCalendar

i have a XML Jaxb class to set with XMLGregorianCalendar type. But we are supposed to set only year in this attribute. XMLGregorianCalendar xmlCal = DatatypeFactory.newInstance().newXMLGregorianCalendar(new…
VKP
  • 589
  • 1
  • 8
  • 34
2
votes
2 answers

Java XMLGregorianCalendar is changing the time - Strange behavior

I have a date as input = 2021-03-12T10:42:01.000Z.... and I want to transform into this format: String pattern = "yyyy-MM-dd'T'HH:mm:ssZ"; public String getDate(XMLGregorianCalendar input) { DateFormat f = new SimpleDateFormat(pattern); …
Julio
  • 429
  • 2
  • 16
2
votes
2 answers

Java Date format : String to XMLGregorianCalendar

I have a String date I am converting to a XMLGregorianCalendar. The below code converts it with no errors. However, the system I pass the date to, gets the error reported below. The following XMLGregorianCalendar works: The following…
Richard
  • 8,193
  • 28
  • 107
  • 228
2
votes
0 answers

How to write object mapper to DE serialize the response json date to xmlgregoriancalendar date with springboot and jackson

org.springframework.web.client.RestClientException: Error while extracting response JSON parse error: Cannot deserialize value of type javax.xml.datatype.XMLGregorianCalendar from String "1983-02-09T00:00:00:000Z": not a valid textual…
2
votes
1 answer

Converting from Instant to XMLGregorianCalendar and vice-versa without losing precision

Using, java.time.Instant and javax.xml.datatype.XMLGregorianCalendar, I'm trying to convert from one to the other without losing precision. Why is this test not passing and how to fix it? class FooTest { @Test void…
2
votes
2 answers

How to set timestamp with zone in XMLGregorianCalendar

I have DateTime in this format '2020-11-08T13:05:46.000-07:00' and trying to set the same to XMLGregorianCalendar. it gets automatically converted to 2020-11-08T20:05:46.000+0000. Anyway to save it as UTC?
2
votes
1 answer

Strange results when converting XMLGregorianCalendar to LocalDateTime

I'm trying to convert an XMLGregorianCalendarObject to LocalDateTime and I'm getting unusual results. I have already tried the solutions in this post and this post. I'm making a few assumptions here that I could be wrong about: 1) the xmlDate…
2
votes
0 answers

How to convert java.util.Date to XMLGregorianCalendar

I am converting a SOAP WS to REST WS for Client. Now in Datatype Objects have field which return type is XMLGregorianCalendar. As I need to keep the Input/Output structure same, so I cannot change any variable names as well their return type. In…
Sanju
  • 53
  • 7
1
2 3 4 5