diff MetaData.py @ 17:ba617e755c56

mostly finished attributions and copyright
author casties
date Tue, 02 Aug 2011 18:28:39 +0200
parents 5d41c350dd2b
children 9a1e75e708e1
line wrap: on
line diff
--- a/MetaData.py	Tue Aug 02 13:38:01 2011 +0200
+++ b/MetaData.py	Tue Aug 02 18:28:39 2011 +0200
@@ -122,6 +122,10 @@
         if attr:
             data['@attr'] = attr
             
+        # put text in @text
+        if elem.text:
+            data['@text'] = elem.text
+            
         for e in elem:
             # put all child elements in data
             if normalizeNames:
@@ -131,7 +135,7 @@
                 key = e.tag
                 
             if recursive > 0:
-                # more recursive - call _getData on elements
+                # more recursive - call _getData on element
                 val = self._getData(e, recursive=recursive-1, normalizeNames=normalizeNames, all=all, allText=allText)
             else:
                 val = getText(e, recursive=allText)
@@ -162,6 +166,9 @@
             return None
         
         elem = self.getSubDom(path=path, dom=dom, all=all)
+        if elem is None:
+            return None
+        
         if all:
             # subdom is list - return list
             data = []