Improve xml parsing on diameter codec
[anna.git] / source / diameter / codec / functions.cpp
index 93ee8e3..fe0ee03 100644 (file)
@@ -336,9 +336,15 @@ void anna::diameter::codec::functions::messageXmlDocumentFromXmlFile(anna::xml::
   );
 }
 
-void anna::diameter::codec::functions::messageXmlDocumentFromXmlString(anna::xml::DocumentFile &xmlDocument, const std::string &xmlString) throw(anna::RuntimeException) {
+void anna::diameter::codec::functions::messageXmlDocumentFromXmlString(anna::xml::DocumentMemory &xmlDocument, const std::string &xmlString) throw(anna::RuntimeException) {
   LOGDEBUG(anna::Logger::debug("Parsing diameter message from xml string representation into xml document", ANNA_FILE_LOCATION));
   xmlDocument.initialize(xmlString.c_str());
-  xmlDocument.parse(MessageDTDMemory); // Parsing: fail here if xml violates dtd
-  LOGDEBUG(anna::Logger::debug("Parsing OK from XML string representation", ANNA_FILE_LOCATION));
+  const anna::xml::Node *rootNode = xmlDocument.parse(MessageDTDMemory); // Parsing: fail here if xml violates dtd
+  LOGDEBUG(
+      std::string trace = "Parsing OK from XML string representation '";
+  trace += xmlString;
+  trace += "':\n";
+  trace += anna::xml::Compiler().apply(rootNode);
+  anna::Logger::debug(trace, ANNA_FILE_LOCATION);
+  );
 }