Huge text node in model/settings XML file error

Hello everyone!

Ran into an issue with a model xml that includes a large source mesh, ~1 million tets. If I write out to an XML settings.xml or model.xml then try to read it in, the parser aborts when it reaches the text node that defines the strengths. Unfortunately I can’t just run the model from the command line since it includes dagmc geometry. The error looks like this:

>>> import openmc
>>> settings = openmc.Settings.from_xml('settingsLi6_10.xml')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/dist-packages/openmc/settings.py", line 1955, in from_xml
    tree = ET.parse(path)
  File "src/lxml/etree.pyx", line 3541, in lxml.etree.parse
  File "src/lxml/parser.pxi", line 1879, in lxml.etree._parseDocument
  File "src/lxml/parser.pxi", line 1905, in lxml.etree._parseDocumentFromURL
  File "src/lxml/parser.pxi", line 1808, in lxml.etree._parseDocFromFile
  File "src/lxml/parser.pxi", line 1180, in lxml.etree._BaseParser._parseDocFromFile
  File "src/lxml/parser.pxi", line 618, in lxml.etree._ParserContext._handleParseResultDoc
  File "src/lxml/parser.pxi", line 728, in lxml.etree._handleParseResult
  File "src/lxml/parser.pxi", line 657, in lxml.etree._raiseParseError
  File "settingsLi6_10.xml", line 8
lxml.etree.XMLSyntaxError: xmlSAX2Characters: huge text node, line 8, column 10003731

Was wondering if there is a parameter I can pass somewhere to alleviate this or if it is a current limitation of OpenMC?

Hi Edgar,
I had the same issue, but with geometry.py

I submitted a pull-request

But haven’t gotten any takers yet :frowning:

I suspect you can take what I did there, adapt it to settings.py, compile, install.
And it will work.

Probably a number of these Python files need the large text node correction.

Perry

2 Likes

Sorry @Edgar for the problem you’ve experienced here, and sorry to @yrrepy your PR didn’t receive attention sooner. It has now been merged into our main develop branch and should cover both of the problem cases (large geometry.xml file and large settings.xml file).

2 Likes

Awesome, I’ll check it out, thank you!