+\r
+ bool parsed=false;\r
+ Poco::XML::DOMParser dp;\r
+\r
+ Initialize();\r
+\r
+ try\r
+ {\r
+ Poco::AutoPtr<Poco::XML::Document> doc=dp.parseString(FixCDATA(xml));\r
+ Poco::XML::Element *root=XMLGetFirstChild(doc,"TrustList");\r
+ Poco::XML::Element *trustel=NULL;\r
+ Poco::XML::Element *txt=NULL;\r
+\r
+ std::vector<std::string> foundkeys;\r
+\r
+ trustel=XMLGetFirstChild(root,"Trust");\r
+ while(trustel)\r
+ {\r
+ std::string identity="";\r
+ int messagetrust=-1;\r
+ int trustlisttrust=-1;\r
+ std::string messagetrustcomment="";\r
+ std::string trustlisttrustcomment="";\r
+\r
+ txt=XMLGetFirstChild(trustel,"Identity");\r
+ if(txt)\r
+ {\r
+ if(txt->firstChild())\r
+ {\r
+ identity=SanitizeSingleString(txt->firstChild()->getNodeValue());\r
+ }\r
+ }\r
+ txt=XMLGetFirstChild(trustel,"MessageTrustLevel");\r
+ if(txt)\r
+ {\r
+ if(txt->firstChild())\r
+ {\r
+ std::string mtl=txt->firstChild()->getNodeValue();\r
+ StringFunctions::Convert(mtl,messagetrust);\r
+ }\r
+ }\r
+ txt=XMLGetFirstChild(trustel,"TrustListTrustLevel");\r
+ if(txt)\r
+ {\r
+ if(txt->firstChild())\r
+ {\r
+ std::string tltl=txt->firstChild()->getNodeValue();\r
+ StringFunctions::Convert(tltl,trustlisttrust);\r
+ }\r
+ }\r
+ txt=XMLGetFirstChild(trustel,"MessageTrustComment");\r
+ if(txt)\r
+ {\r
+ if(txt->firstChild())\r
+ {\r
+ messagetrustcomment=SanitizeSingleString(txt->firstChild()->getNodeValue());\r
+ }\r
+ }\r
+ txt=XMLGetFirstChild(trustel,"TrustListTrustComment");\r
+ if(txt)\r
+ {\r
+ if(txt->firstChild())\r
+ {\r
+ trustlisttrustcomment=SanitizeSingleString(txt->firstChild()->getNodeValue());\r
+ }\r
+ }\r
+\r
+ if(identity!="" && messagetrust>=-1 && messagetrust<=100 && trustlisttrust>=-1 && trustlisttrust<=100)\r
+ {\r
+ // check so we don't add the same identity multiple times from a trust list\r
+ if(std::find(foundkeys.begin(),foundkeys.end(),identity)==foundkeys.end())\r
+ {\r
+ foundkeys.push_back(identity);\r
+ m_trust.push_back(trust(identity,messagetrust,trustlisttrust,messagetrustcomment,trustlisttrustcomment));\r
+ }\r
+ }\r
+ else\r
+ {\r
+ m_log->error("TrustListXML::ParseXML malformed Trust in TrustList.xml");\r
+ }\r
+\r
+ trustel=XMLGetNextSibling(root,"Trust");\r
+ }\r
+\r
+ parsed=true;\r
+ }\r
+ catch(...)\r
+ {\r
+ }\r
+\r
+ return parsed;\r
+\r
+ /*\r