[xsd-users] Limiting field sizes when serializing to DOM documents

Boris Kolpackov boris at codesynthesis.com
Thu Jul 12 17:44:14 EDT 2007


Hi Matt,

Matt Burnham <matt.burnham.ctr at mhpcc.hpc.mil> writes:

> And I get the following:
>
> <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
> <event version="2.000000000000000000000000">
> </event>
>
> Is there some way the enforce the <xs:minInclusive value="2"/>
> restriction when serializing to a DOM document?

I think you misunderstand the semantics of the minInclusive facet.
When used on the decimal type, it forces the value to be greater
or equal to that specified and not the precision of the value.

I assume you want to get something like version="2.0" in your XML
instance. The XSD runtime uses the standard ostream insertion
operator for long double (that is what xsd:decimal is mapped to by
default in 2.x.y series). While the result depends on the particular
implementation of the C++ runtime, I am surprised you get this number
of trailing zeros for 2.0, assuming, of course, the actual value is
2.0, and not something like 2.0000000000000000000000001. Can you
confirm that you indeed serialize 2.0? Also which version of XSD are
you using?

hth,
-boris




More information about the xsd-users mailing list