This is how I dealt with my xml files:
doc = xml.dom.minidom.parse("...my_xml.xml")// Here you parse the xml file
for node in doc.getElementsByTagName("recipe")://Here you read in a cycle the
tags which contain numerous attributes each
t=node.getAttribute("name")//Each attribute is stored as a string in a
variable that you can add to the db
d=node.getAttribute("creator")
try:
db.Recipe.update_or_insert(Name=t,Creator=d)//each time you cycle through
each node you are adding the name and creator to the db if both aren't already
there
except:
pass
Hope it helped.
quarta-feira, 1 de Julho de 2015 às 15:01:19 UTC+1, Sai Harsh Tondomker
escreveu:
>
>
> My project is to make simple quizzing site.
>
> I have made data base in web2py.
>
> with Question, options and Correct answer.
>
> The data will be xml file. From XML file I need to take data and store in
> data base
>
> Please help me to solve the problem.
>
> Waiting for your response.
>
> Best Regards
> T.Sai Harsh
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.