1 /**
2  * Licensed to the University Corporation for Advanced Internet
3  * Development, Inc. (UCAID) under one or more contributor license
4  * agreements. See the NOTICE file distributed with this work for
5  * additional information regarding copyright ownership.
6  *
7  * UCAID licenses this file to you under the Apache License,
8  * Version 2.0 (the "License"); you may not use this file except
9  * in compliance with the License. You may obtain a copy of the
10  * License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing,
15  * software distributed under the License is distributed on an
16  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
17  * either express or implied. See the License for the specific
18  * language governing permissions and limitations under the License.
19  */
20 
21 /**
22  * @file xmltooling/base.h
23  *
24  * Base header file definitions.
25  * Must be included prior to including any other header.
26  */
27 
28 #ifndef __xmltooling_base_h__
29 #define __xmltooling_base_h__
30 
31 #include <typeinfo>
32 
33 /* Required for sprintf, used by integer XML attribute macros. */
34 #include <cstdio>
35 
36 #if defined (_MSC_VER) || defined(__BORLANDC__)
37   #include <xmltooling/config_pub_win32.h>
38 #else
39   #include <xmltooling/config_pub.h>
40 #endif
41 
42 #ifdef XMLTOOLING_LITE
43 # define XMLTOOLING_NO_XMLSEC 1
44 #endif
45 
46 #ifndef HAVE_NULLPTR
47 # define nullptr 0
48 #endif
49 
50 // Windows and GCC4 Symbol Visibility Macros
51 #ifdef WIN32
52   #define XMLTOOL_IMPORT __declspec(dllimport)
53   #define XMLTOOL_EXPORT __declspec(dllexport)
54   #define XMLTOOL_DLLLOCAL
55   #define XMLTOOL_DLLPUBLIC
56 #else
57   #define XMLTOOL_IMPORT
58   #ifdef GCC_HASCLASSVISIBILITY
59     #define XMLTOOL_EXPORT __attribute__ ((visibility("default")))
60     #define XMLTOOL_DLLLOCAL __attribute__ ((visibility("hidden")))
61     #define XMLTOOL_DLLPUBLIC __attribute__ ((visibility("default")))
62   #else
63     #define XMLTOOL_EXPORT
64     #define XMLTOOL_DLLLOCAL
65     #define XMLTOOL_DLLPUBLIC
66   #endif
67 #endif
68 
69 // Define XMLTOOL_API for DLL builds
70 #ifdef XMLTOOLING_EXPORTS
71   #define XMLTOOL_API XMLTOOL_EXPORT
72 #else
73   #define XMLTOOL_API XMLTOOL_IMPORT
74 #endif
75 
76 // Throwable classes must always be visible on GCC in all binaries
77 #ifdef WIN32
78   #define XMLTOOL_EXCEPTIONAPI(api) api
79 #elif defined(GCC_HASCLASSVISIBILITY)
80   #define XMLTOOL_EXCEPTIONAPI(api) XMLTOOL_EXPORT
81 #else
82   #define XMLTOOL_EXCEPTIONAPI(api)
83 #endif
84 
85 #ifdef _MSC_VER
86     #define XMLTOOLING_DOXYGEN(desc) /##** desc */
87 #else
88     #define XMLTOOLING_DOXYGEN(desc)
89 #endif
90 
91 /**
92  * Blocks copy c'tor and assignment operator for a class.
93  */
94 #define MAKE_NONCOPYABLE(type) \
95     private: \
96         type(const type&); \
97         type& operator=(const type&)
98 
99 #ifndef DOXYGEN_SKIP
100 #ifndef NULL
101 #define NULL    0
102 #endif
103 #define UNICODE_LITERAL_1(a) {xercesc::chLatin_##a, xercesc::chNull}
104 #define UNICODE_LITERAL_2(a,b) {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chNull}
105 #define UNICODE_LITERAL_3(a,b,c) {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chNull}
106 #define UNICODE_LITERAL_4(a,b,c,d) {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chNull}
107 #define UNICODE_LITERAL_5(a,b,c,d,e) \
108     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chNull}
109 #define UNICODE_LITERAL_6(a,b,c,d,e,f) \
110     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chNull}
111 #define UNICODE_LITERAL_7(a,b,c,d,e,f,g) \
112     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chNull}
113 #define UNICODE_LITERAL_8(a,b,c,d,e,f,g,h) \
114     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chNull}
115 #define UNICODE_LITERAL_9(a,b,c,d,e,f,g,h,i) \
116     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, xercesc::chNull}
117 #define UNICODE_LITERAL_10(a,b,c,d,e,f,g,h,i,j) \
118     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
119         xercesc::chLatin_##j, xercesc::chNull}
120 #define UNICODE_LITERAL_11(a,b,c,d,e,f,g,h,i,j,k) \
121     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
122         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chNull}
123 #define UNICODE_LITERAL_12(a,b,c,d,e,f,g,h,i,j,k,l) \
124     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
125         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chNull}
126 #define UNICODE_LITERAL_13(a,b,c,d,e,f,g,h,i,j,k,l,m) \
127     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
128         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chNull}
129 #define UNICODE_LITERAL_14(a,b,c,d,e,f,g,h,i,j,k,l,m,n) \
130     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
131         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chNull}
132 #define UNICODE_LITERAL_15(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) \
133     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
134         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chNull}
135 #define UNICODE_LITERAL_16(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
136     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
137         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chNull}
138 #define UNICODE_LITERAL_17(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) \
139     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
140         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chNull}
141 #define UNICODE_LITERAL_18(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) \
142     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
143         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, xercesc::chNull}
144 #define UNICODE_LITERAL_19(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s) \
145     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
146         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
147         xercesc::chLatin_##s, xercesc::chNull}
148 #define UNICODE_LITERAL_20(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) \
149     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
150         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
151         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chNull}
152 #define UNICODE_LITERAL_21(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u) \
153     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
154         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
155         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chNull}
156 #define UNICODE_LITERAL_22(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v) \
157     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
158         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
159         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chNull}
160 #define UNICODE_LITERAL_23(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w) \
161     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
162         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
163         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chNull}
164 #define UNICODE_LITERAL_24(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x) \
165     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
166         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
167         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chNull}
168 #define UNICODE_LITERAL_25(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y) \
169     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
170         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
171         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chNull}
172 #define UNICODE_LITERAL_26(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z) \
173     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
174         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
175         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, xercesc::chNull}
176 #define UNICODE_LITERAL_27(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa) \
177     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
178         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
179         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
180         xercesc::chLatin_##aa, xercesc::chNull}
181 #define UNICODE_LITERAL_28(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb) \
182     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
183         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
184         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
185         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chNull}
186 #define UNICODE_LITERAL_29(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc) \
187     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
188         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
189         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
190         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chNull}
191 #define UNICODE_LITERAL_30(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd) \
192     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
193         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
194         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
195         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chNull}
196 #define UNICODE_LITERAL_31(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee) \
197     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
198         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
199         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
200         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chNull}
201 #define UNICODE_LITERAL_32(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff) \
202     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
203         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
204         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
205         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chNull}
206 #define UNICODE_LITERAL_33(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg) \
207     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
208         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
209         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
210         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chNull}
211 #define UNICODE_LITERAL_34(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh) \
212     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
213         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
214         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
215         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, xercesc::chNull}
216 #define UNICODE_LITERAL_35(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii) \
217     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
218         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
219         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
220         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
221         xercesc::chLatin_##ii, xercesc::chNull}
222 #define UNICODE_LITERAL_36(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj) \
223     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
224         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
225         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
226         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
227         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chNull}
228 #define UNICODE_LITERAL_37(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk) \
229     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
230         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
231         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
232         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
233         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chNull}
234 #define UNICODE_LITERAL_38(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll) \
235     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
236         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
237         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
238         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
239         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chLatin_##ll, xercesc::chNull}
240 #define UNICODE_LITERAL_39(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm) \
241     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
242         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
243         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
244         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
245         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chLatin_##ll, xercesc::chLatin_##mm, xercesc::chNull}
246 #define UNICODE_LITERAL_40(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn) \
247     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
248         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
249         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
250         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
251         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chLatin_##ll, xercesc::chLatin_##mm, xercesc::chLatin_##nn, xercesc::chNull}
252 #define UNICODE_LITERAL_41(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo) \
253     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
254         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
255         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
256         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
257         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chLatin_##ll, xercesc::chLatin_##mm, xercesc::chLatin_##nn, xercesc::chLatin_##oo, xercesc::chNull}
258 #define UNICODE_LITERAL_42(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp) \
259     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
260         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
261         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
262         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
263         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chLatin_##ll, xercesc::chLatin_##mm, xercesc::chLatin_##nn, xercesc::chLatin_##oo, xercesc::chLatin_##pp, xercesc::chNull}
264 #define UNICODE_LITERAL_43(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp,qq) \
265     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
266         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
267         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
268         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
269         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chLatin_##ll, xercesc::chLatin_##mm, xercesc::chLatin_##nn, xercesc::chLatin_##oo, xercesc::chLatin_##pp, \
270         xercesc::chLatin_##qq, xercesc::chNull}
271 #define UNICODE_LITERAL_44(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp,qq,rr) \
272     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
273         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
274         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
275         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
276         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chLatin_##ll, xercesc::chLatin_##mm, xercesc::chLatin_##nn, xercesc::chLatin_##oo, xercesc::chLatin_##pp, \
277         xercesc::chLatin_##qq, xercesc::chLatin_##rr, xercesc::chNull}
278 #define UNICODE_LITERAL_45(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp,qq,rr,ss) \
279     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
280         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
281         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
282         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
283         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chLatin_##ll, xercesc::chLatin_##mm, xercesc::chLatin_##nn, xercesc::chLatin_##oo, xercesc::chLatin_##pp, \
284         xercesc::chLatin_##qq, xercesc::chLatin_##rr, xercesc::chLatin_##ss, xercesc::chNull}
285 #define UNICODE_LITERAL_46(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp,qq,rr,ss,tt) \
286     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
287         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
288         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
289         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
290         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chLatin_##ll, xercesc::chLatin_##mm, xercesc::chLatin_##nn, xercesc::chLatin_##oo, xercesc::chLatin_##pp, \
291         xercesc::chLatin_##qq, xercesc::chLatin_##rr, xercesc::chLatin_##ss, xercesc::chLatin_##tt, xercesc::chNull}
292 #define UNICODE_LITERAL_47(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp,qq,rr,ss,tt,uu) \
293     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
294         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
295         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
296         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
297         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chLatin_##ll, xercesc::chLatin_##mm, xercesc::chLatin_##nn, xercesc::chLatin_##oo, xercesc::chLatin_##pp, \
298         xercesc::chLatin_##qq, xercesc::chLatin_##rr, xercesc::chLatin_##ss, xercesc::chLatin_##tt, xercesc::chLatin_##uu, xercesc::chNull}
299 #define UNICODE_LITERAL_48(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp,qq,rr,ss,tt,uu,vv) \
300     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
301         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
302         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
303         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
304         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chLatin_##ll, xercesc::chLatin_##mm, xercesc::chLatin_##nn, xercesc::chLatin_##oo, xercesc::chLatin_##pp, \
305         xercesc::chLatin_##qq, xercesc::chLatin_##rr, xercesc::chLatin_##ss, xercesc::chLatin_##tt, xercesc::chLatin_##uu, xercesc::chLatin_##vv, xercesc::chNull}
306 #define UNICODE_LITERAL_49(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp,qq,rr,ss,tt,uu,vv,ww) \
307     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
308         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
309         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
310         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
311         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chLatin_##ll, xercesc::chLatin_##mm, xercesc::chLatin_##nn, xercesc::chLatin_##oo, xercesc::chLatin_##pp, \
312         xercesc::chLatin_##qq, xercesc::chLatin_##rr, xercesc::chLatin_##ss, xercesc::chLatin_##tt, xercesc::chLatin_##uu, xercesc::chLatin_##vv, xercesc::chLatin_##ww, xercesc::chNull}
313 #define UNICODE_LITERAL_50(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp,qq,rr,ss,tt,uu,vv,ww,xx) \
314     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
315         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
316         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
317         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
318         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chLatin_##ll, xercesc::chLatin_##mm, xercesc::chLatin_##nn, xercesc::chLatin_##oo, xercesc::chLatin_##pp, \
319         xercesc::chLatin_##qq, xercesc::chLatin_##rr, xercesc::chLatin_##ss, xercesc::chLatin_##tt, xercesc::chLatin_##uu, xercesc::chLatin_##vv, xercesc::chLatin_##ww, xercesc::chLatin_##xx, xercesc::chNull}
320 #define UNICODE_LITERAL_51(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp,qq,rr,ss,tt,uu,vv,ww,xx,yy) \
321     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
322         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
323         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
324         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
325         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chLatin_##ll, xercesc::chLatin_##mm, xercesc::chLatin_##nn, xercesc::chLatin_##oo, xercesc::chLatin_##pp, \
326         xercesc::chLatin_##qq, xercesc::chLatin_##rr, xercesc::chLatin_##ss, xercesc::chLatin_##tt, xercesc::chLatin_##uu, xercesc::chLatin_##vv, xercesc::chLatin_##ww, xercesc::chLatin_##xx, \
327         xercesc::chLatin_##yy, xercesc::chNull}
328 #define UNICODE_LITERAL_52(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp,qq,rr,ss,tt,uu,vv,ww,xx,yy,zz) \
329     {xercesc::chLatin_##a, xercesc::chLatin_##b, xercesc::chLatin_##c, xercesc::chLatin_##d, xercesc::chLatin_##e, xercesc::chLatin_##f, xercesc::chLatin_##g, xercesc::chLatin_##h, xercesc::chLatin_##i, \
330         xercesc::chLatin_##j, xercesc::chLatin_##k, xercesc::chLatin_##l, xercesc::chLatin_##m, xercesc::chLatin_##n, xercesc::chLatin_##o, xercesc::chLatin_##p, xercesc::chLatin_##q, xercesc::chLatin_##r, \
331         xercesc::chLatin_##s, xercesc::chLatin_##t, xercesc::chLatin_##u, xercesc::chLatin_##v, xercesc::chLatin_##w, xercesc::chLatin_##x, xercesc::chLatin_##y, xercesc::chLatin_##z, \
332         xercesc::chLatin_##aa, xercesc::chLatin_##bb, xercesc::chLatin_##cc, xercesc::chLatin_##dd, xercesc::chLatin_##ee, xercesc::chLatin_##ff, xercesc::chLatin_##gg, xercesc::chLatin_##hh, \
333         xercesc::chLatin_##ii, xercesc::chLatin_##jj, xercesc::chLatin_##kk, xercesc::chLatin_##ll, xercesc::chLatin_##mm, xercesc::chLatin_##nn, xercesc::chLatin_##oo, xercesc::chLatin_##pp, \
334         xercesc::chLatin_##qq, xercesc::chLatin_##rr, xercesc::chLatin_##ss, xercesc::chLatin_##tt, xercesc::chLatin_##uu, xercesc::chLatin_##vv, xercesc::chLatin_##ww, xercesc::chLatin_##xx, \
335         xercesc::chLatin_##yy, xercesc::chLatin_##zz, xercesc::chNull}
336 #endif /* DOXYGEN_SKIP */
337 
338 /**
339  * Begins the declaration of an XMLObject specialization for an abstract element/type.
340  * Basic boilerplate includes a protected constructor, empty virtual destructor,
341  * and Unicode constants for the default associated element's name and prefix.
342  *
343  * @param linkage   linkage specifier for the class
344  * @param cname     the name of the class to declare
345  * @param base      the base class to derive from using public virtual inheritance
346  * @param desc      documentation comment for class
347  */
348 #define DECL_XMLOBJECT_ABSTRACT(linkage,cname,base,desc) \
349     XMLTOOLING_DOXYGEN(desc) \
350     class linkage cname : public virtual base { \
351     protected: \
352         cname() {} \
353     public: \
354         virtual ~cname() {} \
355         XMLTOOLING_DOXYGEN(Element local name) \
356         static const XMLCh LOCAL_NAME[]; \
357     }
358 
359 /**
360  * Begins the declaration of an XMLObject specialization.
361  * Basic boilerplate includes a protected constructor, empty virtual destructor,
362  * and Unicode constants for the default associated element's name and prefix.
363  *
364  * @param linkage   linkage specifier for the class
365  * @param cname     the name of the class to declare
366  * @param base      the base class to derive from using public virtual inheritance
367  * @param desc      documentation comment for class
368  */
369 #define BEGIN_XMLOBJECT(linkage,cname,base,desc) \
370     XMLTOOLING_DOXYGEN(desc) \
371     class linkage cname : public virtual base { \
372     protected: \
373         cname() {} \
374     public: \
375         virtual ~cname() {} \
376         XMLTOOLING_DOXYGEN(Type-specific clone method.) \
377         virtual cname* clone##cname() const=0; \
378         XMLTOOLING_DOXYGEN(Element local name) \
379         static const XMLCh LOCAL_NAME[]
380 
381 /**
382  * Begins the declaration of an XMLObject specialization with two base classes.
383  * Basic boilerplate includes a protected constructor, empty virtual destructor,
384  * and Unicode constants for the default associated element's name and prefix.
385  *
386  * @param linkage   linkage specifier for the class
387  * @param cname     the name of the class to declare
388  * @param base      the first base class to derive from using public virtual inheritance
389  * @param base2     the second base class to derive from using public virtual inheritance
390  * @param desc      documentation comment for class
391  */
392 #define BEGIN_XMLOBJECT2(linkage,cname,base,base2,desc) \
393     XMLTOOLING_DOXYGEN(desc) \
394     class linkage cname : public virtual base, public virtual base2 { \
395     protected: \
396         cname() {} \
397     public: \
398         virtual ~cname() {} \
399         XMLTOOLING_DOXYGEN(Type-specific clone method.) \
400         virtual cname* clone##cname() const=0; \
401         XMLTOOLING_DOXYGEN(Element local name) \
402         static const XMLCh LOCAL_NAME[]
403 
404 /**
405  * Begins the declaration of an XMLObject specialization with three base classes.
406  * Basic boilerplate includes a protected constructor, empty virtual destructor,
407  * and Unicode constants for the default associated element's name and prefix.
408  *
409  * @param linkage   linkage specifier for the class
410  * @param cname     the name of the class to declare
411  * @param base      the first base class to derive from using public virtual inheritance
412  * @param base2     the second base class to derive from using public virtual inheritance
413  * @param base3     the third base class to derive from using public virtual inheritance
414  * @param desc      documentation comment for class
415  */
416 #define BEGIN_XMLOBJECT3(linkage,cname,base,base2,base3,desc) \
417     XMLTOOLING_DOXYGEN(desc) \
418     class linkage cname : public virtual base, public virtual base2, public virtual base3 { \
419     protected: \
420         cname() {} \
421     public: \
422         virtual ~cname() {} \
423         XMLTOOLING_DOXYGEN(Type-specific clone method.) \
424         virtual cname* clone##cname() const=0; \
425         XMLTOOLING_DOXYGEN(Element local name) \
426         static const XMLCh LOCAL_NAME[]
427 
428 /**
429  * Begins the declaration of an XMLObject specialization with four base classes.
430  * Basic boilerplate includes a protected constructor, empty virtual destructor,
431  * and Unicode constants for the default associated element's name and prefix.
432  *
433  * @param linkage   linkage specifier for the class
434  * @param cname     the name of the class to declare
435  * @param base      the first base class to derive from using public virtual inheritance
436  * @param base2     the second base class to derive from using public virtual inheritance
437  * @param base3     the third base class to derive from using public virtual inheritance
438  * @param base4     the fourth base class to derive from using public virtual inheritance
439  * @param desc      documentation comment for class
440  */
441 #define BEGIN_XMLOBJECT4(linkage,cname,base,base2,base3,base4,desc) \
442     XMLTOOLING_DOXYGEN(desc) \
443     class linkage cname : public virtual base, public virtual base2, public virtual base3, public virtual base4 { \
444     protected: \
445         cname() {} \
446     public: \
447         virtual ~cname() {} \
448         XMLTOOLING_DOXYGEN(Type-specific clone method.) \
449         virtual cname* clone##cname() const=0; \
450         XMLTOOLING_DOXYGEN(Element local name) \
451         static const XMLCh LOCAL_NAME[]
452 
453 /**
454  * Begins the declaration of an XMLObject specialization with five base classes.
455  * Basic boilerplate includes a protected constructor, empty virtual destructor,
456  * and Unicode constants for the default associated element's name and prefix.
457  *
458  * @param linkage   linkage specifier for the class
459  * @param cname     the name of the class to declare
460  * @param base      the first base class to derive from using public virtual inheritance
461  * @param base2     the second base class to derive from using public virtual inheritance
462  * @param base3     the third base class to derive from using public virtual inheritance
463  * @param base4     the fourth base class to derive from using public virtual inheritance
464  * @param base5     the fifth base class to derive from using public virtual inheritance
465  * @param desc      documentation comment for class
466  */
467 #define BEGIN_XMLOBJECT5(linkage,cname,base,base2,base3,base4,base5,desc) \
468     XMLTOOLING_DOXYGEN(desc) \
469     class linkage cname : public virtual base, public virtual base2, public virtual base3, public virtual base4, public virtual base5 { \
470     protected: \
471         cname() {} \
472     public: \
473         virtual ~cname() {} \
474         XMLTOOLING_DOXYGEN(Type-specific clone method.) \
475         virtual cname* clone##cname() const=0; \
476         XMLTOOLING_DOXYGEN(Element local name) \
477         static const XMLCh LOCAL_NAME[]
478 
479 /**
480  * Ends the declaration of an XMLObject specialization.
481  */
482 #define END_XMLOBJECT }
483 
484 /**
485  * Declares a static variable holding the XMLObject's element QName.
486  */
487 #define DECL_ELEMENT_QNAME \
488     public: \
489         XMLTOOLING_DOXYGEN(Element QName) \
490         static xmltooling::QName ELEMENT_QNAME
491 
492 /**
493  * Declares a static variable holding the XMLObject's schema type QName.
494  */
495 #define DECL_TYPE_QNAME \
496     public: \
497         XMLTOOLING_DOXYGEN(Type QName) \
498         static xmltooling::QName TYPE_QNAME
499 
500 /**
501  * Implements a static variable holding an XMLObject's element QName.
502  *
503  * @param cname             the name of the XMLObject specialization
504  * @param namespaceURI      the XML namespace of the default associated element
505  * @param namespacePrefix   the XML namespace prefix of the default associated element
506  */
507 #define IMPL_ELEMENT_QNAME(cname,namespaceURI,namespacePrefix) \
508     xmltooling::QName cname::ELEMENT_QNAME(namespaceURI,cname::LOCAL_NAME,namespacePrefix)
509 
510 /**
511  * Implements a static variable holding an XMLObject's schema type QName.
512  *
513  * @param cname             the name of the XMLObject specialization
514  * @param namespaceURI      the XML namespace of the default associated element
515  * @param namespacePrefix   the XML namespace prefix of the default associated element
516  */
517 #define IMPL_TYPE_QNAME(cname,namespaceURI,namespacePrefix) \
518     xmltooling::QName cname::TYPE_QNAME(namespaceURI,cname::TYPE_NAME,namespacePrefix)
519 
520 /**
521  * Declares abstract set method for a typed XML attribute.
522  * The get method is omitted.
523  *
524  * @param proper    the proper name of the attribute
525  * @param upcased   the upcased name of the attribute
526  * @param type      the attribute's data type
527  */
528 #define DECL_INHERITED_XMLOBJECT_ATTRIB(proper,upcased,type) \
529     public: \
530         XMLTOOLING_DOXYGEN(proper attribute name) \
531         static const XMLCh upcased##_ATTRIB_NAME[]; \
532         XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
533         virtual void set##proper(const type* proper)=0
534 
535 /**
536  * Declares abstract get/set methods for a typed XML attribute.
537  *
538  * @param proper    the proper name of the attribute
539  * @param upcased   the upcased name of the attribute
540  * @param type      the attribute's data type
541  */
542 #define DECL_XMLOBJECT_ATTRIB(proper,upcased,type) \
543     public: \
544         XMLTOOLING_DOXYGEN(proper attribute name) \
545         static const XMLCh upcased##_ATTRIB_NAME[]; \
546         XMLTOOLING_DOXYGEN(Returns the proper attribute.) \
547         virtual const type* get##proper() const=0; \
548         XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
549         virtual void set##proper(const type* proper)=0
550 
551 /**
552  * Declares abstract set method for a string XML attribute.
553  * The get method is omitted.
554  *
555  * @param proper    the proper name of the attribute
556  * @param upcased   the upcased name of the attribute
557  */
558 #define DECL_INHERITED_STRING_ATTRIB(proper,upcased) \
559     DECL_INHERITED_XMLOBJECT_ATTRIB(proper,upcased,XMLCh)
560 
561 /**
562  * Declares abstract get/set methods for a string XML attribute.
563  *
564  * @param proper    the proper name of the attribute
565  * @param upcased   the upcased name of the attribute
566  */
567 #define DECL_STRING_ATTRIB(proper,upcased) \
568     DECL_XMLOBJECT_ATTRIB(proper,upcased,XMLCh)
569 
570 /**
571  * Declares abstract set method for a DateTime XML attribute.
572  * The get method is omitted.
573  *
574  * @param proper    the proper name of the attribute
575  * @param upcased   the upcased name of the attribute
576  */
577 #define DECL_INHERITED_DATETIME_ATTRIB(proper,upcased) \
578     DECL_INHERITED_XMLOBJECT_ATTRIB(proper,upcased,xercesc::XMLDateTime); \
579     XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
580     virtual void set##proper(time_t proper)=0; \
581     XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
582     virtual void set##proper(const XMLCh* proper)=0
583 
584 /**
585  * Declares abstract get/set methods for a DateTime XML attribute.
586  *
587  * @param proper    the proper name of the attribute
588  * @param upcased   the upcased name of the attribute
589  */
590 #define DECL_DATETIME_ATTRIB(proper,upcased) \
591     DECL_XMLOBJECT_ATTRIB(proper,upcased,xercesc::XMLDateTime); \
592     XMLTOOLING_DOXYGEN(Returns the proper attribute in epoch form.) \
593     virtual time_t get##proper##Epoch() const=0; \
594     XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
595     virtual void set##proper(time_t proper)=0; \
596     XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
597     virtual void set##proper(const XMLCh* proper)=0
598 
599 /**
600  * Declares abstract set method for an integer XML attribute.
601  * The get method is omitted.
602  *
603  * @param proper    the proper name of the attribute
604  * @param upcased   the upcased name of the attribute
605  */
606 #define DECL_INHERITED_INTEGER_ATTRIB(proper,upcased) \
607     public: \
608         XMLTOOLING_DOXYGEN(proper attribute name) \
609         static const XMLCh upcased##_ATTRIB_NAME[]; \
610         XMLTOOLING_DOXYGEN(Sets the proper attribute using a string value.) \
611         virtual void set##proper(const XMLCh* proper)=0; \
612         XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
613         virtual void set##proper(int proper)=0
614 
615 /**
616  * Declares abstract get/set methods for an integer XML attribute.
617  *
618  * @param proper    the proper name of the attribute
619  * @param upcased   the upcased name of the attribute
620  */
621 #define DECL_INTEGER_ATTRIB(proper,upcased) \
622     public: \
623         XMLTOOLING_DOXYGEN(proper attribute name) \
624         static const XMLCh upcased##_ATTRIB_NAME[]; \
625         XMLTOOLING_DOXYGEN(Returns the proper attribute after a NULL indicator.) \
626         virtual std::pair<bool,int> get##proper() const=0; \
627         XMLTOOLING_DOXYGEN(Sets the proper attribute using a string value.) \
628         virtual void set##proper(const XMLCh* proper)=0; \
629         XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
630         virtual void set##proper(int proper)=0
631 
632 /**
633  * Declares abstract get/set methods for a boolean XML attribute.
634  *
635  * @param proper    the proper name of the attribute
636  * @param upcased   the upcased name of the attribute
637  * @param def       the default/presumed value, if no explicit value has been set
638  */
639 #define DECL_BOOLEAN_ATTRIB(proper,upcased,def) \
640     public: \
641         XMLTOOLING_DOXYGEN(proper attribute name) \
642         static const XMLCh upcased##_ATTRIB_NAME[]; \
643         XMLTOOLING_DOXYGEN(Returns the proper attribute or def if not set.) \
644         bool proper() const { \
645             switch (get##proper()) { \
646                 case xmlconstants::XML_BOOL_TRUE: \
647                 case xmlconstants::XML_BOOL_ONE: \
648                     return true; \
649                 case xmlconstants::XML_BOOL_FALSE: \
650                 case xmlconstants::XML_BOOL_ZERO: \
651                     return false; \
652                 default: \
653                     return def; \
654             } \
655         } \
656         XMLTOOLING_DOXYGEN(Returns the proper attribute as an explicit enumerated value.) \
657         virtual xmlconstants::xmltooling_bool_t get##proper() const=0; \
658         XMLTOOLING_DOXYGEN(Sets the proper attribute using an enumerated value.) \
659         virtual void proper(xmlconstants::xmltooling_bool_t value)=0; \
660         XMLTOOLING_DOXYGEN(Sets the proper attribute.) \
661         void proper(bool value) { \
662             proper(value ? xmlconstants::XML_BOOL_ONE : xmlconstants::XML_BOOL_ZERO); \
663         } \
664         XMLTOOLING_DOXYGEN(Sets the proper attribute using a string constant.) \
665         void set##proper(const XMLCh* value) { \
666             if (value) { \
667                 switch (*value) { \
668                     case xercesc::chLatin_t: \
669                         proper(xmlconstants::XML_BOOL_TRUE); \
670                         break; \
671                     case xercesc::chLatin_f: \
672                         proper(xmlconstants::XML_BOOL_FALSE); \
673                         break; \
674                     case xercesc::chDigit_1: \
675                         proper(xmlconstants::XML_BOOL_ONE); \
676                         break; \
677                     case xercesc::chDigit_0: \
678                         proper(xmlconstants::XML_BOOL_ZERO); \
679                         break; \
680                     default: \
681                         proper(xmlconstants::XML_BOOL_NULL); \
682                 } \
683             } \
684             else \
685                 proper(xmlconstants::XML_BOOL_NULL); \
686         }
687 
688 /**
689  * Implements get/set methods and a private member for a typed XML attribute.
690  *
691  * @param proper    the proper name of the attribute
692  * @param type      the attribute's data type
693  */
694 #define IMPL_XMLOBJECT_ATTRIB(proper,type) \
695     protected: \
696         type* m_##proper; \
697     public: \
698         const type* get##proper() const { \
699             return m_##proper; \
700         } \
701         void set##proper(const type* proper) { \
702             m_##proper = prepareForAssignment(m_##proper,proper); \
703         }
704 
705 /**
706  * Implements get/set methods and a private member for a string XML attribute.
707  *
708  * @param proper    the proper name of the attribute
709  */
710 #define IMPL_STRING_ATTRIB(proper) \
711     IMPL_XMLOBJECT_ATTRIB(proper,XMLCh)
712 
713 /**
714  * Implements get/set methods and a private member for a string XML attribute,
715  * plus a getXMLID override.
716  *
717  * @param proper    the proper name of the attribute
718  */
719 #define IMPL_ID_ATTRIB(proper) \
720     IMPL_XMLOBJECT_ATTRIB(proper,XMLCh) \
721     const XMLCh* getXMLID() const { \
722         return m_##proper; \
723     }
724 
725 /**
726  * Implements get/set methods and a private member for a string XML attribute,
727  * plus a getXMLID override and attribute node clearance when DOM is dropped.
728  *
729  * @param proper    the proper name of the attribute
730  * @param ucase         the upcased name of the attribute
731  * @param namespaceURI  the XML namespace of the attribute
732  */
733 #define IMPL_ID_ATTRIB_EX(proper, ucase, namespaceURI) \
734     IMPL_XMLOBJECT_ATTRIB(proper,XMLCh) \
735     const XMLCh* getXMLID() const { \
736         return m_##proper; \
737     } \
738     void releaseDOM() const { \
739         if (getDOM()) \
740             getDOM()->removeAttributeNS(namespaceURI, ucase##_ATTRIB_NAME); \
741         AbstractDOMCachingXMLObject::releaseDOM(); \
742     }
743 
744 /**
745  * Implements get/set methods and a private member for a DateTime XML attribute.
746  *
747  * @param proper    the proper name of the attribute
748  * @param fallback  epoch to return when attribute is NULL
749  */
750 #define IMPL_DATETIME_ATTRIB(proper,fallback) \
751     IMPL_DATETIME_ATTRIB_EX(proper,fallback,false)
752 
753 /**
754  * Implements get/set methods and a private member for a duration-valued DateTime XML attribute.
755  *
756  * @param proper    the proper name of the attribute
757  * @param fallback  epoch to return when attribute is NULL
758  */
759 #define IMPL_DURATION_ATTRIB(proper,fallback) \
760     IMPL_DATETIME_ATTRIB_EX(proper,fallback,true)
761 
762 /**
763  * Implements get/set methods and a private member for a DateTime XML attribute.
764  *
765  * @param proper    the proper name of the attribute
766  * @param fallback  epoch to return when attribute is NULL
767  * @param duration  true iff the attribute should be handled as a duration
768  */
769 #define IMPL_DATETIME_ATTRIB_EX(proper,fallback,duration) \
770     protected: \
771         XMLDateTime* m_##proper; \
772         time_t m_##proper##Epoch; \
773     public: \
774         const XMLDateTime* get##proper() const { \
775             return m_##proper; \
776         } \
777         time_t get##proper##Epoch() const { \
778             return m_##proper ? m_##proper##Epoch : fallback; \
779         } \
780         void set##proper(const XMLDateTime* proper) { \
781             m_##proper = prepareForAssignment(m_##proper,proper); \
782             if (m_##proper) \
783                 m_##proper##Epoch=m_##proper->getEpoch(duration); \
784         } \
785         void set##proper(time_t proper) { \
786             m_##proper = prepareForAssignment(m_##proper,proper,duration); \
787             m_##proper##Epoch = proper; \
788         } \
789         void set##proper(const XMLCh* proper) { \
790             m_##proper = prepareForAssignment(m_##proper,proper,duration); \
791             if (m_##proper) \
792                 m_##proper##Epoch=m_##proper->getEpoch(duration); \
793         }
794 
795 /**
796  * Implements get/set methods and a private member for an integer XML attribute.
797  *
798  * @param proper    the proper name of the attribute
799  */
800 #define IMPL_INTEGER_ATTRIB(proper) \
801     protected: \
802         XMLCh* m_##proper; \
803     public: \
804         pair<bool,int> get##proper() const { \
805             if (m_##proper) { \
806                 try { \
807                     return std::make_pair(true, xercesc::XMLString::parseInt(m_##proper)); \
808                 } \
809                 catch (...) { \
810                     return std::make_pair(true, 0); \
811                 } \
812             } else { \
813                 return std::make_pair(false, 0); \
814             } \
815         } \
816         void set##proper(const XMLCh* proper) { \
817             m_##proper = prepareForAssignment(m_##proper,proper); \
818         } \
819         void set##proper(int proper) { \
820             try { \
821                 std::string buf(boost::lexical_cast<std::string>(proper)); \
822                 xmltooling::auto_ptr_XMLCh widen(buf.c_str()); \
823                 set##proper(widen.get()); \
824             } \
825             catch (boost::bad_lexical_cast&) { \
826             } \
827         }
828 
829 /**
830  * Implements get/set methods and a private member for a boolean XML attribute.
831  *
832  * @param proper    the proper name of the attribute
833  */
834 #define IMPL_BOOLEAN_ATTRIB(proper) \
835     protected: \
836         xmlconstants::xmltooling_bool_t m_##proper; \
837     public: \
838         xmlconstants::xmltooling_bool_t get##proper() const { \
839             return m_##proper; \
840         } \
841         void proper(xmlconstants::xmltooling_bool_t value) { \
842             if (m_##proper != value) { \
843                 releaseThisandParentDOM(); \
844                 m_##proper = value; \
845             } \
846         }
847 
848 /**
849  * Implements get/set methods and a private member for a typed, qualified XML attribute.
850  *
851  * @param proper    the proper name of the attribute
852  * @param type      the attribute's data type
853  */
854 #define IMPL_XMLOBJECT_FOREIGN_ATTRIB(proper,type) \
855     protected: \
856     XMLCh* m_##proper##Prefix; \
857         type* m_##proper; \
858     public: \
859         const type* get##proper() const { \
860             return m_##proper; \
861         } \
862         void set##proper(const type* proper) { \
863             m_##proper = prepareForAssignment(m_##proper,proper); \
864             xercesc::XMLString::release(&m_##proper##Prefix); \
865             m_##proper##Prefix = nullptr; \
866         }
867 
868 /**
869  * Declares abstract set method for a typed XML child object in a foreign namespace.
870  * The get method is omitted.
871  *
872  * @param proper    the proper name of the child type
873  * @param ns        the C++ namespace for the type
874  */
875 #define DECL_INHERITED_TYPED_FOREIGN_CHILD(proper,ns) \
876     public: \
877         XMLTOOLING_DOXYGEN(Sets the proper child.) \
878         virtual void set##proper(ns::proper* child)=0
879 
880 /**
881  * Declares abstract get/set methods for a typed XML child object in a foreign namespace.
882  *
883  * @param proper    the proper name of the child type
884  * @param ns        the C++ namespace for the type
885  */
886 #define DECL_TYPED_FOREIGN_CHILD(proper,ns) \
887     public: \
888         XMLTOOLING_DOXYGEN(Returns the proper child.) \
889         virtual ns::proper* get##proper() const=0; \
890         XMLTOOLING_DOXYGEN(Sets the proper child.) \
891         virtual void set##proper(ns::proper* child)=0
892 
893 /**
894  * Declares abstract set method for a typed XML child object.
895  * The get method is omitted.
896  *
897  * @param proper    the proper name of the child type
898  */
899 #define DECL_INHERITED_TYPED_CHILD(proper) \
900     public: \
901         XMLTOOLING_DOXYGEN(Sets the proper child.) \
902         virtual void set##proper(proper* child)=0
903 
904 /**
905  * Declares abstract get/set methods for a typed XML child object.
906  *
907  * @param proper    the proper name of the child type
908  */
909 #define DECL_TYPED_CHILD(proper) \
910     public: \
911         XMLTOOLING_DOXYGEN(Returns the proper child.) \
912         virtual proper* get##proper() const=0; \
913         XMLTOOLING_DOXYGEN(Sets the proper child.) \
914         virtual void set##proper(proper* child)=0
915 
916 /**
917  * Declares abstract get/set methods for a generic XML child object.
918  *
919  * @param proper    the proper name of the child
920  */
921 #define DECL_XMLOBJECT_CHILD(proper) \
922     public: \
923         XMLTOOLING_DOXYGEN(Returns the proper child.) \
924         virtual xmltooling::XMLObject* get##proper() const=0; \
925         XMLTOOLING_DOXYGEN(Sets the proper child.) \
926         virtual void set##proper(xmltooling::XMLObject* child)=0
927 
928 
929 /**
930  * Implements get/set methods and a private list iterator member for a typed XML child object.
931  *
932  * @param proper    the proper name of the child type
933  */
934 #define IMPL_TYPED_CHILD(proper) \
935     protected: \
936         proper* m_##proper; \
937         std::list<xmltooling::XMLObject*>::iterator m_pos_##proper; \
938     public: \
939         proper* get##proper() const { \
940             return m_##proper; \
941         } \
942         void set##proper(proper* child) { \
943             prepareForAssignment(m_##proper,child); \
944             *m_pos_##proper = m_##proper = child; \
945         }
946 
947 /**
948  * Implements get/set methods and a private list iterator member for
949  * a typed XML child object in a foreign namespace
950  *
951  * @param proper    the proper name of the child type
952  * @param ns        the C++ namespace for the type
953  */
954 #define IMPL_TYPED_FOREIGN_CHILD(proper,ns) \
955     protected: \
956         ns::proper* m_##proper; \
957         std::list<xmltooling::XMLObject*>::iterator m_pos_##proper; \
958     public: \
959         ns::proper* get##proper() const { \
960             return m_##proper; \
961         } \
962         void set##proper(ns::proper* child) { \
963             prepareForAssignment(m_##proper,child); \
964             *m_pos_##proper = m_##proper = child; \
965         }
966 
967 /**
968  * Implements get/set methods and a private list iterator member for a generic XML child object.
969  *
970  * @param proper    the proper name of the child
971  */
972 #define IMPL_XMLOBJECT_CHILD(proper) \
973     protected: \
974         xmltooling::XMLObject* m_##proper; \
975         std::list<xmltooling::XMLObject*>::iterator m_pos_##proper; \
976     public: \
977         xmltooling::XMLObject* get##proper() const { \
978             return m_##proper; \
979         } \
980         void set##proper(xmltooling::XMLObject* child) { \
981             prepareForAssignment(m_##proper,child); \
982             *m_pos_##proper = m_##proper = child; \
983         }
984 
985 /**
986  * Declares abstract get/set methods for a typed XML child collection.
987  *
988  * @param proper    the proper name of the child type
989  */
990 #define DECL_TYPED_CHILDREN(proper) \
991     public: \
992         XMLTOOLING_DOXYGEN(Returns modifiable proper collection.) \
993         virtual VectorOf(proper) get##proper##s()=0; \
994         XMLTOOLING_DOXYGEN(Returns reference to immutable proper collection.) \
995         virtual const std::vector<proper*>& get##proper##s() const=0
996 
997 /**
998  * Declares abstract get/set methods for a typed XML child collection in a foreign namespace.
999  *
1000  * @param proper    the proper name of the child type
1001  * @param ns        the C++ namespace for the type
1002  */
1003 #define DECL_TYPED_FOREIGN_CHILDREN(proper,ns) \
1004     public: \
1005         XMLTOOLING_DOXYGEN(Returns modifiable proper collection.) \
1006         virtual VectorOf(ns::proper) get##proper##s()=0; \
1007         XMLTOOLING_DOXYGEN(Returns reference to immutable proper collection.) \
1008         virtual const std::vector<ns::proper*>& get##proper##s() const=0
1009 
1010 /**
1011  * Declares abstract get/set methods for a generic XML child collection.
1012  *
1013  * @param proper    the proper name of the child
1014  */
1015 #define DECL_XMLOBJECT_CHILDREN(proper) \
1016     public: \
1017         XMLTOOLING_DOXYGEN(Returns modifiable proper collection.) \
1018         virtual VectorOf(xmltooling::XMLObject) get##proper##s()=0; \
1019         XMLTOOLING_DOXYGEN(Returns reference to immutable proper collection.) \
1020         virtual const std::vector<xmltooling::XMLObject*>& get##proper##s() const=0
1021 
1022 /**
1023  * Implements get method and a private vector member for a typed XML child collection.
1024  *
1025  * @param proper    the proper name of the child type
1026  * @param fence     insertion fence for new objects of the child collection in backing list
1027  */
1028 #define IMPL_TYPED_CHILDREN(proper,fence) \
1029     protected: \
1030         std::vector<proper*> m_##proper##s; \
1031     public: \
1032         VectorOf(proper) get##proper##s() { \
1033             return VectorOf(proper)(this, m_##proper##s, &m_children, fence); \
1034         } \
1035         const std::vector<proper*>& get##proper##s() const { \
1036             return m_##proper##s; \
1037         }
1038 
1039 /**
1040  * Implements get method and a private vector member for a typed XML child collection
1041  * in a foreign namespace.
1042  *
1043  * @param proper    the proper name of the child type
1044  * @param ns        the C++ namespace for the type
1045  * @param fence     insertion fence for new objects of the child collection in backing list
1046  */
1047 #define IMPL_TYPED_FOREIGN_CHILDREN(proper,ns,fence) \
1048     protected: \
1049         std::vector<ns::proper*> m_##proper##s; \
1050     public: \
1051         VectorOf(ns::proper) get##proper##s() { \
1052             return VectorOf(ns::proper)(this, m_##proper##s, &m_children, fence); \
1053         } \
1054         const std::vector<ns::proper*>& get##proper##s() const { \
1055             return m_##proper##s; \
1056         }
1057 
1058 /**
1059  * Implements get method and a private vector member for a generic XML child collection.
1060  *
1061  * @param proper    the proper name of the child
1062  * @param fence     insertion fence for new objects of the child collection in backing list
1063  */
1064 #define IMPL_XMLOBJECT_CHILDREN(proper,fence) \
1065     protected: \
1066         std::vector<xmltooling::XMLObject*> m_##proper##s; \
1067     public: \
1068         VectorOf(xmltooling::XMLObject) get##proper##s() { \
1069             return VectorOf(xmltooling::XMLObject)(this, m_##proper##s, &m_children, fence); \
1070         } \
1071         const std::vector<xmltooling::XMLObject*>& get##proper##s() const { \
1072             return m_##proper##s; \
1073         }
1074 
1075 /**
1076  * Implements marshalling for a string attribute
1077  *
1078  * @param proper        the proper name of the attribute
1079  * @param ucase         the upcased name of the attribute
1080  * @param namespaceURI  the XML namespace of the attribute
1081  */
1082 #define MARSHALL_STRING_ATTRIB(proper,ucase,namespaceURI) \
1083     if (m_##proper && *m_##proper) { \
1084         domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
1085     }
1086 
1087 /**
1088  * Implements marshalling for a DateTime attribute
1089  *
1090  * @param proper        the proper name of the attribute
1091  * @param ucase         the upcased name of the attribute
1092  * @param namespaceURI  the XML namespace of the attribute
1093  */
1094 #define MARSHALL_DATETIME_ATTRIB(proper,ucase,namespaceURI) \
1095     if (m_##proper) { \
1096         domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper->getRawData()); \
1097     }
1098 
1099 /**
1100  * Implements marshalling for an integer attribute
1101  *
1102  * @param proper        the proper name of the attribute
1103  * @param ucase         the upcased name of the attribute
1104  * @param namespaceURI  the XML namespace of the attribute
1105  */
1106 #define MARSHALL_INTEGER_ATTRIB(proper,ucase,namespaceURI) \
1107     if (m_##proper && *m_##proper) { \
1108         domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
1109     }
1110 
1111 /**
1112  * Implements marshalling for a boolean attribute
1113  *
1114  * @param proper        the proper name of the attribute
1115  * @param ucase         the upcased name of the attribute
1116  * @param namespaceURI  the XML namespace of the attribute
1117  */
1118 #define MARSHALL_BOOLEAN_ATTRIB(proper,ucase,namespaceURI) \
1119     switch (m_##proper) { \
1120         case xmlconstants::XML_BOOL_TRUE: \
1121             domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_TRUE); \
1122             break; \
1123         case xmlconstants::XML_BOOL_ONE: \
1124             domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_ONE); \
1125             break; \
1126         case xmlconstants::XML_BOOL_FALSE: \
1127             domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_FALSE); \
1128             break; \
1129         case xmlconstants::XML_BOOL_ZERO: \
1130             domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, xmlconstants::XML_ZERO); \
1131             break; \
1132         case xmlconstants::XML_BOOL_NULL: \
1133             break; \
1134     }
1135 
1136 /**
1137  * Implements marshalling for a QName attribute
1138  *
1139  * @param proper        the proper name of the attribute
1140  * @param ucase         the upcased name of the attribute
1141  * @param namespaceURI  the XML namespace of the attribute
1142  */
1143 #define MARSHALL_QNAME_ATTRIB(proper,ucase,namespaceURI) \
1144     if (m_##proper) { \
1145         xmltooling::auto_ptr_XMLCh qstr(m_##proper->toString().c_str()); \
1146         domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, qstr.get()); \
1147     }
1148 
1149 /**
1150  * Implements marshalling for an ID attribute
1151  *
1152  * @param proper        the proper name of the attribute
1153  * @param ucase         the upcased name of the attribute
1154  * @param namespaceURI  the XML namespace of the attribute
1155  */
1156 # define MARSHALL_ID_ATTRIB(proper,ucase,namespaceURI) \
1157     if (m_##proper && *m_##proper) { \
1158         domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
1159         domElement->setIdAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, true); \
1160     }
1161 
1162 /**
1163  * Implements unmarshalling process branch for a string attribute
1164  *
1165  * @param proper        the proper name of the attribute
1166  * @param ucase         the upcased name of the attribute
1167  * @param namespaceURI  the XML namespace of the attribute
1168  */
1169 #define PROC_STRING_ATTRIB(proper,ucase,namespaceURI) \
1170     if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \
1171         set##proper(attribute->getValue()); \
1172         return; \
1173     }
1174 
1175 /**
1176  * Implements unmarshalling process branch for an ID attribute
1177  *
1178  * @param proper        the proper name of the attribute
1179  * @param ucase         the upcased name of the attribute
1180  * @param namespaceURI  the XML namespace of the attribute
1181  */
1182 # define PROC_ID_ATTRIB(proper,ucase,namespaceURI) \
1183     if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \
1184         set##proper(attribute->getValue()); \
1185         attribute->getOwnerElement()->setIdAttributeNode(attribute, true); \
1186         return; \
1187     }
1188 
1189 /**
1190  * Implements unmarshalling process branch for a DateTime attribute
1191  *
1192  * @param proper        the proper name of the attribute
1193  * @param ucase         the upcased name of the attribute
1194  * @param namespaceURI  the XML namespace of the attribute
1195  */
1196 #define PROC_DATETIME_ATTRIB(proper,ucase,namespaceURI) \
1197     PROC_STRING_ATTRIB(proper,ucase,namespaceURI)
1198 
1199 /**
1200  * Implements unmarshalling process branch for a DateTime attribute
1201  *
1202  * @param proper        the proper name of the attribute
1203  * @param ucase         the upcased name of the attribute
1204  * @param namespaceURI  the XML namespace of the attribute
1205  */
1206 #define PROC_QNAME_ATTRIB(proper,ucase,namespaceURI) \
1207     if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \
1208         boost::scoped_ptr<xmltooling::QName> q(xmltooling::XMLHelper::getNodeValueAsQName(attribute)); \
1209         set##proper(q.get()); \
1210         return; \
1211     }
1212 
1213 /**
1214  * Implements unmarshalling process branch for an integer attribute
1215  *
1216  * @param proper        the proper name of the attribute
1217  * @param ucase         the upcased name of the attribute
1218  * @param namespaceURI  the XML namespace of the attribute
1219  */
1220 #define PROC_INTEGER_ATTRIB(proper,ucase,namespaceURI) \
1221     PROC_STRING_ATTRIB(proper,ucase,namespaceURI)
1222 
1223 /**
1224  * Implements unmarshalling process branch for a boolean attribute
1225  *
1226  * @param proper        the proper name of the attribute
1227  * @param ucase         the upcased name of the attribute
1228  * @param namespaceURI  the XML namespace of the attribute
1229  */
1230 #define PROC_BOOLEAN_ATTRIB(proper,ucase,namespaceURI) \
1231     PROC_STRING_ATTRIB(proper,ucase,namespaceURI)
1232 
1233 /**
1234  * Implements unmarshalling process branch for typed child collection element
1235  *
1236  * @param proper        the proper name of the child type
1237  * @param namespaceURI  the XML namespace of the child element
1238  * @param force         bypass use of hint and just cast down to check child
1239  */
1240 #define PROC_TYPED_CHILDREN(proper,namespaceURI,force) \
1241     if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \
1242         proper* typesafe=dynamic_cast<proper*>(childXMLObject); \
1243         if (typesafe) { \
1244             get##proper##s().push_back(typesafe); \
1245             return; \
1246         } \
1247     }
1248 
1249 /**
1250  * Implements unmarshalling process branch for typed child collection element
1251  * in a foreign namespace.
1252  *
1253  * @param proper        the proper name of the child type
1254  * @param ns            the C++ namespace for the type
1255  * @param namespaceURI  the XML namespace of the child element
1256  * @param force         bypass use of hint and just cast down to check child
1257  */
1258 #define PROC_TYPED_FOREIGN_CHILDREN(proper,ns,namespaceURI,force) \
1259     if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,ns::proper::LOCAL_NAME)) { \
1260         ns::proper* typesafe=dynamic_cast<ns::proper*>(childXMLObject); \
1261         if (typesafe) { \
1262             get##proper##s().push_back(typesafe); \
1263             return; \
1264         } \
1265     }
1266 
1267 /**
1268  * Implements unmarshalling process branch for typed child singleton element
1269  *
1270  * @param proper        the proper name of the child type
1271  * @param namespaceURI  the XML namespace of the child element
1272  * @param force         bypass use of hint and just cast down to check child
1273  */
1274 #define PROC_TYPED_CHILD(proper,namespaceURI,force) \
1275     if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \
1276         proper* typesafe=dynamic_cast<proper*>(childXMLObject); \
1277         if (typesafe && !m_##proper) { \
1278             typesafe->setParent(this); \
1279             *m_pos_##proper = m_##proper = typesafe; \
1280             return; \
1281         } \
1282     }
1283 
1284 /**
1285  * Implements unmarshalling process branch for typed child singleton element
1286  * in a foreign namespace.
1287  *
1288  * @param proper        the proper name of the child type
1289  * @param ns            the C++ namespace for the type
1290  * @param namespaceURI  the XML namespace of the child element
1291  * @param force         bypass use of hint and just cast down to check child
1292  */
1293 #define PROC_TYPED_FOREIGN_CHILD(proper,ns,namespaceURI,force) \
1294     if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,ns::proper::LOCAL_NAME)) { \
1295         ns::proper* typesafe=dynamic_cast<ns::proper*>(childXMLObject); \
1296         if (typesafe && !m_##proper) { \
1297             typesafe->setParent(this); \
1298             *m_pos_##proper = m_##proper = typesafe; \
1299             return; \
1300         } \
1301     }
1302 
1303 /**
1304  * Implements unmarshalling process branch for a generic child singleton element
1305  *
1306  * @param proper        the proper name of the child type
1307  * @param namespaceURI  the XML namespace of the child element
1308  */
1309 #define PROC_XMLOBJECT_CHILD(proper,namespaceURI) \
1310     if (xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \
1311         if (!m_##proper) { \
1312             childXMLObject->setParent(this); \
1313             *m_pos_##proper = m_##proper = childXMLObject; \
1314             return; \
1315         } \
1316     }
1317 
1318 /**
1319  * Declares aliased get/set methods for named XML element simple content.
1320  *
1321  * @param proper    the proper name to label the element's content
1322  */
1323 #define DECL_SIMPLE_CONTENT(proper) \
1324     XMLTOOLING_DOXYGEN(Returns proper.) \
1325     const XMLCh* get##proper() const { \
1326         return getTextContent(); \
1327     } \
1328     XMLTOOLING_DOXYGEN(Sets or clears proper.) \
1329     void set##proper(const XMLCh* proper) { \
1330         setTextContent(proper); \
1331     }
1332 
1333 /**
1334  * Declares aliased get/set methods for named integer XML element content.
1335  *
1336  * @param proper    the proper name to label the element's content
1337  */
1338 #define DECL_INTEGER_CONTENT(proper) \
1339     XMLTOOLING_DOXYGEN(Returns proper in integer form after a NULL indicator.) \
1340     std::pair<bool,int> get##proper() const { \
1341         if (getTextContent()) { \
1342             try { \
1343                 return std::make_pair(true, xercesc::XMLString::parseInt(getTextContent())); \
1344             } \
1345             catch (...) { \
1346                 return std::make_pair(true, 0); \
1347             } \
1348         } else { \
1349             return std::make_pair(false, 0); \
1350         } \
1351     } \
1352     XMLTOOLING_DOXYGEN(Sets proper.) \
1353     void set##proper(int proper) { \
1354         try { \
1355             std::string buf(boost::lexical_cast<std::string>(proper)); \
1356             xmltooling::auto_ptr_XMLCh widen(buf.c_str()); \
1357             setTextContent(widen.get()); \
1358         } \
1359         catch (boost::bad_lexical_cast&) { \
1360         } \
1361     } \
1362     XMLTOOLING_DOXYGEN(Sets or clears proper.) \
1363     void set##proper(const XMLCh* proper) { \
1364         setTextContent(proper); \
1365     }
1366 
1367 /**
1368  * Implements cloning methods for an XMLObject specialization implementation class.
1369  *
1370  * @param cname the name of the XMLObject specialization
1371  */
1372 #define IMPL_XMLOBJECT_CLONE(cname) \
1373     cname* clone##cname() const { \
1374         return dynamic_cast<cname*>(clone()); \
1375     } \
1376     xmltooling::XMLObject* clone() const { \
1377         std::auto_ptr<xmltooling::XMLObject> domClone(xmltooling::AbstractDOMCachingXMLObject::clone()); \
1378         cname##Impl* ret=dynamic_cast<cname##Impl*>(domClone.get()); \
1379         if (ret) \
1380             return domClone.release(); \
1381         return new cname##Impl(*this); \
1382     }
1383 
1384 /**
1385  * Implements cloning methods for an XMLObject specialization implementation class
1386  * that must override a base class clone method.
1387  *
1388  * @param cname the name of the XMLObject specialization
1389  * @param base  name of base type.
1390  */
1391 #define IMPL_XMLOBJECT_CLONE2(cname,base) \
1392     cname* clone##cname() const { \
1393         return dynamic_cast<cname*>(clone()); \
1394     } \
1395     base* clone##base() const { \
1396         return dynamic_cast<base*>(clone()); \
1397     } \
1398     xmltooling::XMLObject* clone() const { \
1399         std::auto_ptr<xmltooling::XMLObject> domClone(xmltooling::AbstractDOMCachingXMLObject::clone()); \
1400         cname##Impl* ret=dynamic_cast<cname##Impl*>(domClone.get()); \
1401         if (ret) \
1402             return domClone.release(); \
1403         return new cname##Impl(*this); \
1404     }
1405 
1406 /**
1407  * Implements cloning methods for an XMLObject specialization implementation class that
1408  * needs two stage duplication to avoid invoking virtual methods during construction.
1409  *
1410  * @param cname the name of the XMLObject specialization
1411  */
1412 #define IMPL_XMLOBJECT_CLONE_EX(cname) \
1413     cname* clone##cname() const { \
1414         return dynamic_cast<cname*>(clone()); \
1415     } \
1416     xmltooling::XMLObject* clone() const { \
1417         std::auto_ptr<xmltooling::XMLObject> domClone(xmltooling::AbstractDOMCachingXMLObject::clone()); \
1418         cname##Impl* ret=dynamic_cast<cname##Impl*>(domClone.get()); \
1419         if (ret) \
1420             return domClone.release(); \
1421         std::auto_ptr<cname##Impl> ret2(new cname##Impl(*this)); \
1422         ret2->_clone(*this); \
1423         return ret2.release(); \
1424     }
1425 
1426 /**
1427  * Implements cloning methods for an XMLObject specialization implementation class that
1428  * needs two stage duplication to avoid invoking virtual methods during construction,
1429  * and must override a base class clone method.
1430  *
1431  * @param cname the name of the XMLObject specialization
1432  * @param base  name of base type
1433  */
1434 #define IMPL_XMLOBJECT_CLONE_EX2(cname,base) \
1435     cname* clone##cname() const { \
1436         return dynamic_cast<cname*>(clone()); \
1437     } \
1438     base* clone##base() const { \
1439         return dynamic_cast<base*>(clone()); \
1440     } \
1441     xmltooling::XMLObject* clone() const { \
1442         std::auto_ptr<xmltooling::XMLObject> domClone(xmltooling::AbstractDOMCachingXMLObject::clone()); \
1443         cname##Impl* ret=dynamic_cast<cname##Impl*>(domClone.get()); \
1444         if (ret) \
1445             return domClone.release(); \
1446         std::auto_ptr<cname##Impl> ret2(new cname##Impl(*this)); \
1447         ret2->_clone(*this); \
1448         return ret2.release(); \
1449     }
1450 
1451 /**
1452  * Implements cloning of a child attribute, for use in copy constructor or
1453  * deferred clone methods.
1454  *
1455  * proper   the proper name of the attribute to clone
1456  */
1457 #define IMPL_CLONE_ATTRIB(proper) \
1458     set##proper(src.get##proper())
1459 
1460 /**
1461  * Implements cloning of a child attribute in a foreign namespace, for use in copy constructor or
1462  * deferred clone methods.
1463  *
1464  * proper   the proper name of the attribute to clone
1465  */
1466 #define IMPL_CLONE_FOREIGN_ATTRIB(proper) \
1467     set##proper(src.get##proper()); \
1468     if (src.m_##proper##Prefix) \
1469         m_##proper##Prefix = xercesc::XMLString::replicate(src.m_##proper##Prefix)
1470 
1471 /**
1472  * Implements cloning of an integer child attribute, for use in copy constructor or
1473  * deferred clone methods.
1474  *
1475  * proper   the proper name of the attribute to clone
1476  */
1477 #define IMPL_CLONE_INTEGER_ATTRIB(proper) \
1478     set##proper(src.m_##proper)
1479 
1480 /**
1481  * Implements cloning of a boolean child attribute, for use in copy constructor or
1482  * deferred clone methods.
1483  *
1484  * proper   the proper name of the attribute to clone
1485  */
1486 #define IMPL_CLONE_BOOLEAN_ATTRIB(proper) \
1487     proper(src.m_##proper)
1488 
1489 /**
1490  * Implements cloning of a child object, for use in copy constructor or
1491  * deferred clone methods.
1492  *
1493  * proper   the proper name of the child object to clone
1494  */
1495 #define IMPL_CLONE_XMLOBJECT_CHILD(proper) \
1496     if (src.get##proper()) \
1497         set##proper(src.get##proper()->clone())
1498 
1499 /**
1500  * Implements cloning of a typed child object, for use in copy constructor or
1501  * deferred clone methods.
1502  *
1503  * proper   the proper name of the child type to clone
1504  */
1505 #define IMPL_CLONE_TYPED_CHILD(proper) \
1506     if (src.get##proper()) \
1507         set##proper(src.get##proper()->clone##proper())
1508 
1509 /**
1510  * Implements cloning of an untyped child collection, for use in copy constructor or
1511  * deferred clone methods.
1512  *
1513  * proper   the proper name of the child type to clone
1514  */
1515 #define IMPL_CLONE_XMLOBJECT_CHILDREN(proper) \
1516     static void (VectorOf(XMLObject)::* XMLObject_push_back)(XMLObject* const&) = &VectorOf(XMLObject)::push_back; \
1517     VectorOf(XMLObject) c##proper = get##proper##s(); \
1518     std::for_each( \
1519         src.m_##proper##s.begin(), src.m_##proper##s.end(), \
1520         boost::lambda::if_(boost::lambda::_1 != ((XMLObject*)nullptr)) \
1521             [boost::lambda::bind(XMLObject_push_back, boost::ref(c##proper), boost::lambda::bind(&XMLObject::clone, boost::lambda::_1))] \
1522         )
1523 
1524 /**
1525  * Implements cloning of a child collection, for use in copy constructor or
1526  * deferred clone methods.
1527  *
1528  * proper   the proper name of the child type to clone
1529  */
1530 #define IMPL_CLONE_TYPED_CHILDREN(proper) \
1531     static void (VectorOf(proper)::* proper##_push_back)(proper* const&) = &VectorOf(proper)::push_back; \
1532     VectorOf(proper) c##proper = get##proper##s(); \
1533     std::for_each( \
1534         src.m_##proper##s.begin(), src.m_##proper##s.end(), \
1535         boost::lambda::if_(boost::lambda::_1 != ((proper*)nullptr)) \
1536             [boost::lambda::bind(proper##_push_back, boost::ref(c##proper), boost::lambda::bind(&proper::clone##proper, boost::lambda::_1))] \
1537         )
1538 
1539 /**
1540  * Implements cloning of a child collection in a foreign namespace, for use in copy constructor or
1541  * deferred clone methods.
1542  *
1543  * proper   the proper name of the child type to clone
1544  * ns       the namespace of the child type
1545  */
1546 #define IMPL_CLONE_TYPED_FOREIGN_CHILDREN(proper,ns) \
1547     static void (VectorOf(ns::proper)::* proper##_push_back)(ns::proper* const&) = &VectorOf(ns::proper)::push_back; \
1548     VectorOf(ns::proper) c##proper = get##proper##s(); \
1549     std::for_each( \
1550         src.m_##proper##s.begin(), src.m_##proper##s.end(), \
1551         boost::lambda::if_(boost::lambda::_1 != ((ns::proper*)nullptr)) \
1552             [boost::lambda::bind(proper##_push_back, boost::ref(c##proper), boost::lambda::bind(&ns::proper::clone##proper, boost::lambda::_1))] \
1553         )
1554 
1555 /**
1556  * Opens an iteration loop over all of the children of an object.
1557  */
1558 #define IMPL_CLONE_CHILDBAG_BEGIN \
1559     for (list<xmltooling::XMLObject*>::const_iterator _bagit = src.m_children.begin(); _bagit != src.m_children.end(); ++_bagit) {
1560 
1561 /**
1562  * Closes an iteration loop over all of the children of an object.
1563  */
1564 #define IMPL_CLONE_CHILDBAG_END }
1565 
1566 /**
1567  * Implements cloning of a typed child in a bag iteration loop based on a cast check.
1568  *
1569  * @param proper    the proper name of the child type to clone
1570  */
1571 #define IMPL_CLONE_TYPED_CHILD_IN_BAG(proper) \
1572     proper* _##proper##cast = dynamic_cast<proper*>(*_bagit); \
1573     if (_##proper##cast) { \
1574         get##proper##s().push_back(_##proper##cast->clone##proper()); \
1575         continue; \
1576     }
1577 
1578 /**
1579  * Implements cloning of a typed child in a forign namespace in a bag iteration loop based on a cast check.
1580  *
1581  * @param proper    the proper name of the child type to clone
1582  * @param ns        the namespace of the child type
1583  */
1584 #define IMPL_CLONE_TYPED_FOREIGN_CHILD_IN_BAG(proper,ns) \
1585     ns::proper* _##proper##cast = dynamic_cast<ns::proper*>(*_bagit); \
1586     if (_##proper##cast) { \
1587         get##proper##s().push_back(_##proper##cast->clone##proper()); \
1588         continue; \
1589     }
1590 
1591 /**
1592  * Implements cloning of an XMLObject child in a bag iteration loop.
1593  *
1594  * @param proper    the proper name of the child to clone
1595  */
1596 #define IMPL_CLONE_XMLOBJECT_CHILD_IN_BAG(proper) \
1597     if (*_bagit) { \
1598         get##proper##s().push_back((*_bagit)->clone()); \
1599     }
1600 
1601 /**
1602  * Declares an XMLObject specialization with a simple content model and type,
1603  * handling it as string data.
1604  *
1605  * @param linkage   linkage specifier for the class
1606  * @param cname     the name of the XMLObject specialization
1607  * @param proper    the proper name to label the element's content
1608  * @param desc      documentation for class
1609  */
1610 #define DECL_XMLOBJECT_SIMPLE(linkage,cname,proper,desc) \
1611     BEGIN_XMLOBJECT(linkage,cname,xmltooling::XMLObject,desc); \
1612         DECL_SIMPLE_CONTENT(proper); \
1613     END_XMLOBJECT
1614 
1615 /**
1616  * Declares and defines an implementation class for an XMLObject with
1617  * a simple content model and type, handling it as string data.
1618  *
1619  * @param linkage   linkage specifier for the class
1620  * @param cname     the name of the XMLObject specialization
1621  */
1622 #define DECL_XMLOBJECTIMPL_SIMPLE(linkage,cname) \
1623     class linkage cname##Impl \
1624         : public virtual cname, \
1625             public xmltooling::AbstractSimpleElement, \
1626             public xmltooling::AbstractDOMCachingXMLObject, \
1627             public xmltooling::AbstractXMLObjectMarshaller, \
1628             public xmltooling::AbstractXMLObjectUnmarshaller \
1629     { \
1630     public: \
1631         virtual ~cname##Impl() {} \
1632         cname##Impl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) \
1633             : xmltooling::AbstractXMLObject(nsURI, localName, prefix, schemaType) { \
1634         } \
1635         cname##Impl(const cname##Impl& src) \
1636             : xmltooling::AbstractXMLObject(src), \
1637                 xmltooling::AbstractSimpleElement(src), \
1638                 xmltooling::AbstractDOMCachingXMLObject(src) {} \
1639         IMPL_XMLOBJECT_CLONE(cname) \
1640     }
1641 
1642 #ifdef HAVE_COVARIANT_RETURNS
1643 
1644 /**
1645  * Begins the declaration of an XMLObjectBuilder specialization.
1646  * Basic boilerplate includes an empty virtual destructor, and
1647  * a default builder that defaults the element name.
1648  *
1649  * @param linkage           linkage specifier for the class
1650  * @param cname             the name of the XMLObject specialization
1651  * @param namespaceURI      the XML namespace of the default associated element
1652  * @param namespacePrefix   the XML namespace prefix of the default associated element
1653  */
1654 #define BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
1655     XMLTOOLING_DOXYGEN(Builder for cname objects.) \
1656     class linkage cname##Builder : public xmltooling::ConcreteXMLObjectBuilder { \
1657     public: \
1658         virtual ~cname##Builder() {} \
1659         XMLTOOLING_DOXYGEN(Default builder.) \
1660         virtual cname* buildObject() const { \
1661             return buildObject(namespaceURI,cname::LOCAL_NAME,namespacePrefix); \
1662         } \
1663         XMLTOOLING_DOXYGEN(Builder that allows element/type override.) \
1664         virtual cname* buildObject( \
1665             const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr \
1666             ) const
1667 
1668 /**
1669  * Ends the declaration of an XMLObjectBuilder specialization.
1670  */
1671 #define END_XMLOBJECTBUILDER }
1672 
1673 /**
1674  * Declares a generic XMLObjectBuilder specialization.
1675  *
1676  * @param linkage           linkage specifier for the class
1677  * @param cname             the name of the XMLObject specialization
1678  * @param namespaceURI      the XML namespace of the default associated element
1679  * @param namespacePrefix   the XML namespace prefix of the default associated element
1680  */
1681  #define DECL_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
1682     BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix); \
1683     XMLTOOLING_DOXYGEN(Singleton builder.) \
1684     static cname* build##cname() { \
1685         const cname##Builder* b = dynamic_cast<const cname##Builder*>( \
1686             XMLObjectBuilder::getBuilder(xmltooling::QName(namespaceURI,cname::LOCAL_NAME)) \
1687             ); \
1688         if (b) \
1689             return b->buildObject(); \
1690         throw xmltooling::XMLObjectException("Unable to obtain typed builder for "#cname"."); \
1691     } \
1692     END_XMLOBJECTBUILDER
1693 
1694 /**
1695  * Implements the standard XMLObjectBuilder specialization function.
1696  *
1697  * @param cname the name of the XMLObject specialization
1698  */
1699 #define IMPL_XMLOBJECTBUILDER(cname) \
1700     cname* cname##Builder::buildObject( \
1701         const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType \
1702         ) const \
1703     { \
1704         return new cname##Impl(nsURI,localName,prefix,schemaType); \
1705     }
1706 
1707 #else   /* !HAVE_COVARIANT_RETURNS */
1708 
1709 /**
1710  * Begins the declaration of an XMLObjectBuilder specialization.
1711  * Basic boilerplate includes an empty virtual destructor, and
1712  * a default builder that defaults the element name.
1713  *
1714  * @param linkage           linkage specifier for the class
1715  * @param cname             the name of the XMLObject specialization
1716  * @param namespaceURI      the XML namespace of the default associated element
1717  * @param namespacePrefix   the XML namespace prefix of the default associated element
1718  */
1719 #define BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
1720     XMLTOOLING_DOXYGEN(Builder for cname objects.) \
1721     class linkage cname##Builder : public xmltooling::ConcreteXMLObjectBuilder { \
1722     public: \
1723         virtual ~cname##Builder() {} \
1724         XMLTOOLING_DOXYGEN(Default builder.) \
1725         virtual xmltooling::XMLObject* buildObject() const { \
1726             return buildObject(namespaceURI,cname::LOCAL_NAME,namespacePrefix); \
1727         } \
1728         XMLTOOLING_DOXYGEN(Builder that allows element/type override.) \
1729         virtual xmltooling::XMLObject* buildObject( \
1730             const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix=nullptr, const xmltooling::QName* schemaType=nullptr \
1731             ) const
1732 
1733 /**
1734  * Ends the declaration of an XMLObjectBuilder specialization.
1735  */
1736 #define END_XMLOBJECTBUILDER }
1737 
1738 /**
1739  * Declares a generic XMLObjectBuilder specialization.
1740  *
1741  * @param linkage           linkage specifier for the class
1742  * @param cname             the name of the XMLObject specialization
1743  * @param namespaceURI      the XML namespace of the default associated element
1744  * @param namespacePrefix   the XML namespace prefix of the default associated element
1745  */
1746  #define DECL_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix) \
1747     BEGIN_XMLOBJECTBUILDER(linkage,cname,namespaceURI,namespacePrefix); \
1748     XMLTOOLING_DOXYGEN(Singleton builder.) \
1749     static cname* build##cname() { \
1750         const cname##Builder* b = dynamic_cast<const cname##Builder*>( \
1751             XMLObjectBuilder::getBuilder(xmltooling::QName(namespaceURI,cname::LOCAL_NAME)) \
1752             ); \
1753         if (b) \
1754             return dynamic_cast<cname*>(b->buildObject()); \
1755         throw xmltooling::XMLObjectException("Unable to obtain typed builder for "#cname"."); \
1756     } \
1757     END_XMLOBJECTBUILDER
1758 
1759 /**
1760  * Implements the standard XMLObjectBuilder specialization function.
1761  *
1762  * @param cname the name of the XMLObject specialization
1763  */
1764 #define IMPL_XMLOBJECTBUILDER(cname) \
1765     xmltooling::XMLObject* cname##Builder::buildObject( \
1766         const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType \
1767         ) const \
1768     { \
1769         return new cname##Impl(nsURI,localName,prefix,schemaType); \
1770     }
1771 
1772 #endif  /* HAVE_COVARIANT_RETURNS */
1773 
1774 /**
1775  * Begins the declaration of a Schema Validator specialization.
1776  *
1777  * @param linkage           linkage specifier for the class
1778  * @param cname the base name of the Validator specialization
1779  */
1780  #define BEGIN_XMLOBJECTVALIDATOR(linkage,cname) \
1781     class linkage cname##SchemaValidator : public xmltooling::Validator \
1782     { \
1783     public: \
1784         virtual ~cname##SchemaValidator() {} \
1785         virtual void validate(const xmltooling::XMLObject* xmlObject) const { \
1786             const cname* ptr=dynamic_cast<const cname*>(xmlObject); \
1787             if (!ptr) \
1788                 throw xmltooling::ValidationException(#cname"SchemaValidator: unsupported object type ($1).",xmltooling::params(1,typeid(xmlObject).name())); \
1789             if (ptr->nil() && (ptr->hasChildren() || ptr->getTextContent())) \
1790             	throw xmltooling::ValidationException("Object has nil property but with children or content.")
1791 
1792 /**
1793  * Begins the declaration of a Schema Validator specialization subclass.
1794  *
1795  * @param linkage   linkage specifier for the class
1796  * @param cname     the base name of the Validator specialization
1797  * @param base      base class for the validator
1798  */
1799  #define BEGIN_XMLOBJECTVALIDATOR_SUB(linkage,cname,base) \
1800     class linkage cname##SchemaValidator : public base##SchemaValidator \
1801     { \
1802     public: \
1803         virtual ~cname##SchemaValidator() {} \
1804         virtual void validate(const xmltooling::XMLObject* xmlObject) const { \
1805             const cname* ptr=dynamic_cast<const cname*>(xmlObject); \
1806             if (!ptr) \
1807                 throw xmltooling::ValidationException(#cname"SchemaValidator: unsupported object type ($1).",xmltooling::params(1,typeid(xmlObject).name()));
1808 
1809 /**
1810  * Ends the declaration of a Validator specialization.
1811  */
1812 #define END_XMLOBJECTVALIDATOR } }
1813 
1814 /**
1815  * Validator code that checks the object type.
1816  *
1817  * @param cname     the name of the XMLObject specialization
1818  */
1819 #define XMLOBJECTVALIDATOR_CHECKTYPE(cname) \
1820     const cname* ptr=dynamic_cast<const cname*>(xmlObject); \
1821     if (!ptr) \
1822         throw xmltooling::ValidationException(#cname"SchemaValidator: unsupported object type ($1).",xmltooling::params(1,typeid(xmlObject).name()))
1823 
1824 /**
1825  * Validator code that checks for a required attribute, content, or singleton.
1826  *
1827  * @param cname     the name of the XMLObject specialization
1828  * @param proper    the proper name of the attribute, content, or singleton member
1829  */
1830 #define XMLOBJECTVALIDATOR_REQUIRE(cname,proper) \
1831     if (!ptr->get##proper()) \
1832         throw xmltooling::ValidationException(#cname" must have "#proper".")
1833 
1834 /**
1835  * Validator code that checks for a required integer attribute
1836  *
1837  * @param cname     the name of the XMLObject specialization
1838  * @param proper    the proper name of the attribute, content, or singleton member
1839  */
1840 #define XMLOBJECTVALIDATOR_REQUIRE_INTEGER(cname,proper) \
1841     if (!ptr->get##proper().first) \
1842         throw xmltooling::ValidationException(#cname" must have "#proper".")
1843 
1844 /**
1845  * Validator code that checks for one of a pair of
1846  * required attributes, content, or singletons.
1847  *
1848  * @param cname     the name of the XMLObject specialization
1849  * @param proper1   the proper name of the first attribute, content, or singleton member
1850  * @param proper2   the proper name of the second attribute, content, or singleton member
1851  */
1852 #define XMLOBJECTVALIDATOR_ONEOF(cname,proper1,proper2) \
1853     if (!ptr->get##proper1() && !ptr->get##proper2()) \
1854         throw xmltooling::ValidationException(#cname" must have "#proper1" or "#proper2".")
1855 
1856 /**
1857  * Validator code that checks for one of a pair of
1858  * required attributes, content, or singletons, but disallows both.
1859  *
1860  * @param cname     the name of the XMLObject specialization
1861  * @param proper1   the proper name of the first attribute, content, or singleton member
1862  * @param proper2   the proper name of the second attribute, content, or singleton member
1863  */
1864 #define XMLOBJECTVALIDATOR_ONLYONEOF(cname,proper1,proper2) \
1865     if ((!ptr->get##proper1() && !ptr->get##proper2()) || (ptr->get##proper1() && ptr->get##proper2())) \
1866         throw xmltooling::ValidationException(#cname" must have "#proper1" or "#proper2" but not both.")
1867 
1868 /**
1869  * Validator code that checks for one of a set of three
1870  * required attributes, content, or singletons.
1871  *
1872  * @param cname     the name of the XMLObject specialization
1873  * @param proper1   the proper name of the first attribute, content, or singleton member
1874  * @param proper2   the proper name of the second attribute, content, or singleton member
1875  * @param proper3   the proper name of the third attribute, content, or singleton member
1876  */
1877 #define XMLOBJECTVALIDATOR_ONEOF3(cname,proper1,proper2,proper3) \
1878     if (!ptr->get##proper1() && !ptr->get##proper2() && !ptr->get##proper3()) \
1879         throw xmltooling::ValidationException(#cname" must have "#proper1", "#proper2", or "#proper3".")
1880 
1881 /**
1882  * Validator code that checks for one of a set of three
1883  * required attributes, content, or singletons but disallows more than one.
1884  *
1885  * @param cname     the name of the XMLObject specialization
1886  * @param proper1   the proper name of the first attribute, content, or singleton member
1887  * @param proper2   the proper name of the second attribute, content, or singleton member
1888  * @param proper3   the proper name of the third attribute, content, or singleton member
1889  */
1890 #define XMLOBJECTVALIDATOR_ONLYONEOF3(cname,proper1,proper2,proper3) \
1891     int c##proper1##proper2##proper3=0; \
1892     if (ptr->get##proper1()!=nullptr) \
1893         c##proper1##proper2##proper3++; \
1894     if (ptr->get##proper2()!=nullptr) \
1895         c##proper1##proper2##proper3++; \
1896     if (ptr->get##proper3()!=nullptr) \
1897         c##proper1##proper2##proper3++; \
1898     if (c##proper1##proper2##proper3 != 1) \
1899         throw xmltooling::ValidationException(#cname" must have only one of "#proper1", "#proper2", or "#proper3".")
1900 
1901 /**
1902  * Validator code that checks a co-constraint (if one present, the other must be)
1903  * between a pair of attributes, content, or singletons.
1904  *
1905  * @param cname     the name of the XMLObject specialization
1906  * @param proper1   the proper name of the first attribute, content, or singleton member
1907  * @param proper2   the proper name of the second attribute, content, or singleton member
1908  */
1909 #define XMLOBJECTVALIDATOR_NONEORBOTH(cname,proper1,proper2) \
1910     if ((ptr->get##proper1() && !ptr->get##proper2()) || (!ptr->get##proper1() && ptr->get##proper2())) \
1911         throw xmltooling::ValidationException(#cname" cannot have "#proper1" without "#proper2".")
1912 
1913 /**
1914  * Validator code that checks for a non-empty collection.
1915  *
1916  * @param cname     the name of the XMLObject specialization
1917  * @param proper    the proper name of the collection item
1918  */
1919 #define XMLOBJECTVALIDATOR_NONEMPTY(cname,proper) \
1920     if (ptr->get##proper##s().empty()) \
1921         throw xmltooling::ValidationException(#cname" must have at least one "#proper".")
1922 
1923 /**
1924  * Declares/defines a Validator specialization that checks object type and
1925  * a non-empty simple content model.
1926  *
1927  * @param linkage   linkage specifier for the class
1928  * @param cname     the name of the XMLObject specialization
1929  */
1930 #define XMLOBJECTVALIDATOR_SIMPLE(linkage,cname) \
1931     BEGIN_XMLOBJECTVALIDATOR(linkage,cname); \
1932         XMLOBJECTVALIDATOR_REQUIRE(cname,TextContent); \
1933     END_XMLOBJECTVALIDATOR
1934 
1935 #include <utility>
1936 
1937 /**
1938  * @namespace xmltooling
1939  * Public namespace of XML Tooling library
1940  */
1941 namespace xmltooling {
1942 
1943     /**
1944      * Template function for cloning a sequence of XMLObjects.
1945      * Invokes the clone() member on each element of the input sequence and adds the copy to
1946      * the output sequence. Order is preserved.
1947      *
1948      * @param in    input sequence to clone
1949      * @param out   output sequence to copy cloned pointers into
1950      */
clone(const InputSequence & in,OutputSequence & out)1951     template<class InputSequence,class OutputSequence> void clone(const InputSequence& in, OutputSequence& out) {
1952         for (typename InputSequence::const_iterator i=in.begin(); i!=in.end(); i++) {
1953             if (*i)
1954                 out.push_back((*i)->clone());
1955             else
1956                 out.push_back(*i);
1957         }
1958     }
1959 
1960     /**
1961      * Functor for cleaning up heap objects in containers.
1962      */
1963     template<class T> struct cleanup
1964     {
1965         /**
1966          * Function operator to delete an object.
1967          *
1968          * @param ptr   object to delete
1969          */
operatorcleanup1970         void operator()(T* ptr) {delete ptr;}
1971 
1972         /**
1973          * Function operator to delete an object stored as const.
1974          *
1975          * @param ptr   object to delete after casting away const
1976          */
operatorcleanup1977         void operator()(const T* ptr) {delete const_cast<T*>(ptr);}
1978     };
1979 
1980     /**
1981      * Functor for cleaning up heap objects in key/value containers.
1982      */
1983     template<class A,class B> struct cleanup_pair
1984     {
1985         /**
1986          * Function operator to delete an object.
1987          *
1988          * @param p   a pair in which the second component is the object to delete
1989          */
operatorcleanup_pair1990         void operator()(const std::pair<const A,B*>& p) {delete p.second;}
1991     };
1992 
1993     /**
1994      * Functor for cleaning up const heap objects in key/value containers.
1995      */
1996     template<class A,class B> struct cleanup_const_pair
1997     {
1998         /**
1999          * Function operator to delete an object stored as const
2000          *
2001          * @param p   a pair in which the second component is the const object to delete
2002          */
operatorcleanup_const_pair2003         void operator()(const std::pair<const A,const B*>& p) {delete const_cast<B*>(p.second);}
2004     };
2005 };
2006 
2007 #endif /* __xmltooling_base_h__ */
2008