File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 45
45
46
46
47
47
VERSION = "0.1.0"
48
+ # DataCite namespaces that need to be removed from the individual XML tags before the
49
+ # XML file can be properly processed.
50
+ COLLAPSE_NS = ['http://datacite.org/schema/kernel-4' ]
48
51
49
52
50
53
class ParserException (Exception ):
@@ -76,9 +79,14 @@ def dict_from_xml(xml_file):
76
79
:return: dictionary containing the contents of the xml file.
77
80
"""
78
81
82
+ ns_remove = {}
83
+ for nspace in COLLAPSE_NS :
84
+ ns_remove [nspace ] = None
85
+
79
86
try :
80
87
with open (xml_file ) as file :
81
- doc = xmltodict .parse (file .read ())
88
+ doc = xmltodict .parse (file .read (),
89
+ process_namespaces = True , namespaces = ns_remove )
82
90
except ExpatError as exc :
83
91
msg = "[Error] Could not load file '%s': %s" % (xml_file ,
84
92
exp_err .messages [exc .code ])
You can’t perform that action at this time.
0 commit comments