You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.4 KiB
41 lines
1.4 KiB
#pragma once
|
|
|
|
#include "storm-config.h"
|
|
#ifdef STORM_HAVE_XERCES
|
|
#include <xercesc/parsers/XercesDOMParser.hpp>
|
|
#include <xercesc/util/XMLString.hpp>
|
|
|
|
|
|
#include <xercesc/dom/DOM.hpp>
|
|
#include <xercesc/sax/HandlerBase.hpp>
|
|
#include <xercesc/util/PlatformUtils.hpp>
|
|
|
|
#include "storm/utility/macros.h"
|
|
#include "storm/exceptions/IllegalArgumentException.h"
|
|
|
|
namespace storm {
|
|
namespace adapters {
|
|
inline std::string XMLtoString(const XMLCh *xmlString) {
|
|
char* tmp = xercesc::XMLString::transcode(xmlString);
|
|
auto result = std::string(tmp);
|
|
delete tmp;
|
|
return result;
|
|
}
|
|
|
|
inline std::string getName(xercesc::DOMNode const* node) {
|
|
switch (node->getNodeType()) {
|
|
case xercesc::DOMNode::NodeType::ELEMENT_NODE: {
|
|
auto elementNode = (xercesc::DOMElement *) node;
|
|
return XMLtoString(elementNode->getTagName());
|
|
}
|
|
case xercesc::DOMNode::NodeType::TEXT_NODE:
|
|
return XMLtoString(node->getNodeValue());
|
|
case xercesc::DOMNode::NodeType::ATTRIBUTE_NODE:
|
|
return XMLtoString(node->getNodeName());
|
|
default:
|
|
STORM_LOG_THROW(false, storm::exceptions::IllegalArgumentException, "Unknown DOMNode type");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endif
|