-            entryList = obj.__dict__.items()
-##            # Add in properties
-##            for key in obj.__class__.__dict__.iterkeys():
-##                if (key not in members_to_skip and key not in obj.__dict__
-##                    and hasPropertyValue(obj, key)):
-##                    value = getattr(obj, key)
-##                    entryList.append((key, value))
-            entryList.sort()
-            for name, value in entryList:
-##                # special name handling for private "__*" attributes:
-##                # remove the _<class-name> added by Python
-##                if name.startswith(classNamePrefix): name = name[len(classNamePrefix):]
-                if name in members_to_skip: continue
-                if name.startswith('__') and name.endswith('__'): continue
-##                idx = name.find('__')
-##                if idx > 0:
-##                    newName = name[idx+2:]
-##                    if newName:
-##                        name = newName
-                subElementNameSpacePrefix = nameSpacePrefix
-                if hasattr(obj, '__xmlattrnamespaces__'):
-                    for nameSpaceKey, nameSpaceValues in getattr(obj, '__xmlattrnamespaces__').items():
-                        if name in nameSpaceValues:
-                            subElementNameSpacePrefix = nameSpaceKey + ':'
-                            break
-                # handle sequences listed in __xmlflattensequence__
-                # specially: instead of listing the contained items inside
-                # of a separate list, as god intended, list them inside
-                # the object containing the sequence.
-                if hasattr(obj, '__xmlflattensequence__') and name in obj.__xmlflattensequence__ and value:
-                    try:
+            if hasattr(obj, "__xmlattrgroups__"):
+                attrGroups = obj.__xmlattrgroups__.copy()
+                if (not isinstance(attrGroups, dict)):
+                    raise "__xmlattrgroups__ is not a dict, but must be"
+                for n in attrGroups.iterkeys():
+                    members_to_skip.extend(attrGroups[n])
+            else:
+                attrGroups = {}
+            # add the list of all attributes to attrGroups
+            eList = obj.__dict__.keys()
+            eList.sort()
+            attrGroups["__nogroup__"] = eList
+            
+            for eName, eList in attrGroups.iteritems():
+                if (eName != "__nogroup__"):
+                    prefix += increment*" "
+                    indent += increment
+                    xmlMemberString.append('%s<%s objtype="None">%s' % (prefix, eName, newline))
+                for name in eList:
+                    value = obj.__dict__[name]
+                    if eName == "__nogroup__" and name in members_to_skip: continue
+                    if name.startswith("__") and name.endswith("__"): continue
+                    subElementNameSpacePrefix = nameSpacePrefix
+                    if hasattr(obj, "__xmlattrnamespaces__"):
+                        for nameSpaceKey, nameSpaceValues in getattr(obj, "__xmlattrnamespaces__").iteritems():
+                            if name in nameSpaceValues:
+                                subElementNameSpacePrefix = nameSpaceKey + ":"
+                                break
+                    # handle sequences listed in __xmlflattensequence__
+                    # specially: instead of listing the contained items inside
+                    # of a separate list, as God intended, list them inside
+                    # the object containing the sequence.
+                    if (hasattr(obj, "__xmlflattensequence__") and (value != None) and (name in asDict(obj.__xmlflattensequence__))):