From e45e06de90850fcc25b997d921f1703a9be82161 Mon Sep 17 00:00:00 2001 From: Kevin Puetz Date: Fri, 31 Jan 2020 13:16:37 -0600 Subject: Fix xmlSchemaGetCanonValue formatting for date and dateTime Per https://www.w3.org/TR/xmlschema-2/#dateTime-lexical-representation, the date portion is supposed to use '-' as the delimiter --- xmlschemastypes.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xmlschemastypes.c b/xmlschemastypes.c index e7764d90..75acb560 100644 --- a/xmlschemastypes.c +++ b/xmlschemastypes.c @@ -6003,13 +6003,13 @@ xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlChar **retValue) * recoverable timezone and not "Z". */ snprintf(buf, 30, - "%04ld:%02u:%02uZ", + "%04ld-%02u-%02uZ", norm->value.date.year, norm->value.date.mon, norm->value.date.day); xmlSchemaFreeValue(norm); } else { snprintf(buf, 30, - "%04ld:%02u:%02u", + "%04ld-%02u-%02u", val->value.date.year, val->value.date.mon, val->value.date.day); } @@ -6030,14 +6030,14 @@ xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlChar **retValue) * TODO: Check if "%.14g" is portable. */ snprintf(buf, 50, - "%04ld:%02u:%02uT%02u:%02u:%02.14gZ", + "%04ld-%02u-%02uT%02u:%02u:%02.14gZ", norm->value.date.year, norm->value.date.mon, norm->value.date.day, norm->value.date.hour, norm->value.date.min, norm->value.date.sec); xmlSchemaFreeValue(norm); } else { snprintf(buf, 50, - "%04ld:%02u:%02uT%02u:%02u:%02.14g", + "%04ld-%02u-%02uT%02u:%02u:%02.14g", val->value.date.year, val->value.date.mon, val->value.date.day, val->value.date.hour, val->value.date.min, val->value.date.sec); -- cgit v1.2.1