GDML Import Error Due to Comment at End of File

GDML giles with comments after the closing GDML tag, </gdml>, produce an error when being loaded:

$ root 
root [0] TGeoManager::Import("root-test.gdml")
Info in <TGeoManager::Import>: Reading geometry from file: root-test.gdml
Info in <TGeoManager::TGeoManager>: Geometry GDMLImport, Geometry imported from GDML created
Error in <TXMLEngine::ParseFile>: Unexpected end of xml file
Error in <TGeoManager::Import>: Cannot open file
(TGeoManager *) 0x7ff2fb337400

The GDML file with a comment at the end:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE gdml [
<!ENTITY common_materials SYSTEM "../common/common-materials.xml">
<!ENTITY common_defines   SYSTEM "../common/common-defines.xml">
]>
<gdml xmlns:gdml="http://cern.ch/2001/Schemas/GDML"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="schema/gdml.xsd">

<define>
</define>

<materials>
</materials>

<solids>
   <tube name="solid" rmin="1" rmax="4" z="20" deltaphi="360." aunit="deg" />
</solids>

<structure>
   <volume name="My_Vol">
      <solidref ref="solid"/>
   </volume>
</structure>

<setup name="Default" version="1.0"> <world ref="My_Vol"/></setup>
</gdml>
<!-- A comment which causes an error. -->

Hi,

This is problem with simple XML parser, used for GDML files parsing.
I will try to fix it.

Regards,
Sergey

1 Like

Problem fixed now in master, v6-12-00-patches and v6-10-00-patches branches.

1 Like

Just checked master and it works like a charm. Thanks!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.