[xsd-users] Question about code synthesis C++/Tree : serialization and XSD patterns

LA FATA, Anael anael.la-fata at capgemini.com
Tue Sep 27 11:11:48 EDT 2016


Hi and thank you very much for your answer.

If I understand you well, I have no other solution that redefining << operators for each type that has a specific pattern ?
There is no "generic" solution that could work for any XSD file (since I have several XSD and they might change in the future) ?

Anaël


-----Message d'origine-----
De : Boris Kolpackov [mailto:boris at codesynthesis.com] 
Envoyé : mardi 27 septembre 2016 16:48
À : LA FATA, Anael
Cc : xsd-users at codesynthesis.com
Objet : Re: [xsd-users] Question about code synthesis C++/Tree : serialization and XSD patterns

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
This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.




More information about the xsd-users mailing list