|
ATLAS Offline Software
|
Go to the documentation of this file.
13 class XMLCoreParserDebugger{
15 static bool get_debug_state(){
19 static const bool debug_state = get_debug_state();
42 other.m_node =
nullptr;
61 std::cout <<
"XMLCoreFactory::~XMLCoreFactory> factory=" <<
this << std::endl;
68 std::cout <<
"XMLCoreFactory::start> factory=" <<
this << std::endl;
76 std::cout <<
"XMLCoreFactory::end>" << std::endl;
84 std::cout <<
"XMLCoreFactory::comment>" << std::endl;
92 std::cout <<
"XMLCoreFactory::do_start>" << std::endl;
99 std::cout <<
"XMLCoreFactory::do_end>" << std::endl;
106 std::cout <<
"XMLCoreFactory::do_comment>" << std::endl;
113 return (
attrs.size ());
119 CoreParser::DOMNamedNodeMap::const_iterator
it =
attrs.find (
name);
120 if (
it ==
attrs.end ())
return (
false);
128 sscanf (
s.c_str (),
"%80d", &
result);
136 sscanf (
s.c_str (),
"%80lg", &
result);
144 if (
s ==
"TRUE")
result =
true;
156 std::cout <<
"XMLCoreFactory::get_value> name=" <<
name << std::endl;
159 CoreParser::DOMNamedNodeMap::const_iterator
it =
attrs.find (
name);
160 if (
it ==
attrs.end ())
return (
"");
161 std::string
result = (*it).second;
163 std::cout <<
"XMLCoreFactory::get_value>2 value=" <<
result << std::endl;
170 return node.get_node().get_name ();
175 return node.get_node ().sibling_number ();
181 CoreParser::DOMNamedNodeMap::const_iterator
it;
185 if (
it ==
attrs.end ())
return (
"");
193 while ((
result.length () > 0) &&
196 while ((
result.length () > 0) &&
199 for (std::string::size_type
i = 0;
i <
result.length (); ++
i){
200 static const std::string uc =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
201 static const std::string
lc =
"abcdefghijklmnopqrstuvwxyz";
203 std::string::size_type
p =
lc.find (
c);
219 std::string
t = checkstring +
" " + checkstring;
220 std::istringstream tmpstr (
t.c_str());
221 while (tmpstr.good ()) {
227 std::cerr <<
"XMLCoreFactory::check_int error: no " <<
n
228 <<
" ints in \"" << checkstring <<
"\" for attribute " <<
229 name <<
". exit." << std::endl;
234 if (nodename !=
"" ) std::cerr <<
"for name=" << nodename << std::endl;
235 if (volume !=
"" ) std::cerr <<
"for volume=" << volume << std::endl;
251 std::string
t = checkstring +
" " + checkstring;
252 std::istringstream tmpstr (
t.c_str());
253 while (tmpstr.good ()) {
259 std::cerr <<
"XMLCoreFactory::check_double error: (" <<
counter <<
") no " <<
n
260 <<
" doubles in \"" << checkstring <<
"\" for attribute " <<
261 name <<
". exit." << std::endl;
264 if (
name1 !=
"" ) std::cerr <<
"for name=" <<
name << std::endl;
265 if (volume !=
"" ) std::cerr <<
"for volume=" << volume << std::endl;
280 if (
doc !=
nullptr)
doc->print (
"============ ALL =============");
283 throw std::runtime_error(
"XMLCoreParser: no such file ["+
file_name+
"]");
291 std::cout <<
"XMLCoreParser::visit file_name "
298 std::cout <<
"XMLCoreParser::visit node=" << nptr << std::endl;
308 const std::string& nodeName =
node.get_name();
309 const std::string& nodeValue =
node.get_value();
311 std::cout <<
"XMLCoreParser::visit node(" << nptr <<
") " << nodeName << std::endl;
315 std::cout <<
"XMLCoreParser::visit factory " << factory << std::endl;
318 switch (
node.get_type()) {
329 std::cout <<
"XMLCoreParser::visit ELEMENT_NODE "
330 <<
" factory=" << factory
334 factory->
start (*
this, core_node);
336 std::cerr <<
"XMLCoreParser> Cannot find factory for element "
337 << nodeName << std::endl;
345 if (factory != 0) factory->
end (*
this, core_node);
349 if (factory != 0) factory->
comment (*
this, nodeValue);
353 std::cout <<
"ENTITY_NODE " << nodeValue << std::endl;
357 std::cout <<
"ENTITY_REFERENCE_NODE " << nodeValue << std::endl;
361 std::cerr <<
"Unrecognized node type = " << (long)
node.get_type() << std::endl;
366 std::cout <<
"XMLCoreParser::visit-2" << std::endl;
377 std::unique_ptr<XMLCoreFactory> factory) {
379 std::cout <<
"XMLCoreFactory::register_factory> name=" <<
name
380 <<
" factory=" << factory.get() << std::endl;
388 std::cout <<
"XMLCoreParser::register_external_entity> name=" <<
name
389 <<
" file_name=" <<
file_name << std::endl;
397 std::cout <<
"XMLCoreParser::register_text_entity> name=" <<
name
408 return (*it).second.get();
XMLCoreFactory * find_factory(const std::string &name)
JetConstituentVector::iterator iterator
XMLCoreNode parse(const std::string &file_name)
virtual void do_comment(XMLCoreParser &parser, const std::string &comment)
XMLCoreNode & operator=(const XMLCoreNode &other)
std::vector< DOMNode * > DOMSiblings
static bool has_attribute(const XMLCoreNode &node, const std::string &name)
void start(XMLCoreParser &parser, const XMLCoreNode &node)
std::map< std::string, std::string > DOMNamedNodeMap
static int get_int(const XMLCoreNode &node, const std::string &name)
static bool get_boolean(const XMLCoreNode &node, const std::string &name)
static bool check_int(const int n, const XMLCoreNode &node, const std::string &name)
void register_text_entity(const std::string &name, const std::string &text)
std::unique_ptr< XMLCoreFactory > m_default_factory
static void register_text_entity(const std::string &name, const std::string &text)
static std::string get_value(const XMLCoreNode &node, const std::string &name)
static int attribute_number(const XMLCoreNode &node)
virtual void do_start(XMLCoreParser &parser, const XMLCoreNode &node)
void register_factory(const std::string &name, std::unique_ptr< XMLCoreFactory > factory)
void end(XMLCoreParser &parser, const XMLCoreNode &node)
const CoreParser::DOMNode * m_node
static bool check_double(const int n, const XMLCoreNode &node, const std::string &name)
static std::string get_ID(const XMLCoreNode &node, const std::string &name)
void register_default_factory(std::unique_ptr< XMLCoreFactory > factory)
std::string getenv(const std::string &variableName)
get an environment variable
static std::unique_ptr< CoreParser::DOMNode > parse(const std::string &file_name)
virtual ~XMLCoreFactory()
const CoreParser::DOMNode & get_node() const
void register_external_entity(const std::string &name, const std::string &file_name)
static void register_external_entity(const std::string &name, const std::string &file_name)
static std::string get_token(const XMLCoreNode &node, const std::string &name)
int sibling_number(const XMLCoreNode &node)
std::string get_name(const XMLCoreNode &node)
void comment(XMLCoreParser &parser, const std::string &comment)
static double get_double(const XMLCoreNode &node, const std::string &name)
void visit(const std::string &file_name)
virtual void do_end(XMLCoreParser &parser, const XMLCoreNode &node)