46   : validate(true), check(false), dostrip(true), inLoop(0), loopCount(0)
    57    char* char_str = xercesc::XMLString::transcode(toTranscode);
    59    xercesc::XMLString::release(&char_str);
    88      std::stringstream stream;
    90      nameOut = stream.str();
   100   return sname.
remove(sname.find(
"0x"));
   105   name.
remove(name.find(
"0x"));
   119   G4cout << 
"Stripping off GDML names of materials, solids and volumes ..."   127   for (i=0; i<solids->size(); ++i)
   137   for (i=0; i<lvols->size(); ++i)
   147   for (i=0; i<pvols->size(); ++i)
   157   for (i=0; i<materials->size(); ++i)
   167   for (i=0; i<elements->size(); ++i)
   177      void(
G4GDMLRead::*func)(
const xercesc::DOMElement* 
const))
   184    const xercesc::DOMNamedNodeMap* 
const attributes = element->getAttributes();
   185    XMLSize_t attributeCount = attributes->getLength();
   187    for (XMLSize_t attribute_index=0;
   188         attribute_index<attributeCount;attribute_index++)
   190       xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
   192       if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
   195       const xercesc::DOMAttr* 
const attribute
   196             = 
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);   
   199         G4Exception(
"G4GDMLRead::LoopRead()", 
"InvalidRead",
   206       if (attribute_name==
"for")  { var = attribute_value; }  
else   207       if (attribute_name==
"from") { from = attribute_value; } 
else   208       if (attribute_name==
"to")   { to = attribute_value; }   
else   209       if (attribute_name==
"step") { step = attribute_value; }
   214      G4Exception(
"G4GDMLRead::loopRead()", 
"InvalidRead",
   220      G4Exception(
"G4GDMLRead::loopRead()", 
"InvalidRead",
   229    if (!from.empty()) { _var = _from; }
   233      G4Exception(
"G4GDMLRead::loopRead()", 
"InvalidRead",
   236    if ((_from < _to) && (_step <= 0))
   238      G4Exception(
"G4GDMLRead::loopRead()", 
"InvalidRead",
   241    if ((_from > _to) && (_step >= 0))
   243      G4Exception(
"G4GDMLRead::loopRead()", 
"InvalidRead",
   252       (this->*func)(element);
   267    const xercesc::DOMNamedNodeMap* 
const attributes
   268          = auxiliaryElement->getAttributes();
   269    XMLSize_t attributeCount = attributes->getLength();
   271    for (XMLSize_t attribute_index=0;
   272         attribute_index<attributeCount; attribute_index++)
   274       xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
   276       if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
   279       const xercesc::DOMAttr* 
const attribute
   280             = 
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);   
   290       if (attName==
"auxtype") { auxstruct.
type = attValue; } 
else   291       if (attName==
"auxvalue") { auxstruct.
value = attValue; } 
else   292       if (attName==
"auxunit") { auxstruct.
unit = attValue; }
   295    for (xercesc::DOMNode* iter = auxiliaryElement->getFirstChild();
   296         iter != 0; iter = iter->getNextSibling())
   298       if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)  { 
continue; }
   300       const xercesc::DOMElement* 
const child
   301         = 
dynamic_cast<xercesc::DOMElement*
>(iter);
   310       if (tag==
"auxiliary")
   317    if (auxList) { auxstruct.
auxList = auxList; }
   326    for (xercesc::DOMNode* iter = userinfoElement->getFirstChild();
   327         iter != 0; iter = iter->getNextSibling())
   329       if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)  { 
continue; }
   331       const xercesc::DOMElement* 
const child
   332             = 
dynamic_cast<xercesc::DOMElement*
>(iter);
   341       if (tag==
"auxiliary")
   347         G4String error_msg = 
"Unknown tag in structure: " + tag;
   356    G4String error_msg = 
"No handle to user-code for parsing extensions!";
   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;
 std::vector< G4GDMLAuxStructType > * auxList
 
static void BuildUnitsTable()
 
G4int EvaluateInteger(const G4String &)
 
void SetName(const G4String &name)
 
void OverlapCheck(G4bool)
 
G4String & remove(str_size)
 
static G4MaterialTable * GetMaterialTable()
 
std::vector< G4Material * > G4MaterialTable
 
virtual void MaterialsRead(const xercesc::DOMElement *const)=0
 
G4String Transcode(const XMLCh *const)
 
void SetName(const G4String &pName)
 
void GeneratePhysvolName(const G4String &, G4VPhysicalVolume *)
 
virtual void StructureRead(const xercesc::DOMElement *const)=0
 
static G4PhysicalVolumeStore * GetInstance()
 
void SetName(const G4String &name)
 
void LoopRead(const xercesc::DOMElement *const, void(G4GDMLRead::*)(const xercesc::DOMElement *const))
 
G4GLOB_DLL std::ostream G4cout
 
virtual void UserinfoRead(const xercesc::DOMElement *const)
 
const G4String & GetName() const
 
G4String Strip(const G4String &) const
 
static G4LogicalVolumeStore * GetInstance()
 
static G4SolidStore * GetInstance()
 
CommandLineParser * parser(0)
 
void StripName(G4String &) const
 
const G4GDMLAuxListType * GetAuxList() const
 
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
 
G4String SolveBrackets(const G4String &)
 
virtual void DefineRead(const xercesc::DOMElement *const)=0
 
virtual void ExtensionRead(const xercesc::DOMElement *const)
 
const G4String & GetName() const
 
const G4String & GetName() const
 
G4String GenerateName(const G4String &name, G4bool strip=false)
 
std::vector< G4GDMLAuxStructType > G4GDMLAuxListType
 
void SetVariable(const G4String &, G4double)
 
G4GDMLAuxStructType AuxiliaryRead(const xercesc::DOMElement *const auxElem)
 
void SetName(const G4String &pName)
 
G4GDMLAuxListType auxGlobalList
 
std::vector< G4Element * > G4ElementTable
 
virtual void SetupRead(const xercesc::DOMElement *const)=0
 
static G4ElementTable * GetElementTable()
 
G4LogicalVolume * GetLogicalVolume() const
 
const G4String & GetName() const
 
G4bool IsVariable(const G4String &) const
 
virtual void SolidsRead(const xercesc::DOMElement *const)=0
 
void SetName(const G4String &name)
 
void Read(const G4String &, G4bool validation, G4bool isModule, G4bool strip=true)