How to parse an XML element which has keys and values separated by colons and newlines?
Question:
I am currently working on a project where I have to get information out of a lot of XML Documents. Each document has an element header_text. There are a lot of values in there, which looks like that:
<header_text>
key1: val1
key2: val2
key3: val3
</header_text>
The keys are the same in each document, the values are sometimes empty.
I have a strong feeling that this is not standard XML, but I’m probably wrong?
Has anyone an idea how to parse these values quick and simple?
edit: I’m on python
Answers:
Maybe you can use python and elementTree module to parse it:
https://docs.python.org/3.4/library/xml.etree.elementtree.html#tutorial
I am currently working on a project where I have to get information out of a lot of XML Documents. Each document has an element header_text. There are a lot of values in there, which looks like that:
<header_text>
key1: val1
key2: val2
key3: val3
</header_text>
The keys are the same in each document, the values are sometimes empty.
I have a strong feeling that this is not standard XML, but I’m probably wrong?
Has anyone an idea how to parse these values quick and simple?
edit: I’m on python
Maybe you can use python and elementTree module to parse it:
https://docs.python.org/3.4/library/xml.etree.elementtree.html#tutorial