+ * Opens an iteration loop over all of the children of an object.
+ */
+#define IMPL_CLONE_CHILDBAG_BEGIN \
+ for (list<xmltooling::XMLObject*>::const_iterator _bagit = src.m_children.begin(); _bagit != src.m_children.end(); ++_bagit) {
+
+/**
+ * Closes an iteration loop over all of the children of an object.
+ */
+#define IMPL_CLONE_CHILDBAG_END }
+
+/**
+ * Implements cloning of a typed child in a bag iteration loop based on a cast check.
+ *
+ * @param proper the proper name of the child type to clone
+ */
+#define IMPL_CLONE_TYPED_CHILD_IN_BAG(proper) \
+ proper* _##proper##cast = dynamic_cast<proper*>(*_bagit); \
+ if (_##proper##cast) { \
+ get##proper##s().push_back(_##proper##cast->clone##proper()); \
+ continue; \
+ }
+
+/**
+ * Implements cloning of a typed child in a forign namespace in a bag iteration loop based on a cast check.
+ *
+ * @param proper the proper name of the child type to clone
+ * @param ns the namespace of the child type
+ */
+#define IMPL_CLONE_TYPED_FOREIGN_CHILD_IN_BAG(proper,ns) \
+ ns::proper* _##proper##cast = dynamic_cast<ns::proper*>(*_bagit); \
+ if (_##proper##cast) { \
+ get##proper##s().push_back(_##proper##cast->clone##proper()); \
+ continue; \
+ }
+
+/**
+ * Implements cloning of an XMLObject child in a bag iteration loop.
+ *
+ * @param proper the proper name of the child to clone
+ */
+#define IMPL_CLONE_XMLOBJECT_CHILD_IN_BAG(proper) \
+ if (*_bagit) { \
+ get##proper##s().push_back((*_bagit)->clone()); \
+ }
+
+/**