Re: Output dateTime in canonical form

Anirban Mukherjee <[email protected]>
Newsgroups gmane.text.xml.xmlbeans.user
Message-ID <[email protected]>
Thanks Cezar. I was able to generate the necessary output using GDateBuilder.

Anirban

On Sat, Oct 10, 2009 at 2:32 AM, Cezar Andrei <[email protected]> wrote:
> Anirban,
>
>
>
> Did you look at GDateBuilder, specifically at using normalizeToTimeZone
> methods?
>
>
>
> Cezar
>
>
>
> ________________________________
>
> From: Anirban Mukherjee [mailto:[email protected]]
> Sent: Saturday, September 12, 2009 3:12 PM
> To: [email protected]
> Subject: Output dateTime in canonical form
>
>
>
> I wish to generate xml output where xs:dateTime values will be generated in
> the canonical form rather than the natural form
>
> e.g. instead of 2009-10-13T01:11:17+05:30, I need 2009-10-12T19:41:17Z
> (converted to UTC with Z indicating that it is UTC)
>
> Is there a straightforward way to achieve this ?
>
> The GDate class has a canonicalString() method that produces the form I
> need, but the toString() produces the natural form.
>
> Note: If input xml contains dateTime values in the canonical form, they are
> processed properly.
>
> As an experiment, I tried to inherit a subclass from GDate with the intent
> of overriding toString() to invoke super.canonicalString() but the GDate
> class is final and hence cannot be extended.
> But even that would probably not have worked as the XmlDateTime would
> probably not care about the canonical form. Refer below...
> [
> GDate gdt = new GDate(cal);
> XmlDateTime dt = XmlDateTime.Factory.newInstance();
> dt.setGDateValue(gdt);
> sig.xsetExpirationDateTime(dt);
> ...
> ...
> doc.save...
> ]
>
> Any help would be appreciated.
>
>
> Thanks,
> Anirban
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.