[xsd-users] Question about code synthesis C++/Tree :
serialization and XSD patterns
Boris Kolpackov
boris at codesynthesis.com
Tue Sep 27 10:48:12 EDT 2016
Hi Anael,
LA FATA, Anael <anael.la-fata at capgemini.com> writes:
> The issue I have got is that my XSD file defines patterns for float members
> such as : "<xs:pattern value="[0-9]\.[0-9]{2}"/>"
>
> But in the string stream I get by using the generated serialization method,
> those patterns are not respected.
>
> For instance I will get "0.3" instead of "0.30" for the latest pattern
> example.
>
> Is there any way to force the generated serialization method to be
> compliant with the XSD constraints patterns?
Regex patterns are only used for validation. It is generally impossible
to take a pattern and produce output that matches it except by doing an
exhaustive search.
However, the cxx/tree/custom/double/ example in the XSD distribution
shows another way to achieve what you want.
Boris
More information about the xsd-users
mailing list