I've noticed that the pyxb decimal
datatype doesn't preserve trailing zeroes when it renders to XML. The culprit is a call to normalize()
in the following line of the XsdLiteral
function, in line 159 of binding/datatypes.py
:
(sign, digits, exponent) = value.normalize().as_tuple()
(where value
is an instance of Python's decimal
). This is a bit of a problem for me because the web service I am trying to interact with requires version numbers of the form X.000
and pyxb is truncating that to X.0
.
Is this expected behavior? or required by some standard? Do other XML schema-generating libraries do this as well? My solution right now is to use string
instead, but the code would be easy to change if it doesn't break anything.