Removed JSON<->XML issue

Cannot be done automagically without some assumptions, so it is worth of doing the conversion by hand suited to our needs.
This commit is contained in:
giomba 2018-10-21 11:30:59 +02:00
parent adc2305713
commit e8a2fdb017
2 changed files with 3 additions and 1 deletions

1
TODO
View File

@ -1 +0,0 @@
- Properly automagically read interesting parts of XML into JSON

View File

@ -24,6 +24,9 @@ def getLibrary(path):
newbook['id'] = int(i.attrib['id'])
# these `for` overwrite previous values,
# but it is not an issue since actually these are one shot only elements
# actually there is no 1to1 conversion between XML and JSON, so this operation
# can not be made automagically without doing some preliminary assumptions
# (Possibly useful module: https://github.com/martinblech/xmltodict)
for j in i.iter('title'):
newbook['title'] = j.text
for j in i.iter('publisher'):