How to convert xml to hdf5

I know this is niche but does anyone have example code for the converting xml to hdf5?

Can you give us an idea/example of what your XML schema looks like? Many fine scripting languages have powerful XML parsers and HDF5 modules. That should get you off the ground. If C is your preferred language, I had good success in the past with jansson.

Maybe you can get away with an XSLT and generate a text-based format whose conversion is more straightforward?