You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, is there any interest in serializing values so that they are compatible with XML Schema types?
There are at least two scenarios where I've noticed xmlutil not adhering to XML Schema types:
Serialization of infinity values: xs:float and xs:double expect negative/positive infinity as -INF/INF, whereas xmlutil uses -Infinity/Infinity;
Decoding of boolean values: xs:boolean accepts values false/true/0/1, but xmlutil does not accept 0/1 when decoding booleans.
Obviously, changing these at this point would be a breaking change, so perhaps a setting to enable values to follow XML schema type definitions would make sense.
I would also personally appreciate a setting to specify the preferred encoding of boolean values (false/true vs 0/1). Unfortunately I'm dealing with legacy software which expects xs:booleans encoded as 0/1 and doesn't actually allow the false/true representation 😅. This is, of course, a me problem, which I'm currently working around via a custom serializer.
However, it might make sense to encode booleans as false/true when pretty print is enabled and 0/1 otherwise, to save some precious bytes 😉, so a setting to specify preferred boolean encoding might make sense in the general case.
Regardless of the boolean encoding issue, what are your thoughts on aligning xmlutil value serialization with the XML Schema specification?
The text was updated successfully, but these errors were encountered:
@YarnSphere There is, there is even an XMLSchema module (in development). I hadn't noticed the - floating point issue. Boolean is already supported (with the isStrictBoolean policy configuration option, but not the default (for compatibility) - or using the XmlBoolean value class.
For reading it will certainly make sense to at least accept -INF/INF as values. Writing is more of a challenge, but certainly in new versions will use that as the "recommended" configuration (yay for "versioned" recommendations).
Hi, is there any interest in serializing values so that they are compatible with XML Schema types?
There are at least two scenarios where I've noticed xmlutil not adhering to XML Schema types:
xs:float
andxs:double
expect negative/positive infinity as-INF
/INF
, whereas xmlutil uses-Infinity
/Infinity
;xs:boolean
accepts valuesfalse
/true
/0
/1
, but xmlutil does not accept0
/1
when decoding booleans.Obviously, changing these at this point would be a breaking change, so perhaps a setting to enable values to follow XML schema type definitions would make sense.
I would also personally appreciate a setting to specify the preferred encoding of boolean values (
false
/true
vs0
/1
). Unfortunately I'm dealing with legacy software which expectsxs:boolean
s encoded as0
/1
and doesn't actually allow thefalse
/true
representation 😅. This is, of course, a me problem, which I'm currently working around via a custom serializer.However, it might make sense to encode booleans as
false
/true
when pretty print is enabled and0
/1
otherwise, to save some precious bytes 😉, so a setting to specify preferred boolean encoding might make sense in the general case.Regardless of the boolean encoding issue, what are your thoughts on aligning xmlutil value serialization with the XML Schema specification?
The text was updated successfully, but these errors were encountered: