What's the best way to parse an XML dateTime in Java?

后端 未结 9 1027
刺人心
刺人心 2020-11-28 06:16

What\'s the best way to parse an XML dateTime in Java? Legal dateTime values include 2002-10-10T12:00:00-05:00 AND 2002-10-10T17:00:00Z

Is there a good open source l

9条回答
  •  孤独总比滥情好
    2020-11-28 06:55

    Ideally, XML processing packages that are schema-aware (or to be used as basis for things that are) should provide accessors for typed content. I know of one (http://woodstox.codehaus.org/), but it does not (yet) offer access to date/time, just simpler types (numeric, arrays, QNames etc). There is a request to support javax.xml.datatype.XMLGregorianCalendar.

    Alas, not many do. However, it you are using specific package (like XOM or JDOM etc), it might not be a bad idea to ask this question on their user list.

提交回复
热议问题