369 G4cout <<
"G4GDML: Reading module '" << fileName <<
"'..." <<
G4endl;
373 G4cout <<
"G4GDML: Reading '" << fileName <<
"'..." <<
G4endl;
380 xercesc::XercesDOMParser* parser =
new xercesc::XercesDOMParser;
384 parser->setValidationScheme(xercesc::XercesDOMParser::Val_Always);
386 parser->setValidationSchemaFullChecking(
validate);
387 parser->setCreateEntityReferenceNodes(
false);
390 parser->setDoNamespaces(
true);
392 parser->setErrorHandler(handler);
394 try { parser->parse(fileName.c_str()); }
395 catch (
const xercesc::XMLException &e)
397 catch (
const xercesc::DOMException &e)
400 xercesc::DOMDocument* doc = parser->getDocument();
404 G4String error_msg =
"Unable to open document: " + fileName;
409 xercesc::DOMElement* element = doc->getDocumentElement();
413 std::ostringstream message;
414 message <<
"ERROR - Empty document or unable to validate schema!" <<
G4endl
415 <<
" Check Internet connection is ON in case of schema"
417 <<
" validation enabled and location defined as URL in"
419 <<
" the GDML file - " << fileName <<
" - being imported!"
421 <<
" Otherwise, verify GDML schema server is reachable!";
426 for (xercesc::DOMNode* iter = element->getFirstChild();
427 iter != 0; iter = iter->getNextSibling())
429 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
431 const xercesc::DOMElement*
const child
432 =
dynamic_cast<xercesc::DOMElement*
>(iter);
441 if (tag==
"define") {
DefineRead(child); }
else
443 if (tag==
"solids") {
SolidsRead(child); }
else
444 if (tag==
"setup") {
SetupRead(child); }
else
450 G4String error_msg =
"Unknown tag in gdml: " + tag;
461 G4cout <<
"G4GDML: Reading module '" << fileName <<
"' done!" <<
G4endl;
465 G4cout <<
"G4GDML: Reading '" << fileName <<
"' done!" <<
G4endl;
virtual void MaterialsRead(const xercesc::DOMElement *const)=0
G4String Transcode(const XMLCh *const)
virtual void StructureRead(const xercesc::DOMElement *const)=0
G4GLOB_DLL std::ostream G4cout
virtual void UserinfoRead(const xercesc::DOMElement *const)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
virtual void DefineRead(const xercesc::DOMElement *const)=0
virtual void ExtensionRead(const xercesc::DOMElement *const)
virtual void SetupRead(const xercesc::DOMElement *const)=0
virtual void SolidsRead(const xercesc::DOMElement *const)=0