I have a list of strings which is in xml format, but not from an xml file, so I can't use an xml parser to read in the file and parse the elements, as below:
<Pattern id="001" name="Tesla" type="car">
<trigger>electric</trigger>
<confidence>0.9</confidence_booster>
<condition>
{car ^12}
</condition>
</Pattern>
Is there any convenient way to parse this str as a dictionary:
pattern = {"id":"001",
"name":"Tesla",
"type":"car",
"trigger": "electric",
"confidence":0.9,
"condition": "{car ^12}"
}
It's also fine if it can be parsed into a json object.