summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Parser/SerializingParser.cpp')
-rw-r--r--Swiften/Parser/SerializingParser.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/Swiften/Parser/SerializingParser.cpp b/Swiften/Parser/SerializingParser.cpp
index 43dfc51..cd044cc 100644
--- a/Swiften/Parser/SerializingParser.cpp
+++ b/Swiften/Parser/SerializingParser.cpp
@@ -4,10 +4,12 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Parser/SerializingParser.h"
-#include "Swiften/Serializer/XML/XMLTextNode.h"
-#include "Swiften/Base/foreach.h"
-#include <iostream>
+#include <Swiften/Parser/SerializingParser.h>
+
+#include <boost/smart_ptr/make_shared.hpp>
+
+#include <Swiften/Serializer/XML/XMLTextNode.h>
+#include <Swiften/Base/foreach.h>
namespace Swift {
@@ -15,9 +17,10 @@ SerializingParser::SerializingParser() {
}
void SerializingParser::handleStartElement(const std::string& tag, const std::string& ns, const AttributeMap& attributes) {
- boost::shared_ptr<XMLElement> element(new XMLElement(tag, ns));
- for (AttributeMap::const_iterator i = attributes.begin(); i != attributes.end(); ++i) {
- element->setAttribute((*i).first, (*i).second);
+ boost::shared_ptr<XMLElement> element = boost::make_shared<XMLElement>(tag, ns);
+ // FIXME: Ignoring attribute namespace
+ foreach (const AttributeMap::Entry& e, attributes.getEntries()) {
+ element->setAttribute(e.getAttribute().getName(), e.getValue());
}
if (elementStack_.empty()) {
@@ -36,7 +39,7 @@ void SerializingParser::handleEndElement(const std::string&, const std::string&)
void SerializingParser::handleCharacterData(const std::string& data) {
if (!elementStack_.empty()) {
- (*(elementStack_.end()-1))->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(data)));
+ (*(elementStack_.end()-1))->addNode(boost::make_shared<XMLTextNode>(data));
}
}