+ auto_ptr_XMLCh expected("Firefly");\r
+ TSM_ASSERT_SAME_DATA("ID was not expected value", expected.get(), sxObject->getId(), XMLString::stringLen(expected.get()));\r
+ }\r
+\r
+ void testUnmarshallingWithElementContent() {\r
+ TS_TRACE("testUnmarshallingWithElementContent");\r
+\r
+ string path=data_path + "SimpleXMLObjectWithContent.xml";\r
+ ifstream fs(path.c_str());\r
+ DOMDocument* doc=nonvalidatingPool->parse(fs);\r
+ TS_ASSERT(doc!=NULL);\r
+\r
+ const Unmarshaller* u = Unmarshaller::getUnmarshaller(doc->getDocumentElement());\r
+ TS_ASSERT(u!=NULL);\r
+\r
+ auto_ptr<SimpleXMLObject> sxObject(dynamic_cast<SimpleXMLObject*>(u->unmarshall(doc->getDocumentElement(),true)));\r
+ TS_ASSERT(sxObject.get()!=NULL);\r
+\r
+ auto_ptr_XMLCh expected("Sample Content");\r
+ TSM_ASSERT_SAME_DATA("Element content was not expected value", expected.get(), sxObject->getValue(), XMLString::stringLen(expected.get()));\r
+ }\r
+\r
+ void testUnmarshallingWithChildElements() {\r
+ TS_TRACE("testUnmarshallingWithChildElements");\r
+\r
+ string path=data_path + "SimpleXMLObjectWithChildren.xml";\r
+ ifstream fs(path.c_str());\r
+ DOMDocument* doc=nonvalidatingPool->parse(fs);\r
+ TS_ASSERT(doc!=NULL);\r
+\r
+ const Unmarshaller* u = Unmarshaller::getUnmarshaller(doc->getDocumentElement());\r
+ TS_ASSERT(u!=NULL);\r
+\r
+ auto_ptr<SimpleXMLObject> sxObject(dynamic_cast<SimpleXMLObject*>(u->unmarshall(doc->getDocumentElement(),true)));\r
+ TS_ASSERT(sxObject.get()!=NULL);\r
+\r
+ TSM_ASSERT_EQUALS("Number of child elements was not expected value", 2, sxObject->getSimpleXMLObjects().size());\r
+ }\r
+\r
+ void testUnmarshallingWithUnknownChild() {\r
+ TS_TRACE("testUnmarshallingWithUnknownChild");\r
+\r
+ string path=data_path + "SimpleXMLObjectWithUnknownChild.xml";\r
+ ifstream fs(path.c_str());\r
+ DOMDocument* doc=nonvalidatingPool->parse(fs);\r
+ TS_ASSERT(doc!=NULL);\r
+\r
+ const Unmarshaller* u = Unmarshaller::getUnmarshaller(doc->getDocumentElement());\r
+ TS_ASSERT(u!=NULL);\r
+\r
+ TS_ASSERT_THROWS(u->unmarshall(doc->getDocumentElement(),true),UnmarshallingException);\r
+ doc->release();\r