[xsd-users] inline namespaces
Ray Lischner
rlischner at proteuseng.com
Fri Jan 31 13:58:02 EST 2014
In the past, we used to encode schema version numbers in the namespace. On the one hand, it ensured binary compatibility when a schema changed, but on the other hand, it required large-scale source code changes when a schema's version number incremented.
With inline namespaces, we can gain the advantage of versioned names, but without the associated source-code changes when the version changes.
The trick is to convince Code Synthesis to map an XML schema to a set of C++ namespaces that includes an inline namespace. For example, we might want, XML namespace x:y:v1 to map to:
namespace x {
namespace y {
inline namespace v1 {
In one strange instance, we also had XML schema namespace x:v1:y, which would need to be mapped to:
namespace x {
inline namespace v1 {
namespace y {
Any ideas on how we might do this?
Perhaps the --namespace-regex option can use a magic character in the C++ namespace to mean "make this inline", e.g., --namespace regex '@^.* ([^:]+):([^:]+):(v\d+)@$1::$2::*$3@', where the '*' means 'inline'.
Ray Lischner,
Distinguished Member of Technical Staff
133 National Business Pkwy, Ste 150 t. 443.539.3448
Annapolis Junction, MD 20701 c. 410.854.9787
rlischner at proteuseng.com f. 443.539.3370
More information about the xsd-users
mailing list