DD4hep - The AIDA detector description toolkit for high energy physics experiments
DD4hep  Rev:Unversioneddirectory
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DocumentHandler.cpp
Go to the documentation of this file.
1 // $Id$
2 //==========================================================================
3 // AIDA Detector description implementation for LCD
4 //--------------------------------------------------------------------------
5 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
6 // All rights reserved.
7 //
8 // For the licensing terms see $DD4hepINSTALL/LICENSE.
9 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
10 //
11 // Author : M.Frank
12 //
13 //==========================================================================
14 
15 // Framework include files
16 #include "DD4hep/Printout.h"
17 #include "XML/UriReader.h"
18 #include "XML/DocumentHandler.h"
19 #include "TUri.h"
20 #include "TUrl.h"
21 
22 // C/C++ include files
23 #include <iostream>
24 #include <stdexcept>
25 #include <sys/types.h>
26 #include <sys/stat.h>
27 #ifndef _WIN32
28 #include <libgen.h>
29 #endif
30 
31 using namespace std;
32 using namespace DD4hep;
33 using namespace DD4hep::XML;
34 
35 #ifndef __TIXML__
36 #include "xercesc/framework/LocalFileFormatTarget.hpp"
37 #include "xercesc/framework/StdOutFormatTarget.hpp"
38 #include "xercesc/framework/MemBufFormatTarget.hpp"
39 #include "xercesc/framework/MemBufInputSource.hpp"
40 #include "xercesc/sax/SAXParseException.hpp"
41 #include "xercesc/sax/EntityResolver.hpp"
42 #include "xercesc/sax/InputSource.hpp"
43 #include "xercesc/parsers/XercesDOMParser.hpp"
44 #include "xercesc/util/XMLEntityResolver.hpp"
45 #include "xercesc/util/PlatformUtils.hpp"
46 #include "xercesc/util/XercesDefs.hpp"
47 #include "xercesc/util/XMLUni.hpp"
48 #include "xercesc/util/XMLURL.hpp"
49 #include "xercesc/util/XMLString.hpp"
50 #include "xercesc/dom/DOM.hpp"
51 #include "xercesc/sax/ErrorHandler.hpp"
52 
53 using namespace xercesc;
54 
56 namespace DD4hep {
57 
59  namespace XML {
60 
63  public:
66  }
69  printout(DEBUG,"DocumentErrorHandler","+++ Destructing the XercesC DOM-XML document error handler....");
70  }
72  void resetErrors() {
73  }
75  void warning(const SAXParseException& /* e */) {
76  }
78  void error(const SAXParseException& e);
80  void fatalError(const SAXParseException& e);
82  virtual bool handleError(const DOMError& domError);
83  };
84 
86  bool DocumentErrorHandler::handleError(const DOMError& domError) {
87  string err = "DOM UNKNOWN: ";
88  switch (domError.getSeverity()) {
89  case DOMError::DOM_SEVERITY_WARNING:
90  err = "DOM WARNING: ";
91  break;
92  case DOMError::DOM_SEVERITY_ERROR:
93  err = "DOM ERROR: ";
94  break;
95  case DOMError::DOM_SEVERITY_FATAL_ERROR:
96  err = "DOM FATAL: ";
97  break;
98  default:
99  return false;
100  }
101  printout(FATAL,"DocumentErrorHandler", "+++ %s %s: %s", err.c_str(),
102  _toString(domError.getType()).c_str(),_toString(domError.getMessage()).c_str());
103  DOMLocator* loc = domError.getLocation();
104  if (loc) {
105  printout(FATAL,"DocumentErrorHandler","+++ Location: Line:%d Column: %d",
106  int(loc->getLineNumber()),int(loc->getColumnNumber()));
107  }
108  return false;
109  }
111  void DocumentErrorHandler::error(const SAXParseException& e) {
112  string m(_toString(e.getMessage()));
113  if (m.find("The values for attribute 'name' must be names or name tokens") != string::npos
114  || m.find("The values for attribute 'ID' must be names or name tokens") != string::npos
115  || m.find("for attribute 'name' must be Name or Nmtoken") != string::npos
116  || m.find("for attribute 'ID' must be Name or Nmtoken") != string::npos
117  || m.find("for attribute 'name' is invalid Name or NMTOKEN value") != string::npos
118  || m.find("for attribute 'ID' is invalid Name or NMTOKEN value") != string::npos)
119  return;
120  string sys(_toString(e.getSystemId()));
121  printout(ERROR,"XercesC","+++ Error at file \"%s\", Line %d Column: %d Message:%s",
122  sys.c_str(), int(e.getLineNumber()), int(e.getColumnNumber()), m.c_str());
123  }
125  void DocumentErrorHandler::fatalError(const SAXParseException& e) {
126  string m(_toString(e.getMessage()));
127  string sys(_toString(e.getSystemId()));
128  printout(FATAL,"XercesC","+++ FATAL Error at file \"%s\", Line %d Column: %d Message:%s",
129  sys.c_str(), int(e.getLineNumber()), int(e.getColumnNumber()), m.c_str());
130  }
131 
132  namespace {
133 
135  class DD4hepDOMParser : public XercesDOMParser {
140  class Resolver : public XMLEntityResolver {
141  DD4hepDOMParser* parser;
142  public:
143  Resolver(DD4hepDOMParser* p) : parser(p) {}
144  virtual ~Resolver() {}
145  virtual InputSource *resolveEntity(XMLResourceIdentifier *id)
146  { return parser->read_uri(id); }
147  };
148  Resolver m_resolver;
149  public:
151  DD4hepDOMParser(UriReader* rdr) : XercesDOMParser(), m_reader(rdr), m_resolver(this) {
152  //printout(FATAL,"XercesC","+++ Creating new parser");
153  setErrorHandler(&m_errHandler);
154  setXMLEntityResolver(&m_resolver);
155  }
157  virtual ~DD4hepDOMParser() {
158  //printout(FATAL,"XercesC","+++ Deleting new parser");
159  }
161  InputSource *read_uri(XMLResourceIdentifier *id) {
162  if ( m_reader ) {
163  string buf, systemID(_toString(id->getSystemId()));
164  if ( m_reader->load(systemID, buf) ) {
165  const XMLByte* input = (const XMLByte*)XMLString::replicate(buf.c_str());
166 #if 0
167  string baseURI(_toString(id->getBaseURI()));
168  string schema(_toString(id->getSchemaLocation()));
169  string ns(_toString(id->getNameSpace()));
170  printout(INFO,"XercesC","+++ Resolved URI: sysID:%s uri:%s ns:%s schema:%s",
171  systemID.c_str(), baseURI.c_str(), ns.c_str(), schema.c_str());
172 #endif
173  return new MemBufInputSource(input,buf.length(),systemID.c_str(),true);
174  }
175  }
176  return 0;
177  }
178  };
179 
181  XercesDOMParser* make_parser(UriReader* reader=0) {
182  XercesDOMParser* parser = new DD4hepDOMParser(reader);
183  parser->setValidationScheme(XercesDOMParser::Val_Auto);
184  parser->setValidationSchemaFullChecking(true);
185  parser->setCreateEntityReferenceNodes(false);
186  parser->setDoNamespaces(false);
187  parser->setDoSchema(true);
188  return parser;
189  }
190  }
191 
193  void dumpTree(DOMNode* doc, ostream& os) {
194  if ( doc ) {
195  DOMImplementation *imp = DOMImplementationRegistry::getDOMImplementation(Strng_t("LS"));
196  MemBufFormatTarget *tar = new MemBufFormatTarget();
197  DOMLSOutput *out = imp->createLSOutput();
198  DOMLSSerializer *wrt = imp->createLSSerializer();
199  out->setByteStream(tar);
200  wrt->getDomConfig()->setParameter(Strng_t("format-pretty-print"), true);
201  wrt->write(doc, out);
202  os << tar->getRawBuffer() << endl << flush;
203  out->release();
204  wrt->release();
205  return;
206  }
207  printout(ERROR,"dumpTree","+++ Cannot dump invalid document.");
208  }
209 
211  void dump_doc(DOMDocument* doc, ostream& os) {
212  dumpTree(doc,os);
213  }
215  void dump_tree(Handle_t elt, ostream& os) {
216  dumpTree((DOMNode*)elt.ptr(),os);
217  }
219  void dump_tree(Document doc, ostream& os) {
220  dump_doc((DOMDocument*)doc.ptr(),os);
221  }
222  }
223 }
224 
226 string DocumentHandler::system_path(Handle_t base, const string& fn) {
227  string path, dir = system_path(base);
228  TUri uri_base(dir.c_str()), uri_rel(fn.c_str());
229  TUrl url_base(dir.c_str());
230  path = TUri::MergePaths(uri_rel,uri_base);
231  TUri final(path.c_str());
232  final.Normalise();
233  path = url_base.GetProtocol()+string("://")+final.GetUri().Data();
234  if ( path[path.length()-1]=='/' ) path = path.substr(0,path.length()-1);
235  return path;
236 }
237 
239 string DocumentHandler::system_path(Handle_t base) {
240  DOMElement* elt = (DOMElement*)base.ptr();
241  string path = _toString(elt->getBaseURI());
242  if ( path[0] == '/' ) {
243  string tmp = "file:"+path;
244  return tmp;
245  }
246  return path;
247 }
248 
250 Document DocumentHandler::load(Handle_t base, const XMLCh* fname, UriReader* reader) const {
251  string path;
252  DOMElement* elt = (DOMElement*)base.ptr();
253  try {
254  Strng_t p = _toString(fname);
255  XMLURL ref_url(elt->getBaseURI(), p);
256  path = _toString(ref_url.getURLText());
257  return load(path, reader);
258  }
259  catch(const exception& exc) {
260  string b = _toString(elt->getBaseURI());
261  string e = _toString(fname);
262  printout(DEBUG,"DocumentHandler","+++ URI exception: %s -> %s [%s]",b.c_str(),e.c_str(),exc.what());
263  }
264  catch(...) {
265  string b = _toString(elt->getBaseURI());
266  string e = _toString(fname);
267  printout(DEBUG,"DocumentHandler","+++ URI exception: %s -> %s",b.c_str(),e.c_str());
268  }
269  if ( reader ) {
270  string buf, sys = system_path(base,fname);
271 #if 0
272  string buf, sys, dir = _toString(elt->getBaseURI());
273  string fn = _toString(fname);
274  dir = ::dirname((char*)dir.c_str());
275  while( fn.substr(0,3) == "../" ) {
276  dir = ::dirname((char*)dir.c_str());
277  fn = fn.substr(3);
278  }
279  sys = dir + "/" + fn;
280 #endif
281  if ( reader->load(sys, buf) ) {
282 #if 0
283  Document doc = parse(buf.c_str(), buf.length(), sys.c_str(), reader);
284  dumpTree(doc);
285  return doc;
286 #endif
287  return parse(buf.c_str(), buf.length(), sys.c_str(), reader);
288  }
289  }
290  return Document(0);
291 }
292 
294 Document DocumentHandler::load(const string& fname, UriReader* reader) const {
295  string path;
296  printout(DEBUG,"DocumentHandler","+++ Loading document URI: %s",fname.c_str());
297  try {
298  size_t idx = fname.find(':');
299  size_t idq = fname.find('/');
300  if ( idq == string::npos ) idq = 0;
301  XMLURL xerurl = (const XMLCh*) Strng_t(idx==string::npos || idx>idq ? "file:"+fname : fname);
302  string proto = _toString(xerurl.getProtocolName());
303  path = _toString(xerurl.getPath());
304  printout(DEBUG,"DocumentHandler","+++ protocol:%s path:%s",proto.c_str(), path.c_str());
305  }
306  catch(...) {
307  }
308  dd4hep_ptr < XercesDOMParser > parser(make_parser(reader));
309  try {
310  if ( !path.empty() ) {
311  parser->parse(path.c_str());
312  if ( reader ) reader->parserLoaded(path);
313  }
314  else {
315  if ( reader && reader->load(fname, path) ) {
316  MemBufInputSource src((const XMLByte*)path.c_str(), path.length(), fname.c_str(), false);
317  parser->parse(src);
318  return (XmlDocument*)parser->adoptDocument();
319  }
320  return (XmlDocument*)0;
321  }
322  }
323  catch (const exception& e) {
324  printout(ERROR,"DocumentHandler","+++ Exception(XercesC): parse(path):%s",e.what());
325  try {
326  parser->parse(fname.c_str());
327  if ( reader ) reader->parserLoaded(path);
328  }
329  catch (const exception& ex) {
330  printout(FATAL,"DocumentHandler","+++ Exception(XercesC): parse(URI):%s",ex.what());
331  throw;
332  }
333  }
334  printout(DEBUG,"DocumentHandler","+++ Document %s succesfully parsed with XercesC .....",path.c_str());
335  return (XmlDocument*)parser->adoptDocument();
336 }
337 
339 Document DocumentHandler::parse(const char* bytes, size_t length, const char* sys_id, UriReader* rdr) const {
340  dd4hep_ptr < XercesDOMParser > parser(make_parser(rdr));
341  MemBufInputSource src((const XMLByte*)bytes, length, sys_id, false);
342  parser->parse(src);
343  DOMDocument* doc = parser->adoptDocument();
344  doc->setXmlStandalone(true);
345  doc->setStrictErrorChecking(true);
346  return (XmlDocument*) doc;
347 }
348 
350 int DocumentHandler::output(Document doc, const string& fname) const {
351  XMLFormatTarget *tar = 0;
352  DOMImplementation *imp = DOMImplementationRegistry::getDOMImplementation(Strng_t("LS"));
353  DOMLSOutput *out = imp->createLSOutput();
354  DOMLSSerializer *wrt = imp->createLSSerializer();
355 
356  if (fname.empty())
357  tar = new StdOutFormatTarget();
358  else
359  tar = new LocalFileFormatTarget(Strng_t(fname));
360 
361  out->setByteStream(tar);
362  wrt->getDomConfig()->setParameter(Strng_t("format-pretty-print"), true);
363  wrt->write((xercesc::DOMDocument*) doc.ptr(), out);
364  out->release();
365  wrt->release();
366  delete tar;
367  return 1;
368 }
369 
370 #else
371 
372 #include "XML/tinyxml.h"
373 
375 namespace DD4hep {
377  namespace XML {
378 
380  class DocumentErrorHandler {};
381 
382  union Xml {
383  Xml(void* ptr) : p(ptr) {}
384  Xml(const void* ptr) : cp(ptr) {}
385  void* p;
386  const void* cp;
387  TiXmlElement* e;
388  XmlElement* xe;
389  TiXmlAttribute* a;
390  Attribute attr;
391  TiXmlNode* n;
392  TiXmlDocument* d;
393  XmlDocument* xd;
394  };
395  }}
396 
397 namespace {
398  static string _clean_fname(const string& s) {
399  std::string const& temp = getEnviron(s);
400  std::string temp2 = temp.empty() ? s : temp;
401  if ( strncmp(temp2.c_str(),"file:",5)==0 ) return temp2.substr(5);
402  return temp2;
403  }
404 }
405 
407 string DocumentHandler::system_path(Handle_t base, const string& fname) {
408  string fn, clean = _clean_fname(fname);
409  struct stat st;
410  Element elt(base);
411  // Poor man's URI handling. Xerces is much much better here
412  if ( elt ) {
413  string bn = Xml(elt.document()).d->Value();
414 #ifdef _WIN32
415  char drive[_MAX_DRIVE], dir[_MAX_DIR], file[_MAX_FNAME], ext[_MAX_EXT];
416  ::_splitpath(bn.c_str(),drive,dir,file,ext);
417  fn = drive;
418  fn += ":";
419  fn += dir;
420  fn += "/";
421  fn += clean;
422 #else
423  fn = ::dirname((char*)bn.c_str());
424 #endif
425  fn += "/";
426  fn += _clean_fname(fname);
427  }
428  if ( ::stat(fn.c_str(),&st)==0 )
429  return fn;
430  else if ( ::stat(clean.c_str(),&st)==0 )
431  return clean;
432  return fname;
433 }
434 
436 string DocumentHandler::system_path(Handle_t base) {
437  string fn;
438  Element elt(base);
439  // Poor man's URI handling. Xerces is much much better here
440  if ( elt ) {
441  fn = Xml(elt.document()).d->Value();
442  }
443  return fn;
444 }
445 
447 Document DocumentHandler::load(const std::string& fname, UriReader* reader) const {
448  string clean = _clean_fname(fname);
449  if ( reader ) {
450  printout(WARNING,"DocumentHandler","+++ Loading document URI: %s %s",
451  fname.c_str(),"[URI Resolution is not supported by TiXML]");
452  }
453  else {
454  printout(INFO,"DocumentHandler","+++ Loading document URI: %s",fname.c_str());
455  }
456  TiXmlDocument* doc = new TiXmlDocument(clean.c_str());
457  bool result = false;
458  try {
459  result = doc->LoadFile();
460  if ( !result ) {
461  if ( doc->Error() ) {
462  printout(FATAL,"DocumentHandler","+++ Error (TinyXML) while parsing XML document:%s",doc->ErrorDesc());
463  printout(FATAL,"DocumentHandler","+++ Document:%s Location Line:%d Column:%d",
464  doc->Value(), doc->ErrorRow(), doc->ErrorCol());
465  throw runtime_error(string("DD4hep: ")+doc->ErrorDesc());
466  }
467  throw runtime_error("DD4hep: Unknown error whaile parsing XML document with TinyXML.");
468  }
469  }
470  catch(exception& e) {
471  printout(ERROR,"DocumentHandler","+++ Exception (TinyXML): parse(path):%s",e.what());
472  }
473  if ( result ) {
474  printout(INFO,"DocumentHandler","+++ Document %s succesfully parsed with TinyXML .....",fname.c_str());
475  return (XmlDocument*)doc;
476  }
477  delete doc;
478  return 0;
479 }
480 
482 Document DocumentHandler::load(Handle_t base, const XmlChar* fname, UriReader* reader) const {
483  string path = system_path(base, fname);
484  return load(path,reader);
485 }
486 
488 Document DocumentHandler::parse(const char* bytes, size_t /* length */, const char* /* sys_id */, UriReader* reader) const {
489  if ( reader ) {
490  printout(WARNING,"DocumentHandler","+++ Parsing memory document %s",
491  "[URI Resolution is not supported by TiXML]");
492  }
493  TiXmlDocument* doc = new TiXmlDocument();
494  try {
495  if ( 0 == doc->Parse(bytes) ) {
496  return (XmlDocument*)doc;
497  }
498  if ( doc->Error() ) {
499  printout(FATAL,"DocumentHandler","+++ Error (TinyXML) while parsing XML document:%s",doc->ErrorDesc());
500  printout(FATAL,"DocumentHandler","+++ Document:%s Location Line:%d Column:%d",
501  doc->Value(), doc->ErrorRow(), doc->ErrorCol());
502  throw runtime_error(string("DD4hep: ")+doc->ErrorDesc());
503  }
504  throw runtime_error("DD4hep: Unknown error whaile parsing XML document with TiXml.");
505  }
506  catch(exception& e) {
507  printout(ERROR,"DocumentHandler","+++ Exception (TinyXML): parse(string):%s",e.what());
508  }
509  delete doc;
510  return 0;
511 }
512 
514 int DocumentHandler::output(Document doc, const string& fname) const {
515  FILE* file = fname.empty() ? stdout : ::fopen(fname.c_str(),"w");
516  if ( !file ) {
517  printout(ERROR,"DocumentHandler","+++ Failed to open output file: %s",fname.c_str());
518  return 0;
519  }
520  TiXmlDocument* d = (TiXmlDocument*)doc.ptr();
521  d->Print(file);
522  if ( !fname.empty() ) ::fclose(file);
523  return 1;
524 }
525 
527 void DD4hep::XML::dump_tree(Handle_t elt, ostream& os) {
528  TiXmlNode* node = (TiXmlNode*)elt.ptr();
529  TiXmlPrinter printer;
530  printer.SetStreamPrinting();
531  node->Accept( &printer );
532  os << printer.Str();
533 }
534 
536 void DD4hep::XML::dump_tree(Document doc, ostream& os) {
537  TiXmlDocument* node = (TiXmlDocument*)doc.ptr();
538  TiXmlPrinter printer;
539  printer.SetStreamPrinting();
540  node->Accept( &printer );
541  os << printer.Str();
542 }
543 #endif
544 
545 
547 DocumentHandler::DocumentHandler() {}
548 
550 DocumentHandler::~DocumentHandler() {}
551 
553 Document DocumentHandler::load(const std::string& fname) const {
554  return load(fname, 0);
555 }
556 
558 Document DocumentHandler::load(Handle_t base, const XmlChar* fname) const {
559  return load(base, fname, 0);
560 }
561 
563 Document DocumentHandler::parse(const char* bytes, size_t length) const {
564  return parse(bytes, length, "xml-memory-buffer", 0);
565 }
566 
568 string DocumentHandler::system_path(Handle_t base, const XmlChar* fname) {
569  string fn = _toString(fname);
570  return system_path(base, fn);
571 }
572 
574 string DocumentHandler::system_directory(Handle_t base, const XmlChar* fname) {
575  string path = system_path(base,fname);
576  string dir = ::dirname((char*)path.c_str());
577  return dir;
578 }
579 
581 string DocumentHandler::system_directory(Handle_t base) {
582  string path = system_path(base);
583  string dir = ::dirname((char*)path.c_str());
584  return dir;
585 }
586 
588 Document DocumentHandler::create(const char* tag, const char* comment) const {
589  string top(tag);
590  string empty = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n";
591  empty += "<" + top + "/>\0\0";
592  Document doc = parse(empty.c_str(), empty.length() + 1);
593  if (comment) {
594  Element top_elt = doc.root();
595  top_elt.addComment(comment);
596  }
597  return doc;
598 }
599 
602  dump_tree(elt,cout);
603 }
604 
607  dump_tree(doc,cout);
608 }
TinyXML class. See http://www.grinninglizard.com/tinyxml.
Definition: tinyxml.h:1544
XercesC internal class. Not described here.
Definition: DD4hepGroups.h:64
DD4hepDOMParser * parser
void addComment(const char *text) const
Add comment node to the element.
XML-DOM ERror handler class for the XercesC document parser.
std::string getEnviron(const std::string &env)
Helper function to lookup environment from the expression evaluator.
bool Error() const
Definition: tinyxml.h:1619
Resolver m_resolver
const std::string & Str()
Return the result.
Definition: tinyxml.h:2000
void dump_tree(Document doc, ostream &os)
Dump DOM tree using XercesC handles.
DOC ptr() const
Accessot to DOM document behaviour.
Definition: XMLElements.h:634
void dump_tree(Handle_t elt, ostream &os)
Dump DOM tree using XercesC handles.
virtual bool load(const std::string &system_id, std::string &data)
Resolve a given URI to a string containing the data.
Definition: UriReader.cpp:23
TGeoShape * s
Definition: Volumes.cpp:294
Out version of the std auto_ptr implementation base either on auto_ptr or unique_ptr.
Definition: Memory.h:43
User abstraction class to manipulate XML elements within a document.
Definition: XMLElements.h:686
const char * Value() const
Definition: tinyxml.h:487
return e
Definition: Volumes.cpp:297
Handle_t root() const
Access the ROOT eleemnt of the DOM document.
TinyXML class. See http://www.grinninglizard.com/tinyxml.
Definition: tinyxml.h:431
void SetStreamPrinting()
Definition: tinyxml.h:1985
static pair< TClass *, void * > load(TBranch *branch, int entry)
int ErrorCol() const
The column where the error occured. See ErrorRow()
Definition: tinyxml.h:1645
int ErrorRow() const
Definition: tinyxml.h:1642
Class supporting to read data given a URI.
Definition: UriReader.h:36
void warning(const SAXParseException &)
Warnings callback. Ignore them.
virtual const char * Parse(const char *p, TiXmlParsingData *data=0, TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
TinyXML class. See http://www.grinninglizard.com/tinyxml.
Definition: tinyxml.h:877
Helper class to encapsulate a unicode string.
Definition: XMLElements.h:160
virtual void parserLoaded(const std::string &system_id)
Inform reader about a locally (e.g. by XercesC) handled source load.
Definition: UriReader.cpp:28
virtual ~DocumentErrorHandler()
Destructor.
virtual bool Accept(TiXmlVisitor *visitor) const =0
virtual bool Accept(TiXmlVisitor *content) const
Definition: tinyxml_inl.h:1182
UriReader * m_reader
Pointer to URI reader.
unsigned short XmlChar
Definition: config.h:43
void dump_doc(DOMDocument *doc, ostream &os)
Dump DOM tree using XercesC handles.
void Print() const
Definition: tinyxml.h:1693
void resetErrors()
Reset errors (Noop)
int parse(Property &result, const std::string &input)
#define DEBUG
TinyXML class. See http://www.grinninglizard.com/tinyxml.
Definition: tinyxml.h:1066
bool LoadFile(TiXmlEncoding encoding=TIXML_DEFAULT_ENCODING)
Definition: tinyxml_inl.h:950
const char * ErrorDesc() const
Contains a textual (english) description of the error if one occurs.
Definition: tinyxml.h:1624
Class to easily access the properties of single XmlElements.
Definition: XMLElements.h:361
Class supporting the basic functionality of an XML document.
Definition: XMLElements.h:617
Union to ease castless object access when using XercesC.
const XmlAttr * Attribute
Definition: XMLElements.h:40
void dumpTree(DOMNode *doc, ostream &os)
Dump DOM tree using XercesC handles.
Elt_t ptr() const
Direct access to the XmlElement by function.
Definition: XMLElements.h:382
TinyXML class. See http://www.grinninglizard.com/tinyxml.
Definition: tinyxml.h:1943
int printout(PrintLevel severity, const char *src, const char *fmt,...)
Calls the display action with a given severity level.
Definition: Printout.cpp:111
XercesC internal class. Not described here.
Definition: DD4hepGroups.h:61
DocumentErrorHandler m_errHandler
Xerces Error handler.
static const double ns
Definition: DD4hepUnits.h:122
TGeoShape TGeoMedium * m
Definition: Volumes.cpp:294
static std::string _toString(const DD4hep::XML::XmlChar *value)
std::string conversion of XML strings (e.g. Unicode for Xerces-C)