Hi Dave,

Great project, after a bit of fiddling and overriding a couple of bits I
can now generate 1-1 output from my input XML on a reasonably complex XSD.
One small issue however is formatting the microseconds on a datetime field.
(I am using python 3.6)

Seems like xsd:dateTime allows up to 3dp for microseconds but I am seeing
6dp output instead.

gds_parse_datetime

Modified to:

input_data = '%s.%s' % (time_parts[0], "{}".format(micro_seconds).rjust(6,
"0"), )

Due to:

https://docs.python.org/3/library/datetime.html#datetime.datetime.microsecond

%f Microsecond as a decimal number, zero-padded on the left.

And

def gds_format_datetime

_svalue = ('%04d-%02d-%02dT%02d:%02d:%02d.%s' % (
                    input_data.year,
                    input_data.month,
                    input_data.day,
                    input_data.hour,
                    input_data.minute,
                    input_data.second,
                    ('%f' % (float(input_data.microsecond) / 1000000))[2:],
                ))[0:-3]

(ie adding [0:-3] to trim to 3 digits)

-------

Cheers,

TiM
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to