Allow diameter message & avp to normalize their xml representation
[anna.git] / source / diameter / codec / Message.cpp
index 31b7d14..0cf70cd 100644 (file)
@@ -998,9 +998,11 @@ anna::xml::Node* Message::asXML(anna::xml::Node* parent) const throw() {
 //------------------------------------------------------------------------------
 //------------------------------------------------------- Message::asXMLString()
 //------------------------------------------------------------------------------
-std::string Message::asXMLString() const throw() {
+std::string Message::asXMLString(bool sortAttributes) const throw() {
   anna::xml::Node root("root");
-  return anna::xml::Compiler().apply(asXML(&root));
+
+  anna::xml::Compiler::Mode::_v mode = sortAttributes ? anna::xml::Compiler::Mode::Sort : anna::xml::Compiler::Mode::Visual;
+  return anna::xml::Compiler().apply(asXML(&root), mode);
 }