I think you do something like this:

from xml.dom.minidom import parseString
dom = parseString(data)
for record in dom.getElementsByTagName('Field'):
     db.source.insert(name =
record.getElementsByTagName('Name').toxml())

I did not try it but with minimal change should work.

On Jan 11, 11:20 pm, Nik Go <[email protected]> wrote:
> I access a legacy table that contains a number of fields:
>
> db.define_table(source
> ,Field('sourceID', 'id')
> ,Field('name', 'string')
> ,Field('refNumber', 'string')
> ,Field('actualText', 'text')
> ,Field('remarks', 'text')
> ,Field('fields', 'blob'))
>
> The "fields" field contains an XML description of fields, containing stuff
> like this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <Root><Fields><Field><Name>Owner</Name><Value>Santa Cruz
> Main</Value></Field><Field><Name>Location</Name><Value>Santa Cruz
> District</Value></Field><Field><Name>RegisterName</Name><Value>Register</Va 
> lue></Field><Field><Name>Volume</Name><Value>XXIV</Value></Field><Field><Na 
> me>ArchRegNo</Name><Value>CR</Value></Field><Field><Name>Repository</Name>< 
> Value>Archives</Value></Field><Field><Name>RepositoryLoc</Name><Value/></Fi 
> eld></Fields></Root>
>
> How I can process the contents of the blob field using the advantages of
> web2py forms and validators?

Reply via email to