The method `asXMLString` for Message and Avp classes has now an
optional bool "sortAttributes" which defaults to `false` (previous
behaviour).
So, you could normalize by mean sorting attribute names for nodes
within xml. This does not affect to the structure because the
method asXMLString just generates the representations on-demand.
The new parameter is set to true when programming regexps and during
TestCondition comply for diameter messages received.
/**
Class xml string representation
/**
Class xml string representation
+ @param sortAttributes Optional normalization used to match xml representation with regexps
+
\return XML string representation with relevant information for this instance.
*/
\return XML string representation with relevant information for this instance.
*/
- std::string asXMLString() const throw();
+ std::string asXMLString(bool sortAttributes = false) const throw();
/**
Comparison operator by mean serialization
/**
Comparison operator by mean serialization
/**
Class xml string representation
/**
Class xml string representation
+ @param sortAttributes Optional normalization used to match xml representation with regexps
+
\return XML string representation with relevant information for this instance.
*/
\return XML string representation with relevant information for this instance.
*/
- std::string asXMLString() const throw();
+ std::string asXMLString(bool sortAttributes = false) const throw();
/**
Comparison operator by mean serialization
/**
Comparison operator by mean serialization
Example 1:
std::string pattern = "<avp name=\"Subscription-Id\">\n";
Example 1:
std::string pattern = "<avp name=\"Subscription-Id\">\n";
- pattern += ANNA_XML_COMPILER_TAB; pattern += "<avp name=\"Subscription-Id-Type\" data=\"0\" alias=\"END_USER_E164\"/>\n"
- pattern += ANNA_XML_COMPILER_TAB; pattern += "<avp name=\"Subscription-Id-Data\" data=\"616[0-9]{6,6}\"/>"
+ pattern += std::string(ANNA_XML_INDENTATION_SPACES, ' '); pattern += "<avp name=\"Subscription-Id-Type\" data=\"0\" alias=\"END_USER_E164\"/>\n"
+ pattern += std::string(ANNA_XML_INDENTATION_SPACES, ' '); pattern += "<avp name=\"Subscription-Id-Data\" data=\"616[0-9]{6,6}\"/>"
Example 2:
std::string pattern = "name=\"Subscription-Id\"(.)*name=\"Subscription-Id-Type\" data=\"0\"(.)*name=\"Subscription-Id-Data\" data=\"616[0-9]{6,6}\"";
Example 2:
std::string pattern = "name=\"Subscription-Id\"(.)*name=\"Subscription-Id-Type\" data=\"0\"(.)*name=\"Subscription-Id-Data\" data=\"616[0-9]{6,6}\"";
//------------------------------------------------------------------------------
//----------------------------------------------------------- Avp::asXMLString()
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//----------------------------------------------------------- Avp::asXMLString()
//------------------------------------------------------------------------------
-std::string Avp::asXMLString() const throw() {
+std::string Avp::asXMLString(bool sortAttributes) const throw() {
anna::xml::Node root("root");
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);
//------------------------------------------------------------------------------
//------------------------------------------------------- Message::asXMLString()
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//------------------------------------------------------- Message::asXMLString()
//------------------------------------------------------------------------------
-std::string Message::asXMLString() const throw() {
+std::string Message::asXMLString(bool sortAttributes) const throw() {
anna::xml::Node root("root");
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);