Allow diameter message & avp to normalize their xml representation
[anna.git] / source / diameter / codec / Avp.cpp
index 7b075cf..f0477e2 100644 (file)
@@ -1648,9 +1648,11 @@ anna::xml::Node* Avp::asXML(anna::xml::Node* parent) const throw() {
 //------------------------------------------------------------------------------
 //----------------------------------------------------------- Avp::asXMLString()
 //------------------------------------------------------------------------------
-std::string Avp::asXMLString() const throw() {
+std::string Avp::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);
 }