Skip to content
Snippets Groups Projects
Commit 311501b4 authored by Lars Pieschel's avatar Lars Pieschel
Browse files

Fixed xml default namespaces not working correctly for older versions of...

Fixed xml default namespaces not working correctly for older versions of ElementTree (at least until Python 3.7.8) by replacing it with a named one.
parent 518060a9
No related branches found
No related tags found
No related merge requests found
__version__ = '1.0.1'
__version__ = '1.0.2'
from IPython.display import display_javascript
from .jupyter_rdf import JupyterRDF
......
......@@ -22,14 +22,14 @@ def display_table(body, mime, logger):
def xml_row_iterator(elem):
"""Iterates a Sparql xml result (http://www.w3.org/2005/sparql-results#) by rows. First result are the column headers."""
ns = {"": "http://www.w3.org/2005/sparql-results#"}
ns = {"sparql": "http://www.w3.org/2005/sparql-results#"}
headers = []
for head in elem.findall("head/variable", ns):
for head in elem.findall("sparql:head/sparql:variable", ns):
headers.append(head.attrib["name"])
yield headers
for result in elem.findall("results/result", ns):
for result in elem.findall("sparql:results/sparql:result", ns):
row = []
for binding in result.findall("binding", ns):
for binding in result.findall("sparql:binding", ns):
n = binding[0]
if n.tag == "{http://www.w3.org/2005/sparql-results#}literal":
lang = n.get("{http://www.w3.org/XML/1998/namespace}lang")
......
......@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
setuptools.setup(
name="jupyter-rdfify",
version="1.0.1",
version="1.0.2",
author="Lars Pieschel",
author_email="lars.pieschel@rwth-aachen.de",
description="IPython Extension for semantic web technology support (Turtle, SPARQL, ShEx, etc.)",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment