changeset 51:5a633e875490

also read normalized fields from xml.
author casties
date Fri, 03 Mar 2017 20:11:06 +0100
parents 1be17309db79
children 763b5d29fa5e
files importFromOpenMind/importer/ismixml2model.py
diffstat 1 files changed, 15 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/importFromOpenMind/importer/ismixml2model.py	Thu Feb 23 19:57:36 2017 +0100
+++ b/importFromOpenMind/importer/ismixml2model.py	Fri Mar 03 20:11:06 2017 +0100
@@ -98,10 +98,6 @@
         log('DEBUG', "entity has no attributes: %s"%ent_elem)
         
     else:
-        if atts_elem.tail is not None:
-            # tail belongs to parent
-            ov += atts_elem.tail
-        
         # go through all attributes
         for att_elem in atts_elem:
             ct = att_elem.get('content-type', None)
@@ -123,9 +119,11 @@
                 if val is not None:
                     # keep attribute
                     attrs[name] = val
-                    #if 'nov' in att:
-                    #    # add normalized value
-                    #    attrs['_n_'+name] = att['nov']
+                    # check for normalized value
+                    nov = att_elem.findtext('norm')
+                    if nov is not None:
+                        # add normalized value
+                        attrs['_n_'+name] = nov
                 
             elif ct == 'date':
                 # date attribute
@@ -165,9 +163,11 @@
     if len(ov) > 0:
         # save ov as label
         attrs['label'] = ov
-        #if 'nov' in ent:
-        #    # add normalized value
-        #    attrs['_n_label'] = ent.get('nov')
+        # check for normalized value
+        nov = ent_elem.findtext('norm')
+        if nov is not None:
+            # add normalized value
+            attrs['_n_label'] = nov
     
     # create node
     log('DEBUG', "new node(%s, %s)"%(ismi_id, attrs))
@@ -225,9 +225,11 @@
                 if val is not None:
                     # keep attribute
                     attrs[name] = val
-                    #if 'nov' in att:
-                    #    # add normalized value
-                    #    attrs['_n_'+name] = att['nov']
+                     # check for normalized value
+                    nov = att_elem.findtext('norm')
+                    if nov is not None:
+                        # add normalized value
+                        attrs['_n_'+name] = nov
                 
             elif ct == 'date':
                 # date attribute