I want to retrieve id and name per skill. It works but is it well done? I would like to stay with minidom but all advices will be appreciated.
# This is only part of XML examplethat interesting me:
# <skill>
# <id>14</id>
# <skill>
# <name>C++</name>
# </skill>
# </skill>
# <skill>
# <id>15</id>
# <skill>
# <name>Java</name>
# </skill>
# </skill>
skills = document.getElementsByTagName('skill')
for skill in skills:
try:
id_ = skill.getElementsByTagName('id')[0].firstChild.nodeValue
name = skill.getElementsByTagName('name')[0].firstChild.nodeValue
my_object.create(name=name.strip(),
id=id_.strip())
except IndexError:
pass