diff --git a/dist/hfdb_xml_converter-0.2-py3-none-any.whl b/dist/hfdb_xml_converter-0.2-py3-none-any.whl index 25c7d862fee7354921f472f28bb018314336caf6..627f6dfb62b157cff2987ad7119a730cf989e9af 100644 Binary files a/dist/hfdb_xml_converter-0.2-py3-none-any.whl and b/dist/hfdb_xml_converter-0.2-py3-none-any.whl differ diff --git a/dist/hfdb_xml_converter-0.2.tar.gz b/dist/hfdb_xml_converter-0.2.tar.gz index 06b0c30609b8ec2e6a1866cbfa20741710ec509a..d1a9a9ce73d5c2d365ae3fd5923983e6990663fc 100644 Binary files a/dist/hfdb_xml_converter-0.2.tar.gz and b/dist/hfdb_xml_converter-0.2.tar.gz differ diff --git a/src/hfdb_xml_converter/__pycache__/parser.cpython-312.pyc b/src/hfdb_xml_converter/__pycache__/parser.cpython-312.pyc index dcaae1ed11c8ccbcdac59c0c3fd7a9c316dc9045..0df743784fb2f28935bc0ba9cfea38fc5b2358d6 100644 Binary files a/src/hfdb_xml_converter/__pycache__/parser.cpython-312.pyc and b/src/hfdb_xml_converter/__pycache__/parser.cpython-312.pyc differ diff --git a/src/hfdb_xml_converter/parser.py b/src/hfdb_xml_converter/parser.py index fc2277914a137fb3d29fb9bac8e57d08f90b64b5..6b9db3ead894cf8b6c7c1540fb6211b279722697 100644 --- a/src/hfdb_xml_converter/parser.py +++ b/src/hfdb_xml_converter/parser.py @@ -96,7 +96,6 @@ def personen(elem, ns): # über das Dictionary iterieren und die Texte extrahieren, sofern vorhanden return dict([(key, value.text if value is not None else None) for key, value in person.items()]) - def mitwirkende(obj, ns): """ Extrahier Personenangaben aus dem Mitwirkenden-Feld @@ -129,6 +128,18 @@ def urheber(obj, ns): print("Keine Mitwirkenden gefunden") return None +def gattung(obj, ns): + results = [] + ak_korpus = obj.find('.//ns:AK', ns) + gatt = ak_korpus.findall('.//ns:GATT', ns) + if gatt is not None: + for elem in gatt: + results.append(elem.text) + return results + else: + print("Keine Gattung eingetragen") + return None + def permalink(obj, ns): plugpara = obj.find('.//ns:PLUGPARA', ns) if plugpara is not None: @@ -189,6 +200,9 @@ def parse_xml(xml_file, **kwargs): # Urheber item['urheber'] = urheber(vi, ns) + # Gattung + item['gattung'] = gattung(vi, ns) + # Permalink item['permalink'] = permalink(vi, ns) diff --git a/test/bericht.json b/test/bericht.json index 3f9ce478c7bf0f7fde30f0e4c9c267df941d3686..eccead60e9a363705012b74426c60ebad23a7a15 100644 --- a/test/bericht.json +++ b/test/bericht.json @@ -20,6 +20,7 @@ "funktion": "Autorschaft" } ], + "gattung": [], "permalink": "https://linkresolver1.ivz.cn.ard.de/linkresolver/resolve?context=hfdb1&hfdb-recherche/permalink?typ=vollinfoAnzeige&vollinfoArt=vollinfokonf&ak=43073187&ko=53232625&amo=17350850&gkonf=53232624&destination=swrhfdb1" }, { @@ -73,6 +74,9 @@ "funktion": "Reportage" } ], + "gattung": [ + "Bericht" + ], "permalink": "https://linkresolver1.ivz.cn.ard.de/linkresolver/resolve?context=hfdb1&hfdb-recherche/permalink?typ=vollinfoAnzeige&vollinfoArt=vollinfokonf&ak=42598879&ko=52736037&amo=17124572&gkonf=52736033&destination=swrhfdb1" }, { @@ -132,6 +136,9 @@ "funktion": "Reportage" } ], + "gattung": [ + "Bericht" + ], "permalink": "https://linkresolver1.ivz.cn.ard.de/linkresolver/resolve?context=hfdb1&hfdb-recherche/permalink?typ=vollinfoAnzeige&vollinfoArt=vollinfokonf&ak=41831505&ko=51941457&amo=16760113&gkonf=51941455&destination=swrhfdb1" }, { @@ -185,6 +192,9 @@ "funktion": "Reportage" } ], + "gattung": [ + "Bericht" + ], "permalink": "https://linkresolver1.ivz.cn.ard.de/linkresolver/resolve?context=hfdb1&hfdb-recherche/permalink?typ=vollinfoAnzeige&vollinfoArt=vollinfokonf&ak=41816633&ko=51926204&amo=16753536&gkonf=51926203&destination=swrhfdb1" }, { @@ -226,6 +236,9 @@ "funktion": "Autorschaft" } ], + "gattung": [ + "Bericht" + ], "permalink": "https://linkresolver1.ivz.cn.ard.de/linkresolver/resolve?context=hfdb1&hfdb-recherche/permalink?typ=vollinfoAnzeige&vollinfoArt=vollinfokonf&ak=41688802&ko=51795433&amo=16691904&gkonf=51795432&destination=swrhfdb1" }, { @@ -267,6 +280,9 @@ "funktion": "Reportage" } ], + "gattung": [ + "Bericht" + ], "permalink": "https://linkresolver1.ivz.cn.ard.de/linkresolver/resolve?context=hfdb1&hfdb-recherche/permalink?typ=vollinfoAnzeige&vollinfoArt=vollinfokonf&ak=41688974&ko=51795905&amo=16692020&gkonf=51795904&destination=swrhfdb1" }, { @@ -314,6 +330,9 @@ "funktion": "Reportage" } ], + "gattung": [ + "Bericht" + ], "permalink": "https://linkresolver1.ivz.cn.ard.de/linkresolver/resolve?context=hfdb1&hfdb-recherche/permalink?typ=vollinfoAnzeige&vollinfoArt=vollinfokonf&ak=41626680&ko=51731977&amo=16661363&gkonf=51731976&destination=swrhfdb1" }, { @@ -367,6 +386,9 @@ "funktion": "Autorschaft" } ], + "gattung": [ + "Bericht" + ], "permalink": "https://linkresolver1.ivz.cn.ard.de/linkresolver/resolve?context=hfdb1&hfdb-recherche/permalink?typ=vollinfoAnzeige&vollinfoArt=vollinfokonf&ak=41814787&ko=51923653&amo=16753074&gkonf=51923652&destination=swrhfdb1" }, { @@ -414,6 +436,9 @@ "funktion": "Reportage" } ], + "gattung": [ + "Bericht" + ], "permalink": "https://linkresolver1.ivz.cn.ard.de/linkresolver/resolve?context=hfdb1&hfdb-recherche/permalink?typ=vollinfoAnzeige&vollinfoArt=vollinfokonf&ak=41815720&ko=51924977&amo=16753273&gkonf=51924976&destination=swrhfdb1" }, { @@ -454,6 +479,9 @@ "funktion": "Reportage" } ], + "gattung": [ + "Bericht" + ], "permalink": "https://linkresolver1.ivz.cn.ard.de/linkresolver/resolve?context=hfdb1&hfdb-recherche/permalink?typ=vollinfoAnzeige&vollinfoArt=vollinfokonf&ak=41831321&ko=51941255&amo=16760060&gkonf=51941254&destination=swrhfdb1" }, { @@ -501,6 +529,9 @@ "funktion": "Reportage" } ], + "gattung": [ + "Bericht" + ], "permalink": "https://linkresolver1.ivz.cn.ard.de/linkresolver/resolve?context=hfdb1&hfdb-recherche/permalink?typ=vollinfoAnzeige&vollinfoArt=vollinfokonf&ak=41623957&ko=51729014&amo=16660235&gkonf=51729013&destination=swrhfdb1" }, { @@ -554,6 +585,9 @@ "funktion": "Reportage" } ], + "gattung": [ + "Bericht" + ], "permalink": "https://linkresolver1.ivz.cn.ard.de/linkresolver/resolve?context=hfdb1&hfdb-recherche/permalink?typ=vollinfoAnzeige&vollinfoArt=vollinfokonf&ak=41816312&ko=51925608&amo=16753441&gkonf=51925607&destination=swrhfdb1" }, { @@ -601,6 +635,9 @@ "funktion": "Reportage" } ], + "gattung": [ + "Bericht" + ], "permalink": "https://linkresolver1.ivz.cn.ard.de/linkresolver/resolve?context=hfdb1&hfdb-recherche/permalink?typ=vollinfoAnzeige&vollinfoArt=vollinfokonf&ak=41624013&ko=51729070&amo=16660261&gkonf=51729069&destination=swrhfdb1" }, { @@ -660,6 +697,9 @@ "funktion": "Reportage" } ], + "gattung": [ + "Bericht" + ], "permalink": "https://linkresolver1.ivz.cn.ard.de/linkresolver/resolve?context=hfdb1&hfdb-recherche/permalink?typ=vollinfoAnzeige&vollinfoArt=vollinfokonf&ak=41623072&ko=51728028&amo=16659882&gkonf=51728027&destination=swrhfdb1" }, { @@ -707,6 +747,9 @@ "funktion": "Autorschaft" } ], + "gattung": [ + "Bericht" + ], "permalink": "https://linkresolver1.ivz.cn.ard.de/linkresolver/resolve?context=hfdb1&hfdb-recherche/permalink?typ=vollinfoAnzeige&vollinfoArt=vollinfokonf&ak=41617494&ko=51722314&amo=16657427&gkonf=51722313&destination=swrhfdb1" }, { @@ -754,6 +797,9 @@ "funktion": "Reportage" } ], + "gattung": [ + "Bericht" + ], "permalink": "https://linkresolver1.ivz.cn.ard.de/linkresolver/resolve?context=hfdb1&hfdb-recherche/permalink?typ=vollinfoAnzeige&vollinfoArt=vollinfokonf&ak=41624070&ko=51729127&amo=16660284&gkonf=51729126&destination=swrhfdb1" }, { @@ -785,6 +831,9 @@ "funktion": "Reportage" } ], + "gattung": [ + "Bericht" + ], "permalink": "https://linkresolver1.ivz.cn.ard.de/linkresolver/resolve?context=hfdb1&hfdb-recherche/permalink?typ=vollinfoAnzeige&vollinfoArt=vollinfokonf&ak=41565388&ko=51667646&amo=16632752&gkonf=51667645&destination=swrhfdb1" }, { @@ -822,6 +871,9 @@ "funktion": "Reportage" } ], + "gattung": [ + "Bericht" + ], "permalink": "https://linkresolver1.ivz.cn.ard.de/linkresolver/resolve?context=hfdb1&hfdb-recherche/permalink?typ=vollinfoAnzeige&vollinfoArt=vollinfokonf&ak=41565767&ko=51668028&amo=16632938&gkonf=51668027&destination=swrhfdb1" }, { @@ -875,6 +927,9 @@ "funktion": "Reportage" } ], + "gattung": [ + "Bericht" + ], "permalink": "https://linkresolver1.ivz.cn.ard.de/linkresolver/resolve?context=hfdb1&hfdb-recherche/permalink?typ=vollinfoAnzeige&vollinfoArt=vollinfokonf&ak=41624529&ko=51729621&amo=16660496&gkonf=51729620&destination=swrhfdb1" }, { @@ -912,6 +967,9 @@ "funktion": "Reportage" } ], + "gattung": [ + "Bericht" + ], "permalink": "https://linkresolver1.ivz.cn.ard.de/linkresolver/resolve?context=hfdb1&hfdb-recherche/permalink?typ=vollinfoAnzeige&vollinfoArt=vollinfokonf&ak=41279910&ko=51359991&amo=16502401&gkonf=51359990&destination=swrhfdb1" }, { @@ -961,6 +1019,9 @@ "funktion": "Reportage" } ], + "gattung": [ + "Bericht" + ], "permalink": "https://linkresolver1.ivz.cn.ard.de/linkresolver/resolve?context=hfdb1&hfdb-recherche/permalink?typ=vollinfoAnzeige&vollinfoArt=vollinfokonf&ak=41917058&ko=52028115&amo=16802082&gkonf=52028114&destination=swrhfdb1" }, { @@ -986,6 +1047,9 @@ "funktion": "Autorschaft" } ], + "gattung": [ + "Bericht" + ], "permalink": "https://linkresolver1.ivz.cn.ard.de/linkresolver/resolve?context=hfdb1&hfdb-recherche/permalink?typ=vollinfoAnzeige&vollinfoArt=vollinfokonf&ak=41610542&ko=51714832&amo=16654418&gkonf=51714831&destination=swrhfdb1" }, { @@ -1017,6 +1081,9 @@ "funktion": "Reportage" } ], + "gattung": [ + "Bericht" + ], "permalink": "https://linkresolver1.ivz.cn.ard.de/linkresolver/resolve?context=hfdb1&hfdb-recherche/permalink?typ=vollinfoAnzeige&vollinfoArt=vollinfokonf&ak=41402641&ko=51501639&amo=16554119&gkonf=51501638&destination=swrhfdb1" }, { @@ -1060,6 +1127,9 @@ "funktion": "Reportage" } ], + "gattung": [ + "Bericht" + ], "permalink": "https://linkresolver1.ivz.cn.ard.de/linkresolver/resolve?context=hfdb1&hfdb-recherche/permalink?typ=vollinfoAnzeige&vollinfoArt=vollinfokonf&ak=41232093&ko=51305768&amo=16481935&gkonf=51305767&destination=swrhfdb1" }, { @@ -1097,6 +1167,9 @@ "funktion": "Reportage" } ], + "gattung": [ + "Bericht" + ], "permalink": "https://linkresolver1.ivz.cn.ard.de/linkresolver/resolve?context=hfdb1&hfdb-recherche/permalink?typ=vollinfoAnzeige&vollinfoArt=vollinfokonf&ak=41222974&ko=51296327&amo=16477541&gkonf=51296326&destination=swrhfdb1" }, { @@ -1128,6 +1201,9 @@ "funktion": "Reportage" } ], + "gattung": [ + "Bericht" + ], "permalink": "https://linkresolver1.ivz.cn.ard.de/linkresolver/resolve?context=hfdb1&hfdb-recherche/permalink?typ=vollinfoAnzeige&vollinfoArt=vollinfokonf&ak=41222962&ko=51296315&amo=16477537&gkonf=51296313&destination=swrhfdb1" }, { @@ -1159,6 +1235,9 @@ "funktion": "Reportage" } ], + "gattung": [ + "Bericht" + ], "permalink": "https://linkresolver1.ivz.cn.ard.de/linkresolver/resolve?context=hfdb1&hfdb-recherche/permalink?typ=vollinfoAnzeige&vollinfoArt=vollinfokonf&ak=41278408&ko=51358407&amo=16501708&gkonf=51358406&destination=swrhfdb1" }, { @@ -1190,6 +1269,9 @@ "funktion": "Autorschaft" } ], + "gattung": [ + "Bericht" + ], "permalink": "https://linkresolver1.ivz.cn.ard.de/linkresolver/resolve?context=hfdb1&hfdb-recherche/permalink?typ=vollinfoAnzeige&vollinfoArt=vollinfokonf&ak=40953051&ko=50871445&amo=16331625&gkonf=50871444&destination=swrhfdb1" }, { @@ -1215,6 +1297,9 @@ "funktion": "Autorschaft" } ], + "gattung": [ + "Bericht" + ], "permalink": "https://linkresolver1.ivz.cn.ard.de/linkresolver/resolve?context=hfdb1&hfdb-recherche/permalink?typ=vollinfoAnzeige&vollinfoArt=vollinfokonf&ak=41060458&ko=50986373&amo=16381045&gkonf=50986372&destination=swrhfdb1" }, { @@ -1252,6 +1337,9 @@ "funktion": "Reportage" } ], + "gattung": [ + "Bericht" + ], "permalink": "https://linkresolver1.ivz.cn.ard.de/linkresolver/resolve?context=hfdb1&hfdb-recherche/permalink?typ=vollinfoAnzeige&vollinfoArt=vollinfokonf&ak=41211740&ko=51282883&amo=16472986&gkonf=51282879&destination=swrhfdb1" } ] \ No newline at end of file