On 3 July 2015 at 23:43, Anthony <[email protected]> wrote:

> All of the effort will be in parsing the XML, so you should check the
> documentation of the various XML libraries and ask questions in their
> forums (or on Stack Overflow). The details will depend on the structure of
> your XML. Ultimately, you want to loop over the records in the XML, and for
> each record, build a dictionary where the keys are the DAL table field
> names and the values are the record values you want to insert. Once you
> have such a dictionary, the DAL insert for a single record is simple:
>
> db.mytable.insert(**record_dictionary)
>

Another approach is to import the XML-data directly into a PostgreSQL table
with and id (primary key) field and another field with the type XML.  This
can be queried using XPATH-like syntax in PostgreSQL (from web2py using
exexutesql) and if you want to import that into 'normal' tables, this can
be done within PostgreSQL using the above-mentioned xpath-based queries.

Both ways have a learning curve if you are not used to parsing XML-data.

Regards
Johann

-- 
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.

Reply via email to