2022-11-28 17:14:01 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Poco/DOM/DOMParser.h>
|
|
|
|
#include <Poco/DOM/Node.h>
|
|
|
|
#include <Poco/AutoPtr.h>
|
|
|
|
#include <base/types.h>
|
|
|
|
|
|
|
|
namespace DB:: XMLUtils
|
|
|
|
{
|
2022-12-01 12:36:40 +00:00
|
|
|
/// Returns root element of the document.
|
2022-11-28 17:14:01 +00:00
|
|
|
Poco::XML::Node * getRootNode(Poco::XML::Document * document);
|
|
|
|
|
2022-12-01 12:36:40 +00:00
|
|
|
/// Finds the element in the node's subtree by the specified path and returns its inner text
|
|
|
|
/// trying to parse it as the requested type.
|
|
|
|
/// Throws an exception if path is not found.
|
|
|
|
std::string getString(const Poco::XML::Node * node, const std::string & path);
|
|
|
|
Int64 getInt64(const Poco::XML::Node * node, const std::string & path);
|
|
|
|
UInt64 getUInt64(const Poco::XML::Node * node, const std::string & path);
|
|
|
|
int getInt(const Poco::XML::Node * node, const std::string & path);
|
|
|
|
unsigned getUInt(const Poco::XML::Node * node, const std::string & path);
|
|
|
|
bool getBool(const Poco::XML::Node * node, const std::string & path);
|
|
|
|
|
|
|
|
/// Finds the element in the node's subtree by the specified path and returns its inner text
|
|
|
|
/// trying to parse it as the requested type.
|
|
|
|
/// Returns the specified default value if path is not found.
|
|
|
|
std::string getString(const Poco::XML::Node * node, const std::string & path, const std::string & default_value);
|
|
|
|
Int64 getInt64(const Poco::XML::Node * node, const std::string & path, Int64 default_value);
|
|
|
|
UInt64 getUInt64(const Poco::XML::Node * node, const std::string & path, UInt64 default_value);
|
|
|
|
int getInt(const Poco::XML::Node * node, const std::string & path, int default_value);
|
|
|
|
unsigned getUInt(const Poco::XML::Node * node, const std::string & path, unsigned default_value);
|
|
|
|
bool getBool(const Poco::XML::Node * node, const std::string & path, bool default_value);
|
2022-11-28 17:14:01 +00:00
|
|
|
}
|