27#include <xercesc/sax/HandlerBase.hpp>
28#include <xercesc/sax/AttributeList.hpp>
29#include <xercesc/sax/SAXParseException.hpp>
30#include <xercesc/sax/SAXException.hpp>
46 : myRootOnly(rootOnly), myError(false), myOptions(
OptionsCont::getOptions()), myItem() {}
53 XERCES_CPP_NAMESPACE::AttributeList& attributes) {
56 for (
int i = 0; i < (int)attributes.getLength(); i++) {
59 if (key ==
"value" || key ==
"v") {
70 const std::string& value) {
71 if (value.length() > 0) {
74 WRITE_ERROR(
"Could not set option '" + key +
"' (probably defined twice).");
86 const XERCES3_SIZE_t length) {
93 const std::string& value)
const {
107 if (
myValue.find_first_not_of(
"\n\t \a") == std::string::npos) {
120 +
toString(exception.getLineNumber() + 1) +
'/' \
121 +
toString(exception.getColumnNumber()) +
").");
132 +
toString(exception.getLineNumber() + 1) +
'/'
133 +
toString(exception.getColumnNumber()) +
").");
144 +
toString(exception.getLineNumber() + 1) +
'/'
145 +
toString(exception.getColumnNumber()) +
").");
#define WRITE_WARNING(msg)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A storage for options typed value containers)
bool isWriteable(const std::string &name)
Returns the information whether the named option may be set.
bool set(const std::string &name, const std::string &value, const bool append=false)
Sets the given value for the named option.
OptionsLoader(const bool routeOnly=false)
Constructor.
bool setSecure(const std::string &name, const std::string &value) const
Tries to set the named option to the given value.
virtual void startElement(const XMLCh *const name, XERCES_CPP_NAMESPACE::AttributeList &attributes)
Called on the occurence of the beginning of a tag.
void fatalError(const XERCES_CPP_NAMESPACE::SAXParseException &exception)
Called on an XML-fatal error.
bool myError
The information whether an error occurred.
void characters(const XMLCh *const chars, const XERCES3_SIZE_t length)
Called on the occurence of character data.
bool errorOccurred() const
Returns the information whether an error occurred.
void warning(const XERCES_CPP_NAMESPACE::SAXParseException &exception)
Called on an XML-warning.
std::string myValue
The currently read characters string.
void endElement(const XMLCh *const name)
Called on the end of an element.
bool myRootOnly
The information whether only the root element should be parsed.
OptionsCont & myOptions
The options to fill.
std::string myItem
The name of the currently parsed option.
void setValue(const std::string &key, const std::string &value)
Tries to set the named option to the given value.
void error(const XERCES_CPP_NAMESPACE::SAXParseException &exception)
Called on an XML-error.
static std::string transcode(const XMLCh *const data)
converts a 0-terminated XMLCh* array (usually UTF-16, stemming from Xerces) into std::string in UTF-8