martinblech / xmltodict

Python module that makes working with XML feel like you are working with JSON
MIT License
5.49k stars 462 forks source link

Parsing journal details from Ovid xml fuses entries into one string - any way to control individual tags? #339

Open mjafin opened 11 months ago

mjafin commented 11 months ago

Hi there, I love xmltodict, thank you for making it available. I'm hitting a minor issue parsing journal details from a database called Ovid. The xml looks like this:

<D type="c">
European Journal of Medicinal Chemistry
<T>. </T>
262
<T>:</T>
115860
<T>, </T>
2023 Dec 15
<T>
.
<BR/>
</T>
</D>

The output looks like:

{'@type': 'c', 'T': ['.', ':', ',', {'BR': None, '#text': '.'}], '#text': 'European Journal of Medicinal Chemistry2621158602023 Dec 15'}

From the #text field it becomes very difficult to separate what the volume, page etc. are as all the text has been fused. Is there any way to control the behaviour when there are the <T> tags?