[xsd-users] Customize sequence and optionals

WEBER Stefan stefan.weber at efgfp.com
Tue Jan 27 10:05:03 EST 2009


Hi,
 
so far I could successfully customize the mapping to suit my needs. Now,
I ran into problems with optionals and sequences.
 
In my schema, the reason to make some elements optional is mostly for
convenience of the user writing the XML, such that the user does not
have to explicitly specify the element in case he wants to use the
default value anyway. (e.g. for configuration data) Now I would like to
change the optional type such that whenever get() would return a NULL
pointer, I create an element of the default value and return the newly
created element.
 
In other words, instead of having a
 
typedef xsd::cxx::tree::optional<MyType> MyTypeOptional
 
I would rather provide a custom MyTypeOptional. Is this possible?
 
A similar thing for the sequences:
 
instead of having generated a
 
typedef xsd::cxx::tree::sequence<MyType> MyTypeSequence
 
I would rather provide a MyTypeSequence myself. The reason I want to do
that is that I would prefer to have a vector<MyType> as return value
rather than sequence<MyType> for sequences (because an 3rd party API
expects a const vector& and providing a custom sequence would save a lot
of explicit conversions).
 
Thanks,
 
Stefan

==== The EFG Mail Gateway made the following annotation =====
This message is for the addressee only and may contain confidential or
privileged information. You must delete and not use it if you are not
the intended recipient. It may not be secure or error-free. All e-mail
communications to and from the EFG Financial Products Group may be monitored.
Processing of incoming e-mails cannot be guaranteed. Any views expressed
in this message are those of the individual sender. This message is for
information purposes only. All liability of the EFG Financial Products Group
and its entities for any damages resulting from e-mail use is excluded.
US persons are kindly requested to read the important legal information
presented at following URL: http://www.efgfp.com. If you suspect that the
message may have been intercepted or amended, please call the sender.
Should you require any further information, please contact the Compliance
Manager on compliance at efgfp.com.
=============================================================



More information about the xsd-users mailing list