gdesrosiers1805 commented on code in PR #1682:
URL: https://github.com/apache/daffodil/pull/1682#discussion_r3396857461
##########
daffodil-core/src/main/scala/org/apache/daffodil/lib/xml/XMLUtils.scala:
##########
@@ -1302,6 +1302,16 @@ Differences were (path, expected, actual):
}
}
+ /**
+ * Normalizing fractional seconds to milliseconds precision.
+ * @param data Date/Time
+ * @return normalized data with microseconds precision dropped.
+ */
+ private def normalizeFractionalSeconds(data: String): String = {
+ // match ".ffffff" after seconds, keep at most 3 digits
+ data.replaceAll("""(\.\d{3})\d+""", "$1")
Review Comment:
I actually like that approach better. looks cleaner and less expensive than
the regex possibly, although there is likely no noticeable differences here. I
also like the normalizeXmlCalendar name suggested below as well. there is
already the year0 that needs to be normalized from the other ticket i am also
looking at but unfortunately this one has to be preprocessed because the
XMLGregorianCalendar does not accept year zero and will throw an
IllegalArgumentException on that unlike ICU. it would be nice to have one
normalized method for both, but because of the nature of the two cases that is
not possible here. Nonetheless I still think normalizing the calendar for the
precision makes more sense here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]