+\r
+ virtual Poco::XML::Element *XMLGetFirstChild(Poco::XML::Node *parent, const std::string &name)\r
+ {\r
+ if(parent)\r
+ {\r
+ Poco::XML::Node *child=parent->firstChild();\r
+ while(child && child->nodeName()!=name)\r
+ {\r
+ child=child->nextSibling();\r
+ }\r
+ //return child.cast<Poco::XML::Element>();\r
+ return static_cast<Poco::XML::Element *>(child);\r
+ }\r
+ else\r
+ {\r
+ return NULL;\r
+ }\r
+ }\r
+\r
+ virtual Poco::XML::Element *XMLGetNextSibling(Poco::XML::Node *node, const std::string &name)\r
+ {\r
+ if(node)\r
+ {\r
+ Poco::XML::Node *next=node->nextSibling();\r
+ while(next && next->nodeName()!=name)\r
+ {\r
+ next=next->nextSibling();\r
+ }\r
+ //return next.cast<Poco::XML::Element>();\r
+ return static_cast<Poco::XML::Element *>(next);\r
+ }\r
+ else\r
+ {\r
+ return NULL;\r
+ }\r
+ }\r
+\r
+ const std::string SanitizeSingleString(const std::string &text)\r
+ {\r
+ std::string returntext=text;\r
+ // remove bogus chars from text string\r
+ for(char i=1; i<32; i++)\r
+ {\r
+ returntext=StringFunctions::Replace(returntext,std::string(1,i),"");\r
+ }\r
+ return returntext;\r
+ }\r
+\r
+ const std::string GenerateXML(Poco::AutoPtr<Poco::XML::Document> doc, const bool prettyprint=true)\r
+ {\r
+ std::ostringstream str;\r
+ if(doc)\r
+ {\r
+ Poco::XML::DOMWriter dr;\r
+ if(prettyprint==true)\r
+ {\r
+ dr.setOptions(Poco::XML::XMLWriter::WRITE_XML_DECLARATION | Poco::XML::XMLWriter::PRETTY_PRINT);\r
+ }\r
+ else\r
+ {\r
+ dr.setOptions(Poco::XML::XMLWriter::WRITE_XML_DECLARATION);\r
+ }\r
+ dr.setNewLine(Poco::XML::XMLWriter::NEWLINE_CRLF);\r
+ dr.writeNode(str,doc);\r
+ }\r
+ return str.str();\r
+ }\r