map<uint, terrainFactory> setFactories(Poco::XML::Node* node) { using namespace Poco; map<uint, terrainFactory> factories; XML::NodeIterator childIterator(node, XML::NodeFilter::SHOW_ELEMENT); XML::Node* tileNode = childIterator.nextNode(); while (tileNode) { if (tileNode->nodeName() == "tile") { ScopedNamedNodeMap tileAttributes(tileNode->attributes()); stringstream id(tileAttributes->getNamedItem("id")->getNodeValue()); uint tileId = 0; id >>tileId; auto propertiesNode = tileNode->firstChild()->nextSibling(); auto propertyNode = propertiesNode->firstChild()->nextSibling(); if (propertyNode->hasAttributes()) { ScopedNamedNodeMap attributes(propertyNode->attributes()); setFactory(factories, tileId, attributes->getNamedItem("value")->nodeValue()); } else { throw FileFormatException("TMX file malformed: tile>>properties should have a child, but does not."); } } tileNode = childIterator.nextNode(); }