Hi, all.

I think I'm working too hard to get the end result I'm looking for.  Is
there a better way?

Background:  I'm working with a schema available at
http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd.  The fragment in
question is this:

  <simpleType name="UTCdatetimeType">
    <annotation>
      <documentation>Datestamps are to either day (type date)
      or to seconds granularity (type
oai:UTCdateTimeZType)</documentation>
    </annotation>
    <union memberTypes="date oai:UTCdateTimeZType"/>
  </simpleType>

  <simpleType name="UTCdateTimeZType">
    <restriction base="dateTime">
      <pattern value=".*Z"/>
    </restriction>
  </simpleType>

My task is to produce an XML document compliant with the schema.  I need
the datetime defined as UTCdatetimeType to be in UTC format, e.g.
...
            <header>
                <identifier>host:repository:1</identifier>
                <datestamp>2008-04-04T20:16:33.068Z</datestamp>
            </header>
...

I'm doing it, but it feels like too much work to do it like this:

                Calendar datestamp = Calendar.getInstance();
                datestamp.setTimeZone(TimeZone.getTimeZone("UTC"));
                UTCdateTimeZType dtmz =
UTCdateTimeZType.Factory.newInstance();
                dtmz.setCalendarValue(datestamp);
                UTCdatetimeType utcdtm = (UTCdatetimeType)
dtmz.changeType(UTCdatetimeType.type);
                hdr.xsetDatestamp(utcdtm);

Is there a simpler, more straightforward way that I'm just not finding?

Thanks.

--
Dennis R. Sherman
Ex Libris Group
847-227-2976
[EMAIL PROTECTED]
http://www.exlibrisgroup.com 



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to