Project

General

Profile

« Previous | Next » 

Revision 41

xml2db: Started refactoring xml2db() to support getting as well as inserting data

View differences:

scripts/xml2db/xml_db.py
38 38
        if table not in pkeys: pkeys[table] = db_util.pkey(db, table)
39 39
        return pkeys[table]
40 40
    
41
    def main(node):
42
        for child in xml_util.NodeElemIter(node):
43
            if not xml_util.is_text(child): obj(child) # not XML metadata
44
    
45 41
    def obj(node, parent_id=None):
46 42
        table = name_of(node)
47 43
        pkey_ = pkey(table)
......
78 74
        
79 75
        return id_
80 76
    
81
    return main(node)
77
    return obj(node)
82 78

  
83 79
def xml2db(db, node, row_ct_ref=None):
84
    return get(db, node, True, True, row_ct_ref)
80
    for child in xml_util.NodeElemIter(node):
81
        if not xml_util.is_text(child): # not XML metadata
82
            get(db, child, True, True, row_ct_ref)

Also available in: Unified diff