Hello,
We try to read RFH2 messages from a topic with the sub.get_rfh2() method. We get an exception:
Traceback (most recent call last):
File "/home/ralf/dev/testcasetool/.venv/lib/python3.12/site-packages/ibmmq/mqrfh2.py", line 176, in unpack
folder_name = ET.fromstring(folder_data).tag
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/xml/etree/ElementTree.py", line 1335, in XML
parser.feed(text)
xml.etree.ElementTree.ParseError: unbound prefix: line 1, column 74
The message was written by a Java application using the IBM MQ classes. The message/ RFH2 headers can be read with "MQ Explorer".
The folder_data for the usr folder looks like this:
<usr><CREATED>2026-03-12T11:11:47.000000000+01:00</CREATED><VERS>25</VERS><ABC xsi:nil='true'></ABC></usr>
So there is an attribute "xsi:nil", and the xsi namespace is not declared.
When replacing the ET.fromstring() with something like the following, the message can be read:
g = re.match(b"^<(\\S+?)", folder_data)
if g:
folder_name = str(g[1])
Could you please fix this?
Although this is a fault of the writing application, I think it might be user friendly to make it compatible with the Java libraries.
Hello,
We try to read RFH2 messages from a topic with the sub.get_rfh2() method. We get an exception:
The message was written by a Java application using the IBM MQ classes. The message/ RFH2 headers can be read with "MQ Explorer".
The folder_data for the usr folder looks like this:
<usr><CREATED>2026-03-12T11:11:47.000000000+01:00</CREATED><VERS>25</VERS><ABC xsi:nil='true'></ABC></usr>So there is an attribute "xsi:nil", and the xsi namespace is not declared.
When replacing the ET.fromstring() with something like the following, the message can be read:
Could you please fix this?
Although this is a fault of the writing application, I think it might be user friendly to make it compatible with the Java libraries.