+ xmlString.append("/>%s" % newline)
+## return xmlString
+ xmlMarshallerLogger.debug("<-- _marshal: %s" % str(xmlString))
+ return xmlString
+
+# A simple test, to be executed when the xmlmarshaller is run standalone
+class MarshallerPerson:
+ __xmlname__ = "person"
+ __xmlexclude__ = ["fabulousness",]
+ __xmlattributes__ = ("nonSmoker",)
+ __xmlrename__ = {"_phoneNumber": "telephone"}
+ __xmlflattensequence__ = {"favoriteWords": ("vocabulary",)}
+ __xmlattrgroups__ = {"name": ["firstName", "lastName"], "address": ["addressLine1", "city", "state", "zip"]}
+
+ def setPerson(self):
+ self.firstName = "Albert"
+ self.lastName = "Camus"
+ self.addressLine1 = "23 Absurd St."
+ self.city = "Ennui"
+ self.state = "MO"
+ self.zip = "54321"
+ self._phoneNumber = "808-303-2323"
+ self.favoriteWords = ["angst", "ennui", "existence"]
+ self.phobias = ["war", "tuberculosis", "cars"]
+ self.weight = 150
+ self.fabulousness = "tres tres"
+ self.nonSmoker = False
+
+if isMain(__name__):
+ p1 = MarshallerPerson()
+ p1.setPerson()
+ xmlP1 = marshal(p1, prettyPrint=True, encoding="utf-8")
+ print "\n########################"
+ print "# testPerson test case #"
+ print "########################"
+ print xmlP1
+ p2 = unmarshal(xmlP1)
+ xmlP2 = marshal(p2, prettyPrint=True, encoding="utf-8")
+ if xmlP1 == xmlP2:
+ print "Success: repeated marshalling yields identical results"
+ else:
+ print "Failure: repeated marshalling yields different results"
+ print xmlP2